diff --git a/.editorconfig b/.editorconfig deleted file mode 100644 index 80f3fca5..00000000 --- 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 5f302863..00000000 --- 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 24b327f4..00000000 --- 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 99feda60..00000000 --- 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/string) 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 e4f10fed..00000000 --- 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 b5291db6..00000000 --- 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 e642b5a8..00000000 --- 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/string) 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 29849010..00000000 --- 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 54a276c1..00000000 --- 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: '10 10 * * 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 83d50c46..00000000 --- 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 string = require( '@stdlib/string' ); +If no recognized module system is present, access bundle contents via the global scope: + +```html + ``` #### string @@ -152,11 +158,21 @@ The namespace exposes the following string manipulation functions: -```javascript -var getKeys = require( '@stdlib/utils/keys' ); -var string = require( '@stdlib/string' ); +```html + + + + + + + + ```
diff --git a/SECURITY.md b/SECURITY.md deleted file mode 100644 index 9702d4ca..00000000 --- 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/acronym/README.md b/acronym/README.md deleted file mode 100644 index a8af1d4d..00000000 --- a/acronym/README.md +++ /dev/null @@ -1,232 +0,0 @@ - - -# acronym - -> Generate an acronym for a given string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var acronym = require( '@stdlib/string/acronym' ); -``` - -#### acronym( str\[, options] ) - -Generates an acronym for a given string. - -```javascript -var out = acronym( 'the quick brown fox' ); -// returns 'QBF' - -out = acronym( 'Hard-boiled eggs' ); -// returns 'HBE' -``` - -The function accepts the following `options`: - -- **stopwords**: list of custom stop words. If not specified, the function uses a default set of stop words from the English language that were deemed words one would likely want to exclude from the acronym generation (a subset of the stop words from [@stdlib/datasets/stopwords-en][@stdlib/datasets/stopwords-en]). - -By default, the function uses a list of common English stop words. To use a custom list, set the `stopwords` option. - -```javascript -var out = acronym( 'the quick brown fox', { - 'stopwords': [] -}); -// returns 'TQBF' - -out = acronym( 'the quick brown fox', { - 'stopwords': [ 'the', 'quick', 'brown', 'fox' ] -}); -// returns '' -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var acronym = require( '@stdlib/string/acronym' ); - -var str = 'Test-driven development'; -var out = acronym( str ); -// returns 'TDD' - -str = 'Industrial Business Machines'; -out = acronym( str ); -// returns 'IBM' - -str = 'National Aeronautics and Space Administration'; -out = acronym( str ); -// returns 'NASA' - -str = 'To be determined...'; -out = acronym( str, { - 'stopwords': [] -}); -// returns 'TBD' -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: acronym [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --stopwords str Comma-separated list of custom stop words. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'quick brown fox\nAlpha-Centauri' | acronym --split /\r?\n/ - - # Escaped... - $ echo -n $'quick brown fox\nAlpha-Centauri' | acronym --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - - - -
- -### Examples - -```bash -$ acronym 'the quick brown fox' -QBF -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'the quick brown fox'' | acronym -QBF -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'quick brown fox\tAlpha-Centauri' | acronym --split '\t' -QBF -AC -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/acronym/benchmark/benchmark.js b/acronym/benchmark/benchmark.js deleted file mode 100644 index e414b76d..00000000 --- a/acronym/benchmark/benchmark.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var pkg = require( './../package.json' ).name; -var acronym = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var str; - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = fromCodePoint( i%126 ) + 'eep boop'; - out = acronym( str ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/acronym/bin/cli b/acronym/bin/cli deleted file mode 100755 index 9141757a..00000000 --- a/acronym/bin/cli +++ /dev/null @@ -1,119 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var trim = require( '@stdlib/string/trim' ); -var acronym = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var stopwords; - var flags; - var args; - var opts; - var cli; - var i; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - opts = {}; - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - opts.split = reFromString( flags.split ); - } else { - opts.split = RE_EOL; - } - if ( flags.stopwords ) { - stopwords = flags.stopwords.split( ',' ); - for ( i = 0; i < stopwords.length; i++ ) { - stopwords[ i ] = trim( stopwords[ i ] ); - } - opts.stopwords = stopwords; - } - return stdin( onRead ); - } - console.log( acronym( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( opts.split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( acronym( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/acronym/docs/repl.txt b/acronym/docs/repl.txt deleted file mode 100644 index 93afc485..00000000 --- a/acronym/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str[, options] ) - Generates an acronym for a given string. - - Parameters - ---------- - str: string - Input string. - - options: Object (optional) - Options. - - options.stopwords: Array (optional) - Array of custom stop words. - - Returns - ------- - out: string - Acronym for the given string. - - Examples - -------- - > var out = {{alias}}( 'the quick brown fox' ) - 'QBF' - > out = {{alias}}( 'Hard-boiled eggs' ) - 'HBE' - - See Also - -------- diff --git a/acronym/docs/types/index.d.ts b/acronym/docs/types/index.d.ts deleted file mode 100644 index 5b89e6b1..00000000 --- a/acronym/docs/types/index.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/// - -/** -* Interface defining function options. -*/ -interface Options { - /** - * Custom stop words. - */ - stopwords?: Array; -} - -/** -* Generates an acronym for a given string. -* -* @param str - input string -* @param options - function options -* @param options.stopwords - custom stop words -* @returns generated acronym -* -* @example -* var out = acronym( 'the quick brown fox' ); -* // returns 'QBF' -* -* @example -* var out = acronym( 'Hard-boiled eggs' ); -* // returns 'HBE' -* -* @example -* var out = acronym( 'National Association of Securities Dealers Automated Quotation' ); -* // returns 'NASDAQ' -*/ -declare function acronym( str: string, options?: Options ): string; - - -// EXPORTS // - -export = acronym; diff --git a/acronym/docs/types/test.ts b/acronym/docs/types/test.ts deleted file mode 100644 index 410ceaa7..00000000 --- a/acronym/docs/types/test.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import acronym = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - acronym( 'Hard-boiled eggs' ); // $ExpectType string - const opts = { - 'stopwords': [] - }; - acronym( 'To be determined', opts ); // $ExpectType string -} - -// The compiler throws an error if the function is not provided a string as its first argument... -{ - acronym( true, 6 ); // $ExpectError - acronym( false, 6 ); // $ExpectError - acronym( 3, 6 ); // $ExpectError - acronym( [], 6 ); // $ExpectError - acronym( {}, 6 ); // $ExpectError - acronym( ( x: number ): number => x, 6 ); // $ExpectError -} - -// The compiler throws an error if the function is provided an options argument which is not an object... -{ - acronym( 'beep boop', null ); // $ExpectError -} - -// The compiler throws an error if the function is provided a `stopwords` option which is not an array of strings... -{ - acronym( 'beep boop', { 'stopwords': 'abc' } ); // $ExpectError - acronym( 'beep boop', { 'stopwords': 123 } ); // $ExpectError - acronym( 'beep boop', { 'stopwords': true } ); // $ExpectError - acronym( 'beep boop', { 'stopwords': false } ); // $ExpectError - acronym( 'beep boop', { 'stopwords': {} } ); // $ExpectError - acronym( 'beep boop', { 'stopwords': [ 1, 2, 3 ] } ); // $ExpectError - acronym( 'beep boop', { 'stopwords': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - acronym(); // $ExpectError -} diff --git a/acronym/docs/usage.txt b/acronym/docs/usage.txt deleted file mode 100644 index 3d2b38e4..00000000 --- a/acronym/docs/usage.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Usage: acronym [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --stopwords str Comma-separated list of custom stop words. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/acronym/etc/cli_opts.json b/acronym/etc/cli_opts.json deleted file mode 100644 index f4b95d31..00000000 --- a/acronym/etc/cli_opts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "string": [ - "split", - "stopwords" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/acronym/examples/index.js b/acronym/examples/index.js deleted file mode 100644 index b8310194..00000000 --- a/acronym/examples/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 acronym = require( './../lib' ); - -var str = 'Test-driven development'; -var out = acronym( str ); -console.log( out ); -// => 'TDD' - -str = 'Industrial Business Machines'; -out = acronym( str ); -console.log( out ); -// => 'IBM' - -str = 'National Aeronautics and Space Administration'; -out = acronym( str ); -console.log( out ); -// => 'NASA' - -str = 'To be determined...'; -out = acronym( str, { - 'stopwords': [] -}); -console.log( out ); -// => 'TBD' diff --git a/acronym/lib/index.js b/acronym/lib/index.js deleted file mode 100644 index ea8588bb..00000000 --- a/acronym/lib/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Generate an acronym for a given string. -* -* @module @stdlib/string/acronym -* -* @example -* var acronym = require( '@stdlib/string/acronym' ); -* -* var out = acronym( 'National Association of Securities Dealers Automated Quotation' ); -* // returns 'NASDAQ' -* -* out = acronym( 'To be determined...', { -* 'stopwords': [] -* }); -* // returns 'TBD' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/acronym/lib/main.js b/acronym/lib/main.js deleted file mode 100644 index ea7944c7..00000000 --- a/acronym/lib/main.js +++ /dev/null @@ -1,104 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var removePunctuation = require( './../../remove-punctuation' ); -var tokenize = require( '@stdlib/nlp/tokenize' ); -var replace = require( './../../base/replace' ); -var uppercase = require( './../../base/uppercase' ); -var lowercase = require( './../../base/lowercase' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var format = require( './../../format' ); -var validate = require( './validate.js' ); -var STOPWORDS = require( './stopwords.json' ); - - -// VARIABLES // - -var RE_HYPHEN = /-/g; - - -// MAIN // - -/** -* Generates an acronym for a given string. -* -* ## Notes -* -* - The acronym is generated by capitalizing the first letter of each word in the string. -* - The function removes stop words from the string before generating the acronym. -* - The function splits hyphenated words and uses the first character of each hyphenated part. -* -* @param {string} str - input string -* @param {Options} [options] - function options -* @param {StringArray} [options.stopwords] - custom stop words -* @throws {TypeError} must provide a string primitive -* @throws {TypeError} must provide valid options -* @returns {string} generated acronym -* -* @example -* var out = acronym( 'the quick brown fox' ); -* // returns 'QBF' -* -* @example -* var out = acronym( 'Hard-boiled eggs' ); -* // returns 'HBE' -* -* @example -* var out = acronym( 'National Association of Securities Dealers Automated Quotation' ); -* // returns 'NASDAQ' -*/ -function acronym( str, options ) { - var isStopWord; - var words; - var opts; - var err; - var out; - var i; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - opts = {}; - if ( arguments.length > 1 ) { - err = validate( opts, options ); - if ( err ) { - throw err; - } - } - isStopWord = contains( opts.stopwords || STOPWORDS ); - str = removePunctuation( str ); - str = replace( str, RE_HYPHEN, ' ' ); - words = tokenize( str ); - out = ''; - for ( i = 0; i < words.length; i++ ) { - if ( isStopWord( lowercase( words[ i ] ) ) === false ) { - out += uppercase( words[ i ].charAt( 0 ) ); - } - } - return out; -} - - -// EXPORTS // - -module.exports = acronym; diff --git a/acronym/lib/stopwords.json b/acronym/lib/stopwords.json deleted file mode 100644 index dd482837..00000000 --- a/acronym/lib/stopwords.json +++ /dev/null @@ -1,148 +0,0 @@ -[ - "a", - "all", - "also", - "although", - "an", - "and", - "any", - "are", - "as", - "at", - "b", - "be", - "been", - "but", - "by", - "c", - "could", - "d", - "e", - "each", - "eg", - "either", - "even", - "ever", - "ex", - "except", - "f", - "far", - "few", - "for", - "from", - "further", - "g", - "get", - "gets", - "given", - "gives", - "go", - "going", - "got", - "h", - "had", - "has", - "have", - "having", - "he", - "her", - "here", - "herself", - "him", - "himself", - "his", - "how", - "i", - "ie", - "if", - "in", - "into", - "is", - "it", - "its", - "itself", - "j", - "just", - "k", - "l", - "less", - "let", - "m", - "many", - "may", - "me", - "might", - "must", - "my", - "myself", - "n", - "need", - "needs", - "next", - "no", - "non", - "not", - "now", - "o", - "of", - "off", - "old", - "on", - "once", - "only", - "or", - "our", - "out", - "p", - "per", - "put", - "q", - "r", - "s", - "same", - "shall", - "she", - "should", - "since", - "so", - "such", - "sure", - "t", - "than", - "that", - "the", - "their", - "them", - "then", - "there", - "these", - "they", - "this", - "those", - "though", - "thus", - "to", - "too", - "u", - "us", - "v", - "w", - "was", - "we", - "well", - "went", - "were", - "what", - "when", - "where", - "which", - "who", - "whose", - "why", - "will", - "would", - "x", - "y", - "yet", - "z" -] diff --git a/acronym/lib/validate.js b/acronym/lib/validate.js deleted file mode 100644 index 1d993c32..00000000 --- a/acronym/lib/validate.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isPlainObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var isEmptyArray = require( '@stdlib/assert/is-empty-array' ); -var format = require( './../../format' ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - options to validate -* @param {StringArray} [options.stopwords] - array of custom stop words -* @returns {(null|Error)} error object or null -* -* @example -* var opts = {}; -* var options = { -* 'stopwords': [ 'of' ] -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - if ( !isPlainObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - if ( hasOwnProp( options, 'stopwords' ) ) { - opts.stopwords = options.stopwords; - if ( - !isStringArray( opts.stopwords ) && - !isEmptyArray( opts.stopwords ) - ) { - return new TypeError( format( 'invalid option. `%s` option must be an array of strings. Option: `%s`.', 'stopwords', opts.stopwords ) ); - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/acronym/package.json b/acronym/package.json deleted file mode 100644 index 2520aa53..00000000 --- a/acronym/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/acronym", - "version": "0.0.0", - "description": "Generate an acronym for a given string.", - "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" - } - ], - "bin": { - "acronym": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "short", - "abbreviation", - "abbr", - "abbreviate", - "acronym" - ] -} diff --git a/acronym/test/fixtures/stdin_error.js.txt b/acronym/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/acronym/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/acronym/test/test.cli.js b/acronym/test/test.cli.js deleted file mode 100644 index edbe02ad..00000000 --- a/acronym/test/test.cli.js +++ /dev/null @@ -1,246 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var EXEC_PATH = require( '@stdlib/process/exec-path' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface generates an acronym for a supplied string', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'Test-Driven Development\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'TDD\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'Test-driven Development\tAmerican Statistical Association\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'TDD\nASA\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'Test-driven Development\tAmerican Statistical Association\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'TDD\nASA\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/acronym/test/test.js b/acronym/test/test.js deleted file mode 100644 index 49702f38..00000000 --- a/acronym/test/test.js +++ /dev/null @@ -1,187 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 acronym = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof acronym, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - 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() { - acronym( value ); - }; - } -}); - -tape( 'the function returns an acronym for a string', function test( t ) { - var expected; - var actual; - var str; - - str = 'the quick brown fox'; - expected = 'QBF'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'National Association of Securities Dealers Automated Quotation'; - expected = 'NASDAQ'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'United States of America'; - expected = 'USA'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'The National Association for the Advancement of Colored People'; - expected = 'NAACP'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'The National Association of the Blind'; - expected = 'NAB'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'The Association of Petroleum Geologists'; - expected = 'APG'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'The National Aeronautics and Space Administration'; - expected = 'NASA'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'the-quick-brown-fox'; - expected = 'QBF'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'Hard-boiled eggs'; - expected = 'HBE'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'The quick, brown fox'; - expected = 'QBF'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'Alpha-Centauri'; - expected = 'AC'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'New World Order'; - expected = 'NWO'; - actual = acronym( str ); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - t.end(); -}); - -tape( 'if the second argument is not an object, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - true, - 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() { - acronym( 'beep boop', value ); - }; - } -}); - -tape( 'if provided an invalid option, the function will throw', function test( t ) { - t.throws( foo, Error, 'throws Error' ); - t.end(); - function foo() { - acronym( 'beep', { - 'stopwords': 2 - }); - } -}); - -tape( 'the function returns an acronym for a string (custom stopwords)', function test( t ) { - var expected; - var actual; - var str; - - str = 'the quick brown fox'; - expected = ''; - actual = acronym( str, { - 'stopwords': [ 'the', 'quick', 'brown', 'fox' ] - }); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - str = 'the quick brown fox'; - expected = 'TQBF'; - actual = acronym( str, { - 'stopwords': [] - }); - t.strictEqual( actual, expected, 'returns an acronym for a string' ); - - t.end(); -}); diff --git a/acronym/test/test.validate.js b/acronym/test/test.validate.js deleted file mode 100644 index a1df0d19..00000000 --- a/acronym/test/test.validate.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 validate = require( './../lib/validate.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof validate, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if provided an `options` argument which is not an object, the function returns an error', function test( t ) { - var values; - var err; - var i; - - values = [ - '5', - 5, - null, - NaN, - void 0, - true, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - err = validate( {}, values[ i ] ); - t.ok( err instanceof TypeError, 'returns TypeError' ); - } - t.end(); -}); - -tape( 'if provided an invalid `stopwords` option, the function returns an error', function test( t ) { - var values; - var err; - var i; - - values = [ - '5', - 5, - null, - NaN, - void 0, - true, - false, - [ 1, 2, 3 ], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - err = validate( {}, { - 'stopwords': values[ i ] - }); - t.ok( err instanceof TypeError, 'returns TypeError' ); - } - t.end(); -}); - -tape( 'if all options are valid, the function returns null', function test( t ) { - var options; - var opts; - var err; - - opts = {}; - options = { - 'stopwords': [ 'foo', 'bar' ] - }; - err = validate( opts, options ); - - t.strictEqual( err, null, 'returns expected value' ); - t.strictEqual( opts.stopwords, options.stopwords, 'sets the `stopwords` option' ); - - t.end(); -}); - -tape( 'the function ignores unrecognized options', function test( t ) { - var err = validate( {}, { - 'beep': 'boop', - 'a': null, - 'b': 5 - }); - t.strictEqual( err, null, 'returns expected value' ); - t.end(); -}); diff --git a/base/README.md b/base/README.md deleted file mode 100644 index 149a9649..00000000 --- a/base/README.md +++ /dev/null @@ -1,305 +0,0 @@ - - -# Base String - -> Base (i.e., lower-level) string functions. - -
- -## Usage - -```javascript -var string = require( '@stdlib/string/base' ); -``` - -#### string - -Namespace containing "base" (i.e., lower-level) string functions. - -```javascript -var ns = string; -// returns {...} -``` - -The namespace contains the following functions: - - - -
- -- [`altcase( str )`][@stdlib/string/base/altcase]: convert a string to alternate case. -- [`atob( str )`][@stdlib/string/base/atob]: decode a string of data which has been encoded using Base64 encoding. -- [`base64ToUint8Array( str )`][@stdlib/string/base/base64-to-uint8array]: convert a Base64-encoded string to a Uint8Array. -- [`camelcase( str )`][@stdlib/string/base/camelcase]: convert a string to camel case. -- [`capitalize( str )`][@stdlib/string/base/capitalize]: capitalize the first character in a string. -- [`codePointAt( string, position, backward )`][@stdlib/string/base/code-point-at]: return a Unicode code point from a string at a specified position. -- [`constantcase( str )`][@stdlib/string/base/constantcase]: convert a string to constant case. -- [`distances`][@stdlib/string/base/distances]: implementations of various string similarity metrics. -- [`dotcase( str )`][@stdlib/string/base/dotcase]: convert a string to dot case. -- [`endsWith( str, search, len )`][@stdlib/string/base/ends-with]: test if a string ends with the characters of another string. -- [`firstCodePoint( str, n )`][@stdlib/string/base/first-code-point]: return the first `n` Unicode code points of a string. -- [`firstGraphemeCluster( str, n )`][@stdlib/string/base/first-grapheme-cluster]: return the first `n` grapheme clusters (i.e., user-perceived characters) of a string. -- [`first( str, n )`][@stdlib/string/base/first]: return the first `n` UTF-16 code units of a string. -- [`forEachCodePointRight( str, clbk[, thisArg ] )`][@stdlib/string/base/for-each-code-point-right]: invokes a function for each Unicode code point in a string, iterating from right to left. -- [`forEachCodePoint( str, clbk[, thisArg ] )`][@stdlib/string/base/for-each-code-point]: invokes a function for each Unicode code point in a string. -- [`forEachGraphemeCluster( str, clbk[, thisArg ] )`][@stdlib/string/base/for-each-grapheme-cluster]: invokes a function for each grapheme cluster (i.e., user-perceived character) in a string. -- [`forEachRight( str, clbk[, thisArg ] )`][@stdlib/string/base/for-each-right]: invokes a function for each UTF-16 code unit in a string, iterating from right to left. -- [`forEach( str, clbk[, thisArg ] )`][@stdlib/string/base/for-each]: invokes a function for each UTF-16 code unit in a string. -- [`formatInterpolate( tokens, ...args )`][@stdlib/string/base/format-interpolate]: generate string from a token array by interpolating values. -- [`formatTokenize( str )`][@stdlib/string/base/format-tokenize]: tokenize a string into an array of string parts and format identifier objects. -- [`headercase( str )`][@stdlib/string/base/headercase]: convert a string to HTTP header case. -- [`invcase( str )`][@stdlib/string/base/invcase]: convert a string to inverse case. -- [`kebabcase( str )`][@stdlib/string/base/kebabcase]: convert a string to kebab case. -- [`lastCodePoint( str, n )`][@stdlib/string/base/last-code-point]: return the last `n` Unicode code points of a string. -- [`lastGraphemeCluster( str, n )`][@stdlib/string/base/last-grapheme-cluster]: return the last `n` grapheme clusters (i.e., user-perceived characters) of a string. -- [`last( str, n )`][@stdlib/string/base/last]: return the last `n` UTF-16 code units of a string. -- [`lpad( str, len, pad )`][@stdlib/string/base/left-pad]: left pad a string. -- [`ltrim( str )`][@stdlib/string/base/left-trim]: trim whitespace characters from the beginning of a string. -- [`lowercase( str )`][@stdlib/string/base/lowercase]: convert a string to lowercase. -- [`pascalcase( str )`][@stdlib/string/base/pascalcase]: convert a string to Pascal case. -- [`percentEncode( str )`][@stdlib/string/base/percent-encode]: percent-encode a UTF-16 encoded string according to RFC 3986. -- [`removeFirstCodePoint( str, n )`][@stdlib/string/base/remove-first-code-point]: remove the first `n` Unicode code points of a string. -- [`removeFirstGraphemeCluster( str, n )`][@stdlib/string/base/remove-first-grapheme-cluster]: remove the first `n` grapheme clusters (i.e., user-perceived characters) of a string. -- [`removeFirst( str, n )`][@stdlib/string/base/remove-first]: remove the first `n` UTF-16 code units of a string. -- [`removeLastCodePoint( str, n )`][@stdlib/string/base/remove-last-code-point]: remove the last `n` Unicode code points of a string. -- [`removeLastGraphemeCluster( str, n )`][@stdlib/string/base/remove-last-grapheme-cluster]: remove the last `n` grapheme clusters (i.e., user-perceived characters) of a string. -- [`removeLast( str, n )`][@stdlib/string/base/remove-last]: remove the last `n` UTF-16 code units of a string. -- [`repeat( str, n )`][@stdlib/string/base/repeat]: repeat a string a specified number of times and return the concatenated result. -- [`replaceAfterLast( str, search, replacement, fromIndex )`][@stdlib/string/base/replace-after-last]: replace the substring after the last occurrence of a specified search string. -- [`replaceAfter( str, search, replacement, fromIndex )`][@stdlib/string/base/replace-after]: replace the substring after the first occurrence of a specified search string. -- [`replaceBeforeLast( str, search, replacement, fromIndex )`][@stdlib/string/base/replace-before-last]: replace the substring before the last occurrence of a specified search string. -- [`replaceBefore( str, search, replacement, fromIndex )`][@stdlib/string/base/replace-before]: replace the substring before the first occurrence of a specified search string. -- [`replace( str, search, newval )`][@stdlib/string/base/replace]: replace search occurrences with a replacement string. -- [`reverseCodePoints( str )`][@stdlib/string/base/reverse-code-points]: reverse the Unicode code points of a string. -- [`reverseGraphemeClusters( str )`][@stdlib/string/base/reverse-grapheme-clusters]: reverse the grapheme clusters (i.e., user-perceived characters) of a string. -- [`reverse( str )`][@stdlib/string/base/reverse]: reverse the UTF-16 code units of a string. -- [`rpad( str, len, pad )`][@stdlib/string/base/right-pad]: right pad a string. -- [`rtrim( str )`][@stdlib/string/base/right-trim]: trim whitespace characters from the end of a string. -- [`sliceCodePoints( str, start, end )`][@stdlib/string/base/slice-code-points]: slice a string based on Unicode code point indices. -- [`sliceGraphemeClusters( str, start, end )`][@stdlib/string/base/slice-grapheme-clusters]: slice a string based on grapheme cluster (i.e., user-perceived character) indices. -- [`slice( str, start, end )`][@stdlib/string/base/slice]: slice UTF-16 code units from a string. -- [`snakecase( str )`][@stdlib/string/base/snakecase]: convert a string to snake case. -- [`startcase( str )`][@stdlib/string/base/startcase]: capitalize the first letter of each word in a string. -- [`startsWith( str, search, position )`][@stdlib/string/base/starts-with]: test if a string starts with the characters of another string. -- [`stickycase( str[, p] )`][@stdlib/string/base/stickycase]: convert a string to sticky case. -- [`trim( str )`][@stdlib/string/base/trim]: trim whitespace characters from the beginning and end of a string. -- [`truncateMiddle( str, len, seq )`][@stdlib/string/base/truncate-middle]: truncate the middle UTF-16 code units of a string to return a string having a specified length. -- [`uncapitalize( str )`][@stdlib/string/base/uncapitalize]: uncapitalize the first character of a string. -- [`uppercase( str )`][@stdlib/string/base/uppercase]: convert a string to uppercase. - -
- - - -
- - - - - -
- -
- - - -
- -## Examples - - - - - - - -```javascript -var ns = require( '@stdlib/string/base' ); - -// Generate a Pascal case string... -var str = ns.pascalcase( 'beep boop' ); -// returns 'BeepBoop' - -// Tokenize a string into an array of string parts and format identifier objects... -str = 'The %d %s foxes jumped over the %d %s dogs.'; -var tokens = ns.formatTokenize( str ); -// returns [ 'The ', {...}, ' ', {...}, ' foxes jumped over the ', {...}, ' ', {...}, ' dogs.' ] - -// Generate a string from a token array by interpolating values... -str = ns.formatInterpolate( tokens, 3, 'quick', 4, 'lazy' ); -// returns 'The 3 quick foxes jumped over the 4 lazy dogs.' - -// Test whether a string starts with the characters of another string... -str = 'Lorem ipsum dolor sit amet'; -var bool = ns.startsWith( str, 'Lorem' ); -// returns true - -// Test whether a string ends with the characters of another string... -bool = ns.endsWith( str, 'amet' ); -// returns true - -// Trim whitespace characters from the beginning and end of a string... -str = ' \t\n Lorem ipsum dolor sit amet \n\t '; -str = ns.trim( str ); -// returns 'Lorem ipsum dolor sit amet' -``` - -
- - - - - - - - - - - - - - diff --git a/base/altcase/README.md b/base/altcase/README.md deleted file mode 100644 index a44cb00d..00000000 --- a/base/altcase/README.md +++ /dev/null @@ -1,117 +0,0 @@ - - -# altcase - -> Convert a string to alternate case. - - - -
- -## Usage - -```javascript -var altcase = require( '@stdlib/string/base/altcase' ); -``` - -#### altcase( str ) - -Converts a string to alternate case. - -```javascript -var str = altcase( 'foo bar' ); -// returns 'fOo bAr' - -str = altcase( 'foo bar baz' ); -// returns 'fOo bAr bAz' - -str = altcase( 'foo_bar' ); -// returns 'fOo_bAr' -``` - -
- - - - - -
- -## Examples - -```javascript -var altcase = require( '@stdlib/string/base/altcase' ); - -var str = 'Hello World!'; -var out = altcase( str ); -// returns 'hElLo wOrLd!' - -str = 'I am a tiny little teapot'; -out = altcase( str ); -// returns 'i aM A TiNy lItTlE TeApOt' - -str = 'with big problems'; -out = altcase( str ); -// returns 'wItH BiG PrObLeMs' - -str = 'To be, or not to be: that is the question.'; -out = altcase( str ); -// returns 'tO Be, Or nOt tO Be: ThAt iS ThE QuEsTiOn.' - -str = 'isMobile'; -out = altcase( str ); -// returns 'iSmObIlE' -``` - -
- - - - - - - - - - - - - - diff --git a/base/altcase/benchmark/benchmark.js b/base/altcase/benchmark/benchmark.js deleted file mode 100644 index 1b2ea056..00000000 --- a/base/altcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var altcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = altcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/altcase/docs/repl.txt b/base/altcase/docs/repl.txt deleted file mode 100644 index 43153f44..00000000 --- a/base/altcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to alternate case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Alternate-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'hElLo wOrLd!' - > out = {{alias}}( 'I am a tiny little teapot' ) - 'i aM A TiNy lItTlE TeApOt' - - See Also - -------- diff --git a/base/altcase/docs/types/index.d.ts b/base/altcase/docs/types/index.d.ts deleted file mode 100644 index 457feb7c..00000000 --- a/base/altcase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to alternate case. -* -* @param str - string to convert -* @returns alternate-cased string -* -* @example -* var str = altcase( 'beep' ); -* // returns 'bEeP' -* -* @example -* var str = altcase( 'beep boop' ); -* // returns 'bEeP BoOp' -* -* @example -* var str = altcase( 'Hello World!' ); -* // returns 'hElLo wOrLd!' -*/ -declare function altcase( str: string ): string; - - -// EXPORTS // - -export = altcase; diff --git a/base/altcase/docs/types/test.ts b/base/altcase/docs/types/test.ts deleted file mode 100644 index 894d48ee..00000000 --- a/base/altcase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import altcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - altcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - altcase( true ); // $ExpectError - altcase( false ); // $ExpectError - altcase( null ); // $ExpectError - altcase( undefined ); // $ExpectError - altcase( 5 ); // $ExpectError - altcase( [] ); // $ExpectError - altcase( {} ); // $ExpectError - altcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - altcase(); // $ExpectError -} diff --git a/base/altcase/examples/index.js b/base/altcase/examples/index.js deleted file mode 100644 index 9a106779..00000000 --- a/base/altcase/examples/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 altcase = require( './../lib' ); - -var str = 'Hello World!'; -var out = altcase( str ); -console.log( out ); -// => 'hElLo wOrLd!' - -str = 'I am a tiny little teapot'; -out = altcase( str ); -console.log( out ); -// => 'i aM A TiNy lItTlE TeApOt' - -str = 'with big problems'; -out = altcase( str ); -console.log( out ); -// => 'wItH BiG PrObLeMs' - -str = 'To be, or not to be: that is the question.'; -out = altcase( str ); -console.log( out ); -// => 'tO Be, Or nOt tO Be: ThAt iS ThE QuEsTiOn.' - -str = 'isMobile'; -out = altcase( str ); -console.log( out ); -// => 'iSmObIlE' diff --git a/base/altcase/lib/index.js b/base/altcase/lib/index.js deleted file mode 100644 index 72120ff1..00000000 --- a/base/altcase/lib/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to alternate case. -* -* @module @stdlib/string/base/altcase -* -* @example -* var altcase = require( '@stdlib/string/base/altcase' ); -* -* var str = altcase( 'aBcDeF' ); -* // returns 'aBcDeF' -* -* str = altcase( 'Hello World!' ); -* // returns 'hElLo wOrLd!' -* -* str = altcase( 'I am a robot' ); -* // returns 'i aM A RoBoT' -*/ - - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/altcase/lib/main.js b/base/altcase/lib/main.js deleted file mode 100644 index 21616e5d..00000000 --- a/base/altcase/lib/main.js +++ /dev/null @@ -1,68 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var lowercase = require( './../../../base/lowercase' ); -var uppercase = require( './../../../base/uppercase' ); -var isEven = require( '@stdlib/math/base/assert/is-even' ); - - -// MAIN // - -/** -* Converts a string to alternate case. -* -* @param {string} str - string to convert -* @returns {string} alternate-cased string -* -* @example -* var str = altcase( 'beep' ); -* // returns 'bEeP' -* -* @example -* var str = altcase( 'beep boop' ); -* // returns 'bEeP BoOp' -* -* @example -* var str = altcase( 'isMobile' ); -* // returns 'iSmObIlE' -* -* @example -* var str = altcase( 'Hello World!' ); -* // returns 'hElLo wOrLd!' -*/ -function altcase( str ) { - var out = ''; - var i; - for ( i = 0; i < str.length; i++ ) { - if ( isEven( i ) ) { - out += lowercase( str[i] ); - } else { - out += uppercase( str[i] ); - } - } - return out; -} - - -// EXPORTS // - -module.exports = altcase; diff --git a/base/altcase/package.json b/base/altcase/package.json deleted file mode 100644 index 5106b86d..00000000 --- a/base/altcase/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/altcase", - "version": "0.0.0", - "description": "Convert a string to alternate case.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "case", - "alternate", - "convert" - ], - "__stdlib__": {} -} diff --git a/base/altcase/test/test.js b/base/altcase/test/test.js deleted file mode 100644 index 9c0a6b29..00000000 --- a/base/altcase/test/test.js +++ /dev/null @@ -1,193 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 altcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof altcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a camel case string to alternate case', function test( t ) { - var expected; - var actual; - - expected = 'cAmElCaSe'; - actual = altcase( 'camelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'iSmObIlE'; - actual = altcase( 'isMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function converts a string to alternate case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'Hello World', - 'I am tiny little tea pot', - 'Big problems', - 'The quick brown fox jumps over the lazy dog' - ]; - - expected = [ - 'hElLo wOrLd', - 'i aM TiNy lItTlE TeA PoT', - 'bIg pRoBlEmS', - 'tHe qUiCk bRoWn fOx jUmPs oVeR ThE LaZy dOg' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( altcase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to alternate case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'Привет мир', - 'Я маленькая лошадка', - 'Большие проблемы', - 'Быстрый коричневый фонд', - 'Café esuna bella', - 'fóoBár', - '😀😀-😀', - '신규 서비스' - ]; - - expected = [ - 'пРиВеТ МиР', - 'я мАлЕнЬкАя лОшАдКа', - 'бОлЬшИе пРоБлЕмЫ', - 'бЫсТрЫй кОрИчНеВыЙ ФоНд', - 'cAfÉ EsUnA BeLlA', - 'fÓoBáR', - '😀😀-😀', - '신규 서비스' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( altcase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a string with special characters to alternate case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo-bar', - 'foo!bar', - 'foo@bar', - 'foo#bar', - 'foo$bar', - 'foo%bar', - 'foo^bar', - 'foo&bar', - 'foo*bar', - 'foo(bar', - 'foo)bar', - 'foo[bar', - 'foo]bar', - 'foo{bar', - 'foo}bar', - 'foo|bar', - 'foo~bar', - 'foo:"bar', - 'foo\'bar', - 'foobar', - 'foo?bar', - 'foo/bar' - ]; - - expected = [ - 'fOo-bAr', - 'fOo!bAr', - 'fOo@bAr', - 'fOo#bAr', - 'fOo$bAr', - 'fOo%bAr', - 'fOo^bAr', - 'fOo&bAr', - 'fOo*bAr', - 'fOo(bAr', - 'fOo)bAr', - 'fOo[bAr', - 'fOo]bAr', - 'fOo{bAr', - 'fOo}bAr', - 'fOo|bAr', - 'fOo~bAr', - 'fOo:"BaR', - 'fOo\'bAr', - 'fOobAr', - 'fOo?bAr', - 'fOo/bAr' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( altcase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function leaves a string that is already in alternate case unchanged', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'cAmElCaSe', - 'iSmObIlE', - 'tHe qUiCk bRoWn fOx jUmPs oVeR ThE LaZy dOg' - ]; - - expected = [ - 'cAmElCaSe', - 'iSmObIlE', - 'tHe qUiCk bRoWn fOx jUmPs oVeR ThE LaZy dOg' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( altcase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); diff --git a/base/atob/README.md b/base/atob/README.md deleted file mode 100644 index 316c6df8..00000000 --- a/base/atob/README.md +++ /dev/null @@ -1,110 +0,0 @@ - - -# atob - -> Decode a string of data which has been encoded using Base64 encoding. - - - -
- -## Usage - - - -```javascript -var atob = require( '@stdlib/string/base/atob' ); -``` - -#### atob( str ) - -Decodes a string of data which has been encoded using Base64 encoding. - - - -```javascript -var out = atob( 'SGVsbG8sIHdvcmxk' ); -// returns 'Hello, world' -``` - -
- - - -
- -## Notes - -- This function differs from the global [`atob`][mdn-atob] available in web browsers and more recent Node.js versions in that the function returns `null` when provided a string containing non-ASCII characters, rather than raising an exception. - -
- - - - - -
- -## Examples - - - -```javascript -var atob = require( '@stdlib/string/base/atob' ); - -var str = 'SGVsbG8gV29ybGQh'; -var out = atob( str ); -// returns 'Hello World!' - -str = 'SEVMTE8gV09STEQh'; -out = atob( str ); -// returns 'HELLO WORLD!' - -str = 'VG8gYmUsIG9yIG5vdCB0byBiZTogdGhhdCBpcyB0aGUgcXVlc3Rpb24u'; -out = atob( str ); -// returns 'To be, or not to be: that is the question.' -``` - -
- - - - - - - - - - - - - - diff --git a/base/atob/benchmark/benchmark.js b/base/atob/benchmark/benchmark.js deleted file mode 100644 index 2b3ec499..00000000 --- a/base/atob/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var atob = require( './../lib' ); // eslint-disable-line stdlib/no-redeclare - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beepboop', - 'foobar', - 'xyzabc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = atob( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/atob/benchmark/benchmark.polyfill.js b/base/atob/benchmark/benchmark.polyfill.js deleted file mode 100644 index cc5217dc..00000000 --- a/base/atob/benchmark/benchmark.polyfill.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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var atob = require( './../lib/polyfill.js' ); // eslint-disable-line stdlib/no-redeclare - - -// MAIN // - -bench( format( '%s::polyfill', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beepboop', - 'foobar', - 'xyzabc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = atob( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/atob/docs/repl.txt b/base/atob/docs/repl.txt deleted file mode 100644 index 41186683..00000000 --- a/base/atob/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( str ) - Decodes a string of data which has been encoded using Base64 encoding. - - Parameters - ---------- - str: string - Binary string containing base64-encoded data. - - Returns - ------- - out: string - An ASCII string containing decoded data. - - Examples - -------- - > var out = {{alias}}( 'SGVsbG8sIHdvcmxk' ) - 'Hello, world' - - See Also - -------- - diff --git a/base/atob/docs/types/index.d.ts b/base/atob/docs/types/index.d.ts deleted file mode 100644 index 5d08f4ea..00000000 --- a/base/atob/docs/types/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Decodes a string of data which has been encoded using Base64 encoding. -* -* @param str - binary string containing base64-encoded data -* @returns an ASCII string containing decoded data -* -* @example -* var out = atob( 'SGVsbG8sIHdvcmxk' ); -* // returns 'Hello, world' -*/ -declare function atob( str: string ): string; - - -// EXPORTS // - -export = atob; diff --git a/base/atob/docs/types/test.ts b/base/atob/docs/types/test.ts deleted file mode 100644 index 4a928985..00000000 --- a/base/atob/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import atob = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - atob( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - atob( true ); // $ExpectError - atob( false ); // $ExpectError - atob( null ); // $ExpectError - atob( undefined ); // $ExpectError - atob( 5 ); // $ExpectError - atob( [] ); // $ExpectError - atob( {} ); // $ExpectError - atob( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - atob(); // $ExpectError -} diff --git a/base/atob/examples/index.js b/base/atob/examples/index.js deleted file mode 100644 index 1d8b3de1..00000000 --- a/base/atob/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 atob = require( './../lib' ); // eslint-disable-line stdlib/no-redeclare - -var str = 'SGVsbG8gV29ybGQh'; -var out = atob( str ); -console.log( out ); -// => 'Hello World!' - -str = 'SEVMTE8gV09STEQh'; -out = atob( str ); -console.log( out ); -// => 'HELLO WORLD!' - -str = 'VG8gYmUsIG9yIG5vdCB0byBiZTogdGhhdCBpcyB0aGUgcXVlc3Rpb24u'; -out = atob( str ); -console.log( out ); -// => 'To be, or not to be: that is the question.' diff --git a/base/atob/lib/global.js b/base/atob/lib/global.js deleted file mode 100644 index 2d8f761f..00000000 --- a/base/atob/lib/global.js +++ /dev/null @@ -1,23 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// EXPORTS // - -module.exports = atob; diff --git a/base/atob/lib/index.js b/base/atob/lib/index.js deleted file mode 100644 index ac63fbfb..00000000 --- a/base/atob/lib/index.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'; - -/** -* Decode a string of data which has been encoded using Base64 encoding. -* -* @module @stdlib/string/base/atob -* -* @example -* var atob = require( '@stdlib/string/base/atob' ); -* -* var out = atob( 'SGVsbG8sIHdvcmxk' ); -* // returns 'Hello, world' -*/ - -// MODULES // - -var hasAtobSupport = require( '@stdlib/assert/has-atob-support' ); -var builtin = require( './main.js' ); -var polyfill = require( './polyfill.js' ); - - -// MAIN // - -var main; -if ( hasAtobSupport() ) { - main = builtin; -} else { - main = polyfill; -} - - -// EXPORTS // - -module.exports = main; diff --git a/base/atob/lib/main.js b/base/atob/lib/main.js deleted file mode 100644 index 42e76db4..00000000 --- a/base/atob/lib/main.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var globalAtob = require( './global.js' ); - - -// MAIN // - -/** -* Decodes a string of data which has been encoded using Base64 encoding. -* -* @param {string} str - binary string containing base64-encoded data -* @returns {(string|null)} an ASCII string containing decoded data -* -* @example -* var out = atob( 'SGVsbG8sIHdvcmxk' ); -* // returns 'Hello, world' -*/ -function atob( str ) { // eslint-disable-line stdlib/no-redeclare - try { - return globalAtob( str ); - } catch ( err ) { // eslint-disable-line no-unused-vars - return null; - } -} - - -// EXPORTS // - -module.exports = atob; diff --git a/base/atob/lib/polyfill.js b/base/atob/lib/polyfill.js deleted file mode 100644 index 850b5948..00000000 --- a/base/atob/lib/polyfill.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var string2buffer = require( '@stdlib/buffer/from-string' ); -var RE_NON_ASCII = require( './re_non_ascii.js' ); - - -// MAIN // - -/** -* Decodes a string of data which has been encoded using Base64 encoding. -* -* ## Notes -* -* - Alternative (non-Buffer-based) implementations exist. For example, -* -* - jsdom: -* - base64: -* -* However, having a polyfill is really only required for older Node.js versions `<16.0.0` (see the browser compatibility table at ). Hence, we can use a Node.js-oriented polyfill leveraging `Buffer` with the expectation that bundle size is not an overarching concern. -* -* @private -* @param {string} str - binary string containing base64-encoded data -* @returns {(string|null)} an ASCII string containing decoded data -* -* @example -* var out = atob( 'SGVsbG8sIHdvcmxk' ); -* // returns 'Hello, world' -*/ -function atob( str ) { // eslint-disable-line stdlib/no-redeclare - // `atob` only allows converting ASCII characters to Base64, and, when Node.js's `Buffer` tries converting a non-ASCII character, it simply ignores it. Accordingly, we need to explicitly check whether the input string contains non-ASCII characters in order to ensure consistency with the non-polyfilled implementation... - if ( RE_NON_ASCII.test( str ) ) { - return null; - } - return string2buffer( str, 'base64' ).toString( 'utf8' ); -} - - -// EXPORTS // - -module.exports = atob; diff --git a/base/atob/lib/re_non_ascii.js b/base/atob/lib/re_non_ascii.js deleted file mode 100644 index 9f935373..00000000 --- a/base/atob/lib/re_non_ascii.js +++ /dev/null @@ -1,28 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var RE_NON_ASCII = /[^\u0000-\u007F]/; // eslint-disable-line no-control-regex - - -// EXPORTS // - -module.exports = RE_NON_ASCII; diff --git a/base/atob/package.json b/base/atob/package.json deleted file mode 100644 index 9d05e479..00000000 --- a/base/atob/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/atob", - "version": "0.0.0", - "description": "Decode a string of data which has been encoded using Base64 encoding.", - "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", - "browser": "./lib/main.js", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "decode", - "encode", - "base64", - "binary" - ], - "__stdlib__": {} -} diff --git a/base/atob/test/test.js b/base/atob/test/test.js deleted file mode 100644 index c75c3d4a..00000000 --- a/base/atob/test/test.js +++ /dev/null @@ -1,82 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 polyfill = require( './../lib/polyfill.js' ); -var main = require( './../lib/main.js' ); -var atob = require( './../lib' ); // eslint-disable-line stdlib/no-redeclare - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof atob, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the main export is a polyfill if an environment does not support `atob`', function test( t ) { - var atob = proxyquire( './../lib', { - '@stdlib/assert/has-atob-support': detect - }); - t.strictEqual( atob, polyfill, 'returns expected value' ); - t.end(); - - function detect() { - return false; - } -}); - -tape( 'the main export is a wrapper around a builtin if an environment supports `atob`', function test( t ) { - var atob = proxyquire( './../lib', { - '@stdlib/assert/has-atob-support': detect - }); - t.strictEqual( atob, main, 'returns expected value' ); - t.end(); - - function detect() { - return true; - } -}); - -tape( 'the function decodes a Base64 encoded string', function test( t ) { - var out; - var str; - - str = 'SGVsbG8sIHdvcmxk'; - out = atob( str ); - t.strictEqual( out, 'Hello, world', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `null` if provided a string containing non-ASCII characters', function test( t ) { - var out; - var str; - - str = 'SGVsbG8s ∏⨖∵😃 IHdvcmxk'; - out = atob( str ); - t.strictEqual( out, null, 'returns expected value' ); - - t.end(); -}); diff --git a/base/atob/test/test.main.js b/base/atob/test/test.main.js deleted file mode 100644 index eee1166f..00000000 --- a/base/atob/test/test.main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var hasAtobSupport = require( '@stdlib/assert/has-atob-support' ); -var atob = require( './../lib/main.js' ); // eslint-disable-line stdlib/no-redeclare - - -// VARIABLES // - -var opts = { - 'skip': !hasAtobSupport() -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof atob, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function decodes a Base64 encoded string', opts, function test( t ) { - var out; - var str; - - str = 'SGVsbG8sIHdvcmxk'; - out = atob( str ); - t.strictEqual( out, 'Hello, world', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `null` if provided a string containing non-ASCII characters', opts, function test( t ) { - var out; - var str; - - str = 'SGVsbG8s ∏⨖∵😃 IHdvcmxk'; - out = atob( str ); - t.strictEqual( out, null, 'returns expected value' ); - - t.end(); -}); diff --git a/base/atob/test/test.polyfill.js b/base/atob/test/test.polyfill.js deleted file mode 100644 index 621a5159..00000000 --- a/base/atob/test/test.polyfill.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 tape = require( 'tape' ); -var atob = require( './../lib/polyfill.js' ); // eslint-disable-line stdlib/no-redeclare - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof atob, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function decodes a Base64 encoded string', function test( t ) { - var out; - var str; - - str = 'SGVsbG8sIHdvcmxk'; - out = atob( str ); - t.strictEqual( out, 'Hello, world', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `null` if provided a string containing non-ASCII characters', function test( t ) { - var out; - var str; - - str = 'SGVsbG8s ∏⨖∵😃 IHdvcmxk'; - out = atob( str ); - t.strictEqual( out, null, 'returns expected value' ); - - t.end(); -}); diff --git a/base/base64-to-uint8array/README.md b/base/base64-to-uint8array/README.md deleted file mode 100644 index 81603328..00000000 --- a/base/base64-to-uint8array/README.md +++ /dev/null @@ -1,118 +0,0 @@ - - -# base64ToUint8Array - -> Convert a Base64-encoded string to a [Uint8Array][@stdlib/array/uint8]. - - - -
- -## Usage - - - -```javascript -var base64ToUint8Array = require( '@stdlib/string/base/base64-to-uint8array' ); -``` - -#### base64ToUint8Array( str ) - -Converts a base64-encoded string to a [Uint8Array][@stdlib/array/uint8]. - -```javascript -var string2buffer = require( '@stdlib/buffer/from-string' ); - -var str = string2buffer( 'Hello World!' ).toString( 'base64' ); -// returns 'SGVsbG8gV29ybGQh' - -var out = base64ToUint8Array( str ); -// returns [ 72, 101, ... ] -``` - -
- - - -
- -## Notes - -- The function returns `null` when provided a string containing non-ASCII characters. - -
- - - - - -
- -## Examples - -```javascript -var string2buffer = require( '@stdlib/buffer/from-string' ); -var base64ToUint8Array = require( '@stdlib/string/base/base64-to-uint8array' ); - -var buf = string2buffer( 'Hello World!' ).toString( 'base64' ); -// returns 'SGVsbG8gV29ybGQh' - -var arr = base64ToUint8Array( buf ); -// returns - -buf = string2buffer( 'HELLO WORLD!' ).toString( 'base64' ); -// returns 'SEVMTE8gV09STEQh' - -arr = base64ToUint8Array( buf ); -// returns - -buf = string2buffer( 'To be, or not to be: that is the question.' ).toString( 'base64' ); -// returns 'VG8gYmUsIG9yIG5vdCB0byBiZTogdGhhdCBpcyB0aGUgcXVlc3Rpb24u' - -arr = base64ToUint8Array( buf ); -// returns -``` - -
- - - - - - - - - - - - - - diff --git a/base/base64-to-uint8array/benchmark/benchmark.js b/base/base64-to-uint8array/benchmark/benchmark.js deleted file mode 100644 index da7e2c53..00000000 --- a/base/base64-to-uint8array/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isUint8Array = require( '@stdlib/assert/is-uint8array' ); -var pkg = require( './../package.json' ).name; -var base64ToUint8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'SGVsbG8gV29ybGQh', - 'VG8gYmUsIG9yIG5vdCB0byBiZTogdGhhdCBpcyB0aGUgcXVlc3Rpb24u', - 'SEVMTE8gV09STEQh' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = base64ToUint8Array( values[ i%values.length ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return a Uint8Array' ); - } - } - b.toc(); - if ( !isUint8Array( out ) ) { - b.fail( 'should return a Uint8Array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/base64-to-uint8array/docs/repl.txt b/base/base64-to-uint8array/docs/repl.txt deleted file mode 100644 index c8f771c8..00000000 --- a/base/base64-to-uint8array/docs/repl.txt +++ /dev/null @@ -1,25 +0,0 @@ - -{{alias}}( str ) - Converts a base64-encoded string to a Uint8Array. - - If provided a string containing non-ASCII characters, the function returns - `null`. - - Parameters - ---------- - str: string - Base64-encoded string. - - Returns - ------- - out: Uint8Array|null - Output array. - - Examples - -------- - > var out = {{alias}}( 'SGVsbG8gV29ybGQh' ) - - - See Also - -------- - diff --git a/base/base64-to-uint8array/docs/types/index.d.ts b/base/base64-to-uint8array/docs/types/index.d.ts deleted file mode 100644 index c4314bab..00000000 --- a/base/base64-to-uint8array/docs/types/index.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Converts a base64-encoded string to a Uint8Array. -* -* ## Notes -* -* - If provided a string containing non-ASCII characters, the function returns `null`. -* -* @param str - base64-encoded string -* @returns output array -* -* @example -* var string2buffer = require( '@stdlib/buffer/from-string' ); -* -* var str = string2buffer( 'Hello World!' ).toString( 'base64' ); -* // returns 'SGVsbG8gV29ybGQh' -* -* var out = base64ToUint8Array( str ); -* // returns [ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ] -*/ -declare function base64ToUint8Array( str: string ): Uint8Array | null; - - -// EXPORTS // - -export = base64ToUint8Array; diff --git a/base/base64-to-uint8array/docs/types/test.ts b/base/base64-to-uint8array/docs/types/test.ts deleted file mode 100644 index c5e45c39..00000000 --- a/base/base64-to-uint8array/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import base64ToUint8Array = require( './index' ); - - -// TESTS // - -// The function returns a Uint8Array (or null)... -{ - base64ToUint8Array( 'Hello World!' ); // $ExpectType Uint8Array | null -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - base64ToUint8Array( true ); // $ExpectError - base64ToUint8Array( false ); // $ExpectError - base64ToUint8Array( null ); // $ExpectError - base64ToUint8Array( undefined ); // $ExpectError - base64ToUint8Array( 5 ); // $ExpectError - base64ToUint8Array( [] ); // $ExpectError - base64ToUint8Array( {} ); // $ExpectError - base64ToUint8Array( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - base64ToUint8Array(); // $ExpectError -} diff --git a/base/base64-to-uint8array/examples/index.js b/base/base64-to-uint8array/examples/index.js deleted file mode 100644 index eec3c378..00000000 --- a/base/base64-to-uint8array/examples/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var string2buffer = require( '@stdlib/buffer/from-string' ); -var base64ToUint8Array = require( './../lib' ); - -var buf = string2buffer( 'Hello World!' ).toString( 'base64' ); -// returns 'SGVsbG8gV29ybGQh' - -var arr = base64ToUint8Array( buf ); -console.log( arr ); - -buf = string2buffer( 'HELLO WORLD!' ).toString( 'base64' ); -// returns 'SEVMTE8gV09STEQh' - -arr = base64ToUint8Array( buf ); -console.log( arr ); - -buf = string2buffer( 'To be, or not to be: that is the question.' ).toString( 'base64' ); -// returns 'VG8gYmUsIG9yIG5vdCB0byBiZTogdGhhdCBpcyB0aGUgcXVlc3Rpb24u' - -arr = base64ToUint8Array( buf ); -console.log( arr ); diff --git a/base/base64-to-uint8array/lib/index.js b/base/base64-to-uint8array/lib/index.js deleted file mode 100644 index 11ef265d..00000000 --- a/base/base64-to-uint8array/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a base64-encoded string to a Uint8Array. -* -* @module @stdlib/string/base/base64-to-uint8array -* -* @example -* var string2buffer = require( '@stdlib/buffer/from-string' ); -* var base64ToUint8Array = require( '@stdlib/string/base/base64-to-uint8array' ); -* -* var str = string2buffer( 'Hello World!' ).toString( 'base64' ); -* // returns 'SGVsbG8gV29ybGQh' -* -* var out = base64ToUint8Array( str ); -* // returns [ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/base64-to-uint8array/lib/main.js b/base/base64-to-uint8array/lib/main.js deleted file mode 100644 index d5e22fe5..00000000 --- a/base/base64-to-uint8array/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var atob = require( './../../../base/atob' ); // eslint-disable-line stdlib/no-redeclare -var Uint8Array = require( '@stdlib/array/uint8' ); - - -// MAIN // - -/** -* Converts a base64-encoded string to a Uint8Array. -* -* @param {string} str - base64-encoded string -* @returns {(Uint8Array|null)} output array -* -* @example -* var string2buffer = require( '@stdlib/buffer/from-string' ); -* -* var str = string2buffer( 'Hello World!' ).toString( 'base64' ); -* // returns 'SGVsbG8gV29ybGQh' -* -* var out = base64ToUint8Array( str ); -* // returns [ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ] -*/ -function base64ToUint8Array( str ) { - var bytes; - var v; - var i; - - v = atob( str ); - if ( v === null ) { - return null; - } - bytes = new Uint8Array( v.length ); - for ( i = 0; i < v.length; i++ ) { - bytes[ i ] = v.charCodeAt( i ); - } - return bytes; -} - - -// EXPORTS // - -module.exports = base64ToUint8Array; diff --git a/base/base64-to-uint8array/package.json b/base/base64-to-uint8array/package.json deleted file mode 100644 index d2297146..00000000 --- a/base/base64-to-uint8array/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/base/base64-to-uint8array", - "version": "0.0.0", - "description": "Convert a Base64-encoded string to a Uint8Array.", - "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", - "browser": "./lib/main.js", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "decode", - "encode", - "base64", - "buffer", - "uint8array", - "bytes" - ], - "__stdlib__": {} -} diff --git a/base/base64-to-uint8array/test/test.js b/base/base64-to-uint8array/test/test.js deleted file mode 100644 index 10f9b734..00000000 --- a/base/base64-to-uint8array/test/test.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 tape = require( 'tape' ); -var isUint8Array = require( '@stdlib/assert/is-uint8array' ); -var Uint8Array = require( '@stdlib/array/uint8' ); -var base64ToUint8Array = require( './../lib/main.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof base64ToUint8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a base64-encoded string to a Uint8Array', function test( t ) { - var expected; - var actual; - var str; - - str = 'SGVsbG8sIHdvcmxk'; - actual = base64ToUint8Array( str ); - t.strictEqual( isUint8Array( actual ), true, 'returns expected value' ); - - expected = new Uint8Array( [ 72, 101, 108, 108, 111, 44, 32, 119, 111, 114, 108, 100 ] ); // eslint-disable-line max-len - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty Uint8Array if provided an empty string', function test( t ) { - var expected; - var actual; - var str; - - str = ''; - actual = base64ToUint8Array( str ); - t.strictEqual( isUint8Array( actual ), true, 'returns expected value' ); - - expected = new Uint8Array( [] ); - t.deepEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `null` if provided a string containing non-ASCII characters', function test( t ) { - var out; - var str; - - str = 'SGVsbG8s ∏⨖∵😃 IHdvcmxk'; - out = base64ToUint8Array( str ); - t.strictEqual( out, null, 'returns expected value' ); - - t.end(); -}); diff --git a/base/camelcase/README.md b/base/camelcase/README.md deleted file mode 100644 index c6fe8246..00000000 --- a/base/camelcase/README.md +++ /dev/null @@ -1,118 +0,0 @@ - - -# camelcase - -> Convert a string to camel case. - - - -
- -## Usage - -```javascript -var camelcase = require( '@stdlib/string/base/camelcase' ); -``` - -#### camelcase( str ) - -Converts a string to camel case. - -```javascript -var out = camelcase( 'foo bar' ); -// returns 'fooBar' - -out = camelcase( 'IS_MOBILE' ); -// returns 'isMobile' - -out = camelcase( 'Hello World!' ); -// returns 'helloWorld' - -out = camelcase( '--foo-bar--' ); -// returns 'fooBar' -``` - -
- - - - - -
- -## Examples - -```javascript -var camelcase = require( '@stdlib/string/base/camelcase' ); - -var str = 'Hello World!'; -var out = camelcase( str ); -// returns 'helloWorld' - -str = 'HELLO WORLD!'; -out = camelcase( str ); -// returns 'helloWorld' - -str = 'To be, or not to be: that is the question.'; -out = camelcase( str ); -// returns 'toBeOrNotToBeThatIsTheQuestion' -``` - -
- - - - - - - - - - - - - - diff --git a/base/camelcase/benchmark/benchmark.js b/base/camelcase/benchmark/benchmark.js deleted file mode 100644 index cfb70a23..00000000 --- a/base/camelcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var camelcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = camelcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/camelcase/docs/repl.txt b/base/camelcase/docs/repl.txt deleted file mode 100644 index 3d18f446..00000000 --- a/base/camelcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to camel case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Camel-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'helloWorld' - > out = {{alias}}( 'beep boop' ) - 'beepBoop' - - See Also - -------- diff --git a/base/camelcase/docs/types/index.d.ts b/base/camelcase/docs/types/index.d.ts deleted file mode 100644 index 802d684b..00000000 --- a/base/camelcase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to camel case. -* -* @param str - string to convert -* @returns camel-cased string -* -* @example -* var str = camelcase( 'Hello World!' ); -* // returns 'helloWorld' -* -* @example -* var str = camelcase( 'foo_bar' ); -* // returns 'fooBar' -* -* @example -* var str = camelcase( 'foo-bar' ); -* // returns 'fooBar' -*/ -declare function camelcase( str: string ): string; - - -// EXPORTS // - -export = camelcase; diff --git a/base/camelcase/docs/types/test.ts b/base/camelcase/docs/types/test.ts deleted file mode 100644 index 4a6b32e5..00000000 --- a/base/camelcase/docs/types/test.ts +++ /dev/null @@ -1,44 +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. -*/ - -import camelcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - camelcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - camelcase( true ); // $ExpectError - camelcase( false ); // $ExpectError - camelcase( null ); // $ExpectError - camelcase( undefined ); // $ExpectError - camelcase( 5 ); // $ExpectError - camelcase( [] ); // $ExpectError - camelcase( {} ); // $ExpectError - camelcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - camelcase(); // $ExpectError -} diff --git a/base/camelcase/examples/index.js b/base/camelcase/examples/index.js deleted file mode 100644 index 45ed09b6..00000000 --- a/base/camelcase/examples/index.js +++ /dev/null @@ -1,36 +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. -*/ - -'use strict'; - -var camelcase = require( './../lib' ); - -var str = 'Hello World!'; -var out = camelcase( str ); -console.log( out ); -// => 'helloWorld' - -str = 'HELLO WORLD!'; -out = camelcase( str ); -console.log( out ); -// => 'helloWorld' - -str = 'To be, or not to be: that is the question.'; -out = camelcase( str ); -console.log( out ); -// => 'toBeOrNotToBeThatIsTheQuestion' diff --git a/base/camelcase/lib/index.js b/base/camelcase/lib/index.js deleted file mode 100644 index 742eab47..00000000 --- a/base/camelcase/lib/index.js +++ /dev/null @@ -1,46 +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. -*/ - -'use strict'; - -/** -* Convert a string to camel case. -* -* @module @stdlib/string/base/camelcase -* -* @example -* var camelcase = require( '@stdlib/string/base/camelcase' ); -* -* var str = camelcase( 'foo bar' ); -* // returns 'fooBar' -* -* str = camelcase( '--foo-bar--' ); -* // returns 'fooBar' -* -* str = camelcase( 'Hello World!' ); -* // returns 'helloWorld' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/camelcase/lib/main.js b/base/camelcase/lib/main.js deleted file mode 100644 index 9c77787d..00000000 --- a/base/camelcase/lib/main.js +++ /dev/null @@ -1,89 +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. -*/ - -'use strict'; - -// MODULES // - -var capitalize = require( './../../../base/capitalize' ); -var lowercase = require( './../../../base/lowercase' ); -var replace = require( './../../../base/replace' ); -var trim = require( './../../../base/trim' ); - - -// VARIABLES // - -var RE_WHITESPACE = /\s+/g; -var RE_SPECIAL = /[-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape -var RE_TO_CAMEL = /(?:\s|^)([^\s]+)(?=\s|$)/g; -var RE_CAMEL = /([a-z0-9])([A-Z])/g; - - -// FUNCTIONS // - -/** -* Converts first capture group to uppercase. -* -* @private -* @param {string} match - entire match -* @param {string} p1 - first capture group -* @param {number} offset - offset of the matched substring in entire string -* @returns {string} uppercased capture group -*/ -function replacer( match, p1, offset ) { - p1 = lowercase( p1 ); - return ( offset === 0 ) ? p1 : capitalize( p1 ); -} - - -// MAIN // - -/** -* Converts a string to camel case. -* -* @param {string} str - string to convert -* @returns {string} camel-cased string -* -* @example -* var out = camelcase( 'foo bar' ); -* // returns 'fooBar' -* -* @example -* var out = camelcase( 'IS_MOBILE' ); -* // returns 'isMobile' -* -* @example -* var out = camelcase( 'Hello World!' ); -* // returns 'helloWorld' -* -* @example -* var out = camelcase( '--foo-bar--' ); -* // returns 'fooBar' -*/ -function camelcase( str ) { - str = replace( str, RE_SPECIAL, ' ' ); - str = replace( str, RE_WHITESPACE, ' ' ); - str = replace( str, RE_CAMEL, '$1 $2' ); - str = trim( str ); - return replace( str, RE_TO_CAMEL, replacer ); -} - - -// EXPORTS // - -module.exports = camelcase; diff --git a/base/camelcase/package.json b/base/camelcase/package.json deleted file mode 100644 index a072e7e9..00000000 --- a/base/camelcase/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/camelcase", - "version": "0.0.0", - "description": "Convert a string to camel case.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "case", - "convert", - "camelcase", - "camel", - "snakecase" - ], - "__stdlib__": {} -} diff --git a/base/camelcase/test/test.js b/base/camelcase/test/test.js deleted file mode 100644 index cb98c0b0..00000000 --- a/base/camelcase/test/test.js +++ /dev/null @@ -1,175 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var camelcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof camelcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a string to camel case', function test( t ) { - var expected; - var actual; - - expected = 'fooBar'; - actual = camelcase( 'foo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'fooBar'; - actual = camelcase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'fooBar'; - actual = camelcase( 'foo.bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'helloWorld'; - actual = camelcase( 'Hello World!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'bEepBOop'; - actual = camelcase( 'bEep bOOP' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to camelcase', function test( t ) { - var expected; - var actual; - - expected = 'fóoBar'; - actual = camelcase( 'fóo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'fóoBar'; - actual = camelcase( 'fóo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'fóoBar'; - actual = camelcase( 'fóo.bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'hélloWórld'; - actual = camelcase( 'héllo Wórld!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in constant case to camel case', function test( t ) { - var expected; - var actual; - - expected = 'fooBar'; - actual = camelcase( 'FOO_BAR' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMostlyCamelCase'; - actual = camelcase( 'IS_MOSTLY_CAMEL_CASE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMobile'; - actual = camelcase( 'IS_MOBILE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isNodeRepl'; - actual = camelcase( 'IS_NODE_REPL' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in kebab case to camel case', function test( t ) { - var expected; - var actual; - - expected = 'fooBar'; - actual = camelcase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMostlyCamelCase'; - actual = camelcase( 'is-mostly-camel-case' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMobile'; - actual = camelcase( 'is-mobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isNodeRepl'; - actual = camelcase( 'is-node-repl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in pascal case to camel case', function test( t ) { - var expected; - var actual; - - expected = 'fooBar'; - actual = camelcase( 'FooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMostlyCamelCase'; - actual = camelcase( 'IsMostlyCamelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMobile'; - actual = camelcase( 'IsMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isNodeRepl'; - actual = camelcase( 'IsNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function leaves a string that is already in camel case unchanged', function test( t ) { - var expected; - var actual; - - expected = 'fooBar'; - actual = camelcase( 'fooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMostlyCamelCase'; - actual = camelcase( 'isMostlyCamelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMobile'; - actual = camelcase( 'isMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isNodeRepl'; - actual = camelcase( 'isNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/base/capitalize/README.md b/base/capitalize/README.md deleted file mode 100644 index 9b874b14..00000000 --- a/base/capitalize/README.md +++ /dev/null @@ -1,104 +0,0 @@ - - -# capitalize - -> Capitalize the first character in a string. - -
- -## Usage - -```javascript -var capitalize = require( '@stdlib/string/base/capitalize' ); -``` - -#### capitalize( str ) - -Capitalizes the first character in a string. - -```javascript -var out = capitalize( 'last man standing' ); -// returns 'Last man standing' - -out = capitalize( 'Hidden Treasures' ); -// returns 'Hidden Treasures' -``` - -
- - - -
- -## Examples - - - -```javascript -var capitalize = require( '@stdlib/string/base/capitalize' ); - -var str = capitalize( 'last man standing' ); -// returns 'Last man standing' - -str = capitalize( 'presidential election' ); -// returns 'Presidential election' - -str = capitalize( 'javaScript' ); -// returns 'JavaScript' - -str = capitalize( 'Hidden Treasures' ); -// returns 'Hidden Treasures' -``` - -
- - - - - - - - - - - - - - diff --git a/base/capitalize/benchmark/benchmark.js b/base/capitalize/benchmark/benchmark.js deleted file mode 100644 index 3279cf07..00000000 --- a/base/capitalize/benchmark/benchmark.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var capitalize = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz xyz' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = capitalize( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/capitalize/docs/repl.txt b/base/capitalize/docs/repl.txt deleted file mode 100644 index 5775d98b..00000000 --- a/base/capitalize/docs/repl.txt +++ /dev/null @@ -1,24 +0,0 @@ - -{{alias}}( str ) - Capitalizes the first character in a string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Capitalized string. - - Examples - -------- - > var out = {{alias}}( 'beep' ) - 'Beep' - > out = {{alias}}( 'Boop' ) - 'Boop' - - See Also - -------- - diff --git a/base/capitalize/docs/types/index.d.ts b/base/capitalize/docs/types/index.d.ts deleted file mode 100644 index 2e261a40..00000000 --- a/base/capitalize/docs/types/index.d.ts +++ /dev/null @@ -1,50 +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. -*/ - -// TypeScript Version: 4.1 - -type Capitalize = S extends `${infer F}${infer R}` ? `${Uppercase}${R}` : S; - -/** -* Capitalizes the first character in a string. -* -* @param str - input string -* @returns capitalized string -* -* @example -* var out = capitalize( 'last man standing' ); -* // returns 'Last man standing' -* -* @example -* var out = capitalize( 'presidential election' ); -* // returns 'Presidential election' -* -* @example -* var out = capitalize( 'javaScript' ); -* // returns 'JavaScript' -* -* @example -* var out = capitalize( 'Hidden Treasures' ); -* // returns 'Hidden Treasures' -*/ -declare function capitalize( str: S ): Capitalize; - - -// EXPORTS // - -export = capitalize; diff --git a/base/capitalize/docs/types/test.ts b/base/capitalize/docs/types/test.ts deleted file mode 100644 index 8644f23a..00000000 --- a/base/capitalize/docs/types/test.ts +++ /dev/null @@ -1,48 +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. -*/ - -import capitalize = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - capitalize( 'abc' ); // $ExpectType "Abc" - capitalize( 'beep boop' ); // $ExpectType "Beep boop" - capitalize( 'a' ); // $ExpectType "A" - capitalize( 'A' ); // $ExpectType "A" - capitalize( 'abc' as string ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - capitalize( true ); // $ExpectError - capitalize( false ); // $ExpectError - capitalize( null ); // $ExpectError - capitalize( undefined ); // $ExpectError - capitalize( 5 ); // $ExpectError - capitalize( [] ); // $ExpectError - capitalize( {} ); // $ExpectError - capitalize( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - capitalize(); // $ExpectError -} diff --git a/base/capitalize/examples/index.js b/base/capitalize/examples/index.js deleted file mode 100644 index 854af3f9..00000000 --- a/base/capitalize/examples/index.js +++ /dev/null @@ -1,33 +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. -*/ - -'use strict'; - -var capitalize = require( './../lib' ); - -console.log( capitalize( 'last man standing' ) ); -// => 'Last man standing' - -console.log( capitalize( 'presidential election' ) ); -// => 'Presidential election' - -console.log( capitalize( 'javaScript' ) ); -// => 'JavaScript' - -console.log( capitalize( 'Hidden Treasures' ) ); -// => 'Hidden Treasures' diff --git a/base/capitalize/lib/index.js b/base/capitalize/lib/index.js deleted file mode 100644 index 809b7eee..00000000 --- a/base/capitalize/lib/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -/** -* Capitalize the first character in a string. -* -* @module @stdlib/string/base/capitalize -* -* @example -* var capitalize = require( '@stdlib/string/base/capitalize' ); -* -* var out = capitalize( 'last man standing' ); -* // returns 'Last man standing' -* -* out = capitalize( 'Hidden Treasures' ); -* // returns 'Hidden Treasures' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/capitalize/lib/main.js b/base/capitalize/lib/main.js deleted file mode 100644 index 887c1333..00000000 --- a/base/capitalize/lib/main.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MAIN // - -/** -* Capitalizes the first character in a string. -* -* @param {string} str - input string -* @returns {string} capitalized string -* -* @example -* var out = capitalize( 'last man standing' ); -* // returns 'Last man standing' -* -* @example -* var out = capitalize( 'presidential election' ); -* // returns 'Presidential election' -* -* @example -* var out = capitalize( 'javaScript' ); -* // returns 'JavaScript' -* -* @example -* var out = capitalize( 'Hidden Treasures' ); -* // returns 'Hidden Treasures' -*/ -function capitalize( str ) { - if ( str === '' ) { - return ''; - } - return str.charAt( 0 ).toUpperCase() + str.slice( 1 ); -} - - -// EXPORTS // - -module.exports = capitalize; diff --git a/base/capitalize/package.json b/base/capitalize/package.json deleted file mode 100644 index ee4492ae..00000000 --- a/base/capitalize/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/capitalize", - "version": "0.0.0", - "description": "Capitalize the first character in a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "capitalize", - "uppercase", - "upper", - "case" - ], - "__stdlib__": {} -} diff --git a/base/capitalize/test/test.js b/base/capitalize/test/test.js deleted file mode 100644 index 0ce0588b..00000000 --- a/base/capitalize/test/test.js +++ /dev/null @@ -1,53 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var capitalize = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof capitalize, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( capitalize( '' ), '', 'returns empty string' ); - t.end(); -}); - -tape( 'the function capitalizes the first character in a provided string', function test( t ) { - var out; - - out = capitalize( 'hello world' ); - t.strictEqual( out, 'Hello world', 'capitalizes first character' ); - - out = capitalize( '!!!' ); - t.strictEqual( out, '!!!', 'does not change non-alphabetical characters' ); - - out = capitalize( 'Hello World' ); - t.strictEqual( out, 'Hello World', 'leaves uppercase letters in uppercase' ); - - t.end(); -}); diff --git a/base/code-point-at/README.md b/base/code-point-at/README.md deleted file mode 100644 index 225a09c3..00000000 --- a/base/code-point-at/README.md +++ /dev/null @@ -1,141 +0,0 @@ - - -# codePointAt - -> Return a Unicode [code point][code-point] from a string at a specified position. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var codePointAt = require( '@stdlib/string/base/code-point-at' ); -``` - -#### codePointAt( string, position, backward ) - -Returns a Unicode [code point][code-point] from a string at a specified position. - -```javascript -var out = codePointAt( 'last man standing', 4, false ); -// returns 32 -``` - -The function supports a `backward` argument for performing backward iteration for low surrogates. - -```javascript -var out = codePointAt( '🌷', 1, true ); -// returns 127799 -``` - -The function supports providing a negative `position`. - -```javascript -var out = codePointAt( 'last man standing', -13, false ); -// returns 32 -``` - -
- - - - - -
- -## Notes - -This function differs from [`String.prototype.codePointAt`][mdn-string-codepointat] in the following ways: - -- The function supports providing a negative `position`. If provided a negative `position`, the function determines the string position relative to the end of the string. -- The function supports a `backward` argument for performing backward iteration for low surrogates. [`String.prototype.codePointAt`][mdn-string-codepointat] simply returns the low surrogate value if no [UTF-16][utf-16] surrogate pair begins at the specified position. If invoked with `backward` set to `true`, this function will return the code point after aggregating with the preceding high surrogate, if the specified position does not mark the start of a surrogate pair. - -
- - - - - -
- -## Examples - - - -```javascript -var codePointAt = require( '@stdlib/string/base/code-point-at' ); - -var v = codePointAt( 'last man standing', 4, false ); -// returns 32 - -v = codePointAt( 'presidential election', 8, true ); -// returns 116 - -v = codePointAt( 'अनुच्छेद', 2, false ); -// returns 2369 - -v = codePointAt( '🌷', 1, true ); -// returns 127799 -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/code-point-at/benchmark/benchmark.js b/base/code-point-at/benchmark/benchmark.js deleted file mode 100644 index 976acddb..00000000 --- a/base/code-point-at/benchmark/benchmark.js +++ /dev/null @@ -1,89 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var fromCodePoint = require( './../../../from-code-point' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var UNICODE_MAX = require( '@stdlib/constants/unicode/max' ); -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var codePointAt = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( typeof String.prototype.codePointAt !== 'function' ) -}; -var VALUES = [ - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ) -]; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = codePointAt( VALUES[ i%VALUES.length ], 0, false ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( out ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::built-in', pkg ), opts, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = VALUES[ i%VALUES.length ].codePointAt( 0 ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( out ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/code-point-at/docs/repl.txt b/base/code-point-at/docs/repl.txt deleted file mode 100644 index 78eb6d5e..00000000 --- a/base/code-point-at/docs/repl.txt +++ /dev/null @@ -1,34 +0,0 @@ - -{{alias}}( str, idx, backward ) - Returns a Unicode code point from a string at a specified position. - - Parameters - ---------- - str: string - Input string. - - idx: integer - Position. If less than `0`, the string position is determined relative - to the end of the input string. - - backward: boolean - Backward iteration for low surrogates. - - Returns - ------- - out: integer - Unicode code point. - - Examples - -------- - > var out = {{alias}}( 'last man standing', 4, false ) - 32 - > out = {{alias}}( 'presidential election', 8, true ) - 116 - > out = {{alias}}( 'अनुच्छेद', 2, false ) - 2369 - > out = {{alias}}( '🌷', 1, true ) - 127799 - - See Also - -------- diff --git a/base/code-point-at/docs/types/index.d.ts b/base/code-point-at/docs/types/index.d.ts deleted file mode 100644 index 72362cb9..00000000 --- a/base/code-point-at/docs/types/index.d.ts +++ /dev/null @@ -1,41 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns a Unicode code point from a string at specified position. -* -* @param str - input string -* @param idx - position -* @param backward - backward iteration for low surrogates -* @returns code point -* -* @example -* var str = codePointAt( 'अनुच्छेद', 2, false ); -* // returns 2369 -* -* str = codePointAt( '🌷', 1, true ); -* // returns 127799 -*/ -declare function codePointAt( str: string, idx: number, backward: boolean ): number; - - -// EXPORTS // - -export = codePointAt; diff --git a/base/code-point-at/docs/types/test.ts b/base/code-point-at/docs/types/test.ts deleted file mode 100644 index 14f170e3..00000000 --- a/base/code-point-at/docs/types/test.ts +++ /dev/null @@ -1,52 +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. -*/ - -import codePointAt = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - codePointAt( 'last man standing', 4, false ); // $ExpectType number - codePointAt( 'presidential election', 8, true ); // $ExpectType number - codePointAt( 'अनुच्छेद', 2, false ); // $ExpectType number - codePointAt( '🌷', 1, true ); // $ExpectType number -} - -// The compiler throws an error if the function is provided incorrect arguments... -{ - codePointAt( false, 3, false ); // $ExpectError - codePointAt( {}, 3, false ); // $ExpectError - codePointAt( ( x: number ): number => x, 3, false ); // $ExpectError - - codePointAt( 'string', true, false ); // $ExpectError - codePointAt( 'string', false, false ); // $ExpectError - codePointAt( 'string', {}, false ); // $ExpectError - codePointAt( 'string', ( x: number ): number => x, false ); // $ExpectError - - codePointAt( 'string', 2, {} ); // $ExpectError - codePointAt( 'string', 2, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - codePointAt(); // $ExpectError - codePointAt( 'abc' ); // $ExpectError - codePointAt( 'abc', 0 ); // $ExpectError -} diff --git a/base/code-point-at/examples/index.js b/base/code-point-at/examples/index.js deleted file mode 100644 index 05cc505a..00000000 --- a/base/code-point-at/examples/index.js +++ /dev/null @@ -1,33 +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. -*/ - -'use strict'; - -var codePointAt = require( './../lib' ); - -console.log( codePointAt( 'last man standing', 4, false ) ); -// => 32 - -console.log( codePointAt( 'presidential election', 8, true ) ); -// => 116 - -console.log( codePointAt( 'अनुच्छेद', 2, false ) ); -// => 2369 - -console.log( codePointAt( '🌷', 1, true ) ); -// => 127799 diff --git a/base/code-point-at/lib/index.js b/base/code-point-at/lib/index.js deleted file mode 100644 index c168bfd8..00000000 --- a/base/code-point-at/lib/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -/** -* Return a Unicode code point from a string at a specified position. -* -* @module @stdlib/string/base/code-point-at -* -* @example -* var codePointAt = require( '@stdlib/string/base/code-point-at' ); -* -* var out = codePointAt( 'अनुच्छेद', 2, false ); -* // returns 2369 -* -* out = codePointAt( '🌷', 1, true ); -* // returns 127799 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/code-point-at/lib/main.js b/base/code-point-at/lib/main.js deleted file mode 100644 index 5a594cf4..00000000 --- a/base/code-point-at/lib/main.js +++ /dev/null @@ -1,103 +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. -*/ - -'use strict'; - -// VARIABLES // - -// Factors for converting individual surrogates... -var Ox10000 = 0x10000|0; // 65536 -var Ox400 = 0x400|0; // 1024 - -// Range for a high surrogate -var OxD800 = 0xD800|0; // 55296 -var OxDBFF = 0xDBFF|0; // 56319 - -// Range for a low surrogate -var OxDC00 = 0xDC00|0; // 56320 -var OxDFFF = 0xDFFF|0; // 57343 - - -// MAIN // - -/** -* Returns a Unicode code point from a string at a specified position. -* -* ## Notes -* -* - UTF-16 encoding uses one 16-bit unit for non-surrogates (U+0000 to U+D7FF and U+E000 to U+FFFF). -* - UTF-16 encoding uses two 16-bit units (surrogate pairs) for U+10000 to U+10FFFF and encodes U+10000-U+10FFFF by subtracting 0x10000 from the code point, expressing the result as a 20-bit binary, and splitting the 20 bits of 0x0-0xFFFFF as upper and lower 10-bits. The respective 10-bits are stored in two 16-bit words: a high and a low surrogate. -* -* @param {string} str - input string -* @param {integer} idx - position -* @param {boolean} backward - backward iteration for low surrogates -* @returns {NonNegativeInteger} code point -* -* @example -* var out = codePointAt( 'last man standing', 4, false ); -* // returns 32 -* -* @example -* var out = codePointAt( 'presidential election', 8, true ); -* // returns 116 -* -* @example -* var out = codePointAt( 'अनुच्छेद', 2, false ); -* // returns 2369 -* -* @example -* var out = codePointAt( '🌷', 1, true ); -* // returns 127799 -*/ -function codePointAt( str, idx, backward ) { - var code; - var low; - var hi; - - if ( idx < 0 ) { - idx += str.length; - } - code = str.charCodeAt( idx ); - - // High surrogate - if ( code >= OxD800 && code <= OxDBFF && idx < str.length - 1 ) { - hi = code; - low = str.charCodeAt( idx+1 ); - if ( OxDC00 <= low && low <= OxDFFF ) { - return ( ( hi - OxD800 ) * Ox400 ) + ( low - OxDC00 ) + Ox10000; - } - return hi; - } - // Low surrogate - support only if backward iteration is desired - if ( backward ) { - if ( code >= OxDC00 && code <= OxDFFF && idx >= 1 ) { - hi = str.charCodeAt( idx-1 ); - low = code; - if ( OxD800 <= hi && hi <= OxDBFF ) { - return ( ( hi - OxD800 ) * Ox400 ) + ( low - OxDC00 ) + Ox10000; - } - return low; - } - } - return code; -} - - -// EXPORTS // - -module.exports = codePointAt; diff --git a/base/code-point-at/package.json b/base/code-point-at/package.json deleted file mode 100644 index a4694b97..00000000 --- a/base/code-point-at/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/base/code-point-at", - "version": "0.0.0", - "description": "Return a Unicode code point from a string at a specified position.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "base", - "code", - "point", - "pt", - "unicode", - "utf-16", - "utf16", - "surrogate", - "astral" - ] -} diff --git a/base/code-point-at/test/test.js b/base/code-point-at/test/test.js deleted file mode 100644 index 461d752a..00000000 --- a/base/code-point-at/test/test.js +++ /dev/null @@ -1,68 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var codePointAt = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof codePointAt, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the arity of the function is 3', function test( t ) { - t.strictEqual( codePointAt.length, 3, 'has length 3' ); - t.end(); -}); - -tape( 'the function returns the code point at a specified string position', function test( t ) { - var out; - - out = codePointAt( 'last man standing', 4, false ); - t.strictEqual( out, 0x20, 'returns expected value' ); - - out = codePointAt( 'last man standing', -13, false ); - t.strictEqual( out, 0x20, 'returns expected value' ); - - out = codePointAt( 'presidential election', 8, true ); - t.strictEqual( out, 0x74, 'returns expected value' ); - - out = codePointAt( 'presidential election', -13, true ); - t.strictEqual( out, 0x74, 'returns expected value' ); - - out = codePointAt( 'अनुच्छेद', 2, false ); - t.strictEqual( out, 0x941, 'returns expected value' ); - - out = codePointAt( 'अनुच्छेद', -6, false ); - t.strictEqual( out, 0x941, 'returns expected value' ); - - out = codePointAt( '🌷', 0, true ); - t.strictEqual( out, 0x1F337, 'returns expected value' ); - - out = codePointAt( '🌷', -2, true ); - t.strictEqual( out, 0x1F337, 'returns expected value' ); - - t.end(); -}); diff --git a/base/concat/README.md b/base/concat/README.md deleted file mode 100644 index b3132b2d..00000000 --- a/base/concat/README.md +++ /dev/null @@ -1,95 +0,0 @@ - - -# concat - -> Concatenate two strings. - -
- -
- - - -
- -## Usage - -```javascript -var concat = require( '@stdlib/string/base/concat' ); -``` - -#### concat( str1, str2 ) - -Concatenates two strings. - -```javascript -var out = concat( 'beep', 'boop' ); -// returns 'beepboop' -``` - -
- - - -
- -## Examples - - - -```javascript -var concat = require( '@stdlib/string/base/concat' ); - -var str = concat( 'beep', 'boop' ); -// returns 'beepboop' - -str = concat( 'foo', 'bar' ); -// returns 'foobar' - -str = concat( 'hello', 'world' ); -// returns 'helloworld' - -str = concat( '', 'abc' ); -// returns 'abc' - -str = concat( '123', '' ); -// returns '123' -``` - -
- - - - - - - - - - - - - - diff --git a/base/concat/benchmark/benchmark.js b/base/concat/benchmark/benchmark.js deleted file mode 100644 index 34fb22e4..00000000 --- a/base/concat/benchmark/benchmark.js +++ /dev/null @@ -1,78 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var concat = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values1; - var values2; - var out; - var i; - - values1 = [ 'BEEP', 'FOO', 'HELLO' ]; - values2 = [ 'BOOP', 'BAR', 'WORLD' ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = concat( values1[ i%values1.length ], values2[ i%values2.length ] ); // eslint-disable-line max-len - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::builtin', pkg ), function benchmark( b ) { - var values1; - var values2; - var out; - var i; - - values1 = [ 'BEEP', 'FOO', 'HELLO' ]; - values2 = [ 'BOOP', 'BAR', 'WORLD' ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = values1[ i%values1.length ].concat( values2[ i%values2.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/concat/docs/repl.txt b/base/concat/docs/repl.txt deleted file mode 100644 index 92bb4560..00000000 --- a/base/concat/docs/repl.txt +++ /dev/null @@ -1,24 +0,0 @@ - -{{alias}}( str1, str2 ) - Concatenates two strings. - - Parameters - ---------- - str1: string - First input string. - - str2: string - Second input string. - - Returns - ------- - out: string - Concatenated string. - - Examples - -------- - > var out = {{alias}}( 'beep', 'boop' ) - 'beepboop' - - See Also - -------- diff --git a/base/concat/docs/types/index.d.ts b/base/concat/docs/types/index.d.ts deleted file mode 100644 index 9e291dab..00000000 --- a/base/concat/docs/types/index.d.ts +++ /dev/null @@ -1,37 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Concatenates two strings. -* -* @param str1 - first string -* @param str2 - second string -* @returns concatenated string -* -* @example -* var out = concat( 'beep', 'boop' ); -* // returns 'beepboop' -*/ -declare function concat( str1: S1, str2: S2 ): `${S1}${S2}`; - - -// EXPORTS // - -export = concat; diff --git a/base/concat/docs/types/test.ts b/base/concat/docs/types/test.ts deleted file mode 100644 index d7beea4c..00000000 --- a/base/concat/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import concat = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - concat( 'beep', 'boop' ); // $ExpectType "beepboop" - concat( 'foo', 'bar' ); // $ExpectType "foobar" - concat( 'abc' as string, 'xyz' as string ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - concat( true, 'boop' ); // $ExpectError - concat( null, 'boop' ); // $ExpectError - concat( undefined, 'boop' ); // $ExpectError - concat( 123, 'boop' ); // $ExpectError - concat( {}, 'boop' ); // $ExpectError - concat( [], 'boop' ); // $ExpectError - concat( ( x: number ): number => x, 'boop' ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a string... -{ - concat( 'beep', true ); // $ExpectError - concat( 'beep', null ); // $ExpectError - concat( 'beep', undefined ); // $ExpectError - concat( 'beep', 123 ); // $ExpectError - concat( 'beep', {} ); // $ExpectError - concat( 'beep', [] ); // $ExpectError - concat( 'beep', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - concat(); // $ExpectError - concat( 'beep' ); // $ExpectError -} diff --git a/base/concat/examples/index.js b/base/concat/examples/index.js deleted file mode 100644 index 96c9151d..00000000 --- a/base/concat/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var concat = require( './../lib' ); - -var str = concat( 'beep', 'boop' ); -console.log( str ); -// => 'beepboop' - -str = concat( 'foo', 'bar' ); -console.log( str ); -// => 'foobar' - -str = concat( 'Hello, ', 'world!' ); -console.log( str ); -// => 'Hello, world!' - -str = concat( '', 'empty' ); -console.log( str ); -// => 'empty' - -str = concat( 'test', '' ); -console.log( str ); -// => 'test' diff --git a/base/concat/lib/index.js b/base/concat/lib/index.js deleted file mode 100644 index 6707d888..00000000 --- a/base/concat/lib/index.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Concatenate two strings. -* -* @module @stdlib/string/base/concat -* -* @example -* var concat = require( '@stdlib/string/base/concat' ); -* -* var str = concat( 'beep', 'boop' ); -* // returns 'beepboop' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/concat/lib/main.js b/base/concat/lib/main.js deleted file mode 100644 index 1e4c9e30..00000000 --- a/base/concat/lib/main.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Concatenates two strings. -* -* @param {string} str1 - first string -* @param {string} str2 - second string -* @returns {string} concatenated string -* -* @example -* var str = concat( 'beep', 'boop' ); -* // returns 'beepboop' -*/ -function concat( str1, str2 ) { - return str1 + str2; -} - - -// EXPORTS // - -module.exports = concat; diff --git a/base/concat/package.json b/base/concat/package.json deleted file mode 100644 index f40f3955..00000000 --- a/base/concat/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/concat", - "version": "0.0.0", - "description": "Concatenate two strings.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "concat", - "concatenate", - "join", - "combine", - "string", - "str" - ] -} diff --git a/base/concat/test/test.js b/base/concat/test/test.js deleted file mode 100644 index 0a59ec74..00000000 --- a/base/concat/test/test.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var concat = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof concat, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function concatenates two strings', function test( t ) { - var expected; - var values; - var actual; - var i; - - values = [ - [ 'beep', 'boop' ], - [ 'foo', 'bar' ], - [ 'Hello, ', 'World!' ], - [ '', 'empty' ], - [ 'non-empty', '' ], - [ '', '' ] - ]; - expected = [ - 'beepboop', - 'foobar', - 'Hello, World!', - 'empty', - 'non-empty', - '' - ]; - for ( i = 0; i < values.length; i++ ) { - actual = concat( values[i][0], values[i][1] ); - t.strictEqual( actual, expected[i], 'returns expected value' ); - } - t.end(); -}); diff --git a/base/constantcase/README.md b/base/constantcase/README.md deleted file mode 100644 index aa750d22..00000000 --- a/base/constantcase/README.md +++ /dev/null @@ -1,123 +0,0 @@ - - -# constantcase - -> Convert a string to constant case. - - - -
- -## Usage - -```javascript -var constantcase = require( '@stdlib/string/base/constantcase' ); -``` - -#### constantcase( str ) - -Converts a string to constant case. - -```javascript -var str = constantcase( 'foo bar' ); -// returns 'FOO_BAR' - -str = constantcase( 'foo bar baz' ); -// returns 'FOO_BAR_BAZ' - -str = constantcase( 'foo_bar' ); -// returns 'FOO_BAR' -``` - -
- - - - - -
- -## Examples - -```javascript -var constantcase = require( '@stdlib/string/base/constantcase' ); - -var str = 'Hello World!'; -var out = constantcase( str ); -// returns 'HELLO_WORLD' - -str = 'I am a tiny little teapot'; -out = constantcase( str ); -// returns 'I_AM_A_TINY_LITTLE_TEAPOT' - -str = 'with big problems'; -out = constantcase( str ); -// returns 'WITH_BIG_PROBLEMS' - -str = 'To be, or not to be: that is the question.'; -out = constantcase( str ); -// returns 'TO_BE_OR_NOT_TO_BE_THAT_IS_THE_QUESTION' - -str = 'isMobile'; -out = constantcase( str ); -// returns 'IS_MOBILE' -``` - -
- - - - - - - - - - - - - - diff --git a/base/constantcase/benchmark/benchmark.js b/base/constantcase/benchmark/benchmark.js deleted file mode 100644 index da9c1b35..00000000 --- a/base/constantcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var constantcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = constantcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/constantcase/docs/repl.txt b/base/constantcase/docs/repl.txt deleted file mode 100644 index 6e510074..00000000 --- a/base/constantcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to constant case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Constant-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'HELLO_WORLD' - > out = {{alias}}( 'I am a tiny little teapot' ) - 'I_AM_A_TINY_LITTLE_TEAPOT' - - See Also - -------- diff --git a/base/constantcase/docs/types/index.d.ts b/base/constantcase/docs/types/index.d.ts deleted file mode 100644 index 74190023..00000000 --- a/base/constantcase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to constant case. -* -* @param str - string to convert -* @returns constant-cased string -* -* @example -* var str = constantcase( 'beep' ); -* // returns 'BEEP' -* -* @example -* var str = constantcase( 'beep boop' ); -* // returns 'BEEP_BOOP' -* -* @example -* var str = constantcase( 'Hello World!' ); -* // returns 'HELLO_WORLD' -*/ -declare function constantcase( str: string ): string; - - -// EXPORTS // - -export = constantcase; diff --git a/base/constantcase/docs/types/test.ts b/base/constantcase/docs/types/test.ts deleted file mode 100644 index 38d595a5..00000000 --- a/base/constantcase/docs/types/test.ts +++ /dev/null @@ -1,44 +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. -*/ - -import constantcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - constantcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - constantcase( true ); // $ExpectError - constantcase( false ); // $ExpectError - constantcase( null ); // $ExpectError - constantcase( undefined ); // $ExpectError - constantcase( 5 ); // $ExpectError - constantcase( [] ); // $ExpectError - constantcase( {} ); // $ExpectError - constantcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - constantcase(); // $ExpectError -} diff --git a/base/constantcase/examples/index.js b/base/constantcase/examples/index.js deleted file mode 100644 index b5b3b9ba..00000000 --- a/base/constantcase/examples/index.js +++ /dev/null @@ -1,46 +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. -*/ - -'use strict'; - -var constantcase = require( './../lib' ); - -var str = 'Hello World!'; -var out = constantcase( str ); -console.log( out ); -// => 'HELLO_WORLD' - -str = 'I am a tiny little teapot'; -out = constantcase( str ); -console.log( out ); -// => 'I_AM_A_TINY_LITTLE_TEAPOT' - -str = 'with big problems'; -out = constantcase( str ); -console.log( out ); -// => 'WITH_BIG_PROBLEMS' - -str = 'To be, or not to be: that is the question.'; -out = constantcase( str ); -console.log( out ); -// => 'TO_BE_OR_NOT_TO_BE_THAT_IS_THE_QUESTION' - -str = 'isMobile'; -out = constantcase( str ); -console.log( out ); -// => 'IS_MOBILE' diff --git a/base/constantcase/lib/index.js b/base/constantcase/lib/index.js deleted file mode 100644 index 0966f42f..00000000 --- a/base/constantcase/lib/index.js +++ /dev/null @@ -1,47 +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. -*/ - -'use strict'; - -/** -* Convert a string to constant case. -* -* @module @stdlib/string/base/constantcase -* -* @example -* var constantcase = require( '@stdlib/string/base/constantcase' ); -* -* var str = constantcase( 'aBcDeF' ); -* // returns 'ABCDEF' -* -* str = constantcase( 'Hello World!' ); -* // returns 'HELLO_WORLD' -* -* str = constantcase( 'I am a robot' ); -* // returns 'I_AM_A_ROBOT' -*/ - - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/constantcase/lib/main.js b/base/constantcase/lib/main.js deleted file mode 100644 index 2d461a11..00000000 --- a/base/constantcase/lib/main.js +++ /dev/null @@ -1,70 +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. -*/ - -'use strict'; - -// MODULES // - -var uppercase = require( './../../../base/uppercase' ); -var replace = require( './../../../base/replace' ); -var trim = require( './../../../base/trim' ); - - -// VARIABLES // - -var RE_WHITESPACE = /\s+/g; -var RE_SPECIAL = /[\-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape -var RE_CAMEL = /([a-z0-9])([A-Z])/g; - - -// MAIN // - -/** -* Converts a string to constant case. -* -* @param {string} str - string to convert -* @returns {string} constant-cased string -* -* @example -* var str = constantcase( 'beep' ); -* // returns 'BEEP' -* -* @example -* var str = constantcase( 'beep boop' ); -* // returns 'BEEP_BOOP' -* -* @example -* var str = constantcase( 'isMobile' ); -* // returns 'IS_MOBILE' -* -* @example -* var str = constantcase( 'Hello World!' ); -* // returns 'HELLO_WORLD' -*/ -function constantcase( str ) { - str = replace( str, RE_SPECIAL, ' ' ); - str = replace( str, RE_CAMEL, '$1 $2' ); - str = trim( str ); - str = replace( str, RE_WHITESPACE, '_' ); - return uppercase( str ); -} - - -// EXPORTS // - -module.exports = constantcase; diff --git a/base/constantcase/package.json b/base/constantcase/package.json deleted file mode 100644 index 2b3514bf..00000000 --- a/base/constantcase/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/constantcase", - "version": "0.0.0", - "description": "Convert a string to constant case.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "case", - "constant", - "convert" - ], - "__stdlib__": {} -} diff --git a/base/constantcase/test/test.js b/base/constantcase/test/test.js deleted file mode 100644 index 02baf02d..00000000 --- a/base/constantcase/test/test.js +++ /dev/null @@ -1,194 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var constantcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof constantcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a camel case string to a constant case string', function test( t ) { - var expected; - var actual; - - expected = 'CAMEL_CASE'; - actual = constantcase( 'camelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IS_MOBILE'; - actual = constantcase( 'isMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function converts a string to constant case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'Hello World', - 'I am tiny little tea pot', - 'Big problems', - 'The quick brown fox jumps over the lazy dog' - ]; - - expected = [ - 'HELLO_WORLD', - 'I_AM_TINY_LITTLE_TEA_POT', - 'BIG_PROBLEMS', - 'THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( constantcase( values[i] ), expected[i], 'returns expected value.' ); - } - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to constant case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'Привет мир', - 'Я маленькая лошадка', - 'Большие проблемы', - 'Быстрый коричневый фонд', - 'Café esuna bella', - 'fóoBár', - '😀😀-😀', - '신규 서비스' - ]; - - expected = [ - 'ПРИВЕТ_МИР', - 'Я_МАЛЕНЬКАЯ_ЛОШАДКА', - 'БОЛЬШИЕ_ПРОБЛЕМЫ', - 'БЫСТРЫЙ_КОРИЧНЕВЫЙ_ФОНД', - 'CAFÉ_ESUNA_BELLA', - 'FÓO_BÁR', - '😀😀_😀', - '신규_서비스' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( constantcase( values[i] ), expected[i], 'returns expected value.' ); - } - t.end(); -}); - -tape( 'the function converts a string with special characters to constant case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo-bar', - 'foo!bar', - 'foo@bar', - 'foo#bar', - 'foo$bar', - 'foo%bar', - 'foo^bar', - 'foo&bar', - 'foo*bar', - 'foo(bar', - 'foo)bar', - 'foo[bar', - 'foo]bar', - 'foo{bar', - 'foo}bar', - 'foo|bar', - 'foo~bar', - 'foo:"bar', - 'foo\'bar', - 'foobar', - 'foo?bar', - 'foo/bar' - ]; - - expected = [ - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR', - 'FOO_BAR' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( constantcase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function leaves a string that is already in constant case unchanged', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'CAMEL_CASE', - 'IS_MOBILE', - 'THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG' - ]; - - expected = [ - 'CAMEL_CASE', - 'IS_MOBILE', - 'THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( constantcase( values[i] ), expected[i], 'returns expected value.' ); - } - t.end(); -}); diff --git a/base/distances/README.md b/base/distances/README.md deleted file mode 100644 index 778203fc..00000000 --- a/base/distances/README.md +++ /dev/null @@ -1,109 +0,0 @@ - - -# Distances - -> Implementations of various string similarity metrics. - -
- -## Usage - -```javascript -var distances = require( '@stdlib/string/base/distances' ); -``` - -#### distances - -Namespace containing "distances", i.e, implementations of various string similarity metrics. - -```javascript -var ns = distances; -// returns {...} -``` - -The namespace contains the following functions: - - - -
- -- [`hammingDistance( s1, s2 )`][@stdlib/string/base/distances/hamming]: calculate the Hamming distance between two equal-length strings. -- [`levenshteinDistance( s1, s2 )`][@stdlib/string/base/distances/levenshtein]: calculate the Levenshtein (edit) distance between two strings. - -
- - - -
- - - - - -
- -
- - - -
- -## Examples - - - - - -```javascript -var ns = require( '@stdlib/string/base/distances' ); - -// Calculate the edit distance between two input strings... -var dist = ns.levenshteinDistance( 'algorithm', 'altruistic' ); -// returns 6 -``` - -
- - - - - - - - - - - - - - diff --git a/base/distances/docs/types/index.d.ts b/base/distances/docs/types/index.d.ts deleted file mode 100644 index c62a4a85..00000000 --- a/base/distances/docs/types/index.d.ts +++ /dev/null @@ -1,85 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/* eslint-disable max-lines */ - -import hammingDistance = require( './../../../../base/distances/hamming' ); -import levenshteinDistance = require( './../../../../base/distances/levenshtein' ); - -/** -* Interface describing the `distances` namespace. -*/ -interface Namespace { - /** - * Calculates the Hamming distance between two equal-length strings. - * - * ## Notes - * - * - The function returns a sentinel value of `-1` if the input string lengths differ. - * - * @param str1 - first input string - * @param str2 - second input string - * @returns Hamming distance - * - * @example - * var dist = ns.hammingDistance( 'fly', 'ant' ); - * // returns 3 - * - * @example - * var dist = ns.hammingDistance( 'algorithms', 'altruistic' ); - * // returns 7 - * - * @example - * var dist = ns.hammingDistance( 'hippopod', 'elephant' ); - * // returns 7 - */ - hammingDistance: typeof hammingDistance; - - /** - * Calculates the Levenshtein (edit) distance between two strings. - * - * @param str1 - first string value - * @param str2 - second string value - * @returns Levenshtein distance - * - * @example - * var dist = ns.levenshteinDistance( 'fly', 'ant' ); - * // returns 3 - * - * @example - * var dist = ns.levenshteinDistance( 'algorithm', 'altruistic' ); - * // returns 6 - * - * @example - * var dist = ns.levenshteinDistance( 'hippo', 'elephant' ); - * // returns 7 - */ - levenshteinDistance: typeof levenshteinDistance; -} - -/** -* Implementations of various string similarity metrics. -*/ -declare var ns: Namespace; - - -// EXPORTS // - -export = ns; diff --git a/base/distances/docs/types/test.ts b/base/distances/docs/types/test.ts deleted file mode 100644 index 25f373d6..00000000 --- a/base/distances/docs/types/test.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 ns = require( './index' ); - - -// TESTS // - -// The exported value is the expected interface... -{ - ns; // $ExpectType Namespace -} diff --git a/base/distances/examples/index.js b/base/distances/examples/index.js deleted file mode 100644 index 0f26e079..00000000 --- a/base/distances/examples/index.js +++ /dev/null @@ -1,26 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 ns = require( './../lib' ); - -// Calculates the Levenshtein (edit) distance between two input strings... -var dist = ns.levenshteinDistance( 'algorithm', 'altruistic' ); -console.log( dist ); -// => 6 diff --git a/base/distances/hamming/README.md b/base/distances/hamming/README.md deleted file mode 100644 index 450cd58d..00000000 --- a/base/distances/hamming/README.md +++ /dev/null @@ -1,115 +0,0 @@ - - -# hammingDistance - -> Calculate the [Hamming distance][hamming-distance] between two equal-length strings. - - - -
- -## Usage - -```javascript -var hammingDistance = require( '@stdlib/string/base/distances/hamming' ); -``` - -#### hammingDistance( s1, s2 ) - -Calculates the [Hamming distance][hamming-distance] between two equal-length strings. - -```javascript -var dist = hammingDistance( 'frog', 'from' ); -// returns 1 - -dist = hammingDistance( 'tooth', 'froth' ); -// returns 2 - -dist = hammingDistance( 'cat', 'cot' ); -// returns 1 - -dist = hammingDistance( '', '' ); -// returns 0 - -dist = hammingDistance( '1638452297', '2311638451' ); -// returns 10 -``` - -
- - - - - -
- -## Notes - -- If the two strings differ in length, the [Hamming distance][hamming-distance] is not defined. Consequently, when provided two input strings of unequal length, the function returns a sentinel value of `-1`. -- As the function calculates the [Hamming distance][hamming-distance] by comparing UTF-16 code units, the function should behave as expected for strings composed of most characters. However, the function is likely to not behave as expected if strings contain visual characters composed of multiple Unicode code points, such as certain mathematical symbols and grapheme clusters (e.g., emojis). - -
- - - - - -
- -## Examples - -```javascript -var hammingDistance = require( '@stdlib/string/base/distances/hamming' ); - -var dist = hammingDistance( 'algorithms', 'altruistic' ); -// returns 7 - -dist = hammingDistance( 'elephant', 'Tashkent' ); -// returns 6 - -dist = hammingDistance( 'javascript', 'typescript' ); -// returns 4 - -dist = hammingDistance( 'hamming', 'ladybug' ); -// returns 5 -``` - -
- - - - - - - - - - - - - - diff --git a/base/distances/hamming/benchmark/benchmark.js b/base/distances/hamming/benchmark/benchmark.js deleted file mode 100644 index dc278005..00000000 --- a/base/distances/hamming/benchmark/benchmark.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pkg = require( './../package.json' ).name; -var hammingDistance = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var value; - var out; - var i; - - values = [ - [ 'algorithms', 'altruistic' ], - [ '1638452297', '4444884447' ], - [ '', '' ], - [ 'z', 'a' ], - [ 'aaappppk', 'aardvark' ], - [ 'frog', 'flog' ], - [ 'fly', 'ant' ], - [ 'elephant', 'hippopod' ], - [ 'hippopod', 'elephant' ], - [ 'hippo', 'zzzzz' ], - [ 'hello', 'hallo' ], - [ 'congratulations', 'conmgeautlatins' ] - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - value = values[ i%values.length ]; - out = hammingDistance( value[0], value[1] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/distances/hamming/docs/repl.txt b/base/distances/hamming/docs/repl.txt deleted file mode 100644 index b637ddb4..00000000 --- a/base/distances/hamming/docs/repl.txt +++ /dev/null @@ -1,36 +0,0 @@ - -{{alias}}( s1, s2 ) - Calculates the Hamming distance between two equal-length input strings. - - The function returns a sentinel value of -1 if the input string lengths - differ. - - Parameters - ---------- - s1: string - First input string. - - s2: string - Second input string. - - Returns - ------- - out: number - Hamming distance. - - Examples - -------- - > var d = {{alias}}( 'algorithms', 'altruistic' ) - 7 - > d = {{alias}}( 'elephant', 'hippopod' ) - 7 - > d = {{alias}}( 'javascript', 'typescript' ) - 4 - > d = {{alias}}( 'levenshtein', 'levitations' ) - 8 - > d = {{alias}}( 'sacrifice', 'paradisal' ) - 8 - - See Also - -------- - diff --git a/base/distances/hamming/docs/types/index.d.ts b/base/distances/hamming/docs/types/index.d.ts deleted file mode 100644 index 094bb1ac..00000000 --- a/base/distances/hamming/docs/types/index.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Calculates the Hamming distance between two equal-length strings. -* -* ## Notes -* -* - The function returns a sentinel value of `-1` if the input string lengths differ. -* -* @param str1 - first input string -* @param str2 - second input string -* @returns Hamming distance -* -* @example -* var dist = hammingDistance( 'fly', 'ant' ); -* // returns 3 -* -* @example -* var dist = hammingDistance( 'algorithms', 'altruistic' ); -* // returns 7 -* -* @example -* var dist = hammingDistance( 'hippopod', 'elephant' ); -* // returns 7 -*/ -declare function hammingDistance( str1: string, str2: string ): number; - - -// EXPORTS // - -export = hammingDistance; diff --git a/base/distances/hamming/docs/types/test.ts b/base/distances/hamming/docs/types/test.ts deleted file mode 100644 index 45905bc3..00000000 --- a/base/distances/hamming/docs/types/test.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import hammingDistance = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - hammingDistance( '', '' ); // $ExpectType number -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - hammingDistance( true, '' ); // $ExpectError - hammingDistance( false, '' ); // $ExpectError - hammingDistance( null, '' ); // $ExpectError - hammingDistance( undefined, '' ); // $ExpectError - hammingDistance( 5, '' ); // $ExpectError - hammingDistance( [], '' ); // $ExpectError - hammingDistance( {}, '' ); // $ExpectError - hammingDistance( ( x: number ): number => x, '' ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a string... -{ - hammingDistance( '', true ); // $ExpectError - hammingDistance( '', false ); // $ExpectError - hammingDistance( '', null ); // $ExpectError - hammingDistance( '', undefined ); // $ExpectError - hammingDistance( '', 5 ); // $ExpectError - hammingDistance( '', [] ); // $ExpectError - hammingDistance( '', {} ); // $ExpectError - hammingDistance( '', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - hammingDistance(); // $ExpectError - hammingDistance( '' ); // $ExpectError - hammingDistance( '', '', 3 ); // $ExpectError -} diff --git a/base/distances/hamming/examples/index.js b/base/distances/hamming/examples/index.js deleted file mode 100644 index bd2f7a3e..00000000 --- a/base/distances/hamming/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var hammingDistance = require( './../lib' ); - -console.log( hammingDistance( 'algorithms', 'altruistic' ) ); -// => 7 - -console.log( hammingDistance( 'elephant', 'hippopod' ) ); -// => 7 - -console.log( hammingDistance( 'javascript', 'typescript' ) ); -// => 4 - -console.log( hammingDistance( 'hamming', 'hamster' ) ); -// => 4 - -console.log( hammingDistance( 'a', 'abcissa' ) ); -// => -1 diff --git a/base/distances/hamming/lib/index.js b/base/distances/hamming/lib/index.js deleted file mode 100644 index 9b723ebc..00000000 --- a/base/distances/hamming/lib/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Calculate the Hamming distance between two equal-length strings. -* -* @module @stdlib/string/base/distances/hamming -* -* @example -* var hammingDistance = require( '@stdlib/string/base/distances/hamming' ); -* -* var dist = hammingDistance( 'fly', 'ant' ); -* // returns 3 -* -* dist = hammingDistance( 'frog', 'blog' ); -* // returns 2 -* -* dist = hammingDistance( 'javascript', 'typescript' ); -* // returns 4 -*/ - - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/distances/hamming/lib/main.js b/base/distances/hamming/lib/main.js deleted file mode 100644 index 5da9dbaa..00000000 --- a/base/distances/hamming/lib/main.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../../format' ); - - -// MAIN // - -/** -* Calculates the Hamming distance between two equal-length strings. -* -* ## Notes -* -* - The function returns a sentinel value of `-1` if the input string lengths differ. -* -* @param {string} s1 - first input string -* @param {string} s2 - second input string -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a string -* @returns {integer} Hamming distance -* -* @example -* var distance = hammingDistance( 'algorithm', 'altruistic' ); -* // returns -1 -*/ -function hammingDistance( s1, s2 ) { - var out; - var i; - - if ( !isString( s1 ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', s1 ) ); - } - if ( !isString( s2 ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', s2 ) ); - } - if ( s1.length !== s2.length ) { - return -1; - } - out = 0; - for ( i = 0; i < s1.length; i++ ) { - if (s1[ i ] !== s2[ i ] ) { - out += 1; - } - } - return out; -} - - -// EXPORTS // - -module.exports = hammingDistance; diff --git a/base/distances/hamming/package.json b/base/distances/hamming/package.json deleted file mode 100644 index 05996b10..00000000 --- a/base/distances/hamming/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/distances/hamming", - "version": "0.0.0", - "description": "Calculate the Hamming distance between two equal-length strings.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "distances", - "distance", - "hamming", - "edit" - ], - "__stdlib__": {} -} diff --git a/base/distances/hamming/test/test.js b/base/distances/hamming/test/test.js deleted file mode 100644 index c7c1dff4..00000000 --- a/base/distances/hamming/test/test.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 tape = require( 'tape' ); -var hammingDistance = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof hammingDistance, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string as its first argument', function test( t ) { - var values; - var i; - - 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() { - hammingDistance( value, 'foo' ); - }; - } -}); - -tape( 'the function throws an error if not provided a string as its second argument', function test( t ) { - var values; - var i; - - 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() { - hammingDistance( 'foo', value ); - }; - } -}); - -tape( 'the function returns -1 as a sentinel value if provided strings of unequal length', function test( t ) { - t.strictEqual( hammingDistance( 'length', 'differs' ), -1, 'returns expected value' ); - t.end(); -}); - -tape( 'the function calculates the Hamming distance between two equal-length strings', function test( t ) { - var expected; - var values; - var i; - - values = [ - [ '1638452297', '4444884442' ], // 10 - [ '', '' ], // 0 - [ 'a', 'a' ], // 0 - [ 'a', 'b' ], // 1 - [ 'xy', 'xy' ], // 0 - [ 'xx', 'xy' ], // 1 - [ 'frog', 'blog' ], // 2 - [ 'fly', 'ant' ], // 3 - [ 'hello', 'hallo' ], // 1 - [ 'congratulations', 'conmgeautlatins' ] // 9 - ]; - - expected = [ 10, 0, 0, 1, 0, 1, 2, 3, 1, 9 ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( hammingDistance( values[i][0], values[i][1] ), expected[i], 'returns expected value' ); - } - t.end(); -}); diff --git a/base/distances/levenshtein/README.md b/base/distances/levenshtein/README.md deleted file mode 100644 index 84376b17..00000000 --- a/base/distances/levenshtein/README.md +++ /dev/null @@ -1,102 +0,0 @@ - - -# levenshteinDistance - -> Calculate the [Levenshtein][levenshtein] (edit) distance between two strings. - - - -
- -## Usage - -```javascript -var levenshteinDistance = require( '@stdlib/string/base/distances/levenshtein' ); -``` - -#### levenshteinDistance( s1, s2 ) - -Calculates the [Levenshtein][levenshtein] (edit) distance between two strings. - -```javascript -var dist = levenshteinDistance( 'frog', 'from' ); -// returns 1 - -dist = levenshteinDistance( 'frog', 'froth' ); -// returns 2 - -dist = levenshteinDistance( 'cat', 'kitty' ); -// returns 4 - -dist = levenshteinDistance( '', 'abcdef' ); -// returns 6 - -dist = levenshteinDistance( '1638452297', '2311638451' ); -// returns 7 -``` - -
- - - - - -
- -## Examples - -```javascript -var levenshteinDistance = require( '@stdlib/string/base/distances/levenshtein' ); - -var dist = levenshteinDistance( 'algorithm', 'altruistic' ); -// returns 6 - -dist = levenshteinDistance( 'elephant', 'hippo' ); -// returns 7 - -dist = levenshteinDistance( 'javascript', 'typescript' ); -// returns 4 - -dist = levenshteinDistance( 'levenshtein', 'leviathan' ); -// returns 6 -``` - -
- - - - - - - - - - - - - - diff --git a/base/distances/levenshtein/benchmark/benchmark.js b/base/distances/levenshtein/benchmark/benchmark.js deleted file mode 100644 index 63f34ca1..00000000 --- a/base/distances/levenshtein/benchmark/benchmark.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var pkg = require( './../package.json' ).name; -var levenshteinDistance = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var value; - var out; - var i; - - values = [ - [ 'algorithm', 'altruistic' ], - [ '1638452297', '444488444' ], - [ '', '' ], - [ '', 'a' ], - [ 'aaapppp', '' ], - [ 'frog', 'fog' ], - [ 'fly', 'ant' ], - [ 'elephant', 'hippo' ], - [ 'hippo', 'elephant' ], - [ 'hippo', 'zzzzzzzz' ], - [ 'hello', 'hallo' ], - [ 'congratulations', 'conmgeautlatins' ] - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - value = values[ i%values.length ]; - out = levenshteinDistance( value[0], value[1] ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/distances/levenshtein/docs/repl.txt b/base/distances/levenshtein/docs/repl.txt deleted file mode 100644 index df2fbc7a..00000000 --- a/base/distances/levenshtein/docs/repl.txt +++ /dev/null @@ -1,33 +0,0 @@ - -{{alias}}( s1, s2 ) - Calculates the Levenshtein (edit) distance between two input strings. - - Parameters - ---------- - s1: string - First input string. - - s2: string - Second input string. - - Returns - ------- - dist: number - Levenshtein (edit) distance between two strings. - - Examples - -------- - > var dist = {{alias}}( 'algorithm', 'altruistic' ) - 6 - > dist = {{alias}}( 'elephant', 'hippo' ) - 7 - > dist = {{alias}}( 'javascript', 'typescript' ) - 4 - > dist = {{alias}}( 'levenshtein', 'leviathan' ) - 6 - > dist = {{alias}}( 'sacrifice', 'paradise' ) - 5 - - See Also - -------- - diff --git a/base/distances/levenshtein/docs/types/index.d.ts b/base/distances/levenshtein/docs/types/index.d.ts deleted file mode 100644 index 1cc7ec52..00000000 --- a/base/distances/levenshtein/docs/types/index.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Calculates the Levenshtein (edit) distance between two strings. -* -* @param str1 - first string value -* @param str2 - second string value -* @returns Levenshtein distance -* -* @example -* var dist = levenshteinDistance( 'fly', 'ant' ); -* // returns 3 -* -* @example -* var dist = levenshteinDistance( 'algorithm', 'altruistic' ); -* // returns 6 -* -* @example -* var dist = levenshteinDistance( 'hippo', 'elephant' ); -* // returns 7 -*/ -declare function levenshteinDistance( str1: string, str2: string ): number; - - -// EXPORTS // - -export = levenshteinDistance; diff --git a/base/distances/levenshtein/docs/types/test.ts b/base/distances/levenshtein/docs/types/test.ts deleted file mode 100644 index 3606e620..00000000 --- a/base/distances/levenshtein/docs/types/test.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import levenshteinDistance = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - levenshteinDistance( '', '' ); // $ExpectType number -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - levenshteinDistance( true, '' ); // $ExpectError - levenshteinDistance( false, '' ); // $ExpectError - levenshteinDistance( null, '' ); // $ExpectError - levenshteinDistance( undefined, '' ); // $ExpectError - levenshteinDistance( 5, '' ); // $ExpectError - levenshteinDistance( [], '' ); // $ExpectError - levenshteinDistance( {}, '' ); // $ExpectError - levenshteinDistance( ( x: number ): number => x, '' ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a string... -{ - levenshteinDistance( '', true ); // $ExpectError - levenshteinDistance( '', false ); // $ExpectError - levenshteinDistance( '', null ); // $ExpectError - levenshteinDistance( '', undefined ); // $ExpectError - levenshteinDistance( '', 5 ); // $ExpectError - levenshteinDistance( '', [] ); // $ExpectError - levenshteinDistance( '', {} ); // $ExpectError - levenshteinDistance( '', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - levenshteinDistance(); // $ExpectError - levenshteinDistance( '' ); // $ExpectError - levenshteinDistance( '', '', 3 ); // $ExpectError -} diff --git a/base/distances/levenshtein/examples/index.js b/base/distances/levenshtein/examples/index.js deleted file mode 100644 index 0cc15d8f..00000000 --- a/base/distances/levenshtein/examples/index.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'; - -var levenshteinDistance = require( './../lib' ); - -console.log( levenshteinDistance( 'algorithm', 'altruistic' ) ); -// => 6 - -console.log( levenshteinDistance( 'elephant', 'hippo' ) ); -// => 7 - -console.log( levenshteinDistance( 'javascript', 'typescript' ) ); -// => 4 - -console.log( levenshteinDistance( 'levenshtein', 'leviathan' ) ); -// => 6 diff --git a/base/distances/levenshtein/lib/index.js b/base/distances/levenshtein/lib/index.js deleted file mode 100644 index d5c33a0d..00000000 --- a/base/distances/levenshtein/lib/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Calculate the Levenshtein (edit) distance between two strings. -* -* @module @stdlib/string/base/distances/levenshtein -* -* @example -* var levenshteinDistance = require( '@stdlib/string/base/distances/levenshtein' ); -* -* var dist = levenshteinDistance( 'fly', 'ant' ); -* // returns 3 -* -* dist = levenshteinDistance( 'frog', 'fog' ); -* // returns 1 -* -* dist = levenshteinDistance( 'javascript', 'typescript' ); -* // returns 4 -*/ - - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/distances/levenshtein/lib/main.js b/base/distances/levenshtein/lib/main.js deleted file mode 100644 index 557c2d2c..00000000 --- a/base/distances/levenshtein/lib/main.js +++ /dev/null @@ -1,95 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../../format' ); -var min = require( '@stdlib/math/base/special/min' ); - - -// MAIN // - -/** -* Calculates the Levenshtein (edit) distance between two strings. -* -* @param {string} s1 - first string value -* @param {string} s2 - second string value -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a string -* @returns {NonNegativeInteger} Levenshtein distance -* -* @example -* var distance = levenshteinDistance( 'algorithm', 'altruistic' ); -* // returns 6 -*/ -function levenshteinDistance( s1, s2 ) { - var temp; - var row; - var pre; - var m; - var n; - var i; - var j; - var k; - - if ( !isString( s1 ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', s1 ) ); - } - if ( !isString( s2 ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', s2 ) ); - } - n = s1.length; - m = s2.length; - - // If either string is empty, the edit distance is equal to the number of characters in the non-empty string... - if ( n === 0 ) { - return m; - } - if ( m === 0 ) { - return n; - } - - row = []; - for ( i = 0; i <= m; i++ ) { - row.push( i ); - } - - for ( i = 0; i < n; i++ ) { - pre = row[ 0 ]; - row[ 0 ] = i + 1; - for ( j = 0; j < m; j++ ) { - k = j + 1; - temp = row[ k ]; - if ( s1[ i ] === s2[ j ] ) { - row[ k ] = pre; - } else { - row[ k ] = min( pre, min( row[ j ], row[ k ] ) ) + 1; - } - pre = temp; - } - } - return row[ m ]; -} - - -// EXPORTS // - -module.exports = levenshteinDistance; diff --git a/base/distances/levenshtein/package.json b/base/distances/levenshtein/package.json deleted file mode 100644 index b0ac7f5c..00000000 --- a/base/distances/levenshtein/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/distances/levenshtein", - "version": "0.0.0", - "description": "Calculate the Levenshtein (edit) distance between two strings.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "distances", - "distance", - "levenshtein", - "edit" - ], - "__stdlib__": {} -} diff --git a/base/distances/levenshtein/test/test.js b/base/distances/levenshtein/test/test.js deleted file mode 100644 index e4ab43ee..00000000 --- a/base/distances/levenshtein/test/test.js +++ /dev/null @@ -1,139 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 levenshteinDistance = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof levenshteinDistance, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string as its first argument', function test( t ) { - var values; - var i; - - 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() { - levenshteinDistance( value, 'dummy' ); - }; - } -}); - -tape( 'the function throws an error if not provided a string as its second argument', function test( t ) { - var values; - var i; - - 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() { - levenshteinDistance( 'dummy', value ); - }; - } -}); - -tape( 'the function calculates the Levenshtein (edit) distance between two strings', function test( t ) { - var expected; - var values; - var i; - - values = [ - [ 'algorithm', 'altruistic' ], - [ '1638452297', '444488444' ], - [ '', '' ], - [ '', 'a' ], - [ 'aaapppp', '' ], - [ 'frog', 'fog' ], - [ 'fly', 'ant' ], - [ 'elephant', 'hippo' ], - [ 'hippo', 'elephant' ], - [ 'hippo', 'zzzzzzzz' ], - [ 'hello', 'hallo' ], - [ 'congratulations', 'conmgeautlatins' ] - ]; - - expected = [ 6, 9, 0, 1, 7, 1, 3, 7, 7, 8, 1, 5 ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( levenshteinDistance( values[i][0], values[i][1] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function calculates the Levenshtein (edit) distance between two strings with Unicode characters', function test( t ) { - var expected; - var values; - var i; - - values = [ - [ 'fóoBár', 'fóo' ], - [ 'Привет', 'теи' ], - [ '_Світ-прекрасний', 'прекрасний' ], - [ '🤨🥹', '🥹' ], - [ 'हिंदी', 'தமிழ்' ], - [ '𝄞', '\uD834\uDD1E' ] - ]; - - expected = [ 3, 5, 6, 2, 5, 0 ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( levenshteinDistance( values[i][0], values[i][1] ), expected[i], 'returns expected value' ); - } - t.end(); -}); diff --git a/base/distances/lib/index.js b/base/distances/lib/index.js deleted file mode 100644 index 2822cd09..00000000 --- a/base/distances/lib/index.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/* -* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); - - -// MAIN // - -/** -* Top-level namespace. -* -* @namespace ns -*/ -var ns = {}; - -/** -* @name hammingDistance -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/distances/hamming} -*/ -setReadOnly( ns, 'hammingDistance', require( './../../../base/distances/hamming' ) ); - -/** -* @name levenshteinDistance -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/distances/levenshtein} -*/ -setReadOnly( ns, 'levenshteinDistance', require( './../../../base/distances/levenshtein' ) ); - - -// EXPORTS // - -module.exports = ns; diff --git a/base/distances/package.json b/base/distances/package.json deleted file mode 100644 index 47eb5517..00000000 --- a/base/distances/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/distances", - "version": "0.0.0", - "description": "Implementations of various string similarity metrics.", - "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": { - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "standard", - "library", - "std", - "lib", - "string", - "characters", - "text", - "manipulation", - "utilities", - "similarity", - "distances", - "util", - "utility", - "metrics" - ] -} diff --git a/base/distances/test/test.js b/base/distances/test/test.js deleted file mode 100644 index 3849d6be..00000000 --- a/base/distances/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var ns = require( './../lib' ); - - -// TESTS // - -tape( 'main export is an object', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ns, 'object', 'main export is an object' ); - t.end(); -}); - -tape( 'the exported object contains various implementations of string similarity metrics', function test( t ) { - var keys = objectKeys( ns ); - t.strictEqual( keys.length > 0, true, 'has keys' ); - t.end(); -}); diff --git a/base/docs/types/index.d.ts b/base/docs/types/index.d.ts deleted file mode 100644 index e3fa404a..00000000 --- a/base/docs/types/index.d.ts +++ /dev/null @@ -1,1544 +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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable max-lines */ - -import altcase = require( './../../../base/altcase' ); -import atob = require( './../../../base/atob' ); -import base64ToUint8Array = require( './../../../base/base64-to-uint8array' ); -import camelcase = require( './../../../base/camelcase' ); -import capitalize = require( './../../../base/capitalize' ); -import codePointAt = require( './../../../base/code-point-at' ); -import constantcase = require( './../../../base/constantcase' ); -import distances = require( './../../../base/distances' ); -import dotcase = require( './../../../base/dotcase' ); -import endsWith = require( './../../../base/ends-with' ); -import first = require( './../../../base/first' ); -import firstCodePoint = require( './../../../base/first-code-point' ); -import firstGraphemeCluster = require( './../../../base/first-grapheme-cluster' ); -import forEach = require( './../../../base/for-each' ); -import forEachCodePoint = require( './../../../base/for-each-code-point' ); -import forEachCodePointRight = require( './../../../base/for-each-code-point-right' ); -import forEachGraphemeCluster = require( './../../../base/for-each-grapheme-cluster' ); -import forEachRight = require( './../../../base/for-each-right' ); -import formatInterpolate = require( './../../../base/format-interpolate' ); -import formatTokenize = require( './../../../base/format-tokenize' ); -import headercase = require( './../../../base/headercase' ); -import invcase = require( './../../../base/invcase' ); -import kebabcase = require( './../../../base/kebabcase' ); -import last = require( './../../../base/last' ); -import lastCodePoint = require( './../../../base/last-code-point' ); -import lastGraphemeCluster = require( './../../../base/last-grapheme-cluster' ); -import lpad = require( './../../../base/left-pad' ); -import ltrim = require( './../../../base/left-trim' ); -import lowercase = require( './../../../base/lowercase' ); -import pascalcase = require( './../../../base/pascalcase' ); -import percentEncode = require( './../../../base/percent-encode' ); -import removeFirst = require( './../../../base/remove-first' ); -import removeFirstCodePoint = require( './../../../base/remove-first-code-point' ); -import removeFirstGraphemeCluster = require( './../../../base/remove-first-grapheme-cluster' ); -import removeLast = require( './../../../base/remove-last' ); -import removeLastCodePoint = require( './../../../base/remove-last-code-point' ); -import removeLastGraphemeCluster = require( './../../../base/remove-last-grapheme-cluster' ); -import repeat = require( './../../../base/repeat' ); -import replace = require( './../../../base/replace' ); -import replaceAfter = require( './../../../base/replace-after' ); -import replaceAfterLast = require( './../../../base/replace-after-last' ); -import replaceBefore = require( './../../../base/replace-before' ); -import replaceBeforeLast = require( './../../../base/replace-before-last' ); -import reverse = require( './../../../base/reverse' ); -import reverseCodePoints = require( './../../../base/reverse-code-points' ); -import reverseGraphemeClusters = require( './../../../base/reverse-grapheme-clusters' ); -import rpad = require( './../../../base/right-pad' ); -import rtrim = require( './../../../base/right-trim' ); -import slice = require( './../../../base/slice' ); -import sliceCodePoints = require( './../../../base/slice-code-points' ); -import sliceGraphemeClusters = require( './../../../base/slice-grapheme-clusters' ); -import snakecase = require( './../../../base/snakecase' ); -import startcase = require( './../../../base/startcase' ); -import startsWith = require( './../../../base/starts-with' ); -import stickycase = require( './../../../base/stickycase' ); -import trim = require( './../../../base/trim' ); -import truncateMiddle = require( './../../../base/truncate-middle' ); -import uncapitalize = require( './../../../base/uncapitalize' ); -import uppercase = require( './../../../base/uppercase' ); - -/** -* Interface describing the `base` namespace. -*/ -interface Namespace { - /** - * Converts a string to alternate case. - * - * @param str - string to convert - * @returns alternate-cased string - * - * @example - * var str = ns.altcase( 'beep' ); - * // returns 'bEeP' - * - * @example - * var str = ns.altcase( 'beep boop' ); - * // returns 'bEeP BoOp' - * - * @example - * var str = ns.altcase( 'Hello World!' ); - * // returns 'hElLo wOrLd!' - */ - altcase: typeof altcase; - - /** - * Decodes a string of data which has been encoded using Base64 encoding. - * - * @param str - binary string containing base64-encoded data - * @returns an ASCII string containing decoded data - * - * @example - * var out = ns.atob( 'SGVsbG8sIHdvcmxk' ); - * // returns 'Hello, world' - */ - atob: typeof atob; - - /** - * Converts a base64-encoded string to a Uint8Array. - * - * ## Notes - * - * - If provided a string containing non-ASCII characters, the function returns `null`. - * - * @param str - base64-encoded string - * @returns output array - * - * @example - * var string2buffer = require( '@stdlib/buffer/from-string' ); - * - * var str = string2buffer( 'Hello World!' ).toString( 'base64' ); - * // returns 'SGVsbG8gV29ybGQh' - * - * var out = ns.base64ToUint8Array( str ); - * // returns [ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ] - */ - base64ToUint8Array: typeof base64ToUint8Array; - - /** - * Converts a string to camel case. - * - * @param str - string to convert - * @returns camel-cased string - * - * @example - * var str = ns.camelcase( 'Hello World!' ); - * // returns 'helloWorld' - * - * @example - * var str = ns.camelcase( 'foo_bar' ); - * // returns 'fooBar' - * - * @example - * var str = ns.camelcase( 'foo-bar' ); - * // returns 'fooBar' - */ - camelcase: typeof camelcase; - - /** - * Capitalizes the first character in a string. - * - * @param str - input string - * @returns capitalized string - * - * @example - * var out = ns.capitalize( 'last man standing' ); - * // returns 'Last man standing' - * - * @example - * var out = ns.capitalize( 'presidential election' ); - * // returns 'Presidential election' - * - * @example - * var out = ns.capitalize( 'javaScript' ); - * // returns 'JavaScript' - * - * @example - * var out = ns.capitalize( 'Hidden Treasures' ); - * // returns 'Hidden Treasures' - */ - capitalize: typeof capitalize; - - /** - * Returns a Unicode code point from a string at specified position. - * - * @param str - input string - * @param idx - position - * @param backward - backward iteration for low surrogates - * @returns code point - * - * @example - * var str = ns.codePointAt( 'अनुच्छेद', 2, false ); - * // returns 2369 - * - * str = ns.codePointAt( '🌷', 1, true ); - * // returns 127799 - */ - codePointAt: typeof codePointAt; - - /** - * Converts a string to constant case. - * - * @param str - string to convert - * @returns constant-cased string - * - * @example - * var str = ns.constantcase( 'beep' ); - * // returns 'BEEP' - * - * @example - * var str = ns.constantcase( 'beep boop' ); - * // returns 'BEEP_BOOP' - * - * @example - * var str = ns.constantcase( 'Hello World!' ); - * // returns 'HELLO_WORLD' - */ - constantcase: typeof constantcase; - - /** - * Implementations of various string similarity metrics. - */ - distances: typeof distances; - - /** - * Converts a string to dot case. - * - * @param str - string to convert - * @returns dot-cased string - * - * @example - * var str = ns.dotcase( 'beepBoop' ); - * // returns 'beep.boop' - * - * @example - * var str = ns.dotcase( 'beep boop' ); - * // returns 'beep.boop' - * - * @example - * var str = ns.dotcase( 'Hello World!' ); - * // returns 'hello.world' - */ - dotcase: typeof dotcase; - - /** - * Tests if a string ends with the characters of another string. - * - * ## Notes - * - * - The last parameter restricts the search to a substring within the input string beginning from the leftmost character. If provided a negative value, `len` indicates to ignore the last `len` characters, and is thus equivalent to `str.length + len`. - * - * @param str - input string - * @param search - search string - * @param len - substring length - * @returns boolean indicating if the input string ends with the search string - * - * @example - * var bool = ns.endsWith( 'To be, or not to be, that is the question.', 'to be', 19 ); - * // returns true - * - * @example - * var bool = ns.endsWith( 'To be, or not to be, that is the question.', 'to be', -23 ); - * // returns true - */ - endsWith: typeof endsWith; - - /** - * Returns the first `n` UTF-16 code units of a string. - * - * @param str - input string - * @param n - number of code units to return - * @returns output string - * - * @example - * var out = ns.first( 'last man standing', 1 ); - * // returns 'l' - * - * @example - * var out = ns.first( 'presidential election', 1 ); - * // returns 'p' - * - * @example - * var out = ns.first( 'JavaScript', 1 ); - * // returns 'J' - * - * @example - * var out = ns.first( 'Hidden Treasures', 1 ); - * // returns 'H' - * - * @example - * var out = ns.first( 'foo bar', 5 ); - * // returns 'foo b' - */ - first: typeof first; - - /** - * Returns the first `n` Unicode code points of a string. - * - * @param str - input string - * @param n - number of code points to return - * @returns output string - * - * @example - * var out = ns.firstCodePoint( 'last man standing', 1 ); - * // returns 'l' - * - * @example - * var out = ns.firstCodePoint( 'presidential election', 1 ); - * // returns 'p' - * - * @example - * var out = ns.firstCodePoint( 'JavaScript', 1 ); - * // returns 'J' - * - * @example - * var out = ns.firstCodePoint( 'Hidden Treasures', 1 ); - * // returns 'H' - * - * @example - * var out = ns.firstCodePoint( 'foo bar', 5 ); - * // returns 'foo b' - */ - firstCodePoint: typeof firstCodePoint; - - /** - * Returns the first `n` grapheme clusters (i.e., user-perceived characters) of a string. - * - * @param str - input string - * @param n - number of grapheme clusters to return - * @returns output string - * - * @example - * var out = ns.firstGraphemeCluster( 'last man standing', 1 ); - * // returns 'l' - * - * @example - * var out = ns.firstGraphemeCluster( 'presidential election', 1 ); - * // returns 'p' - * - * @example - * var out = ns.firstGraphemeCluster( 'JavaScript', 1 ); - * // returns 'J' - * - * @example - * var out = ns.firstGraphemeCluster( 'Hidden Treasures', 1 ); - * // returns 'H' - * - * @example - * var out = ns.firstGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ); - * // returns '🐶🐮' - * - * @example - * var out = ns.firstGraphemeCluster( 'foo bar', 5 ); - * // returns 'foo b' - */ - firstGraphemeCluster: typeof firstGraphemeCluster; - - /** - * Invokes a function for each UTF-16 code unit in a string. - * - * ## Notes - * - * - When invoked, the provided function is provided three arguments: - * - * - **value**: character. - * - **index**: character index. - * - **str**: input string. - * - * @param str - input string - * @param clbk - function to invoke - * @param thisArg - execution context - * @returns input string - * - * @example - * function log( value, index ) { - * console.log( '%d: %s', index, value ); - * } - * - * ns.forEach( 'Hello, World!', log ); - */ - forEach: typeof forEach; - - /** - * Invokes a function for each Unicode code point in a string. - * - * ## Notes - * - * - When invoked, the provided function is provided three arguments: - * - * - **value**: code point. - * - **index**: starting code point index. - * - **str**: input string. - * - * @param str - input string - * @param clbk - function to invoke - * @param thisArg - execution context - * @returns input string - * - * @example - * function log( value, index ) { - * console.log( '%d: %s', index, value ); - * } - * - * ns.forEachCodePoint( 'Hello, World!', log ); - */ - forEachCodePoint: typeof forEachCodePoint; - - /** - * Invokes a function for each Unicode code point in a string, iterating from right to left. - * - * ## Notes - * - * - When invoked, the provided function is provided three arguments: - * - * - **value**: code point. - * - **index**: starting code point index. - * - **str**: input string. - * - * @param str - input string - * @param clbk - function to invoke - * @param thisArg - execution context - * @returns input string - * - * @example - * function log( value, index ) { - * console.log( '%d: %s', index, value ); - * } - * - * ns.forEachCodePointRight( 'Hello, World!', log ); - */ - forEachCodePointRight: typeof forEachCodePointRight; - - /** - * Invokes a function for each grapheme cluster (i.e., user-perceived character) in a string. - * - * ## Notes - * - * - When invoked, the provided function is provided three arguments: - * - * - **value**: grapheme cluster. - * - **index**: starting grapheme cluster index. - * - **str**: input string. - * - * @param str - input string - * @param clbk - function to invoke - * @param thisArg - execution context - * @returns input string - * - * @example - * function log( value, index ) { - * console.log( '%d: %s', index, value ); - * } - * - * ns.forEachGraphemeCluster( 'Hello, World!', log ); - */ - forEachGraphemeCluster: typeof forEachGraphemeCluster; - - /** - * Invokes a function for each UTF-16 code unit in a string, iterating from right to left. - * - * ## Notes - * - * - When invoked, the provided function is provided three arguments: - * - * - **value**: character. - * - **index**: character index. - * - **str**: input string. - * - * @param str - input string - * @param clbk - function to invoke - * @param thisArg - execution context - * @returns input string - * - * @example - * function log( value, index ) { - * console.log( '%d: %s', index, value ); - * } - * - * ns.forEachRight( 'Hello, World!', log ); - */ - forEachRight: typeof forEachRight; - - /** - * Generates string from a token array by interpolating values. - * - * @param tokens - string parts and format identifier objects - * @param args - variable values - * @throws invalid flags - * @returns formatted string - * - * @example - * var tokens = [ 'beep ', { 'specifier': 's' } ]; - * var out = ns.formatInterpolate( tokens, 'boop' ); - * // returns 'beep boop' - */ - formatInterpolate: typeof formatInterpolate; - - /** - * Tokenizes a string into an array of string parts and format identifier objects. - * - * @param str - input string - * @returns tokens - * - * @example - * var tokens = ns.formatTokenize( 'Hello %s!' ); - * // returns [ 'Hello ', {...}, '!' ] - */ - formatTokenize: typeof formatTokenize; - - /** - * Converts a string to HTTP header case. - * - * @param str - string to convert - * @returns HTTP header-cased string - * - * @example - * var str = ns.headercase( 'Hello World!' ); - * // returns 'Hello-World' - * - * @example - * var str = ns.headercase( 'foo_bar' ); - * // returns 'Foo-Bar' - * - * @example - * var str = ns.headercase( 'foo-bar' ); - * // returns 'Foo-Bar' - */ - headercase: typeof headercase; - - /** - * Converts a string to inverse case. - * - * @param str - string to convert - * @returns inverse-cased string - * - * @example - * var str = ns.invcase( 'FOO bar' ); - * // returns 'foo BAR' - * - * @example - * var str = ns.invcase( 'beep' ); - * // returns 'BEEP' - * - * @example - * var str = ns.invcase( 'beep boop' ); - * // returns 'BEEP BOOP' - * - * @example - * var str = ns.invcase( 'Hello World!' ); - * // returns 'hELLO wORLD!' - */ - invcase: typeof invcase; - - /** - * Converts a string to kebab case. - * - * @param str - string to convert - * @returns kebab-cased string - * - * @example - * var str = ns.kebabcase( 'fooBar' ); - * // returns 'foo-bar' - * - * @example - * var str = ns.kebabcase( 'foo_bar' ); - * // returns 'foo-bar' - * - * @example - * var str = ns.kebabcase( 'foo-bar' ); - * // returns 'foo-bar' - */ - kebabcase: typeof kebabcase; - - /** - * Returns the last `n` UTF-16 code units of a string. - * - * @param str - input string - * @param n - number of code units to return - * @returns output string - * - * @example - * var s = ns.last( 'hello world', 1 ); - * // returns 'd' - * - * @example - * var s = ns.last( 'foo', 2 ); - * // returns 'oo' - * - * @example - * var s = ns.last( 'JavaScript', 6 ); - * // returns 'Script' - * - * @example - * var s = ns.last( 'foo bar', 10 ); - * // returns 'foo bar' - */ - last: typeof last; - - /** - * Returns the last `n` Unicode code points of a string. - * - * @param str - input string - * @param n - number of code points to return - * @returns output string - * - * @example - * var out = ns.lastCodePoint( 'Hello World', 1 ); - * // returns 'd' - * - * @example - * var out = ns.lastCodePoint( 'JavaScript', 6 ); - * // returns 'Script' - * - * @example - * var out = ns.lastCodePoint( 'New', 5 ); - * // returns 'New' - * - * @example - * var out = ns.lastCodePoint( 'अनुच्छेद', 1 ); - * // returns 'द' - */ - lastCodePoint: typeof lastCodePoint; - - /** - * Returns the last `n` grapheme clusters (i.e., user-perceived characters) of a string. - * - * @param str - input string - * @param n - number of grapheme clusters to return - * @returns output string - * - * @example - * var out = ns.lastGraphemeCluster( 'Hello World', 1 ); - * // returns 'd' - * - * @example - * var out = ns.lastGraphemeCluster( 'Evening', 3 ); - * // returns 'ing' - * - * @example - * var out = ns.lastGraphemeCluster( 'JavaScript', 6 ); - * // returns 'Script' - * - * @example - * var out = ns.lastGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ); - * // returns '🐰🐸' - * - * @example - * var out = ns.lastGraphemeCluster( 'foo bar', 5 ); - * // returns 'o bar' - */ - lastGraphemeCluster: typeof lastGraphemeCluster; - - /** - * Left pads a string such that the padded string has a length of at least `len`. - * - * ## Notes - * - * - An output string is not guaranteed to have a length of exactly `len`, but to have a length of at least `len`. To generate a padded string having a length equal to `len`, post-process a padded string by trimming off excess characters. - * - * @param str - string to pad - * @param len - minimum string length - * @param pad - string used to pad - * @returns padded string - * - * @example - * var str = ns.lpad( 'a', 5, ' ' ); - * // returns ' a' - * - * @example - * var str = ns.lpad( 'beep', 10, 'b' ); - * // returns 'bbbbbbbeep' - * - * @example - * var str = ns.lpad( 'boop', 12, 'beep' ); - * // returns 'beepbeepboop' - */ - lpad: typeof lpad; - - /** - * Trims whitespace characters from the beginning of a string. - * - * @param str - input string - * @returns trimmed string - * - * @example - * var out = ns.ltrim( ' Whitespace ' ); - * // returns 'Whitespace ' - * - * @example - * var out = ns.ltrim( '\t\t\tTabs\t\t\t' ); - * // returns 'Tabs\t\t\t' - * - * @example - * var out = ns.ltrim( '\n\n\nNew Lines\n\n\n' ); - * // returns 'New Lines\n\n\n' - */ - ltrim: typeof ltrim; - - /** - * Converts a string to lowercase. - * - * @param str - string to convert - * @returns lowercase string - * - * @example - * var str = ns.lowercase( 'bEEp' ); - * // returns 'beep' - */ - lowercase: typeof lowercase; - - /** - * Converts a string to Pascal case. - * - * @param str - string to convert - * @returns Pascal-cased string - * - * @example - * var str = ns.pascalcase( 'Hello World!' ); - * // returns 'HelloWorld' - * - * @example - * var str = ns.pascalcase( 'foo_bar' ); - * // returns 'FooBar' - * - * @example - * var str = ns.pascalcase( 'foo-bar' ); - * // returns 'FooBar' - */ - pascalcase: typeof pascalcase; - - /** - * Percent-encodes a UTF-16 encoded string according to [RFC 3986][1]. - * - * [1]: https://tools.ietf.org/html/rfc3986#section-2.1 - * - * @param str - string to percent-encode - * @returns percent-encoded string - * - * @example - * var str1 = 'Ladies + Gentlemen'; - * - * var str2 = ns.percentEncode( str1 ); - * // returns 'Ladies%20%2B%20Gentlemen' - */ - percentEncode: typeof percentEncode; - - /** - * Removes the first `n` UTF-16 code units of a string. - * - * @param str - input string - * @param n - number of code units to remove - * @returns output string - * - * @example - * var out = ns.removeFirst( 'last man standing', 1 ); - * // returns 'ast man standing' - * - * @example - * var out = ns.removeFirst( 'presidential election', 1 ); - * // returns 'residential election' - * - * @example - * var out = ns.removeFirst( 'JavaScript', 1 ); - * // returns 'avaScript' - * - * @example - * var out = ns.removeFirst( 'Hidden Treasures', 1 ); - * // returns 'idden Treasures' - * - * @example - * var out = ns.removeFirst( 'foo bar', 5 ); - * // returns 'ar' - */ - removeFirst: typeof removeFirst; - - /** - * Removes the first `n` Unicode code points of a string. - * - * @param str - input string - * @param n - number of code points to remove - * @returns output string - * - * @example - * var out = ns.removeFirstCodePoint( 'last man standing', 1 ); - * // returns 'ast man standing' - * - * @example - * var out = ns.removeFirstCodePoint( 'presidential election', 1 ); - * // returns 'residential election' - * - * @example - * var out = ns.removeFirstCodePoint( 'JavaScript', 1 ); - * // returns 'avaScript' - * - * @example - * var out = ns.removeFirstCodePoint( 'Hidden Treasures', 1 ); - * // returns 'idden Treasures' - * - * @example - * var out = ns.removeFirstCodePoint( 'foo bar', 5 ); - * // returns 'ar' - */ - removeFirstCodePoint: typeof removeFirstCodePoint; - - /** - * Removes the first `n` grapheme clusters (i.e., user-perceived characters) of a string. - * - * @param str - input string - * @param n - number of grapheme clusters to remove - * @returns output string - * - * @example - * var out = ns.removeFirstGraphemeCluster( 'last man standing', 1 ); - * // returns 'ast man standing' - * - * @example - * var out = ns.removeFirstGraphemeCluster( 'presidential election', 1 ); - * // returns 'residential election' - * - * @example - * var out = ns.removeFirstGraphemeCluster( 'JavaScript', 1 ); - * // returns 'avaScript' - * - * @example - * var out = ns.removeFirstGraphemeCluster( 'Hidden Treasures', 1 ); - * // returns 'idden Treasures' - * - * @example - * var out = ns.removeFirstGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ); - * // returns '🐷🐰🐸' - * - * @example - * var out = ns.removeFirstGraphemeCluster( 'foo bar', 5 ); - * // returns 'ar' - */ - removeFirstGraphemeCluster: typeof removeFirstGraphemeCluster; - - /** - * Removes the last `n` UTF-16 code units of a string. - * - * @param str - input string - * @param n - number of code units to remove - * @returns output string - * - * @example - * var out = ns.removeLast( 'last man standing', 1 ); - * // returns 'last man standin' - * - * @example - * var out = ns.removeLast( 'presidential election', 1 ); - * // returns 'presidential electio' - * - * @example - * var out = ns.removeLast( 'JavaScript', 1 ); - * // returns 'JavaScrip' - * - * @example - * var out = ns.removeLast( 'Hidden Treasures', 1 ); - * // returns 'Hidden Treasure' - * - * @example - * var out = ns.removeLast( 'foo bar', 5 ); - * // returns 'fo' - */ - removeLast: typeof removeLast; - - /** - * Removes the last `n` Unicode code points of a string. - * - * @param str - input string - * @param n - number of code points to remove - * @returns output string - * - * @example - * var out = ns.removeLastCodePoint( 'last man standing', 1 ); - * // returns 'last man standin' - * - * @example - * var out = ns.removeLastCodePoint( 'presidential election', 1 ); - * // returns 'presidential electio' - * - * @example - * var out = ns.removeLastCodePoint( 'JavaScript', 1 ); - * // returns 'JavaScrip' - * - * @example - * var out = ns.removeLastCodePoint( 'Hidden Treasures', 1 ); - * // returns 'Hidden Treasure' - * - * @example - * var out = ns.removeLastCodePoint( 'foo bar', 5 ); - * // returns 'fo' - */ - removeLastCodePoint: typeof removeLastCodePoint; - - /** - * Removes the last `n` grapheme clusters (i.e., user-perceived characters) of a string. - * - * @param str - input string - * @param n - number of grapheme clusters to remove - * @returns output string - * - * @example - * var out = ns.removeLastGraphemeCluster( 'last man standing', 1 ); - * // returns 'last man standin' - * - * @example - * var out = ns.removeLastGraphemeCluster( 'presidential election', 1 ); - * // returns 'presidential electio' - * - * @example - * var out = ns.removeLastGraphemeCluster( 'JavaScript', 1 ); - * // returns 'JavaScrip' - * - * @example - * var out = ns.removeLastGraphemeCluster( 'Hidden Treasures', 1 ); - * // returns 'Hidden Treasure' - * - * @example - * var out = ns.removeLastGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ); - * // returns '🐶🐮🐷' - * - * @example - * var out = ns.removeLastGraphemeCluster( 'foo bar', 5 ); - * // returns 'fo' - */ - removeLastGraphemeCluster: typeof removeLastGraphemeCluster; - - /** - * Repeats a string `n` times and returns the concatenated result. - * - * @param str - string to repeat - * @param n - number of times to repeat the string - * @returns repeated string - * - * @example - * var str = ns.repeat( 'a', 5 ); - * // returns 'aaaaa' - * - * @example - * var str = ns.repeat( '', 100 ); - * // returns '' - * - * @example - * var str = ns.repeat( 'beep', 0 ); - * // returns '' - */ - repeat: typeof repeat; - - /** - * Replaces search occurrences with a replacement string. - * - * @param str - input string - * @param search - search expression - * @param newval - replacement value or function - * @returns new string containing replacement(s) - * - * @example - * var str = 'Hello World'; - * var out = ns.replace( str, /world/i, 'Mr. President' ); - * // returns 'Hello Mr. President' - * - * @example - * var capitalize = require( './../../../base/capitalize' ); - * - * var str = 'Oranges and lemons say the bells of St. Clement\'s'; - * - * function replacer( match, p1 ) { - * return capitalize( p1 ); - * } - * - * var out = ns.replace( str, /([^\s]*)/gi, replacer ); - * // returns 'Oranges And Lemons Say The Bells Of St. Clement\'s' - */ - replace: typeof replace; - - /** - * Replaces the substring after the first occurrence of a specified search string. - * - * ## Notes - * - * - If unable to find search string, the function returns the input string unchanged. - * - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. - * - * @param str - input string - * @param search - search string - * @param replacement - replacement string - * @param fromIndex - index at which to start the search - * @returns output string - * - * @example - * var out = ns.replaceAfter( 'beep boop', ' ', 'foo', 0 ); - * // returns 'beep foo' - * - * @example - * var out = ns.replaceAfter( 'beep boop', 'p', 'foo', 5 ); - * // returns 'beep boopfoo' - * - * @example - * var out = ns.replaceAfter( 'Hello World!', '', 'foo', 0 ); - * // returns 'Hello World!' - * - * @example - * var out = ns.replaceAfter( 'Hello World!', 'xyz', 'foo', 0 ); - * // returns 'Hello World!' - * - * @example - * var out = ns.replaceAfter( 'beep boop', ' ', 'foo' , 5 ); - * // returns 'beep boop' - * - * @example - * var out = ns.replaceAfter( 'beep boop beep baz', 'beep', 'foo' , 5 ); - * // returns 'beep boop beepfoo' - */ - replaceAfter: typeof replaceAfter; - - /** - * Replaces the substring after the last occurrence of a specified search string. - * - * ## Notes - * - * - The function scans a provided string from the starting index to the beginning of the string (i.e., backward). - * - If unable to find search string, the function returns the input string unchanged. - * - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. - * - * @param str - input string - * @param search - search string - * @param replacement - replacement string - * @param fromIndex - index from which to start searching - * @returns output string - * - * @example - * var str = 'beep boop'; - * var out = ns.replaceAfterLast( str, ' ', 'foo', str.length ); - * // returns 'beep foo' - * - * @example - * var str = 'beep boop'; - * var out = ns.replaceAfterLast( str, 'p', 'foo', str.length ); - * // returns 'beep boopfoo' - * - * @example - * var str = 'Hello World!'; - * var out = ns.replaceAfterLast( str, '', 'foo', str.length ); - * // returns 'Hello World!' - * - * @example - * var str = 'Hello World!'; - * var out = ns.replaceAfterLast( str, 'xyz', 'foo', str.length ); - * // returns 'Hello World!' - * - * @example - * var str = 'beep boop baz'; - * var out = ns.replaceAfterLast( str, 'p b', 'foo', str.length ); - * // returns 'beep boop bfoo' - * - * @example - * var str = 'beep boop baz'; - * var out = ns.replaceAfterLast( str, 'p b', 'foo', 6 ); - * // returns 'beep bfoo' - */ - replaceAfterLast: typeof replaceAfterLast; - - /** - * Replaces the substring before the first occurrence of a specified search string. - * - * ## Notes - * - * - If unable to find search string, the function returns the input string unchanged. - * - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. - * - * @param str - input string - * @param search - search string - * @param replacement - replacement string - * @param fromIndex - index at which to start the search - * @returns output string - * - * @example - * var out = ns.replaceBefore( 'beep boop', ' ', 'foo', 0 ); - * // returns 'foo boop' - * - * @example - * var out = ns.replaceBefore( 'beep boop', 'p', 'foo', 5 ); - * // returns 'foop' - * - * @example - * var out = ns.replaceBefore( 'Hello World!', '', 'foo', 0 ); - * // returns 'Hello World!' - * - * @example - * var out = ns.replaceBefore( 'Hello World!', 'xyz', 'foo', 0 ); - * // returns 'Hello World!' - */ - replaceBefore: typeof replaceBefore; - - /** - * Replaces the substring before the last occurrence of a specified search string. - * - * ## Notes - * - * - The function scans a provided string from the starting index to the beginning of the string (i.e., backward). - * - If unable to find search string, the function returns the input string unchanged. - * - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. - * - * @param str - input string - * @param search - search string - * @param replacement - replacement string - * @param fromIndex - index from which to start searching - * @returns output string - * - * @example - * var str = 'beep boop'; - * var out = ns.replaceBeforeLast( str, ' ', 'foo', str.length ); - * // returns 'foo boop' - * - * @example - * var str = 'beep boop'; - * var out = ns.replaceBeforeLast( str, 'p', 'foo', str.length ); - * // returns 'foop' - * - * @example - * var str = 'Hello World!'; - * var out = ns.replaceBeforeLast( str, '', 'foo', str.length ); - * // returns 'Hello World!' - * - * @example - * var str = 'Hello World!'; - * var out = ns.replaceBeforeLast( str, 'xyz', 'foo', str.length ); - * // returns 'Hello World!' - * - * @example - * var str = 'beep boop baz'; - * var out = ns.replaceBeforeLast( str, 'p b', 'foo', str.length ); - * // returns 'foop baz' - * - * @example - * var str = 'beep boop baz'; - * var out = ns.replaceBeforeLast( str, 'p b', 'foo', 6 ); - * // returns 'foop boop baz' - */ - replaceBeforeLast: typeof replaceBeforeLast; - - /** - * Reverses the UTF-16 code units of a string. - * - * @param str - input string - * @returns output string - * - * @example - * var out = ns.reverse( 'last man standing' ); - * // returns 'gnidnats nam tsal' - * - * @example - * var out = ns.reverse( 'presidential election' ); - * // returns 'noitcele laitnediserp' - * - * @example - * var out = ns.reverse( 'JavaScript' ); - * // returns 'tpircSavaJ' - * - * @example - * var out = ns.reverse( 'Hidden Treasures' ); - * // returns 'serusaerT neddiH' - * - * @example - * var out = ns.reverse( 'foo bar' ); - * // returns 'rab oof' - */ - reverse: typeof reverse; - - /** - * Reverses the Unicode code points of a string. - * - * @param str - input string - * @returns output string - * - * @example - * var out = ns.reverseCodePoints( 'last man standing' ); - * // returns 'gnidnats nam tsal' - * - * @example - * var out = ns.reverseCodePoints( 'presidential election' ); - * // returns 'noitcele laitnediserp' - * - * @example - * var out = ns.reverseCodePoints( 'JavaScript' ); - * // returns 'tpircSavaJ' - * - * @example - * var out = ns.reverseCodePoints( 'Hidden Treasures' ); - * // returns 'serusaerT neddiH' - * - * @example - * var out = ns.reverseCodePoints( 'foo bar' ); - * // returns 'rab oof' - */ - reverseCodePoints: typeof reverseCodePoints; - - /** - * Reverses the grapheme clusters (i.e., user-perceived characters) of a string. - * - * @param str - input string - * @returns output string - * - * @example - * var out = ns.reverseGraphemeClusters( 'last man standing' ); - * // returns 'gnidnats nam tsal' - * - * @example - * var out = ns.reverseGraphemeClusters( 'presidential election' ); - * // returns 'noitcele laitnediserp' - * - * @example - * var out = ns.reverseGraphemeClusters( 'JavaScript' ); - * // returns 'tpircSavaJ' - * - * @example - * var out = ns.reverseGraphemeClusters( 'Hidden Treasures' ); - * // returns 'serusaerT neddiH' - * - * @example - * var out = ns.reverseGraphemeClusters( '🐶🐮🐷🐰🐸' ); - * // returns '🐸🐰🐷🐮🐶' - * - * @example - * var out = ns.reverseGraphemeClusters( 'foo bar' ); - * // returns 'rab oof' - */ - reverseGraphemeClusters: typeof reverseGraphemeClusters; - - /** - * Right pads a string such that the padded string has a length of at least `len`. - * - * ## Notes - * - * - An output string is not guaranteed to have a length of exactly `len`, but to have a length of at least `len`. To generate a padded string having a length equal to `len`, post-process a padded string by trimming off excess characters. - * - * @param str - string to pad - * @param len - minimum string length - * @param pad - string used to pad - * @returns padded string - * - * @example - * var str = ns.rpad( 'a', 5, ' ' ); - * // returns 'a ' - * - * @example - * var str = ns.rpad( 'beep', 10, 'b' ); - * // returns 'beepbbbbbb' - * - * @example - * var str = ns.rpad( 'boop', 12, 'beep' ); - * // returns 'boopbeepbeep' - */ - rpad: typeof rpad; - - /** - * Trims whitespace characters from the end of a string. - * - * @param str - input string - * @returns trimmed string - * - * @example - * var out = ns.rtrim( ' Whitespace ' ); - * // returns ' Whitespace' - * - * @example - * var out = ns.rtrim( '\t\t\tTabs\t\t\t' ); - * // returns '\t\t\tTabs' - * - * @example - * var out = ns.rtrim( '\n\n\nNew Lines\n\n\n' ); - * // returns '\n\n\nNew Lines' - */ - rtrim: typeof rtrim; - - /** - * Slices UTF-16 code units from a string. - * - * @param str - input string - * @param start - slice start index (inclusive) - * @param end - slice end index (exclusive) - * @returns output string - * - * @example - * var out = ns.slice( 'last man standing', 1, 17 ); - * // returns 'ast man standing' - * - * @example - * var out = ns.slice( 'presidential election', 1, 21 ); - * // returns 'residential election' - * - * @example - * var out = ns.slice( 'JavaScript', 4, 10 ); - * // returns 'Script' - * - * @example - * var out = ns.slice( 'Hidden Treasures', 0, 6 ); - * // returns 'Hidden' - * - * @example - * var out = ns.slice( 'foo bar', 2, 7 ); - * // returns 'o bar' - * - * @example - * var out = ns.slice( 'foo bar', -1, 7 ); - * // returns 'r' - */ - slice: typeof slice; - - /** - * Slices a string based on Unicode code point indices. - * - * @param str - input string - * @param start - the `ith` Unicode code point to start a slice (inclusive) - * @param end - the `jth` Unicode code point to end a slice (exclusive) - * @returns output string - * - * @example - * var out = ns.sliceCodePoints( 'Hello 👋 World', 1, 3 ); - * // returns 'el' - * - * @example - * var out = ns.sliceCodePoints( '👋👋👋', 1, 2 ); - * // returns '👋' - */ - sliceCodePoints: typeof sliceCodePoints; - - /** - * Slices a string based on grapheme cluster (i.e., user-perceived character) indices. - * - * @param str - input string - * @param start - the `ith` grapheme cluster to start a slice (inclusive) - * @param end - the `jth` grapheme cluster to end a slice (exclusive) - * @returns output string - * - * @example - * var out = ns.sliceGraphemeClusters( 'Hello World', 0, 5 ); - * // returns 'Hello' - * - * out = ns.sliceGraphemeClusters( '👋👋👋', 0, 2 ); - * // returns '👋👋' - * - * out = ns.sliceGraphemeClusters( 'अनुच्छेद', 1, 3 ); - * // returns 'नुच्' - * - * out = ns.sliceGraphemeClusters( 'Hello World', -5, -1 ); - * // returns 'Worl' - */ - sliceGraphemeClusters: typeof sliceGraphemeClusters; - - /** - * Converts a string to snake case. - * - * @param str - string to convert - * @returns snake-cased string - * - * @example - * var str = ns.snakecase( 'fooBar' ); - * // returns 'foo_bar' - * - * @example - * var str = ns.snakecase( 'foo-bar' ); - * // returns 'foo_bar' - * - * @example - * var str = ns.snakecase( 'foo_bar' ); - * // returns 'foo_bar' - */ - snakecase: typeof snakecase; - - /** - * Capitalizes the first letter of each word in an input string. - * - * @param str - string to convert - * @returns start-cased string - * - * @example - * var str = ns.startcase( 'beep boop foo bar' ); - * // returns 'Beep Boop Foo Bar' - */ - startcase: typeof startcase; - - /** - * Tests if a string starts with the characters of another string. - * - * ## Notes - * - * - If provided a negative `position`, the search starting position is resolved relative to the end of the string. For example, if provided the input string `'beep boop'` and a `position` equal to `-2`, the starting position resolves to `7`. - * - * @param str - input string - * @param search - search string - * @param position - position at which to start searching - * @returns boolean indicating if the input string starts with the search string - * - * @example - * var bool = ns.startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember', 0 ); - * // returns true - * - * @example - * var bool = ns.startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember', 0 ); - * // returns false - * - * @example - * var bool = ns.startsWith( 'To be, or not to be, that is the question.', 'To be', 0 ); - * // returns true - * - * @example - * var bool = ns.startsWith( 'To be, or not to be, that is the question.', 'to be', 0 ); - * // returns false - * - * @example - * var bool = ns.startsWith( 'To be, or not to be, that is the question.', 'to be', 14 ); - * // returns true - * - * @example - * var bool = ns.startsWith( 'To be, or not to be, that is the question.', 'quest', -9 ); - * // returns true - */ - startsWith: typeof startsWith; - - /** - * Converts a string to "sticky caps" case. - * - * @param str - input string - * @param p - probability of capitalization (default: 0.5) - * @returns sticky case string - * - * @example - * var str = ns.stickycase( 'hello world' ); - * // returns - * - * @example - * var str = ns.stickycase( 'hello world', 0.2 ); - * // returns - * - * @example - * var str = ns.stickycase( 'hello world', 0.8 ); - * // returns - */ - stickycase: typeof stickycase; - - /** - * Trims whitespace characters from the beginning and end of a string. - * - * @param str - input string - * @returns trimmed string - * - * @example - * var out = ns.trim( ' Whitespace ' ); - * // returns 'Whitespace' - * - * @example - * var out = ns.trim( '\t\t\tTabs\t\t\t' ); - * // returns 'Tabs' - * - * @example - * var out = ns.trim( '\n\n\nNew Lines\n\n\n' ); - * // returns 'New Lines' - */ - trim: typeof trim; - - /** - * Truncates the middle UTF-16 code units of a string to return a string having a specified length. - * - * @param str - input string - * @param len - output string length (including sequence) - * @param seq - custom replacement sequence - * @returns truncated string - * - * @example - * var str = 'beep boop'; - * var out = ns.truncateMiddle( str, 5, '...' ); - * // returns 'b...p' - * - * @example - * var str = 'beep boop'; - * var out = ns.truncateMiddle( str, 5, '>>>' ); - * // returns 'b>>>p' - * - * @example - * var str = 'beep boop'; - * var out = ns.truncateMiddle( str, 10, '...' ); - * // returns 'beep boop' - * - * @example - * var str = 'beep boop'; - * var out = ns.truncateMiddle( str, 0, '...' ); - * // returns '' - * - * @example - * var str = 'beep boop'; - * var out = ns.truncateMiddle( str, 2, '...' ); - * // returns '..' - */ - truncateMiddle: typeof truncateMiddle; - - /** - * Uncapitalizes the first character of a string. - * - * @param str - input string - * @returns input string with first character converted to lowercase - * - * @example - * var out = ns.uncapitalize( 'Last man standing' ); - * // returns 'last man standing' - * - * @example - * var out = ns.uncapitalize( 'Presidential election' ); - * // returns 'presidential election' - * - * @example - * var out = ns.uncapitalize( 'JavaScript' ); - * // returns 'javaScript' - * - * @example - * var out = ns.uncapitalize( 'Hidden Treasures' ); - * // returns 'hidden Treasures' - */ - uncapitalize: typeof uncapitalize; - - /** - * Converts a string to uppercase. - * - * @param str - string to convert - * @returns uppercase string - * - * @example - * var str = ns.uppercase( 'bEEp' ); - * // returns 'BEEP' - */ - uppercase: typeof uppercase; -} - -/** -* Base (i.e., lower-level) string functions. -*/ -declare var ns: Namespace; - - -// EXPORTS // - -export = ns; diff --git a/base/docs/types/test.ts b/base/docs/types/test.ts deleted file mode 100644 index e344b791..00000000 --- a/base/docs/types/test.ts +++ /dev/null @@ -1,29 +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. -*/ - -/* eslint-disable @typescript-eslint/no-unused-expressions */ - -import ns = require( './index' ); - - -// TESTS // - -// The exported value is the expected interface... -{ - ns; // $ExpectType Namespace -} diff --git a/base/dotcase/README.md b/base/dotcase/README.md deleted file mode 100644 index 29973d19..00000000 --- a/base/dotcase/README.md +++ /dev/null @@ -1,123 +0,0 @@ - - -# dotcase - -> Convert a string to dot case. - - - -
- -## Usage - -```javascript -var dotcase = require( '@stdlib/string/base/dotcase' ); -``` - -#### dotcase( str ) - -Converts a string to dot case. - -```javascript -var str = dotcase( 'foo bar' ); -// returns 'foo.bar' - -str = dotcase( 'foo bar baz' ); -// returns 'foo.bar.baz' - -str = dotcase( 'foo_bar' ); -// returns 'foo.bar' -``` - -
- - - - - -
- -## Examples - -```javascript -var dotcase = require( '@stdlib/string/base/dotcase' ); - -var str = 'Hello World!'; -var out = dotcase( str ); -// returns 'hello.world' - -str = 'I am a tiny little teapot'; -out = dotcase( str ); -// returns 'i.am.a.tiny.little.teapot' - -str = 'with big problems'; -out = dotcase( str ); -// returns 'with.big.problems' - -str = 'To be, or not to be: that is the question.'; -out = dotcase( str ); -// returns 'to.be.or.not.to.be.that.is.the.question' - -str = 'isMobile'; -out = dotcase( str ); -// returns 'is.mobile' -``` - -
- - - - - - - - - - - - - - diff --git a/base/dotcase/benchmark/benchmark.js b/base/dotcase/benchmark/benchmark.js deleted file mode 100644 index c20544a4..00000000 --- a/base/dotcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var dotcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = dotcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/dotcase/docs/repl.txt b/base/dotcase/docs/repl.txt deleted file mode 100644 index c09a8262..00000000 --- a/base/dotcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to dot case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Dot-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'hello.world' - > out = {{alias}}( 'I am a tiny little teapot' ) - 'i.am.a.tiny.little.teapot' - - See Also - -------- diff --git a/base/dotcase/docs/types/index.d.ts b/base/dotcase/docs/types/index.d.ts deleted file mode 100644 index f9bed0db..00000000 --- a/base/dotcase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to dot case. -* -* @param str - string to convert -* @returns dot-cased string -* -* @example -* var str = dotcase( 'beepBoop' ); -* // returns 'beep.boop' -* -* @example -* var str = dotcase( 'beep boop' ); -* // returns 'beep.boop' -* -* @example -* var str = dotcase( 'Hello World!' ); -* // returns 'hello.world' -*/ -declare function dotcase( str: string ): string; - - -// EXPORTS // - -export = dotcase; diff --git a/base/dotcase/docs/types/test.ts b/base/dotcase/docs/types/test.ts deleted file mode 100644 index 52409df0..00000000 --- a/base/dotcase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import dotcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - dotcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - dotcase( true ); // $ExpectError - dotcase( false ); // $ExpectError - dotcase( null ); // $ExpectError - dotcase( undefined ); // $ExpectError - dotcase( 5 ); // $ExpectError - dotcase( [] ); // $ExpectError - dotcase( {} ); // $ExpectError - dotcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - dotcase(); // $ExpectError -} diff --git a/base/dotcase/examples/index.js b/base/dotcase/examples/index.js deleted file mode 100644 index 5df73e65..00000000 --- a/base/dotcase/examples/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 dotcase = require( './../lib' ); - -var str = 'Hello World!'; -var out = dotcase( str ); -console.log( out ); -// => 'hello.world' - -str = 'I am a tiny little teapot'; -out = dotcase( str ); -console.log( out ); -// => 'i.am.a.tiny.little.teapot' - -str = 'with big problems'; -out = dotcase( str ); -console.log( out ); -// => 'with.big.problems' - -str = 'To be, or not to be: that is the question.'; -out = dotcase( str ); -console.log( out ); -// => 'to.be.or.not.to.be.that.is.the.question' - -str = 'isMobile'; -out = dotcase( str ); -console.log( out ); -// => 'is.mobile' diff --git a/base/dotcase/lib/index.js b/base/dotcase/lib/index.js deleted file mode 100644 index c216cdfa..00000000 --- a/base/dotcase/lib/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to dot case. -* -* @module @stdlib/string/base/dotcase -* -* @example -* var dotcase = require( '@stdlib/string/base/dotcase' ); -* -* var str = dotcase( 'aBcDeF' ); -* // returns 'abcdef' -* -* str = dotcase( 'Hello World!' ); -* // returns 'hello.world' -* -* str = dotcase( 'I am a robot' ); -* // returns 'i.am.a.robot' -*/ - - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/dotcase/lib/main.js b/base/dotcase/lib/main.js deleted file mode 100644 index bc725517..00000000 --- a/base/dotcase/lib/main.js +++ /dev/null @@ -1,70 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var lowercase = require( './../../../base/lowercase' ); -var replace = require( './../../../base/replace' ); -var trim = require( './../../../base/trim' ); - - -// VARIABLES // - -var RE_WHITESPACE = /\s+/g; -var RE_SPECIAL = /[\-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape -var RE_CAMEL = /([a-z0-9])([A-Z])/g; - - -// MAIN // - -/** -* Converts a string to dot case. -* -* @param {string} str - string to convert -* @returns {string} dot-cased string -* -* @example -* var str = dotcase( 'beep' ); -* // returns 'beep' -* -* @example -* var str = dotcase( 'beep boop' ); -* // returns 'beep.boop' -* -* @example -* var str = dotcase( 'isMobile' ); -* // returns 'is.mobile' -* -* @example -* var str = dotcase( 'Hello World!' ); -* // returns 'hello.world' -*/ -function dotcase( str ) { - str = replace( str, RE_SPECIAL, ' ' ); - str = replace( str, RE_CAMEL, '$1 $2' ); - str = trim( str ); - str = replace( str, RE_WHITESPACE, '.' ); - return lowercase( str ); -} - - -// EXPORTS // - -module.exports = dotcase; diff --git a/base/dotcase/package.json b/base/dotcase/package.json deleted file mode 100644 index 129edcb4..00000000 --- a/base/dotcase/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/dotcase", - "version": "0.0.0", - "description": "Convert a string to dot case.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "case", - "dot", - "dotcase", - "convert" - ], - "__stdlib__": {} -} diff --git a/base/dotcase/test/test.js b/base/dotcase/test/test.js deleted file mode 100644 index b7afd732..00000000 --- a/base/dotcase/test/test.js +++ /dev/null @@ -1,219 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dotcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof dotcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a string to dot case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo', - 'foo-bar', - 'fooBar', - 'foo_bar', - 'foo-bar-baz', - 'foo_bar_baz', - 'foo bar baz', - 'foo bar baz qux', - 'foo_bar_baz_qux', - 'foo_bar baz qux' - ]; - - expected = [ - 'foo', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar.baz', - 'foo.bar.baz', - 'foo.bar.baz', - 'foo.bar.baz.qux', - 'foo.bar.baz.qux', - 'foo.bar.baz.qux' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( dotcase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a string to dot case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'Hello World', - 'I am tiny little tea pot', - 'Big problems', - 'The quick brown fox jumps over the lazy dog' - ]; - - expected = [ - 'hello.world', - 'i.am.tiny.little.tea.pot', - 'big.problems', - 'the.quick.brown.fox.jumps.over.the.lazy.dog' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( dotcase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to dot case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'fóoBár', - 'Привет мир', - '_Світ-прекрасний!', - 'Café esuna bella', - 'meu coração', - '#🥹 🤨', - '𩷶$𝒳 ', - '안녕하@세요' - ]; - - expected = [ - 'fóo.bár', - 'привет.мир', - 'світ.прекрасний', - 'café.esuna.bella', - 'meu.coração', - '🥹.🤨', - '𩷶.𝒳', - '안녕하.세요' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( dotcase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a string with special characters to dot case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo-bar', - 'foo!bar', - 'foo@bar', - 'foo#bar', - 'foo$bar', - 'foo%bar', - 'foo^bar', - 'foo&bar', - 'foo*bar', - 'foo(bar', - 'foo)bar', - 'foo[bar', - 'foo]bar', - 'foo{bar', - 'foo}bar', - 'foo|bar', - 'foo~bar', - 'foo:"bar', - 'foo\'bar', - 'foobar', - 'foo?bar', - 'foo/bar' - ]; - - expected = [ - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar', - 'foo.bar' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( dotcase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function leaves a string that is already in dot case unchanged', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'camel.case', - 'is.mobile', - 'the.quick.brown.fox.jumps.over.the.lazy.dog', - '🥹.🤨' - ]; - - expected = [ - 'camel.case', - 'is.mobile', - 'the.quick.brown.fox.jumps.over.the.lazy.dog', - '🥹.🤨' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( dotcase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); diff --git a/base/ends-with/README.md b/base/ends-with/README.md deleted file mode 100644 index e12318c8..00000000 --- a/base/ends-with/README.md +++ /dev/null @@ -1,155 +0,0 @@ - - -# endsWith - -> Test if a string ends with the characters of another string. - -
- -
- - - -
- -## Usage - -```javascript -var endsWith = require( '@stdlib/string/base/ends-with' ); -``` - -#### endsWith( str, search, len ) - -Tests if a string ends with the characters of another string. - -```javascript -var str = 'Remember the story I used to tell you when you were a boy?'; - -var bool = endsWith( str, 'boy?', str.length ); -// returns true - -bool = endsWith( str, 'Boy?', str.length ); -// returns false -``` - -To search from a specific character position, provide a `len` argument. If `len` is positive, the function restricts the search to a substring with length `len`, beginning with the leftmost character. If `len` is negative, `len` indicates to ignore the last `len` characters (equivalent to `str.length + len`). - -```javascript -var str = 'To be, or not to be, that is the question.'; - -var bool = endsWith( str, 'to be', 19 ); -// returns true - -bool = endsWith( str, 'to be', -23 ); -// returns true -``` - -If provided an empty `search` string, the function **always** returns `true`. - -```javascript -var str = 'beep boop'; - -var bool = endsWith( str, '' ); -// returns true -``` - -
- - - -
- -## Notes - -- In general, exercise caution when operating on substrings containing Unicode characters, as the visual character length may not equal the number of code points. For example, - - ```javascript - var len = '🏠'.length; - // returns 2 - ``` - -- This function differs from [`String.prototype.endsWith`][mdn-string-endswith] in the following ways: - - - The function assumes string values for the first and second arguments and assumes that the `len` argument is an integer value. - - The function does **not** clamp positive `len` values to the end of the input string. - - Except when provided an empty `search` string, the function **always** returns `false` if `len` resolves to a starting search position which exceeds the bounds of the input string. - -
- - - -
- -## Examples - - - -```javascript -var endsWith = require( '@stdlib/string/base/ends-with' ); - -var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; - -var bool = endsWith( str, 'air', str.length ); -// returns true - -bool = endsWith( str, 'fair', str.length ); -// returns false - -bool = endsWith( str, 'fair', 30 ); -// returns true - -bool = endsWith( str, 'fair', -34 ); -// returns true -``` - -
- - - - - - - - - - - - - - diff --git a/base/ends-with/benchmark/benchmark.js b/base/ends-with/benchmark/benchmark.js deleted file mode 100644 index 217a3c8b..00000000 --- a/base/ends-with/benchmark/benchmark.js +++ /dev/null @@ -1,93 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var endsWith = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': typeof String.prototype.endsWith !== 'function' -}; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - '.', - 'z', - 'questions' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = endsWith( str, values[ i%values.length ], str.length ); - 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(); -}); - -bench( format( '%s::builtin', pkg ), opts, function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - '.', - 'z', - 'questions' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = str.endsWith( values[ i%values.length ], str.length ); - 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/base/ends-with/benchmark/benchmark.polyfill.js b/base/ends-with/benchmark/benchmark.polyfill.js deleted file mode 100644 index 31b238e4..00000000 --- a/base/ends-with/benchmark/benchmark.polyfill.js +++ /dev/null @@ -1,58 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var endsWith = require( './../lib/polyfill.js' ); - - -// MAIN // - -bench( format( '%s::polyfill', pkg ), function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - '.', - 'z', - 'questions' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = endsWith( str, values[ i%values.length ], str.length ); - 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/base/ends-with/docs/repl.txt b/base/ends-with/docs/repl.txt deleted file mode 100644 index e341ccfa..00000000 --- a/base/ends-with/docs/repl.txt +++ /dev/null @@ -1,42 +0,0 @@ - -{{alias}}( str, search, len ) - Tests if a string ends with the characters of another string. - - If provided an empty search string, the function always returns `true`. - - Parameters - ---------- - str: string - Input string. - - search: string - Search string. - - len: integer - Substring length. Restricts the search to a substring within the input - string beginning from the leftmost character. If provided a negative - value, `len` indicates to ignore the last `len` characters, and is thus - equivalent to `str.length + len`. Default: str.length. - - Returns - ------- - bool: boolean - Boolean indicating whether a string ends with the characters of another - string. - - Examples - -------- - > var bool = {{alias}}( 'beep', 'ep', 4 ) - true - > bool = {{alias}}( 'Beep', 'op', 4 ) - false - > bool = {{alias}}( 'Beep', 'ee', 3 ) - true - > bool = {{alias}}( 'Beep', 'ee', -1 ) - true - > bool = {{alias}}( 'beep', '', 4 ) - true - - See Also - -------- - diff --git a/base/ends-with/docs/types/index.d.ts b/base/ends-with/docs/types/index.d.ts deleted file mode 100644 index 16b139a4..00000000 --- a/base/ends-with/docs/types/index.d.ts +++ /dev/null @@ -1,46 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Tests if a string ends with the characters of another string. -* -* ## Notes -* -* - The last parameter restricts the search to a substring within the input string beginning from the leftmost character. If provided a negative value, `len` indicates to ignore the last `len` characters, and is thus equivalent to `str.length + len`. -* -* @param str - input string -* @param search - search string -* @param len - substring length -* @returns boolean indicating if the input string ends with the search string -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 ); -* // returns true -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 ); -* // returns true -*/ -declare function endsWith( str: string, search: string, len: number ): boolean; - - -// EXPORTS // - -export = endsWith; diff --git a/base/ends-with/docs/types/test.ts b/base/ends-with/docs/types/test.ts deleted file mode 100644 index a8d2005a..00000000 --- a/base/ends-with/docs/types/test.ts +++ /dev/null @@ -1,59 +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. -*/ - -import endsWith = require( './index' ); - - -// TESTS // - -// The function returns a boolean... -{ - endsWith( 'To be, or not to be, that is the question.', 'b', 19 ); // $ExpectType boolean - endsWith( 'abd', 'ab', 2 ); // $ExpectType boolean -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - endsWith( true, 'd', 2 ); // $ExpectError - endsWith( false, 'd', 2 ); // $ExpectError - endsWith( 3, 'd', 3 ); // $ExpectError - endsWith( [], 'd', 3 ); // $ExpectError - endsWith( {}, 'd', 3 ); // $ExpectError - endsWith( ( x: number ): number => x, 'd', 0 ); // $ExpectError - - endsWith( 'abd', true, 2 ); // $ExpectError - endsWith( 'abd', false, 2 ); // $ExpectError - endsWith( 'abd', 5, 2 ); // $ExpectError - endsWith( 'abd', [], 3 ); // $ExpectError - endsWith( 'abd', {}, 3 ); // $ExpectError - endsWith( 'abd', ( x: number ): number => x, 0 ); // $ExpectError - - endsWith( 'abd', 'a', true ); // $ExpectError - endsWith( 'abd', 'a', false ); // $ExpectError - endsWith( 'abd', 'a', '5' ); // $ExpectError - endsWith( 'abd', 'b', [] ); // $ExpectError - endsWith( 'abd', 'b', {} ); // $ExpectError - endsWith( 'abd', 'b', /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - endsWith(); // $ExpectError - endsWith( 'abc' ); // $ExpectError - endsWith( 'abc', 'a' ); // $ExpectError -} diff --git a/base/ends-with/examples/index.js b/base/ends-with/examples/index.js deleted file mode 100644 index a094d70e..00000000 --- a/base/ends-with/examples/index.js +++ /dev/null @@ -1,35 +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. -*/ - -'use strict'; - -var endsWith = require( './../lib' ); - -var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; - -console.log( endsWith( str, 'air', str.length ) ); -// => true - -console.log( endsWith( str, 'fair', str.length ) ); -// => false - -console.log( endsWith( str, 'fair', 30 ) ); -// => true - -console.log( endsWith( str, 'fair', -34 ) ); -// => true diff --git a/base/ends-with/lib/builtin.js b/base/ends-with/lib/builtin.js deleted file mode 100644 index 9528796f..00000000 --- a/base/ends-with/lib/builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var endsWith = String.prototype.endsWith; - - -// EXPORTS // - -module.exports = endsWith; diff --git a/base/ends-with/lib/has_builtin.js b/base/ends-with/lib/has_builtin.js deleted file mode 100644 index 7aad4e9c..00000000 --- a/base/ends-with/lib/has_builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var bool = ( typeof String.prototype.endsWith !== 'undefined' ); - - -// EXPORTS // - -module.exports = bool; diff --git a/base/ends-with/lib/index.js b/base/ends-with/lib/index.js deleted file mode 100644 index e13ee73e..00000000 --- a/base/ends-with/lib/index.js +++ /dev/null @@ -1,63 +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. -*/ - -'use strict'; - -/** -* Test if a string ends with the characters of another string. -* -* @module @stdlib/string/base/ends-with -* -* @example -* var endsWith = require( '@stdlib/string/base/ends-with' ); -* -* var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; -* -* var bool = endsWith( str, 'air', str.length ); -* // returns true -* -* bool = endsWith( str, 'fair', str.length ); -* // returns false -* -* bool = endsWith( str, 'fair', 30 ); -* // returns true -* -* bool = endsWith( str, 'fair', -34 ); -* // returns true -*/ - -// MODULES // - -var HAS_BUILTIN = require( './has_builtin.js' ); -var polyfill = require( './polyfill.js' ); -var main = require( './main.js' ); - - -// MAIN // - -var endsWith; -if ( HAS_BUILTIN ) { - endsWith = main; -} else { - endsWith = polyfill; -} - - -// EXPORTS // - -module.exports = endsWith; diff --git a/base/ends-with/lib/main.js b/base/ends-with/lib/main.js deleted file mode 100644 index 396a2173..00000000 --- a/base/ends-with/lib/main.js +++ /dev/null @@ -1,74 +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. -*/ - -'use strict'; - -// MODULES // - -var builtin = require( './builtin.js' ); - - -// MAIN // - -/** -* Tests if a string ends with the characters of another string. -* -* ## Notes -* -* - The last parameter restricts the search to a substring within the input string beginning from the leftmost character. If provided a negative value, `len` indicates to ignore the last `len` characters, and is thus equivalent to `str.length + len`. -* -* @param {string} str - input string -* @param {string} search - search string -* @param {integer} len - substring length -* @returns {boolean} boolean indicating if the input string ends with the search string -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 ); -* // returns true -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 ); -* // returns true -*/ -function endsWith( str, search, len ) { - var idx; - var N; - - N = search.length; - if ( len === 0 ) { - return ( N === 0 ); - } - if ( len < 0 ) { - idx = str.length + len; - } else { - idx = len; - } - if ( N === 0 ) { - // Based on the premise that every string can be "surrounded" by empty strings (e.g., "" + "a" + "" + "b" + "" === "ab"): - return true; - } - if ( idx - N < 0 || idx > str.length ) { - return false; - } - return builtin.call( str, search, idx ); -} - - -// EXPORTS // - -module.exports = endsWith; diff --git a/base/ends-with/lib/polyfill.js b/base/ends-with/lib/polyfill.js deleted file mode 100644 index dcd109da..00000000 --- a/base/ends-with/lib/polyfill.js +++ /dev/null @@ -1,77 +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. -*/ - -'use strict'; - -// MAIN // - -/** -* Tests if a string ends with the characters of another string. -* -* ## Notes -* -* - The last parameter restricts the search to a substring within the input string beginning from the leftmost character. If provided a negative value, `len` indicates to ignore the last `len` characters, and is thus equivalent to `str.length + len`. -* -* @private -* @param {string} str - input string -* @param {string} search - search string -* @param {integer} len - substring length -* @returns {boolean} boolean indicating if the input string ends with the search string -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 ); -* // returns true -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 ); -* // returns true -*/ -function endsWith( str, search, len ) { - var idx; - var N; - var i; - - N = search.length; - if ( len === 0 ) { - return ( N === 0 ); - } - if ( len < 0 ) { - idx = str.length + len; - } else { - idx = len; - } - if ( N === 0 ) { - // Based on the premise that every string can be "surrounded" by empty strings (e.g., "" + "a" + "" + "b" + "" === "ab"): - return true; - } - idx -= N; - if ( idx < 0 ) { - return false; - } - for ( i = 0; i < N; i++ ) { - if ( str.charCodeAt( idx + i ) !== search.charCodeAt( i ) ) { - return false; - } - } - return true; -} - - -// EXPORTS // - -module.exports = endsWith; diff --git a/base/ends-with/package.json b/base/ends-with/package.json deleted file mode 100644 index 3a576d98..00000000 --- a/base/ends-with/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/ends-with", - "version": "0.0.0", - "description": "Test if a string ends with the characters of another string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "check", - "end", - "ends", - "search", - "match" - ] -} diff --git a/base/ends-with/test/test.js b/base/ends-with/test/test.js deleted file mode 100644 index 09e009e8..00000000 --- a/base/ends-with/test/test.js +++ /dev/null @@ -1,192 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var polyfill = require( './../lib/polyfill.js' ); -var main = require( './../lib/main.js' ); -var endsWith = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof endsWith, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the main export is a polyfill if an environment does not support String.prototype.endsWith', function test( t ) { - var endsWith = proxyquire( './../lib', { - './has_builtin.js': false - }); - t.strictEqual( endsWith, polyfill, 'returns expected value' ); - t.end(); -}); - -tape( 'the main export is a wrapper around a builtin if an environment supports String.prototype.endsWith', function test( t ) { - var endsWith = proxyquire( './../lib', { - './has_builtin.js': true - }); - t.strictEqual( endsWith, main, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `true` if the input string ends with the search value', function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - bool = endsWith( str, 'afraid', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - str = 'Not too late, I\'m afraid...'; - bool = endsWith( str, 'afraid...', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - str = 'Welcome home!'; - bool = endsWith( str, 'home!', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - str = 'Welcome home! 🏠'; - bool = endsWith( str, '🏠', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if the input string does not end with the search value', function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - bool = endsWith( str, 'Afraid', str.length ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Not too late, I\'m afraid...'; - bool = endsWith( str, 'afraid', str.length ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Welcome home!'; - bool = endsWith( str, 'welcome home!', str.length ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports restricting the search to a substring by providing a length parameter (positive)', function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - - bool = endsWith( str, 'late', 7 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = endsWith( str, 'late', 8 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', 9 ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Welcome 🏠!'; - bool = endsWith( str, '🏠', str.length-1 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports restricting the search to a substring by providing a length parameter (negative)', function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - - bool = endsWith( str, 'i', -1 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', -13 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = endsWith( str, 'late', -12 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', -11 ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Welcome 🏠!'; - bool = endsWith( str, '🏠', -1 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a length parameter equal to `0`', function test( t ) { - var bool = endsWith( 'abc', 'c', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a length parameter which exceeds the input string length', function test( t ) { - var bool = endsWith( 'abcdef', 'f', 9999 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input string length', function test( t ) { - var bool = endsWith( 'abc', 'abcd' ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length', function test( t ) { - var bool = endsWith( 'abcdef', 'abcd', 3 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length (negative)', function test( t ) { - var bool = endsWith( 'abcdef', 'abcd', -3 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `true` if provided an empty search string', function test( t ) { - var bool; - - bool = endsWith( '', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', 3 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', 10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', -10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); diff --git a/base/ends-with/test/test.main.js b/base/ends-with/test/test.main.js deleted file mode 100644 index eb1adbf8..00000000 --- a/base/ends-with/test/test.main.js +++ /dev/null @@ -1,181 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var HAS_BUILTIN = require( './../lib/has_builtin.js' ); -var endsWith = require( './../lib/main.js' ); - - -// VARIABLES // - -var opts = { - 'skip': !HAS_BUILTIN -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof endsWith, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns `true` if the input string ends with the search value', opts, function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - bool = endsWith( str, 'afraid', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - str = 'Not too late, I\'m afraid...'; - bool = endsWith( str, 'afraid...', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - str = 'Welcome home!'; - bool = endsWith( str, 'home!', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - str = 'Welcome home! 🏠'; - bool = endsWith( str, '🏠', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if the input string does not end with the search value', opts, function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - bool = endsWith( str, 'Afraid', str.length ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Not too late, I\'m afraid...'; - bool = endsWith( str, 'afraid', str.length ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Welcome home!'; - bool = endsWith( str, 'welcome home!', str.length ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports restricting the search to a substring by providing a length parameter (positive)', opts, function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - - bool = endsWith( str, 'late', 7 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = endsWith( str, 'late', 8 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', 9 ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Welcome 🏠!'; - bool = endsWith( str, '🏠', str.length-1 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports restricting the search to a substring by providing a length parameter (negative)', opts, function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - - bool = endsWith( str, 'i', -1 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', -13 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = endsWith( str, 'late', -12 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', -11 ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Welcome 🏠!'; - bool = endsWith( str, '🏠', -1 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a length parameter equal to `0`', opts, function test( t ) { - var bool = endsWith( 'abc', 'c', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a length parameter which exceeds the input string length', opts, function test( t ) { - var bool = endsWith( 'abcdef', 'f', 9999 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input string length', opts, function test( t ) { - var bool = endsWith( 'abc', 'abcd' ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length', opts, function test( t ) { - var bool = endsWith( 'abcdef', 'abcd', 3 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length (negative)', opts, function test( t ) { - var bool = endsWith( 'abcdef', 'abcd', -3 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `true` if provided an empty search string', opts, function test( t ) { - var bool; - - bool = endsWith( '', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', 3 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', 10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', -10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); diff --git a/base/ends-with/test/test.polyfill.js b/base/ends-with/test/test.polyfill.js deleted file mode 100644 index b4d5b1df..00000000 --- a/base/ends-with/test/test.polyfill.js +++ /dev/null @@ -1,173 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var endsWith = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof endsWith, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns `true` if the input string ends with the search value', function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - bool = endsWith( str, 'afraid', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - str = 'Not too late, I\'m afraid...'; - bool = endsWith( str, 'afraid...', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - str = 'Welcome home!'; - bool = endsWith( str, 'home!', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - str = 'Welcome home! 🏠'; - bool = endsWith( str, '🏠', str.length ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if the input string does not end with the search value', function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - bool = endsWith( str, 'Afraid', str.length ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Not too late, I\'m afraid...'; - bool = endsWith( str, 'afraid', str.length ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Welcome home!'; - bool = endsWith( str, 'welcome home!', str.length ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports restricting the search to a substring by providing a length parameter (positive)', function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - - bool = endsWith( str, 'late', 7 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = endsWith( str, 'late', 8 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', 9 ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Welcome 🏠!'; - bool = endsWith( str, '🏠', str.length-1 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports restricting the search to a substring by providing a length parameter (negative)', function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - - bool = endsWith( str, 'i', -1 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', -13 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = endsWith( str, 'late', -12 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', -11 ); - t.strictEqual( bool, false, 'returns expected value' ); - - str = 'Welcome 🏠!'; - bool = endsWith( str, '🏠', -1 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a length parameter equal to `0`', function test( t ) { - var bool = endsWith( 'abc', 'c', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a length parameter which exceeds the input string length', function test( t ) { - var bool = endsWith( 'abcdef', 'f', 9999 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input string length', function test( t ) { - var bool = endsWith( 'abc', 'abcd' ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length', function test( t ) { - var bool = endsWith( 'abcdef', 'abcd', 3 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length (negative)', function test( t ) { - var bool = endsWith( 'abcdef', 'abcd', -3 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `true` if provided an empty search string', function test( t ) { - var bool; - - bool = endsWith( '', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', 3 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', 10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', -10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); diff --git a/base/examples/index.js b/base/examples/index.js deleted file mode 100644 index 28d27ed4..00000000 --- a/base/examples/index.js +++ /dev/null @@ -1,54 +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. -*/ - -'use strict'; - -var ns = require( './../lib' ); - -// Generate a Pascal case string... -var str = ns.pascalcase( 'beep boop' ); -console.log( str ); -// => 'BeepBoop' - -// Tokenize a string into an array of string parts and format identifier objects... -str = 'The %d %s foxes jumped over the %d %s dogs.'; -var tokens = ns.formatTokenize( str ); -console.log( tokens ); -// => [ 'The ', {...}, ' ', {...}, ' foxes jumped over the ', {...}, ' ', {...}, ' dogs.' ] - -// Generate a string from a token array by interpolating values... -str = ns.formatInterpolate( tokens, 3, 'quick', 4, 'lazy' ); -console.log( str ); -// => 'The 3 quick foxes jumped over the 4 lazy dogs.' - -// Test whether a string starts with the characters of another string... -str = 'Lorem ipsum dolor sit amet'; -var bool = ns.startsWith( str, 'Lorem' ); // eslint-disable-line no-restricted-syntax -console.log( bool ); -// => true - -// Test whether a string ends with the characters of another string... -bool = ns.endsWith( str, 'amet' ); // eslint-disable-line no-restricted-syntax -console.log( bool ); -// => true - -// Trim whitespace characters from the beginning and end of a string... -str = ' \t\n Lorem ipsum dolor sit amet \n\t '; -str = ns.trim( str ); // eslint-disable-line no-restricted-syntax -console.log( str ); -// => 'Lorem ipsum dolor sit amet' diff --git a/base/first-code-point/README.md b/base/first-code-point/README.md deleted file mode 100644 index 9b4e0825..00000000 --- a/base/first-code-point/README.md +++ /dev/null @@ -1,119 +0,0 @@ - - -# firstCodePoint - -> Return the first `n` Unicode code points of a string. - -
- -## Usage - -```javascript -var firstCodePoint = require( '@stdlib/string/base/first-code-point' ); -``` - -#### firstCodePoint( str, n ) - -Returns the first `n` Unicode code points of a string. - -```javascript -var out = firstCodePoint( 'last man standing', 1 ); -// returns 'l' - -out = firstCodePoint( 'Hidden Treasures', 1 ); -// returns 'H' - -out = firstCodePoint( 'foo bar', 5 ); -// returns 'foo b' - -out = firstCodePoint( 'foo bar', 10 ); -// returns 'foo bar' -``` - -
- - - -
- -## Examples - - - -```javascript -var firstCodePoint = require( '@stdlib/string/base/first-code-point' ); - -var str = firstCodePoint( 'presidential election', 1 ); -// returns 'p' - -str = firstCodePoint( 'JavaScript', 1 ); -// returns 'J' - -str = firstCodePoint( 'The Last of the Mohicans', 5 ); -// returns 'The L' - -str = firstCodePoint( 'अनुच्छेद', 1 ); -// returns 'अ' -``` - -
- - - - - - - - - - - - - - diff --git a/base/first-code-point/benchmark/benchmark.js b/base/first-code-point/benchmark/benchmark.js deleted file mode 100644 index fceaf9f5..00000000 --- a/base/first-code-point/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var first = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = first( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/first-code-point/docs/repl.txt b/base/first-code-point/docs/repl.txt deleted file mode 100644 index 0d8b5af6..00000000 --- a/base/first-code-point/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n ) - Returns the first `n` Unicode code points of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of Unicode code points to return. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 1 ) - 'b' - > out = {{alias}}( 'Boop', 1 ) - 'B' - > out = {{alias}}( 'foo bar', 5 ) - 'foo b' - - See Also - -------- - diff --git a/base/first-code-point/docs/types/index.d.ts b/base/first-code-point/docs/types/index.d.ts deleted file mode 100644 index 99dee4b2..00000000 --- a/base/first-code-point/docs/types/index.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns the first `n` Unicode code points of a string. -* -* @param str - input string -* @param n - number of code points to return -* @returns output string -* -* @example -* var out = first( 'last man standing', 1 ); -* // returns 'l' -* -* @example -* var out = first( 'presidential election', 1 ); -* // returns 'p' -* -* @example -* var out = first( 'JavaScript', 1 ); -* // returns 'J' -* -* @example -* var out = first( 'Hidden Treasures', 1 ); -* // returns 'H' -* -* @example -* var out = first( 'foo bar', 5 ); -* // returns 'foo b' -*/ -declare function first( str: string, n: number ): string; - - -// EXPORTS // - -export = first; diff --git a/base/first-code-point/docs/types/test.ts b/base/first-code-point/docs/types/test.ts deleted file mode 100644 index 7311e817..00000000 --- a/base/first-code-point/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import first = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - first( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - first( true, 1 ); // $ExpectError - first( false, 1 ); // $ExpectError - first( null, 1 ); // $ExpectError - first( undefined, 1 ); // $ExpectError - first( 5, 1 ); // $ExpectError - first( [], 1 ); // $ExpectError - first( {}, 1 ); // $ExpectError - first( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - first( 'abc', true ); // $ExpectError - first( 'abc', false ); // $ExpectError - first( 'abc', null ); // $ExpectError - first( 'abc', 'abc' ); // $ExpectError - first( 'abc', [] ); // $ExpectError - first( 'abc', {} ); // $ExpectError - first( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - first(); // $ExpectError - first( 'abc' ); // $ExpectError - first( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/first-code-point/examples/index.js b/base/first-code-point/examples/index.js deleted file mode 100644 index 7588794a..00000000 --- a/base/first-code-point/examples/index.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'; - -var firstCodePoint = require( './../lib' ); - -console.log( firstCodePoint( 'presidential election', 1 ) ); -// => 'p' - -console.log( firstCodePoint( 'JavaScript', 1 ) ); -// => 'J' - -console.log( firstCodePoint( 'The Last of the Mohicans', 5 ) ); -// => 'The L' - -console.log( firstCodePoint( 'अनुच्छेद', 1 ) ); -// => 'अ' diff --git a/base/first-code-point/lib/index.js b/base/first-code-point/lib/index.js deleted file mode 100644 index f75332ae..00000000 --- a/base/first-code-point/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the first `n` Unicode code points of a string. -* -* @module @stdlib/string/base/first-code-point -* -* @example -* var first = require( '@stdlib/string/base/first-code-point' ); -* -* var out = first( 'last man standing', 1 ); -* // returns 'l' -* -* out = first( 'Hidden Treasures', 1 ); -* // returns 'H' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/first-code-point/lib/main.js b/base/first-code-point/lib/main.js deleted file mode 100644 index 622cecdc..00000000 --- a/base/first-code-point/lib/main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var RE_UTF16_SURROGATE_PAIR = require( '@stdlib/regexp/utf16-surrogate-pair' ).REGEXP; - - -// VARIABLES // - -var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/; // TODO: replace with stdlib pkg -var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/; // TODO: replace with stdlib pkg - - -// MAIN // - -/** -* Returns the first `n` Unicode code points of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of Unicode code points to return -* @returns {string} output string -* -* @example -* var out = first( 'last man standing', 1 ); -* // returns 'l' -* -* @example -* var out = first( 'presidential election', 1 ); -* // returns 'p' -* -* @example -* var out = first( 'JavaScript', 1 ); -* // returns 'J' -* -* @example -* var out = first( 'Hidden Treasures', 1 ); -* // returns 'H' -*/ -function first( str, n ) { - var len; - var out; - var ch1; - var ch2; - var cnt; - var i; - if ( str === '' || n === 0 ) { - return ''; - } - if ( n === 1 ) { - str = str.substring( 0, 2 ); - if ( RE_UTF16_SURROGATE_PAIR.test( str ) ) { - return str; - } - return str[ 0 ]; - } - len = str.length; - out = ''; - cnt = 0; - - // Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point... - for ( i = 0; i < len; i++ ) { - ch1 = str[ i ]; - out += ch1; - cnt += 1; - - // Check for a high UTF-16 surrogate... - if ( RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) { - // Check for an unpaired surrogate at the end of the input string... - if ( i === len-1 ) { - // We found an unpaired surrogate... - break; - } - // Check whether the high surrogate is paired with a low surrogate... - ch2 = str[ i+1 ]; - if ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) { - // We found a surrogate pair: - out += ch2; - i += 1; // bump the index to process the next code unit - } - } - // Check whether we've found the desired number of code points... - if ( cnt === n ) { - break; - } - } - return out; -} - - -// EXPORTS // - -module.exports = first; diff --git a/base/first-code-point/package.json b/base/first-code-point/package.json deleted file mode 100644 index fcee4d03..00000000 --- a/base/first-code-point/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/first-code-point", - "version": "0.0.0", - "description": "Return the first Unicode code point of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "first", - "character", - "char", - "codepoint", - "unicode" - ] -} diff --git a/base/first-code-point/test/test.js b/base/first-code-point/test/test.js deleted file mode 100644 index 95e53264..00000000 --- a/base/first-code-point/test/test.js +++ /dev/null @@ -1,96 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var first = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof first, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( first( '', 1 ), '', 'returns expected value' ); - t.strictEqual( first( '', 2 ), '', 'returns expected value' ); - t.strictEqual( first( '', 3 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided zero as the second argument', function test( t ) { - t.strictEqual( first( 'hello world', 0 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the first Unicode code point of a provided string (ascii)', function test( t ) { - var out; - - out = first( 'hello world', 1 ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = first( '!!!', 1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = first( 'Hello World', 1 ); - t.strictEqual( out, 'H', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the first Unicode code point of a provided string (Unicode)', function test( t ) { - var out; - - out = first( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'अ', 'returns expected value' ); - - out = first( '六书/六書', 1 ); - t.strictEqual( out, '六', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the first `n` Unicode code points of a provided string', function test( t ) { - var out; - - out = first( 'hello world', 1 ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = first( 'hello world', 7 ); - t.strictEqual( out, 'hello w', 'returns expected value' ); - - out = first( '!!!', 1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = first( '!!!', 2 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = first( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'अ', 'returns expected value' ); - - out = first( '六书/六書', 3 ); - t.strictEqual( out, '六书/', 'returns expected value' ); - - t.end(); -}); diff --git a/base/first-grapheme-cluster/README.md b/base/first-grapheme-cluster/README.md deleted file mode 100644 index 701919be..00000000 --- a/base/first-grapheme-cluster/README.md +++ /dev/null @@ -1,122 +0,0 @@ - - -# firstGraphemeCluster - -> Return the first `n` grapheme clusters (i.e., user-perceived characters) of a string. - -
- -## Usage - -```javascript -var firstGraphemeCluster = require( '@stdlib/string/base/first-grapheme-cluster' ); -``` - -#### firstGraphemeCluster( str, n ) - -Returns the first `n` grapheme clusters (i.e., user-perceived characters) of a string. - -```javascript -var out = firstGraphemeCluster( 'last man standing', 1 ); -// returns 'l' - -out = firstGraphemeCluster( 'Hidden Treasures', 1 ); -// returns 'H' - -out = firstGraphemeCluster( 'foo bar', 5 ); -// returns 'foo b' - -out = firstGraphemeCluster( 'foo bar', 10 ); -// returns 'foo bar' -``` - -
- - - -
- -## Examples - - - -```javascript -var firstGraphemeCluster = require( '@stdlib/string/base/first-grapheme-cluster' ); - -var str = firstGraphemeCluster( 'presidential election', 1 ); -// returns 'p' - -str = firstGraphemeCluster( 'JavaScript', 1 ); -// returns 'J' - -str = firstGraphemeCluster( 'The Last of the Mohicans', 5 ); -// returns 'The L' - -str = firstGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ); -// returns '🐶🐮' - -str = firstGraphemeCluster( '🐶🐮🐷🐰🐸', 10 ); -// returns '🐶🐮🐷🐰🐸' -``` - -
- - - - - - - - - - - - - - diff --git a/base/first-grapheme-cluster/benchmark/benchmark.js b/base/first-grapheme-cluster/benchmark/benchmark.js deleted file mode 100644 index fceaf9f5..00000000 --- a/base/first-grapheme-cluster/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var first = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = first( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/first-grapheme-cluster/docs/repl.txt b/base/first-grapheme-cluster/docs/repl.txt deleted file mode 100644 index 58d420e5..00000000 --- a/base/first-grapheme-cluster/docs/repl.txt +++ /dev/null @@ -1,30 +0,0 @@ - -{{alias}}( str, n ) - Returns the first `n` grapheme clusters (i.e., user-perceived characters) of - a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of grapheme clusters to return. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 1 ) - 'b' - > out = {{alias}}( 'Boop', 1 ) - 'B' - > out = {{alias}}( 'foo bar', 5 ) - 'foo b' - - See Also - -------- - diff --git a/base/first-grapheme-cluster/docs/types/index.d.ts b/base/first-grapheme-cluster/docs/types/index.d.ts deleted file mode 100644 index ab76da11..00000000 --- a/base/first-grapheme-cluster/docs/types/index.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the first `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @param str - input string -* @param n - number of grapheme clusters to return -* @returns output string -* -* @example -* var out = first( 'last man standing', 1 ); -* // returns 'l' -* -* @example -* var out = first( 'presidential election', 1 ); -* // returns 'p' -* -* @example -* var out = first( 'JavaScript', 1 ); -* // returns 'J' -* -* @example -* var out = first( 'Hidden Treasures', 1 ); -* // returns 'H' -* -* @example -* var out = first( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐶🐮' -* -* @example -* var out = first( 'foo bar', 5 ); -* // returns 'foo b' -*/ -declare function first( str: string, n: number ): string; - - -// EXPORTS // - -export = first; diff --git a/base/first-grapheme-cluster/docs/types/test.ts b/base/first-grapheme-cluster/docs/types/test.ts deleted file mode 100644 index 7311e817..00000000 --- a/base/first-grapheme-cluster/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import first = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - first( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - first( true, 1 ); // $ExpectError - first( false, 1 ); // $ExpectError - first( null, 1 ); // $ExpectError - first( undefined, 1 ); // $ExpectError - first( 5, 1 ); // $ExpectError - first( [], 1 ); // $ExpectError - first( {}, 1 ); // $ExpectError - first( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - first( 'abc', true ); // $ExpectError - first( 'abc', false ); // $ExpectError - first( 'abc', null ); // $ExpectError - first( 'abc', 'abc' ); // $ExpectError - first( 'abc', [] ); // $ExpectError - first( 'abc', {} ); // $ExpectError - first( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - first(); // $ExpectError - first( 'abc' ); // $ExpectError - first( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/first-grapheme-cluster/examples/index.js b/base/first-grapheme-cluster/examples/index.js deleted file mode 100644 index 9e300844..00000000 --- a/base/first-grapheme-cluster/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var firstGraphemeCluster = require( './../lib' ); - -console.log( firstGraphemeCluster( 'presidential election', 1 ) ); -// => 'p' - -console.log( firstGraphemeCluster( 'JavaScript', 1 ) ); -// => 'J' - -console.log( firstGraphemeCluster( 'The Last of the Mohicans', 5 ) ); -// => 'The L' - -console.log( firstGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ) ); -// => '🐶🐮' - -console.log( firstGraphemeCluster( '🐶🐮🐷🐰🐸', 10 ) ); -// => '🐶🐮🐷🐰🐸' diff --git a/base/first-grapheme-cluster/lib/index.js b/base/first-grapheme-cluster/lib/index.js deleted file mode 100644 index 285af90e..00000000 --- a/base/first-grapheme-cluster/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the first `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @module @stdlib/string/base/first-grapheme-cluster -* -* @example -* var first = require( '@stdlib/string/base/first-grapheme-cluster' ); -* -* var out = first( 'last man standing', 1 ); -* // returns 'l' -* -* out = first( 'Hidden Treasures', 1 ); -* // returns 'H' -* -* out = first( '🐮🐷🐸🐵', 2 ); -* // returns '🐮🐷' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/first-grapheme-cluster/lib/main.js b/base/first-grapheme-cluster/lib/main.js deleted file mode 100644 index cb4ed1cd..00000000 --- a/base/first-grapheme-cluster/lib/main.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var nextGraphemeClusterBreak = require( './../../../next-grapheme-cluster-break' ); - - -// MAIN // - -/** -* Returns the first `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of grapheme clusters to return -* @returns {string} output string -* -* @example -* var out = first( 'last man standing', 1 ); -* // returns 'l' -* -* @example -* var out = first( 'presidential election', 1 ); -* // returns 'p' -* -* @example -* var out = first( 'JavaScript', 1 ); -* // returns 'J' -* -* @example -* var out = first( 'Hidden Treasures', 1 ); -* // returns 'H' -* -* @example -* var out = first( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐶🐮' -* -* @example -* var out = first( 'foo bar', 5 ); -* // returns 'foo b' -*/ -function first( str, n ) { - var i = 0; - while ( n > 0 ) { - i = nextGraphemeClusterBreak( str, i ); - n -= 1; - } - // Value of `i` will be -1 if and only if `str` is an empty string or `str` has only 1 extended grapheme cluster... - if ( str === '' || i === -1 ) { - return str; - } - return str.substring( 0, i ); -} - - -// EXPORTS // - -module.exports = first; diff --git a/base/first-grapheme-cluster/package.json b/base/first-grapheme-cluster/package.json deleted file mode 100644 index e9169e01..00000000 --- a/base/first-grapheme-cluster/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/first-grapheme-cluster", - "version": "0.0.0", - "description": "Return the first grapheme cluster (i.e., user-perceived character) of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "first", - "character", - "char", - "grapheme", - "cluster", - "unicode" - ] -} diff --git a/base/first-grapheme-cluster/test/test.js b/base/first-grapheme-cluster/test/test.js deleted file mode 100644 index f4d8a455..00000000 --- a/base/first-grapheme-cluster/test/test.js +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 first = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof first, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( first( '', 1 ), '', 'returns expected value' ); - t.strictEqual( first( '', 2 ), '', 'returns expected value' ); - t.strictEqual( first( '', 3 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided zero as the second argument', function test( t ) { - t.strictEqual( first( 'hello world', 0 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the first grapheme cluster of a provided string (ascii)', function test( t ) { - var out; - - out = first( 'hello world', 1 ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = first( '!!!', 1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = first( 'Hello World', 1 ); - t.strictEqual( out, 'H', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the first grapheme cluster of a provided string (Unicode)', function test( t ) { - var out; - - out = first( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'अ', 'returns expected value' ); - - out = first( '六书/六書', 1 ); - t.strictEqual( out, '六', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the first grapheme cluster of a provided string (emoji)', function test( t ) { - var out; - - out = first( '🌷', 1 ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - out = first( '🏝️🌷', 1 ); - t.strictEqual( out, '🏝️', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the first `n` grapheme clusters of a provided string', function test( t ) { - var out; - - out = first( 'hello world', 1 ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = first( 'hello world', 7 ); - t.strictEqual( out, 'hello w', 'returns expected value' ); - - out = first( '!!!', 1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = first( '!!!', 2 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = first( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'अ', 'returns expected value' ); - - out = first( '六书/六書', 1 ); - t.strictEqual( out, '六', 'returns expected value' ); - - out = first( '🌷🌷🌷🌷🌷', 2 ); - t.strictEqual( out, '🌷🌷', 'returns expected value' ); - - t.end(); -}); diff --git a/base/first/README.md b/base/first/README.md deleted file mode 100644 index 6d0a23e4..00000000 --- a/base/first/README.md +++ /dev/null @@ -1,116 +0,0 @@ - - -# first - -> Return the first `n` UTF-16 code units of a string. - -
- -## Usage - -```javascript -var first = require( '@stdlib/string/base/first' ); -``` - -#### first( str, n ) - -Returns the first `n` UTF-16 code units of a string. - -```javascript -var out = first( 'last man standing', 1 ); -// returns 'l' - -out = first( 'Hidden Treasures', 1 ); -// returns 'H' - -out = first( 'foo bar', 5 ); -// returns 'foo b' - -out = first( 'foo bar', 10 ); -// returns 'foo bar' -``` - -
- - - -
- -## Examples - - - -```javascript -var first = require( '@stdlib/string/base/first' ); - -var str = first( 'presidential election', 1 ); -// returns 'p' - -str = first( 'JavaScript', 1 ); -// returns 'J' - -str = first( 'The Last of the Mohicans', 5 ); -// returns 'The L' -``` - -
- - - - - - - - - - - - - - diff --git a/base/first/benchmark/benchmark.js b/base/first/benchmark/benchmark.js deleted file mode 100644 index fceaf9f5..00000000 --- a/base/first/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var first = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = first( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/first/docs/repl.txt b/base/first/docs/repl.txt deleted file mode 100644 index 451f9a96..00000000 --- a/base/first/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n ) - Returns the first `n` UTF-16 code units of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of UTF-16 code units to return. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 1 ) - 'b' - > out = {{alias}}( 'Boop', 1 ) - 'B' - > out = {{alias}}( 'foo bar', 5 ) - 'foo b' - - See Also - -------- - diff --git a/base/first/docs/types/index.d.ts b/base/first/docs/types/index.d.ts deleted file mode 100644 index bcb14721..00000000 --- a/base/first/docs/types/index.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns the first `n` UTF-16 code units of a string. -* -* @param str - input string -* @param n - number of code units to return -* @returns output string -* -* @example -* var out = first( 'last man standing', 1 ); -* // returns 'l' -* -* @example -* var out = first( 'presidential election', 1 ); -* // returns 'p' -* -* @example -* var out = first( 'JavaScript', 1 ); -* // returns 'J' -* -* @example -* var out = first( 'Hidden Treasures', 1 ); -* // returns 'H' -* -* @example -* var out = first( 'foo bar', 5 ); -* // returns 'foo b' -*/ -declare function first( str: string, n: number ): string; - - -// EXPORTS // - -export = first; diff --git a/base/first/docs/types/test.ts b/base/first/docs/types/test.ts deleted file mode 100644 index 7311e817..00000000 --- a/base/first/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import first = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - first( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - first( true, 1 ); // $ExpectError - first( false, 1 ); // $ExpectError - first( null, 1 ); // $ExpectError - first( undefined, 1 ); // $ExpectError - first( 5, 1 ); // $ExpectError - first( [], 1 ); // $ExpectError - first( {}, 1 ); // $ExpectError - first( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - first( 'abc', true ); // $ExpectError - first( 'abc', false ); // $ExpectError - first( 'abc', null ); // $ExpectError - first( 'abc', 'abc' ); // $ExpectError - first( 'abc', [] ); // $ExpectError - first( 'abc', {} ); // $ExpectError - first( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - first(); // $ExpectError - first( 'abc' ); // $ExpectError - first( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/first/examples/index.js b/base/first/examples/index.js deleted file mode 100644 index d33f94e1..00000000 --- a/base/first/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 first = require( './../lib' ); - -console.log( first( 'presidential election', 1 ) ); -// => 'p' - -console.log( first( 'JavaScript', 1 ) ); -// => 'J' - -console.log( first( 'The Last of the Mohicans', 5 ) ); -// => 'The L' diff --git a/base/first/lib/index.js b/base/first/lib/index.js deleted file mode 100644 index a437ff9c..00000000 --- a/base/first/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the first `n` UTF-16 code units of a string. -* -* @module @stdlib/string/base/first -* -* @example -* var first = require( '@stdlib/string/base/first' ); -* -* var out = first( 'last man standing', 1 ); -* // returns 'l' -* -* out = first( 'Hidden Treasures', 1 ); -* // returns 'H' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/first/lib/main.js b/base/first/lib/main.js deleted file mode 100644 index 4419b209..00000000 --- a/base/first/lib/main.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Returns the first `n` UTF-16 code units of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of UTF-16 code units to return -* @returns {string} output string -* -* @example -* var out = first( 'last man standing', 1 ); -* // returns 'l' -* -* @example -* var out = first( 'presidential election', 1 ); -* // returns 'p' -* -* @example -* var out = first( 'JavaScript', 1 ); -* // returns 'J' -* -* @example -* var out = first( 'Hidden Treasures', 1 ); -* // returns 'H' -*/ -function first( str, n ) { - return str.substring( 0, n ); -} - - -// EXPORTS // - -module.exports = first; diff --git a/base/first/package.json b/base/first/package.json deleted file mode 100644 index 99db1689..00000000 --- a/base/first/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/first", - "version": "0.0.0", - "description": "Return the first UTF-16 code unit of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "first", - "character", - "char", - "codeunit", - "unicode" - ] -} diff --git a/base/first/test/test.js b/base/first/test/test.js deleted file mode 100644 index e63248d9..00000000 --- a/base/first/test/test.js +++ /dev/null @@ -1,78 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 first = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof first, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( first( '', 1 ), '', 'returns expected value' ); - t.strictEqual( first( '', 2 ), '', 'returns expected value' ); - t.strictEqual( first( '', 3 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided zero as the second argument', function test( t ) { - t.strictEqual( first( 'hello world', 0 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the first UTF-16 code unit of a provided string', function test( t ) { - var out; - - out = first( 'hello world', 1 ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = first( '!!!', 1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = first( 'Hello World', 1 ); - t.strictEqual( out, 'H', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the first `n` UTF-16 code units of a provided string', function test( t ) { - var out; - - out = first( 'hello world', 1 ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = first( 'hello world', 7 ); - t.strictEqual( out, 'hello w', 'returns expected value' ); - - out = first( '!!!', 1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = first( '!!!', 2 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - t.end(); -}); diff --git a/base/for-each-code-point-right/README.md b/base/for-each-code-point-right/README.md deleted file mode 100644 index 8a0f0dbb..00000000 --- a/base/for-each-code-point-right/README.md +++ /dev/null @@ -1,161 +0,0 @@ - - -# forEachCodePointRight - -> Invokes a function for each Unicode code point in a string, iterating from right to left. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var forEachCodePointRight = require( '@stdlib/string/base/for-each-code-point-right' ); -``` - -#### forEachCodePointRight( str, clbk\[, thisArg ] ) - -Invokes a function for each Unicode code point in a string, iterating from right to left. - -```javascript -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachCodePointRight( 'Beep!', log ); -/* => - 4: ! - 3: p - 2: e - 1: e - 0: B -*/ -``` - -The invoked function is provided three arguments: - -- **value**: Unicode code point. -- **index**: starting Unicode code point index. -- **str**: input string. - -To set the function execution context, provide a `thisArg`. - -```javascript -function clbk() { - this.count += 1; -} - -var str = '👉🏿'; - -var ctx = { - 'count': 0 -}; - -forEachCodePointRight( str, clbk, ctx ); - -var cnt = ctx.count; -// returns 2 -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var forEachCodePointRight = require( '@stdlib/string/base/for-each-code-point-right' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachCodePointRight( 'presidential election', log ); -forEachCodePointRight( 'Iñtërnâtiônàlizætiøn', log ); -forEachCodePointRight( '🌷🍕', log ); -forEachCodePointRight( '\uD834\uDD1E', log ); -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/for-each-code-point-right/benchmark/benchmark.js b/base/for-each-code-point-right/benchmark/benchmark.js deleted file mode 100644 index 4445af7c..00000000 --- a/base/for-each-code-point-right/benchmark/benchmark.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var forEachRight = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Iñtërnâtiônàlizætiøn', - 'presidential election', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = forEachRight( values[ i%values.length ], clbk ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - if ( typeof v !== 'string' ) { - b.fail( 'unexpected value' ); - } - } -}); diff --git a/base/for-each-code-point-right/docs/repl.txt b/base/for-each-code-point-right/docs/repl.txt deleted file mode 100644 index b53326b0..00000000 --- a/base/for-each-code-point-right/docs/repl.txt +++ /dev/null @@ -1,38 +0,0 @@ - -{{alias}}( str, clbk[, thisArg] ) - Invokes a function for each Unicode code point in a string, iterating from - right to left. - - When invoked, the provided function is provided three arguments: - - - value: code point. - - index: starting code point index. - - str: input string. - - Parameters - ---------- - str: string - Input string over which to iterate. - - clbk: Function - The function to invoke for each Unicode code point in the input string. - - thisArg: any (optional) - Execution context. - - Returns - ------- - out: string - Input string. - - Examples - -------- - > var n = 0; - > function fcn() { n += 1; }; - > {{alias}}( 'hello world!', fcn ); - > n - 12 - - See Also - -------- - diff --git a/base/for-each-code-point-right/docs/types/index.d.ts b/base/for-each-code-point-right/docs/types/index.d.ts deleted file mode 100644 index a46e1099..00000000 --- a/base/for-each-code-point-right/docs/types/index.d.ts +++ /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. -*/ - -// TypeScript Version: 4.1 - -/** -* Callback invoked for each Unicode code point in a string. -* -* @returns result -*/ -type Nullary = ( this: T ) => any; - -/** -* Callback invoked for each Unicode code point in a string. -* -* @param value - code point -* @returns result -*/ -type Unary = ( this: T, value: string ) => any; - -/** -* Callback invoked for each Unicode code point in a string. -* -* @param value - code point -* @param index - starting code point index -* @returns result -*/ -type Binary = ( this: T, value: string, index: number ) => any; - -/** -* Callback invoked for each Unicode code point in a string. -* -* @param value - code point -* @param index - starting code point index -* @param str - input string -* @returns result -*/ -type Ternary = ( this: T, value: string, index: number, str: string ) => any; - -/** -* Callback invoked for each Unicode code point in a string. -* -* @param value - code point -* @param index - starting code point index -* @param str - input string -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Invokes a function for each Unicode code point in a string, iterating from right to left. -* -* ## Notes -* -* - When invoked, the provided function is provided three arguments: -* -* - **value**: code point. -* - **index**: starting code point index. -* - **str**: input string. -* -* @param str - input string -* @param clbk - function to invoke -* @param thisArg - execution context -* @returns input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEachRight( 'Hello, World!', log ); -*/ -declare function forEachRight( str: string, clbk: Callback, thisArg?: ThisParameterType> ): string; - - -// EXPORTS // - -export = forEachRight; diff --git a/base/for-each-code-point-right/docs/types/test.ts b/base/for-each-code-point-right/docs/types/test.ts deleted file mode 100644 index 17a3cc65..00000000 --- a/base/for-each-code-point-right/docs/types/test.ts +++ /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. -*/ - -import forEachRight = require( './index' ); - -/** -* Callback function. -* -* @param v - argument -* @returns result -*/ -function clbk( v: string ): string { - return v; -} - - -// TESTS // - -// The function returns a string... -{ - forEachRight( 'presidential election', clbk ); // $ExpectType string - forEachRight( 'Iñtërnâtiônàlizætiøn', clbk, {} ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - forEachRight( 1, clbk ); // $ExpectError - forEachRight( false, clbk ); // $ExpectError - forEachRight( true, clbk ); // $ExpectError - forEachRight( null, clbk ); // $ExpectError - forEachRight( [], clbk ); // $ExpectError - forEachRight( {}, clbk ); // $ExpectError - forEachRight( ( x: number ): number => x, clbk ); // $ExpectError - - forEachRight( 1, clbk, {} ); // $ExpectError - forEachRight( false, clbk, {} ); // $ExpectError - forEachRight( true, clbk, {} ); // $ExpectError - forEachRight( null, clbk, {} ); // $ExpectError - forEachRight( [], clbk, {} ); // $ExpectError - forEachRight( {}, clbk, {} ); // $ExpectError - forEachRight( ( x: number ): number => x, clbk, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a function having a supported signature... -{ - forEachRight( 'presidential election', 'abc' ); // $ExpectError - forEachRight( 'presidential election', 2 ); // $ExpectError - forEachRight( 'presidential election', true ); // $ExpectError - forEachRight( 'presidential election', false ); // $ExpectError - forEachRight( 'presidential election', null ); // $ExpectError - forEachRight( 'presidential election', {} ); // $ExpectError - forEachRight( 'presidential election', [] ); // $ExpectError - - forEachRight( 'presidential election', 'abc', {} ); // $ExpectError - forEachRight( 'presidential election', 2, {} ); // $ExpectError - forEachRight( 'presidential election', true, {} ); // $ExpectError - forEachRight( 'presidential election', false, {} ); // $ExpectError - forEachRight( 'presidential election', null, {} ); // $ExpectError - forEachRight( 'presidential election', {}, {} ); // $ExpectError - forEachRight( 'presidential election', [], {} ); // $ExpectError - - forEachRight( 'presidential election', ( x: number ): number => x ); // $ExpectError - forEachRight( 'presidential election', ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - forEachRight(); // $ExpectError - forEachRight( 'presidential election' ); // $ExpectError - forEachRight( 'presidential election', clbk, {}, 3 ); // $ExpectError -} diff --git a/base/for-each-code-point-right/examples/index.js b/base/for-each-code-point-right/examples/index.js deleted file mode 100644 index 43983ae4..00000000 --- a/base/for-each-code-point-right/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 forEachCodePointRight = require( './../lib' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachCodePointRight( 'presidential election', log ); -forEachCodePointRight( 'Iñtërnâtiônàlizætiøn', log ); -forEachCodePointRight( '🌷🍕', log ); -forEachCodePointRight( '\uD834\uDD1E', log ); diff --git a/base/for-each-code-point-right/lib/index.js b/base/for-each-code-point-right/lib/index.js deleted file mode 100644 index d6c94e17..00000000 --- a/base/for-each-code-point-right/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Invoke a function for each Unicode code point in a string, iterating from right to left. -* -* @module @stdlib/string/base/for-each-code-point-right -* -* @example -* var forEachRight = require( '@stdlib/string/base/for-each-code-point-right' ); -* -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEachRight( 'Hello', log ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/for-each-code-point-right/lib/main.js b/base/for-each-code-point-right/lib/main.js deleted file mode 100644 index 7459adf4..00000000 --- a/base/for-each-code-point-right/lib/main.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// VARIABLES // - -var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/; // TODO: replace with stdlib pkg -var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/; // TODO: replace with stdlib pkg - - -// MAIN // - -/** -* Invokes a function for each Unicode code point in a string, iterating from right to left. -* -* @param {string} str - input string -* @param {Function} clbk - function to invoke -* @param {*} [thisArg] - execution context -* @returns {string} input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEachRight( 'Hello', log ); -*/ -function forEachRight( str, clbk, thisArg ) { - var len; - var ch1; - var ch2; - var idx; - var ch; - var i; - - len = str.length; - - // Process the string one Unicode code unit at a time and handle UTF-16 surrogate pairs as a single Unicode code point... - for ( i = len-1; i >= 0; i-- ) { - ch1 = str[ i ]; - idx = i; - ch = ch1; - - // Check for a UTF-16 surrogate pair... - if ( i > 0 && RE_UTF16_LOW_SURROGATE.test( ch1 ) ) { - // Check whether the low surrogate is preceded by a high surrogate... - ch2 = str[ i-1 ]; - if ( RE_UTF16_HIGH_SURROGATE.test( ch2 ) ) { - // We found a surrogate pair: - ch = ch2 + ch1; - i -= 1; // decrement the index to process the next code unit - } - } - // Note: `ch` may be a lone surrogate (e.g., a high surrogate without a following low surrogate or a low surrogate at the start of the input string). - - // Invoke the callback with the code point: - clbk.call( thisArg, ch, idx, str ); - } - return str; -} - - -// EXPORTS // - -module.exports = forEachRight; diff --git a/base/for-each-code-point-right/package.json b/base/for-each-code-point-right/package.json deleted file mode 100644 index ebc9d09b..00000000 --- a/base/for-each-code-point-right/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/base/for-each-code-point-right", - "version": "0.0.0", - "description": "Invoke a function for each Unicode code point in a string, iterating from right to left.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdutils", - "stdutil", - "utilities", - "utility", - "utils", - "util", - "base", - "for", - "each", - "foreach", - "iterate", - "stdstring", - "string", - "str", - "unicode", - "reverse" - ] -} diff --git a/base/for-each-code-point-right/test/test.js b/base/for-each-code-point-right/test/test.js deleted file mode 100644 index 3f3f0c75..00000000 --- a/base/for-each-code-point-right/test/test.js +++ /dev/null @@ -1,165 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 noop = require( '@stdlib/utils/noop' ); -var forEachRight = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof forEachRight, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if provided an empty string, the function never invokes a provided function', function test( t ) { - var out = forEachRight( '', fcn ); - t.strictEqual( out, '', 'returns expected value' ); - t.end(); - - function fcn() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the function returns a provided string', function test( t ) { - var str; - var out; - - str = 'Hello, world'; - - out = forEachRight( str, noop ); - t.strictEqual( out, str, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function invokes a provided function for each Unicode code point of a provided string', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world'; - expected = [ - 'd', - 'l', - 'r', - 'o', - 'w', - ' ', - ',', - 'o', - 'l', - 'l', - 'e', - 'H' - ]; - - actual = []; - forEachRight( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each Unicode code point of the string (Unicode)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world \uD834\uDD1E'; - expected = [ - '\uD834\uDD1E', - ' ', - 'd', - 'l', - 'r', - 'o', - 'w', - ' ', - ',', - 'o', - 'l', - 'l', - 'e', - 'H' - ]; - - actual = []; - forEachRight( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each Unicode code point of the string (emoji)', function test( t ) { - var expected; - var actual; - var str; - - str = '🌷🍕👉🏿'; - expected = [ - '🏿', - '👉', - '🍕', - '🌷' - ]; - - actual = []; - forEachRight( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function supports providing an execution context', function test( t ) { - var ctx; - var str; - - str = 'Hello, world'; - ctx = { - 'count': 0 - }; - - forEachRight( str, count, ctx ); - - t.strictEqual( ctx.count, 12, 'returns expected value' ); - t.end(); - - function count() { - this.count += 1; // eslint-disable-line no-invalid-this - } -}); diff --git a/base/for-each-code-point/README.md b/base/for-each-code-point/README.md deleted file mode 100644 index 05f0e87f..00000000 --- a/base/for-each-code-point/README.md +++ /dev/null @@ -1,164 +0,0 @@ - - -# forEachCodePoint - -> Invokes a function for each Unicode code point in a string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var forEachCodePoint = require( '@stdlib/string/base/for-each-code-point' ); -``` - -#### forEachCodePoint( str, clbk\[, thisArg ] ) - -Invokes a function for each Unicode code point in a string. - -```javascript -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachCodePoint( 'Beep!', log ); -/* => - 0: B - 1: e - 2: e - 3: p - 4: ! -*/ -``` - -The invoked function is provided three arguments: - -- **value**: Unicode code point. -- **index**: starting Unicode code point index. -- **str**: input string. - -To set the function execution context, provide a `thisArg`. - -```javascript -function clbk() { - this.count += 1; -} - -var str = '👉🏿'; - -var ctx = { - 'count': 0 -}; - -forEachCodePoint( str, clbk, ctx ); - -var cnt = ctx.count; -// returns 2 -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var forEachCodePoint = require( '@stdlib/string/base/for-each-code-point' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachCodePoint( 'presidential election', log ); -forEachCodePoint( 'Iñtërnâtiônàlizætiøn', log ); -forEachCodePoint( '🌷🍕', log ); -forEachCodePoint( '\uD834\uDD1E', log ); -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/for-each-code-point/benchmark/benchmark.js b/base/for-each-code-point/benchmark/benchmark.js deleted file mode 100644 index f802ee4c..00000000 --- a/base/for-each-code-point/benchmark/benchmark.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var forEach = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Iñtërnâtiônàlizætiøn', - 'presidential election', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = forEach( values[ i%values.length ], clbk ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - if ( typeof v !== 'string' ) { - b.fail( 'unexpected value' ); - } - } -}); diff --git a/base/for-each-code-point/docs/repl.txt b/base/for-each-code-point/docs/repl.txt deleted file mode 100644 index a5d8e28e..00000000 --- a/base/for-each-code-point/docs/repl.txt +++ /dev/null @@ -1,37 +0,0 @@ - -{{alias}}( str, clbk[, thisArg] ) - Invokes a function for each Unicode code point in a string. - - When invoked, the provided function is provided three arguments: - - - value: code point. - - index: starting code point index. - - str: input string. - - Parameters - ---------- - str: string - Input string over which to iterate. - - clbk: Function - The function to invoke for each Unicode code point in the input string. - - thisArg: any (optional) - Execution context. - - Returns - ------- - out: string - Input string. - - Examples - -------- - > var n = 0; - > function fcn() { n += 1; }; - > {{alias}}( 'hello world!', fcn ); - > n - 12 - - See Also - -------- - diff --git a/base/for-each-code-point/docs/types/index.d.ts b/base/for-each-code-point/docs/types/index.d.ts deleted file mode 100644 index a941bbf4..00000000 --- a/base/for-each-code-point/docs/types/index.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Callback invoked for each Unicode code point in a string. -* -* @returns result -*/ -type Nullary = ( this: T ) => any; - -/** -* Callback invoked for each Unicode code point in a string. -* -* @param value - code point -* @returns result -*/ -type Unary = ( this: T, value: string ) => any; - -/** -* Callback invoked for each Unicode code point in a string. -* -* @param value - code point -* @param index - starting code point index -* @returns result -*/ -type Binary = ( this: T, value: string, index: number ) => any; - -/** -* Callback invoked for each Unicode code point in a string. -* -* @param value - code point -* @param index - starting code point index -* @param str - input string -* @returns result -*/ -type Ternary = ( this: T, value: string, index: number, str: string ) => any; - -/** -* Callback invoked for each Unicode code point in a string. -* -* @param value - code point -* @param index - starting code point index -* @param str - input string -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Invokes a function for each Unicode code point in a string. -* -* ## Notes -* -* - When invoked, the provided function is provided three arguments: -* -* - **value**: code point. -* - **index**: starting code point index. -* - **str**: input string. -* -* @param str - input string -* @param clbk - function to invoke -* @param thisArg - execution context -* @returns input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello, World!', log ); -*/ -declare function forEach( str: string, clbk: Callback, thisArg?: ThisParameterType> ): string; - - -// EXPORTS // - -export = forEach; diff --git a/base/for-each-code-point/docs/types/test.ts b/base/for-each-code-point/docs/types/test.ts deleted file mode 100644 index bceb6561..00000000 --- a/base/for-each-code-point/docs/types/test.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import forEach = require( './index' ); - -/** -* Callback function. -* -* @param v - argument -* @returns result -*/ -function clbk( v: string ): string { - return v; -} - - -// TESTS // - -// The function returns a string... -{ - forEach( 'presidential election', clbk ); // $ExpectType string - forEach( 'Iñtërnâtiônàlizætiøn', clbk, {} ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - forEach( 1, clbk ); // $ExpectError - forEach( false, clbk ); // $ExpectError - forEach( true, clbk ); // $ExpectError - forEach( null, clbk ); // $ExpectError - forEach( [], clbk ); // $ExpectError - forEach( {}, clbk ); // $ExpectError - forEach( ( x: number ): number => x, clbk ); // $ExpectError - - forEach( 1, clbk, {} ); // $ExpectError - forEach( false, clbk, {} ); // $ExpectError - forEach( true, clbk, {} ); // $ExpectError - forEach( null, clbk, {} ); // $ExpectError - forEach( [], clbk, {} ); // $ExpectError - forEach( {}, clbk, {} ); // $ExpectError - forEach( ( x: number ): number => x, clbk, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a function having a supported signature... -{ - forEach( 'presidential election', 'abc' ); // $ExpectError - forEach( 'presidential election', 2 ); // $ExpectError - forEach( 'presidential election', true ); // $ExpectError - forEach( 'presidential election', false ); // $ExpectError - forEach( 'presidential election', null ); // $ExpectError - forEach( 'presidential election', {} ); // $ExpectError - forEach( 'presidential election', [] ); // $ExpectError - - forEach( 'presidential election', 'abc', {} ); // $ExpectError - forEach( 'presidential election', 2, {} ); // $ExpectError - forEach( 'presidential election', true, {} ); // $ExpectError - forEach( 'presidential election', false, {} ); // $ExpectError - forEach( 'presidential election', null, {} ); // $ExpectError - forEach( 'presidential election', {}, {} ); // $ExpectError - forEach( 'presidential election', [], {} ); // $ExpectError - - forEach( 'presidential election', ( x: number ): number => x ); // $ExpectError - forEach( 'presidential election', ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - forEach(); // $ExpectError - forEach( 'presidential election' ); // $ExpectError - forEach( 'presidential election', clbk, {}, 3 ); // $ExpectError -} diff --git a/base/for-each-code-point/examples/index.js b/base/for-each-code-point/examples/index.js deleted file mode 100644 index 9bf78be8..00000000 --- a/base/for-each-code-point/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 forEachCodePoint = require( './../lib' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachCodePoint( 'presidential election', log ); -forEachCodePoint( 'Iñtërnâtiônàlizætiøn', log ); -forEachCodePoint( '🌷🍕', log ); -forEachCodePoint( '\uD834\uDD1E', log ); diff --git a/base/for-each-code-point/lib/index.js b/base/for-each-code-point/lib/index.js deleted file mode 100644 index 35f502d5..00000000 --- a/base/for-each-code-point/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Invoke a function for each Unicode code point in a string. -* -* @module @stdlib/string/base/for-each-code-point -* -* @example -* var forEach = require( '@stdlib/string/base/for-each-code-point' ); -* -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello', log ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/for-each-code-point/lib/main.js b/base/for-each-code-point/lib/main.js deleted file mode 100644 index 4dc0b5ab..00000000 --- a/base/for-each-code-point/lib/main.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// VARIABLES // - -var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/; // TODO: replace with stdlib pkg -var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/; // TODO: replace with stdlib pkg - - -// MAIN // - -/** -* Invokes a function for each Unicode code point in a string. -* -* @param {string} str - input string -* @param {Function} clbk - function to invoke -* @param {*} [thisArg] - execution context -* @returns {string} input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello', log ); -*/ -function forEach( str, clbk, thisArg ) { - var len; - var ch1; - var ch2; - var idx; - var ch; - var i; - - len = str.length; - - // Process the string one Unicode code unit at a time and handle UTF-16 surrogate pairs as a single Unicode code point... - for ( i = 0; i < len; i++ ) { - ch1 = str[ i ]; - idx = i; - ch = ch1; - - // Check for a UTF-16 surrogate pair... - if ( i < len-1 && RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) { - // Check whether the high surrogate is paired with a low surrogate... - ch2 = str[ i+1 ]; - if ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) { - // We found a surrogate pair: - ch += ch2; - i += 1; // bump the index to process the next code unit - } - } - // Note: `ch` may be a lone surrogate (e.g., a low surrogate without a preceding high surrogate or a high surrogate at the end of the input string). - - // Invoke the callback with the code point: - clbk.call( thisArg, ch, idx, str ); - } - return str; -} - - -// EXPORTS // - -module.exports = forEach; diff --git a/base/for-each-code-point/package.json b/base/for-each-code-point/package.json deleted file mode 100644 index 266d8f4f..00000000 --- a/base/for-each-code-point/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/base/for-each-code-point", - "version": "0.0.0", - "description": "Invoke a function for each Unicode code point in a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdutils", - "stdutil", - "utilities", - "utility", - "utils", - "util", - "base", - "for", - "each", - "foreach", - "iterate", - "stdstring", - "string", - "str", - "unicode" - ] -} diff --git a/base/for-each-code-point/test/test.js b/base/for-each-code-point/test/test.js deleted file mode 100644 index 0011798f..00000000 --- a/base/for-each-code-point/test/test.js +++ /dev/null @@ -1,165 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 noop = require( '@stdlib/utils/noop' ); -var forEach = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof forEach, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if provided an empty string, the function never invokes a provided function', function test( t ) { - var out = forEach( '', fcn ); - t.strictEqual( out, '', 'returns expected value' ); - t.end(); - - function fcn() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the function returns a provided string', function test( t ) { - var str; - var out; - - str = 'Hello, world'; - - out = forEach( str, noop ); - t.strictEqual( out, str, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function invokes a provided function for each Unicode code point of a provided string', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each Unicode code point of the string (Unicode)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world \uD834\uDD1E'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd', - ' ', - '\uD834\uDD1E' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each Unicode code point of the string (emoji)', function test( t ) { - var expected; - var actual; - var str; - - str = '🌷🍕👉🏿'; - expected = [ - '🌷', - '🍕', - '👉', - '🏿' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function supports providing an execution context', function test( t ) { - var ctx; - var str; - - str = 'Hello, world'; - ctx = { - 'count': 0 - }; - - forEach( str, count, ctx ); - - t.strictEqual( ctx.count, 12, 'returns expected value' ); - t.end(); - - function count() { - this.count += 1; // eslint-disable-line no-invalid-this - } -}); diff --git a/base/for-each-grapheme-cluster/README.md b/base/for-each-grapheme-cluster/README.md deleted file mode 100644 index 936b4c6f..00000000 --- a/base/for-each-grapheme-cluster/README.md +++ /dev/null @@ -1,164 +0,0 @@ - - -# forEachGraphemeCluster - -> Invokes a function for each grapheme cluster (i.e., user-perceived character) in a string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var forEachGraphemeCluster = require( '@stdlib/string/base/for-each-grapheme-cluster' ); -``` - -#### forEachGraphemeCluster( str, clbk\[, thisArg ] ) - -Invokes a function for each grapheme cluster (i.e., user-perceived character) in a string. - -```javascript -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachGraphemeCluster( 'Beep!', log ); -/* => - 0: B - 1: e - 2: e - 3: p - 4: ! -*/ -``` - -The invoked function is provided three arguments: - -- **value**: grapheme cluster. -- **index**: starting grapheme cluster index. -- **str**: input string. - -To set the function execution context, provide a `thisArg`. - -```javascript -function clbk() { - this.count += 1; -} - -var str = '👉🏿'; - -var ctx = { - 'count': 0 -}; - -forEachGraphemeCluster( str, clbk, ctx ); - -var cnt = ctx.count; -// returns 1 -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var forEachGraphemeCluster = require( '@stdlib/string/base/for-each-grapheme-cluster' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachGraphemeCluster( 'presidential election', log ); -forEachGraphemeCluster( 'Iñtërnâtiônàlizætiøn', log ); -forEachGraphemeCluster( '🌷🍕', log ); -forEachGraphemeCluster( '\uD834\uDD1E', log ); -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/for-each-grapheme-cluster/benchmark/benchmark.js b/base/for-each-grapheme-cluster/benchmark/benchmark.js deleted file mode 100644 index f802ee4c..00000000 --- a/base/for-each-grapheme-cluster/benchmark/benchmark.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var forEach = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Iñtërnâtiônàlizætiøn', - 'presidential election', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = forEach( values[ i%values.length ], clbk ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - if ( typeof v !== 'string' ) { - b.fail( 'unexpected value' ); - } - } -}); diff --git a/base/for-each-grapheme-cluster/docs/repl.txt b/base/for-each-grapheme-cluster/docs/repl.txt deleted file mode 100644 index bd760f82..00000000 --- a/base/for-each-grapheme-cluster/docs/repl.txt +++ /dev/null @@ -1,38 +0,0 @@ - -{{alias}}( str, clbk[, thisArg] ) - Invokes a function for each grapheme cluster (i.e., user-perceived - character) in a string. - - When invoked, the provided function is provided three arguments: - - - value: grapheme cluster. - - index: starting grapheme cluster index. - - str: input string. - - Parameters - ---------- - str: string - Input string over which to iterate. - - clbk: Function - The function to invoke for each grapheme cluster in the input string. - - thisArg: any (optional) - Execution context. - - Returns - ------- - out: string - Input string. - - Examples - -------- - > var n = 0; - > function fcn() { n += 1; }; - > {{alias}}( 'hello world!', fcn ); - > n - 12 - - See Also - -------- - diff --git a/base/for-each-grapheme-cluster/docs/types/index.d.ts b/base/for-each-grapheme-cluster/docs/types/index.d.ts deleted file mode 100644 index 9f4db9b6..00000000 --- a/base/for-each-grapheme-cluster/docs/types/index.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Callback invoked for each grapheme cluster (i.e., user-perceived character) in a string. -* -* @returns result -*/ -type Nullary = ( this: T ) => any; - -/** -* Callback invoked for each grapheme cluster (i.e., user-perceived character) in a string. -* -* @param value - grapheme cluster -* @returns result -*/ -type Unary = ( this: T, value: string ) => any; - -/** -* Callback invoked for each grapheme cluster (i.e., user-perceived character) in a string. -* -* @param value - grapheme cluster -* @param index - starting grapheme cluster index -* @returns result -*/ -type Binary = ( this: T, value: string, index: number ) => any; - -/** -* Callback invoked for each grapheme cluster (i.e., user-perceived character) in a string. -* -* @param value - grapheme cluster -* @param index - starting grapheme cluster index -* @param str - input string -* @returns result -*/ -type Ternary = ( this: T, value: string, index: number, str: string ) => any; - -/** -* Callback invoked for each grapheme cluster (i.e., user-perceived character) in a string. -* -* @param value - grapheme cluster -* @param index - starting grapheme cluster index -* @param str - input string -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Invokes a function for each grapheme cluster (i.e., user-perceived character) in a string. -* -* ## Notes -* -* - When invoked, the provided function is provided three arguments: -* -* - **value**: grapheme cluster. -* - **index**: starting grapheme cluster index. -* - **str**: input string. -* -* @param str - input string -* @param clbk - function to invoke -* @param thisArg - execution context -* @returns input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello, World!', log ); -*/ -declare function forEach( str: string, clbk: Callback, thisArg?: ThisParameterType> ): string; - - -// EXPORTS // - -export = forEach; diff --git a/base/for-each-grapheme-cluster/docs/types/test.ts b/base/for-each-grapheme-cluster/docs/types/test.ts deleted file mode 100644 index bceb6561..00000000 --- a/base/for-each-grapheme-cluster/docs/types/test.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import forEach = require( './index' ); - -/** -* Callback function. -* -* @param v - argument -* @returns result -*/ -function clbk( v: string ): string { - return v; -} - - -// TESTS // - -// The function returns a string... -{ - forEach( 'presidential election', clbk ); // $ExpectType string - forEach( 'Iñtërnâtiônàlizætiøn', clbk, {} ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - forEach( 1, clbk ); // $ExpectError - forEach( false, clbk ); // $ExpectError - forEach( true, clbk ); // $ExpectError - forEach( null, clbk ); // $ExpectError - forEach( [], clbk ); // $ExpectError - forEach( {}, clbk ); // $ExpectError - forEach( ( x: number ): number => x, clbk ); // $ExpectError - - forEach( 1, clbk, {} ); // $ExpectError - forEach( false, clbk, {} ); // $ExpectError - forEach( true, clbk, {} ); // $ExpectError - forEach( null, clbk, {} ); // $ExpectError - forEach( [], clbk, {} ); // $ExpectError - forEach( {}, clbk, {} ); // $ExpectError - forEach( ( x: number ): number => x, clbk, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a function having a supported signature... -{ - forEach( 'presidential election', 'abc' ); // $ExpectError - forEach( 'presidential election', 2 ); // $ExpectError - forEach( 'presidential election', true ); // $ExpectError - forEach( 'presidential election', false ); // $ExpectError - forEach( 'presidential election', null ); // $ExpectError - forEach( 'presidential election', {} ); // $ExpectError - forEach( 'presidential election', [] ); // $ExpectError - - forEach( 'presidential election', 'abc', {} ); // $ExpectError - forEach( 'presidential election', 2, {} ); // $ExpectError - forEach( 'presidential election', true, {} ); // $ExpectError - forEach( 'presidential election', false, {} ); // $ExpectError - forEach( 'presidential election', null, {} ); // $ExpectError - forEach( 'presidential election', {}, {} ); // $ExpectError - forEach( 'presidential election', [], {} ); // $ExpectError - - forEach( 'presidential election', ( x: number ): number => x ); // $ExpectError - forEach( 'presidential election', ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - forEach(); // $ExpectError - forEach( 'presidential election' ); // $ExpectError - forEach( 'presidential election', clbk, {}, 3 ); // $ExpectError -} diff --git a/base/for-each-grapheme-cluster/examples/index.js b/base/for-each-grapheme-cluster/examples/index.js deleted file mode 100644 index b93ac6cd..00000000 --- a/base/for-each-grapheme-cluster/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 forEachGraphemeCluster = require( './../lib' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachGraphemeCluster( 'presidential election', log ); -forEachGraphemeCluster( 'Iñtërnâtiônàlizætiøn', log ); -forEachGraphemeCluster( '🌷🍕', log ); -forEachGraphemeCluster( '\uD834\uDD1E', log ); diff --git a/base/for-each-grapheme-cluster/lib/index.js b/base/for-each-grapheme-cluster/lib/index.js deleted file mode 100644 index 96155d9d..00000000 --- a/base/for-each-grapheme-cluster/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Invoke a function for each grapheme cluster (i.e., user-perceived character) in a string. -* -* @module @stdlib/string/base/for-each-grapheme-cluster -* -* @example -* var forEach = require( '@stdlib/string/base/for-each-grapheme-cluster' ); -* -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello', log ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/for-each-grapheme-cluster/lib/main.js b/base/for-each-grapheme-cluster/lib/main.js deleted file mode 100644 index df9fd6dc..00000000 --- a/base/for-each-grapheme-cluster/lib/main.js +++ /dev/null @@ -1,64 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var nextGraphemeClusterBreak = require( './../../../next-grapheme-cluster-break' ); - - -// MAIN // - -/** -* Invokes a function for each grapheme cluster (i.e., user-perceived character) in a string. -* -* @param {string} str - input string -* @param {Function} clbk - function to invoke -* @param {*} [thisArg] - execution context -* @returns {string} input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello', log ); -*/ -function forEach( str, clbk, thisArg ) { - var len; - var idx; - var brk; - - len = str.length; - idx = 0; - while ( idx < len ) { - brk = nextGraphemeClusterBreak( str, idx ); - if ( brk === -1 ) { - brk = len; - } - clbk.call( thisArg, str.substring( idx, brk ), idx, str ); - idx = brk; - } - return str; -} - - -// EXPORTS // - -module.exports = forEach; diff --git a/base/for-each-grapheme-cluster/package.json b/base/for-each-grapheme-cluster/package.json deleted file mode 100644 index 547eeba7..00000000 --- a/base/for-each-grapheme-cluster/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/base/for-each-grapheme-cluster", - "version": "0.0.0", - "description": "Invoke a function for each grapheme cluster (i.e., user-perceived character) in a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdutils", - "stdutil", - "utilities", - "utility", - "utils", - "util", - "base", - "for", - "each", - "foreach", - "iterate", - "stdstring", - "string", - "str", - "grapheme", - "unicode" - ] -} diff --git a/base/for-each-grapheme-cluster/test/test.js b/base/for-each-grapheme-cluster/test/test.js deleted file mode 100644 index 1e917f4c..00000000 --- a/base/for-each-grapheme-cluster/test/test.js +++ /dev/null @@ -1,164 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 noop = require( '@stdlib/utils/noop' ); -var forEach = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof forEach, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if provided an empty string, the function never invokes a provided function', function test( t ) { - var out = forEach( '', fcn ); - t.strictEqual( out, '', 'returns expected value' ); - t.end(); - - function fcn() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the function returns a provided string', function test( t ) { - var str; - var out; - - str = 'Hello, world'; - - out = forEach( str, noop ); - t.strictEqual( out, str, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function invokes a provided function for each grapheme cluster of a provided string', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each grapheme cluster of the string (Unicode)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world \uD834\uDD1E'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd', - ' ', - '\uD834\uDD1E' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each grapheme cluster of the string (emoji)', function test( t ) { - var expected; - var actual; - var str; - - str = '🌷🍕👉🏿'; - expected = [ - '🌷', - '🍕', - '👉🏿' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function supports providing an execution context', function test( t ) { - var ctx; - var str; - - str = 'Hello, world'; - ctx = { - 'count': 0 - }; - - forEach( str, count, ctx ); - - t.strictEqual( ctx.count, 12, 'returns expected value' ); - t.end(); - - function count() { - this.count += 1; // eslint-disable-line no-invalid-this - } -}); diff --git a/base/for-each-right/README.md b/base/for-each-right/README.md deleted file mode 100644 index 81e8c3f0..00000000 --- a/base/for-each-right/README.md +++ /dev/null @@ -1,161 +0,0 @@ - - -# forEachRight - -> Invokes a function for each UTF-16 code unit in a string, iterating from right to left. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var forEachRight = require( '@stdlib/string/base/for-each-right' ); -``` - -#### forEachRight( str, clbk\[, thisArg ] ) - -Invokes a function for each UTF-16 code unit in a string, iterating from right to left. - -```javascript -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachRight( 'Beep!', log ); -/* => - 4: ! - 3: p - 2: e - 1: e - 0: B -*/ -``` - -The invoked function is provided three arguments: - -- **value**: character. -- **index**: character index. -- **str**: input string. - -To set the function execution context, provide a `thisArg`. - -```javascript -function clbk() { - this.count += 1; -} - -var str = '👉🏿'; - -var ctx = { - 'count': 0 -}; - -forEachRight( str, clbk, ctx ); - -var cnt = ctx.count; -// returns 4 -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var forEachRight = require( '@stdlib/string/base/for-each-right' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachRight( 'presidential election', log ); -forEachRight( 'Iñtërnâtiônàlizætiøn', log ); -forEachRight( '🌷🍕', log ); -forEachRight( '\uD834\uDD1E', log ); -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/for-each-right/benchmark/benchmark.js b/base/for-each-right/benchmark/benchmark.js deleted file mode 100644 index 4445af7c..00000000 --- a/base/for-each-right/benchmark/benchmark.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var forEachRight = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Iñtërnâtiônàlizætiøn', - 'presidential election', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = forEachRight( values[ i%values.length ], clbk ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - if ( typeof v !== 'string' ) { - b.fail( 'unexpected value' ); - } - } -}); diff --git a/base/for-each-right/docs/repl.txt b/base/for-each-right/docs/repl.txt deleted file mode 100644 index 758e99d4..00000000 --- a/base/for-each-right/docs/repl.txt +++ /dev/null @@ -1,38 +0,0 @@ - -{{alias}}( str, clbk[, thisArg] ) - Invokes a function for each UTF-16 code unit in a string, iterating from - right to left. - - When invoked, the provided function is provided three arguments: - - - value: character. - - index: character index. - - str: input string. - - Parameters - ---------- - str: string - Input string over which to iterate. - - clbk: Function - Function to invoke for each UTF-16 code unit in the input string. - - thisArg: any (optional) - Execution context. - - Returns - ------- - out: string - Input string. - - Examples - -------- - > var n = 0; - > function fcn() { n += 1; }; - > {{alias}}( 'hello world!', fcn ); - > n - 12 - - See Also - -------- - diff --git a/base/for-each-right/docs/types/index.d.ts b/base/for-each-right/docs/types/index.d.ts deleted file mode 100644 index 7bd162b1..00000000 --- a/base/for-each-right/docs/types/index.d.ts +++ /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. -*/ - -// TypeScript Version: 4.1 - -/** -* Callback invoked for each UTF-16 code unit in a string. -* -* @returns result -*/ -type Nullary = ( this: T ) => any; - -/** -* Callback invoked for each UTF-16 code unit in a string. -* -* @param value - character -* @returns result -*/ -type Unary = ( this: T, value: string ) => any; - -/** -* Callback invoked for each UTF-16 code unit in a string. -* -* @param value - character -* @param index - character index -* @returns result -*/ -type Binary = ( this: T, value: string, index: number ) => any; - -/** -* Callback invoked for each UTF-16 code unit in a string. -* -* @param value - character -* @param index - character index -* @param str - input string -* @returns result -*/ -type Ternary = ( this: T, value: string, index: number, str: string ) => any; - -/** -* Callback invoked for each UTF-16 code unit in a string. -* -* @param value - character -* @param index - character index -* @param str - input string -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Invokes a function for each UTF-16 code unit in a string, iterating from right to left. -* -* ## Notes -* -* - When invoked, the provided function is provided three arguments: -* -* - **value**: character. -* - **index**: character index. -* - **str**: input string. -* -* @param str - input string -* @param clbk - function to invoke -* @param thisArg - execution context -* @returns input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEachRight( 'Hello, World!', log ); -*/ -declare function forEachRight( str: string, clbk: Callback, thisArg?: ThisParameterType> ): string; - - -// EXPORTS // - -export = forEachRight; diff --git a/base/for-each-right/docs/types/test.ts b/base/for-each-right/docs/types/test.ts deleted file mode 100644 index 17a3cc65..00000000 --- a/base/for-each-right/docs/types/test.ts +++ /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. -*/ - -import forEachRight = require( './index' ); - -/** -* Callback function. -* -* @param v - argument -* @returns result -*/ -function clbk( v: string ): string { - return v; -} - - -// TESTS // - -// The function returns a string... -{ - forEachRight( 'presidential election', clbk ); // $ExpectType string - forEachRight( 'Iñtërnâtiônàlizætiøn', clbk, {} ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - forEachRight( 1, clbk ); // $ExpectError - forEachRight( false, clbk ); // $ExpectError - forEachRight( true, clbk ); // $ExpectError - forEachRight( null, clbk ); // $ExpectError - forEachRight( [], clbk ); // $ExpectError - forEachRight( {}, clbk ); // $ExpectError - forEachRight( ( x: number ): number => x, clbk ); // $ExpectError - - forEachRight( 1, clbk, {} ); // $ExpectError - forEachRight( false, clbk, {} ); // $ExpectError - forEachRight( true, clbk, {} ); // $ExpectError - forEachRight( null, clbk, {} ); // $ExpectError - forEachRight( [], clbk, {} ); // $ExpectError - forEachRight( {}, clbk, {} ); // $ExpectError - forEachRight( ( x: number ): number => x, clbk, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a function having a supported signature... -{ - forEachRight( 'presidential election', 'abc' ); // $ExpectError - forEachRight( 'presidential election', 2 ); // $ExpectError - forEachRight( 'presidential election', true ); // $ExpectError - forEachRight( 'presidential election', false ); // $ExpectError - forEachRight( 'presidential election', null ); // $ExpectError - forEachRight( 'presidential election', {} ); // $ExpectError - forEachRight( 'presidential election', [] ); // $ExpectError - - forEachRight( 'presidential election', 'abc', {} ); // $ExpectError - forEachRight( 'presidential election', 2, {} ); // $ExpectError - forEachRight( 'presidential election', true, {} ); // $ExpectError - forEachRight( 'presidential election', false, {} ); // $ExpectError - forEachRight( 'presidential election', null, {} ); // $ExpectError - forEachRight( 'presidential election', {}, {} ); // $ExpectError - forEachRight( 'presidential election', [], {} ); // $ExpectError - - forEachRight( 'presidential election', ( x: number ): number => x ); // $ExpectError - forEachRight( 'presidential election', ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - forEachRight(); // $ExpectError - forEachRight( 'presidential election' ); // $ExpectError - forEachRight( 'presidential election', clbk, {}, 3 ); // $ExpectError -} diff --git a/base/for-each-right/examples/index.js b/base/for-each-right/examples/index.js deleted file mode 100644 index 781f8a45..00000000 --- a/base/for-each-right/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 forEachRight = require( './../lib' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEachRight( 'presidential election', log ); -forEachRight( 'Iñtërnâtiônàlizætiøn', log ); -forEachRight( '🌷🍕', log ); -forEachRight( '\uD834\uDD1E', log ); diff --git a/base/for-each-right/lib/index.js b/base/for-each-right/lib/index.js deleted file mode 100644 index 5dc53b64..00000000 --- a/base/for-each-right/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Invoke a function for each UTF-16 code unit in a string, iterating from right to left. -* -* @module @stdlib/string/base/for-each-right -* -* @example -* var forEachRight = require( '@stdlib/string/base/for-each-right' ); -* -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEachRight( 'Hello', log ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/for-each-right/lib/main.js b/base/for-each-right/lib/main.js deleted file mode 100644 index 604004ff..00000000 --- a/base/for-each-right/lib/main.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Invokes a function for each UTF-16 code unit in a string, iterating from right to left. -* -* @param {string} str - input string -* @param {Function} clbk - function to invoke -* @param {*} [thisArg] - execution context -* @returns {string} input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEachRight( 'Hello', log ); -*/ -function forEachRight( str, clbk, thisArg ) { - var i; - for ( i = str.length-1; i >= 0; i-- ) { - clbk.call( thisArg, str[ i ], i, str ); - } - return str; -} - - -// EXPORTS // - -module.exports = forEachRight; diff --git a/base/for-each-right/package.json b/base/for-each-right/package.json deleted file mode 100644 index eea5c85c..00000000 --- a/base/for-each-right/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@stdlib/string/base/for-each-right", - "version": "0.0.0", - "description": "Invoke a function for each UTF-16 code unit in a string, iterating from right to left.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdutils", - "stdutil", - "utilities", - "utility", - "utils", - "util", - "base", - "for", - "each", - "foreachright", - "iterate", - "stdstring", - "string", - "str", - "utf16", - "utf-16", - "reverse" - ] -} diff --git a/base/for-each-right/test/test.js b/base/for-each-right/test/test.js deleted file mode 100644 index 03155a30..00000000 --- a/base/for-each-right/test/test.js +++ /dev/null @@ -1,170 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 noop = require( '@stdlib/utils/noop' ); -var forEachRight = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof forEachRight, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if provided an empty string, the function never invokes a provided function', function test( t ) { - var out = forEachRight( '', fcn ); - t.strictEqual( out, '', 'returns expected value' ); - t.end(); - - function fcn() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the function returns a provided string', function test( t ) { - var str; - var out; - - str = 'Hello, world'; - - out = forEachRight( str, noop ); - t.strictEqual( out, str, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function invokes a provided function for each UTF-16 code unit in a provided string', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world'; - expected = [ - 'd', - 'l', - 'r', - 'o', - 'w', - ' ', - ',', - 'o', - 'l', - 'l', - 'e', - 'H' - ]; - - actual = []; - forEachRight( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each UTF-16 code unit in a provided string (Unicode)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world \uD834\uDD1E'; - expected = [ - '\uDD1E', - '\uD834', - ' ', - 'd', - 'l', - 'r', - 'o', - 'w', - ' ', - ',', - 'o', - 'l', - 'l', - 'e', - 'H' - ]; - - actual = []; - forEachRight( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each UTF-16 code unit in a provided string (emoji)', function test( t ) { - var expected; - var actual; - var str; - - str = '🌷🍕👉🏿'; - expected = [ - '\uDFFF', - '\uD83C', - '\uDC49', - '\uD83D', - '\uDF55', - '\uD83C', - '\uDF37', - '\uD83C' - ]; - - actual = []; - forEachRight( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function supports providing an execution context', function test( t ) { - var ctx; - var str; - - str = 'Hello, world'; - ctx = { - 'count': 0 - }; - - forEachRight( str, count, ctx ); - - t.strictEqual( ctx.count, 12, 'returns expected value' ); - t.end(); - - function count() { - this.count += 1; // eslint-disable-line no-invalid-this - } -}); diff --git a/base/for-each/README.md b/base/for-each/README.md deleted file mode 100644 index 0d40585d..00000000 --- a/base/for-each/README.md +++ /dev/null @@ -1,164 +0,0 @@ - - -# forEach - -> Invokes a function for each UTF-16 code unit in a string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var forEach = require( '@stdlib/string/base/for-each' ); -``` - -#### forEach( str, clbk\[, thisArg ] ) - -Invokes a function for each UTF-16 code unit in a string. - -```javascript -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEach( 'Beep!', log ); -/* => - 0: B - 1: e - 2: e - 3: p - 4: ! -*/ -``` - -The invoked function is provided three arguments: - -- **value**: character. -- **index**: character index. -- **str**: input string. - -To set the function execution context, provide a `thisArg`. - -```javascript -function clbk() { - this.count += 1; -} - -var str = '👉🏿'; - -var ctx = { - 'count': 0 -}; - -forEach( str, clbk, ctx ); - -var cnt = ctx.count; -// returns 4 -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var forEach = require( '@stdlib/string/base/for-each' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEach( 'presidential election', log ); -forEach( 'Iñtërnâtiônàlizætiøn', log ); -forEach( '🌷🍕', log ); -forEach( '\uD834\uDD1E', log ); -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/for-each/benchmark/benchmark.js b/base/for-each/benchmark/benchmark.js deleted file mode 100644 index f802ee4c..00000000 --- a/base/for-each/benchmark/benchmark.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var forEach = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Iñtërnâtiônàlizætiøn', - 'presidential election', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = forEach( values[ i%values.length ], clbk ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - if ( typeof v !== 'string' ) { - b.fail( 'unexpected value' ); - } - } -}); diff --git a/base/for-each/docs/repl.txt b/base/for-each/docs/repl.txt deleted file mode 100644 index 4340d87c..00000000 --- a/base/for-each/docs/repl.txt +++ /dev/null @@ -1,37 +0,0 @@ - -{{alias}}( str, clbk[, thisArg] ) - Invokes a function for each UTF-16 code unit in a string. - - When invoked, the provided function is provided three arguments: - - - value: character. - - index: character index. - - str: input string. - - Parameters - ---------- - str: string - Input string over which to iterate. - - clbk: Function - The function to invoke for each UTF-16 code unit in the input string. - - thisArg: any (optional) - Execution context. - - Returns - ------- - out: string - Input string. - - Examples - -------- - > var n = 0; - > function fcn() { n += 1; }; - > {{alias}}( 'hello world!', fcn ); - > n - 12 - - See Also - -------- - diff --git a/base/for-each/docs/types/index.d.ts b/base/for-each/docs/types/index.d.ts deleted file mode 100644 index 467651af..00000000 --- a/base/for-each/docs/types/index.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Callback invoked for each UTF-16 code unit in a string. -* -* @returns result -*/ -type Nullary = ( this: T ) => any; - -/** -* Callback invoked for each UTF-16 code unit in a string. -* -* @param value - character -* @returns result -*/ -type Unary = ( this: T, value: string ) => any; - -/** -* Callback invoked for each UTF-16 code unit in a string. -* -* @param value - character -* @param index - character index -* @returns result -*/ -type Binary = ( this: T, value: string, index: number ) => any; - -/** -* Callback invoked for each UTF-16 code unit in a string. -* -* @param value - character -* @param index - character index -* @param str - input string -* @returns result -*/ -type Ternary = ( this: T, value: string, index: number, str: string ) => any; - -/** -* Callback invoked for each UTF-16 code unit in a string. -* -* @param value - character -* @param index - character index -* @param str - input string -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Invokes a function for each UTF-16 code unit in a string. -* -* ## Notes -* -* - When invoked, the provided function is provided three arguments: -* -* - **value**: character. -* - **index**: character index. -* - **str**: input string. -* -* @param str - input string -* @param clbk - function to invoke -* @param thisArg - execution context -* @returns input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello, World!', log ); -*/ -declare function forEach( str: string, clbk: Callback, thisArg?: ThisParameterType> ): string; - - -// EXPORTS // - -export = forEach; diff --git a/base/for-each/docs/types/test.ts b/base/for-each/docs/types/test.ts deleted file mode 100644 index bceb6561..00000000 --- a/base/for-each/docs/types/test.ts +++ /dev/null @@ -1,86 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import forEach = require( './index' ); - -/** -* Callback function. -* -* @param v - argument -* @returns result -*/ -function clbk( v: string ): string { - return v; -} - - -// TESTS // - -// The function returns a string... -{ - forEach( 'presidential election', clbk ); // $ExpectType string - forEach( 'Iñtërnâtiônàlizætiøn', clbk, {} ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - forEach( 1, clbk ); // $ExpectError - forEach( false, clbk ); // $ExpectError - forEach( true, clbk ); // $ExpectError - forEach( null, clbk ); // $ExpectError - forEach( [], clbk ); // $ExpectError - forEach( {}, clbk ); // $ExpectError - forEach( ( x: number ): number => x, clbk ); // $ExpectError - - forEach( 1, clbk, {} ); // $ExpectError - forEach( false, clbk, {} ); // $ExpectError - forEach( true, clbk, {} ); // $ExpectError - forEach( null, clbk, {} ); // $ExpectError - forEach( [], clbk, {} ); // $ExpectError - forEach( {}, clbk, {} ); // $ExpectError - forEach( ( x: number ): number => x, clbk, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a function having a supported signature... -{ - forEach( 'presidential election', 'abc' ); // $ExpectError - forEach( 'presidential election', 2 ); // $ExpectError - forEach( 'presidential election', true ); // $ExpectError - forEach( 'presidential election', false ); // $ExpectError - forEach( 'presidential election', null ); // $ExpectError - forEach( 'presidential election', {} ); // $ExpectError - forEach( 'presidential election', [] ); // $ExpectError - - forEach( 'presidential election', 'abc', {} ); // $ExpectError - forEach( 'presidential election', 2, {} ); // $ExpectError - forEach( 'presidential election', true, {} ); // $ExpectError - forEach( 'presidential election', false, {} ); // $ExpectError - forEach( 'presidential election', null, {} ); // $ExpectError - forEach( 'presidential election', {}, {} ); // $ExpectError - forEach( 'presidential election', [], {} ); // $ExpectError - - forEach( 'presidential election', ( x: number ): number => x ); // $ExpectError - forEach( 'presidential election', ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - forEach(); // $ExpectError - forEach( 'presidential election' ); // $ExpectError - forEach( 'presidential election', clbk, {}, 3 ); // $ExpectError -} diff --git a/base/for-each/examples/index.js b/base/for-each/examples/index.js deleted file mode 100644 index 354f8ea5..00000000 --- a/base/for-each/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 forEach = require( './../lib' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEach( 'presidential election', log ); -forEach( 'Iñtërnâtiônàlizætiøn', log ); -forEach( '🌷🍕', log ); -forEach( '\uD834\uDD1E', log ); diff --git a/base/for-each/lib/index.js b/base/for-each/lib/index.js deleted file mode 100644 index 8cc87e5b..00000000 --- a/base/for-each/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Invoke a function for each UTF-16 code unit in a string. -* -* @module @stdlib/string/base/for-each -* -* @example -* var forEach = require( '@stdlib/string/base/for-each' ); -* -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello', log ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/for-each/lib/main.js b/base/for-each/lib/main.js deleted file mode 100644 index 0d115151..00000000 --- a/base/for-each/lib/main.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Invokes a function for each UTF-16 code unit in a string. -* -* @param {string} str - input string -* @param {Function} clbk - function to invoke -* @param {*} [thisArg] - execution context -* @returns {string} input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello', log ); -*/ -function forEach( str, clbk, thisArg ) { - var i; - for ( i = 0; i < str.length; i++ ) { - clbk.call( thisArg, str[ i ], i, str ); - } - return str; -} - - -// EXPORTS // - -module.exports = forEach; diff --git a/base/for-each/package.json b/base/for-each/package.json deleted file mode 100644 index dafc9bd6..00000000 --- a/base/for-each/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/base/for-each", - "version": "0.0.0", - "description": "Invoke a function for each UTF-16 code unit in a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdutils", - "stdutil", - "utilities", - "utility", - "utils", - "util", - "base", - "for", - "each", - "foreach", - "iterate", - "stdstring", - "string", - "str", - "utf16", - "utf-16" - ] -} diff --git a/base/for-each/test/test.js b/base/for-each/test/test.js deleted file mode 100644 index 3c76f1e2..00000000 --- a/base/for-each/test/test.js +++ /dev/null @@ -1,170 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 noop = require( '@stdlib/utils/noop' ); -var forEach = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof forEach, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if provided an empty string, the function never invokes a provided function', function test( t ) { - var out = forEach( '', fcn ); - t.strictEqual( out, '', 'returns expected value' ); - t.end(); - - function fcn() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the function returns a provided string', function test( t ) { - var str; - var out; - - str = 'Hello, world'; - - out = forEach( str, noop ); - t.strictEqual( out, str, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function invokes a provided function for each UTF-16 code unit in a provided string', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each UTF-16 code unit in a provided string (Unicode)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world \uD834\uDD1E'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd', - ' ', - '\uD834', - '\uDD1E' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each UTF-16 code unit in a provided string (emoji)', function test( t ) { - var expected; - var actual; - var str; - - str = '🌷🍕👉🏿'; - expected = [ - '\uD83C', - '\uDF37', - '\uD83C', - '\uDF55', - '\uD83D', - '\uDC49', - '\uD83C', - '\uDFFF' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function supports providing an execution context', function test( t ) { - var ctx; - var str; - - str = 'Hello, world'; - ctx = { - 'count': 0 - }; - - forEach( str, count, ctx ); - - t.strictEqual( ctx.count, 12, 'returns expected value' ); - t.end(); - - function count() { - this.count += 1; // eslint-disable-line no-invalid-this - } -}); diff --git a/base/format-interpolate/README.md b/base/format-interpolate/README.md deleted file mode 100644 index d4e6f9b0..00000000 --- a/base/format-interpolate/README.md +++ /dev/null @@ -1,128 +0,0 @@ - - -# formatInterpolate - -> Generate string from a token array by interpolating values. - -
- -
- - - -
- -## Usage - -```javascript -var formatInterpolate = require( '@stdlib/string/base/format-interpolate' ); -``` - -#### formatInterpolate( tokens, ...args ) - -Generates string from a token array by interpolating values. - -```javascript -var formatTokenize = require( '@stdlib/string/base/format-tokenize' ); - -var str = 'Hello, %s! My name is %s.'; -var tokens = formatTokenize( str ); -var out = formatInterpolate( tokens, 'World', 'Bob' ); -// returns 'Hello, World! My name is Bob.' -``` - -The array of `tokens` should contain string parts and format identifier objects. - -```javascript -var tokens = [ 'beep ', { 'specifier': 's' } ]; -var out = formatInterpolate( tokens, 'boop' ); -// returns 'beep boop' -``` - -Format identifier objects can have the following properties: - -| property | description | -| --------- | --------------------------------------------------------------------------------------------------- | -| specifier | format specifier (one of 's', 'c', 'd', 'i', 'u', 'b', 'o', 'x', 'X', 'e', 'E', 'f', 'F', 'g', 'G') | -| flags | format flags (string with any of '0', ' ', '+', '-', '#') | -| width | minimum field width (integer or `'*'`) | -| precision | precision (integer or `'*'`) | -| mapping | positional mapping from format specifier to argument index | - -
- - - -
- -## Examples - - - -```javascript -var formatTokenize = require( '@stdlib/string/base/format-tokenize' ); -var PI = require( '@stdlib/constants/float64/pi' ); -var formatInterpolate = require( '@stdlib/string/base/format-interpolate' ); - -var tokens = formatTokenize( 'Hello %s!' ); -var out = formatInterpolate( tokens, 'World' ); -// returns 'Hello World!' - -tokens = formatTokenize( 'Pi: ~%.2f' ); -out = formatInterpolate( tokens, PI ); -// returns 'Pi: ~3.14' - -tokens = formatTokenize( 'Index: %d, Value: %s' ); -out = formatInterpolate( tokens, 0, 'foo' ); -// returns 'Index: 0, Value: foo' -``` - -
- - - - - - - - - - - - - - diff --git a/base/format-interpolate/benchmark/benchmark.js b/base/format-interpolate/benchmark/benchmark.js deleted file mode 100644 index fea355a7..00000000 --- a/base/format-interpolate/benchmark/benchmark.js +++ /dev/null @@ -1,79 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var formatTokenize = require( './../../../base/format-tokenize' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var formatInterpolate = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var tokens; - var out; - var str; - var i; - - str = '%s %s!'; - tokens = formatTokenize( str ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = formatInterpolate( tokens, 'Hello', 'World' ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::positional', pkg ), function benchmark( b ) { - var tokens; - var out; - var str; - var i; - - str = '%2$s %1$s!'; - tokens = formatTokenize( str ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = formatInterpolate( tokens, 'World', 'Hello' ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/format-interpolate/docs/repl.txt b/base/format-interpolate/docs/repl.txt deleted file mode 100644 index a7a69f06..00000000 --- a/base/format-interpolate/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( tokens, ...args ) - Generate string from a token array by interpolating values. - - Parameters - ---------- - tokens: Array - Array of string parts and format identifier objects. - - args: ...any - Variable values. - - Returns - ------- - out: string - Formatted string. - - Examples - -------- - > var out = {{alias}}( [ 'beep ', { 'specifier': 's' } ], 'boop' ) - 'beep boop' - > out = {{alias}}( [ 'baz ', { 'specifier': 'd', 'precision': 2 } ], 1 ) - 'baz 1.00' - > out = {{alias}}( [ { 'specifier': 'u', 'width': 6 } ], 12 ) - ' 12' - - See Also - -------- - diff --git a/base/format-interpolate/docs/types/index.d.ts b/base/format-interpolate/docs/types/index.d.ts deleted file mode 100644 index f66d129b..00000000 --- a/base/format-interpolate/docs/types/index.d.ts +++ /dev/null @@ -1,71 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Format identifier object. -*/ -interface FormatIdentifier { - /** - * Format specifier (one of 's', 'c', 'd', 'i', 'u', 'b', 'o', 'x', 'X', 'e', 'E', 'f', 'F', 'g', 'G'). - */ - specifier: string; - - /** - * Flags. - */ - flags?: string; - - /** - * Minimum field width (integer or `'*'`). - */ - width?: string; - - /** - * Precision (integer or `'*'`). - */ - precision?: string; - - /** - * Positional mapping from format specifier to argument index. - */ - mapping?: number; -} - -type StringOrToken = string | FormatIdentifier; - -/** -* Generates string from a token array by interpolating values. -* -* @param tokens - string parts and format identifier objects -* @param args - variable values -* @throws invalid flags -* @returns formatted string -* -* @example -* var tokens = [ 'beep ', { 'specifier': 's' } ]; -* var out = formatInterpolate( tokens, 'boop' ); -* // returns 'beep boop' -*/ -declare function formatInterpolate( tokens: Array, ...args: Array ): string; - - -// EXPORTS // - -export = formatInterpolate; diff --git a/base/format-interpolate/docs/types/test.ts b/base/format-interpolate/docs/types/test.ts deleted file mode 100644 index c495d812..00000000 --- a/base/format-interpolate/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import formatInterpolate = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - formatInterpolate( [ 'beep ', { 'specifier': 's' }], 'boop' ); // $ExpectType string - formatInterpolate( [] ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument other than an array... -{ - formatInterpolate( 'abc' ); // $ExpectError - formatInterpolate( true ); // $ExpectError - formatInterpolate( false ); // $ExpectError - formatInterpolate( null ); // $ExpectError - formatInterpolate( undefined ); // $ExpectError - formatInterpolate( 5 ); // $ExpectError - formatInterpolate( {} ); // $ExpectError - formatInterpolate( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - formatInterpolate(); // $ExpectError -} diff --git a/base/format-interpolate/examples/index.js b/base/format-interpolate/examples/index.js deleted file mode 100644 index b5b04a6d..00000000 --- a/base/format-interpolate/examples/index.js +++ /dev/null @@ -1,38 +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. -*/ - -'use strict'; - -var formatTokenize = require( './../../../base/format-tokenize' ); -var PI = require( '@stdlib/constants/float64/pi' ); -var formatInterpolate = require( './../lib' ); - -var tokens = formatTokenize( 'Hello %s!' ); -var out = formatInterpolate( tokens, 'World' ); -console.log( out ); -// => 'Hello World!' - -tokens = formatTokenize( 'Pi: ~%.2f' ); -out = formatInterpolate( tokens, PI ); -console.log( out ); -// => 'Pi: ~3.14' - -tokens = formatTokenize( 'Index: %d, Value: %s' ); -out = formatInterpolate( tokens, 0, 'foo' ); -console.log( out ); -// => 'Index: 0, Value: foo' diff --git a/base/format-interpolate/lib/format_double.js b/base/format-interpolate/lib/format_double.js deleted file mode 100644 index e6d3d9eb..00000000 --- a/base/format-interpolate/lib/format_double.js +++ /dev/null @@ -1,103 +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. -*/ - -'use strict'; - -// MODULES // - -// NOTE: for the following, we explicitly avoid using stdlib packages in this particular package in order to avoid circular dependencies. -var abs = Math.abs; // eslint-disable-line stdlib/no-builtin-math -var lowercase = String.prototype.toLowerCase; -var uppercase = String.prototype.toUpperCase; -var replace = String.prototype.replace; - - -// VARIABLES // - -var RE_EXP_POS_DIGITS = /e\+(\d)$/; -var RE_EXP_NEG_DIGITS = /e-(\d)$/; -var RE_ONLY_DIGITS = /^(\d+)$/; -var RE_DIGITS_BEFORE_EXP = /^(\d+)e/; -var RE_TRAILING_PERIOD_ZERO = /\.0$/; -var RE_PERIOD_ZERO_EXP = /\.0*e/; -var RE_ZERO_BEFORE_EXP = /(\..*[^0])0*e/; - - -// MAIN // - -/** -* Formats a token object argument as a floating-point number. -* -* @private -* @param {number} f - parsed number -* @param {Object} token - token object -* @throws {Error} must provide a valid floating-point number -* @returns {string} formatted token argument -*/ -function formatDouble( f, token ) { - var digits; - var out; - - switch ( token.specifier ) { - case 'e': - case 'E': - out = f.toExponential( token.precision ); - break; - case 'f': - case 'F': - out = f.toFixed( token.precision ); - break; - case 'g': - case 'G': - if ( abs( f ) < 0.0001 ) { - digits = token.precision; - if ( digits > 0 ) { - digits -= 1; - } - out = f.toExponential( digits ); - } else { - out = f.toPrecision( token.precision ); - } - if ( !token.alternate ) { - out = replace.call( out, RE_ZERO_BEFORE_EXP, '$1e' ); - out = replace.call( out, RE_PERIOD_ZERO_EXP, 'e' ); - out = replace.call( out, RE_TRAILING_PERIOD_ZERO, '' ); - } - break; - default: - throw new Error( 'invalid double notation. Value: ' + token.specifier ); - } - out = replace.call( out, RE_EXP_POS_DIGITS, 'e+0$1' ); - out = replace.call( out, RE_EXP_NEG_DIGITS, 'e-0$1' ); - if ( token.alternate ) { - out = replace.call( out, RE_ONLY_DIGITS, '$1.' ); - out = replace.call( out, RE_DIGITS_BEFORE_EXP, '$1.e' ); - } - if ( f >= 0 && token.sign ) { - out = token.sign + out; - } - out = ( token.specifier === uppercase.call( token.specifier ) ) ? - uppercase.call( out ) : - lowercase.call( out ); - return out; -} - - -// EXPORTS // - -module.exports = formatDouble; diff --git a/base/format-interpolate/lib/format_integer.js b/base/format-interpolate/lib/format_integer.js deleted file mode 100644 index f16a61e4..00000000 --- a/base/format-interpolate/lib/format_integer.js +++ /dev/null @@ -1,115 +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. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( './is_number.js' ); -var zeroPad = require( './zero_pad.js' ); - -// NOTE: for the following, we explicitly avoid using stdlib packages in this particular package in order to avoid circular dependencies. -var lowercase = String.prototype.toLowerCase; -var uppercase = String.prototype.toUpperCase; - - -// MAIN // - -/** -* Formats a token object argument as an integer. -* -* @private -* @param {Object} token - token object -* @throws {Error} must provide a valid integer -* @returns {string} formatted token argument -*/ -function formatInteger( token ) { - var base; - var out; - var i; - - switch ( token.specifier ) { - case 'b': - // Case: %b (binary) - base = 2; - break; - case 'o': - // Case: %o (octal) - base = 8; - break; - case 'x': - case 'X': - // Case: %x, %X (hexadecimal) - base = 16; - break; - case 'd': - case 'i': - case 'u': - default: - // Case: %d, %i, %u (decimal) - base = 10; - break; - } - out = token.arg; - i = parseInt( out, 10 ); - if ( !isFinite( i ) ) { // NOTE: We use the global `isFinite` function here instead of `@stdlib/math/base/assert/is-finite` in order to avoid circular dependencies. - if ( !isNumber( out ) ) { - throw new Error( 'invalid integer. Value: ' + out ); - } - i = 0; - } - if ( i < 0 && ( token.specifier === 'u' || base !== 10 ) ) { - i = 0xffffffff + i + 1; - } - if ( i < 0 ) { - out = ( -i ).toString( base ); - if ( token.precision ) { - out = zeroPad( out, token.precision, token.padRight ); - } - out = '-' + out; - } else { - out = i.toString( base ); - if ( !i && !token.precision ) { - out = ''; - } else if ( token.precision ) { - out = zeroPad( out, token.precision, token.padRight ); - } - if ( token.sign ) { - out = token.sign + out; - } - } - if ( base === 16 ) { - if ( token.alternate ) { - out = '0x' + out; - } - out = ( token.specifier === uppercase.call( token.specifier ) ) ? - uppercase.call( out ) : - lowercase.call( out ); - } - if ( base === 8 ) { - if ( token.alternate && out.charAt( 0 ) !== '0' ) { - out = '0' + out; - } - } - return out; -} - - -// EXPORTS // - -module.exports = formatInteger; diff --git a/base/format-interpolate/lib/index.js b/base/format-interpolate/lib/index.js deleted file mode 100644 index f0e45df3..00000000 --- a/base/format-interpolate/lib/index.js +++ /dev/null @@ -1,41 +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. -*/ - -'use strict'; - -/** -* Generate string from a token array by interpolating values. -* -* @module @stdlib/string/base/format-interpolate -* -* @example -* var formatInterpolate = require( '@stdlib/string/base/format-interpolate' ); -* -* var tokens = ['Hello ', { 'specifier': 's' }, '!' ]; -* var out = formatInterpolate( tokens, 'World' ); -* // returns 'Hello World!' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/format-interpolate/lib/is_number.js b/base/format-interpolate/lib/is_number.js deleted file mode 100644 index a6320c8a..00000000 --- a/base/format-interpolate/lib/is_number.js +++ /dev/null @@ -1,46 +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. -*/ - -'use strict'; - -/** -* Tests if a value is a number primitive. -* -* @param {*} value - value to test -* @returns {boolean} boolean indicating if a value is a number primitive -* -* @example -* var bool = isNumber( 3.14 ); -* // returns true -* -* @example -* var bool = isNumber( NaN ); -* // returns true -* -* @example -* var bool = isNumber( new Number( 3.14 ) ); -* // returns false -*/ -function isNumber( value ) { - return ( typeof value === 'number' ); // NOTE: we inline the `isNumber.isPrimitive` function from `@stdlib/assert/is-number` in order to avoid circular dependencies. -} - - -// EXPORTS // - -module.exports = isNumber; diff --git a/base/format-interpolate/lib/is_string.js b/base/format-interpolate/lib/is_string.js deleted file mode 100644 index 8f1fd29f..00000000 --- a/base/format-interpolate/lib/is_string.js +++ /dev/null @@ -1,42 +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. -*/ - -'use strict'; - -/** -* Tests if a value is a string primitive. -* -* @param {*} value - value to test -* @returns {boolean} boolean indicating if a value is a string primitive -* -* @example -* var bool = isString( 'beep' ); -* // returns true -* -* @example -* var bool = isString( new String( 'beep' ) ); -* // returns false -*/ -function isString( value ) { - return ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies. -} - - -// EXPORTS // - -module.exports = isString; diff --git a/base/format-interpolate/lib/main.js b/base/format-interpolate/lib/main.js deleted file mode 100644 index fdfe710d..00000000 --- a/base/format-interpolate/lib/main.js +++ /dev/null @@ -1,243 +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. -*/ - -'use strict'; - -// MODULES // - -var formatInteger = require( './format_integer.js' ); -var isString = require( './is_string.js' ); -var isNumber = require( './is_number.js' ); -var formatDouble = require( './format_double.js' ); -var spacePad = require( './space_pad.js' ); -var zeroPad = require( './zero_pad.js' ); - - -// VARIABLES // - -var fromCharCode = String.fromCharCode; -var isArray = Array.isArray; // NOTE: We use the global `Array.isArray` function here instead of `@stdlib/assert/is-array` to avoid circular dependencies. - - -// FUNCTIONS // - -/** -* Returns a boolean indicating whether a value is `NaN`. -* -* @private -* @param {*} value - input value -* @returns {boolean} boolean indicating whether a value is `NaN` -* -* @example -* var bool = isnan( NaN ); -* // returns true -* -* @example -* var bool = isnan( 4 ); -* // returns false -*/ -function isnan( value ) { // explicitly define a function here instead of `@stdlib/math/base/assert/is-nan` in order to avoid circular dependencies - return ( value !== value ); -} - -/** -* Initializes token object with properties of supplied format identifier object or default values if not present. -* -* @private -* @param {Object} token - format identifier object -* @returns {Object} token object -*/ -function initialize( token ) { - var out = {}; - out.specifier = token.specifier; - out.precision = ( token.precision === void 0 ) ? 1 : token.precision; - out.width = token.width; - out.flags = token.flags || ''; - out.mapping = token.mapping; - return out; -} - - -// MAIN // - -/** -* Generates string from a token array by interpolating values. -* -* @param {Array} tokens - string parts and format identifier objects -* @param {Array} ...args - variable values -* @throws {TypeError} first argument must be an array -* @throws {Error} invalid flags -* @returns {string} formatted string -* -* @example -* var tokens = [ 'beep ', { 'specifier': 's' } ]; -* var out = formatInterpolate( tokens, 'boop' ); -* // returns 'beep boop' -*/ -function formatInterpolate( tokens ) { - var hasPeriod; - var flags; - var token; - var flag; - var num; - var out; - var pos; - var f; - var i; - var j; - - if ( !isArray( tokens ) ) { - throw new TypeError( 'invalid argument. First argument must be an array. Value: `' + tokens + '`.' ); - } - out = ''; - pos = 1; - for ( i = 0; i < tokens.length; i++ ) { - token = tokens[ i ]; - if ( isString( token ) ) { - out += token; - } else { - hasPeriod = token.precision !== void 0; - token = initialize( token ); - if ( !token.specifier ) { - throw new TypeError( 'invalid argument. Token is missing `specifier` property. Index: `'+ i +'`. Value: `' + token + '`.' ); - } - if ( token.mapping ) { - pos = token.mapping; - } - flags = token.flags; - for ( j = 0; j < flags.length; j++ ) { - flag = flags.charAt( j ); - switch ( flag ) { - case ' ': - token.sign = ' '; - break; - case '+': - token.sign = '+'; - break; - case '-': - token.padRight = true; - token.padZeros = false; - break; - case '0': - token.padZeros = flags.indexOf( '-' ) < 0; // NOTE: We use built-in `Array.prototype.indexOf` here instead of `@stdlib/assert/contains` in order to avoid circular dependencies. - break; - case '#': - token.alternate = true; - break; - default: - throw new Error( 'invalid flag: ' + flag ); - } - } - if ( token.width === '*' ) { - token.width = parseInt( arguments[ pos ], 10 ); - pos += 1; - if ( isnan( token.width ) ) { - throw new TypeError( 'the argument for * width at position ' + pos + ' is not a number. Value: `' + token.width + '`.' ); - } - if ( token.width < 0 ) { - token.padRight = true; - token.width = -token.width; - } - } - if ( hasPeriod ) { - if ( token.precision === '*' ) { - token.precision = parseInt( arguments[ pos ], 10 ); - pos += 1; - if ( isnan( token.precision ) ) { - throw new TypeError( 'the argument for * precision at position ' + pos + ' is not a number. Value: `' + token.precision + '`.' ); - } - if ( token.precision < 0 ) { - token.precision = 1; - hasPeriod = false; - } - } - } - token.arg = arguments[ pos ]; - switch ( token.specifier ) { - case 'b': - case 'o': - case 'x': - case 'X': - case 'd': - case 'i': - case 'u': - // Case: %b (binary), %o (octal), %x, %X (hexadecimal), %d, %i (decimal), %u (unsigned decimal) - if ( hasPeriod ) { - token.padZeros = false; - } - token.arg = formatInteger( token ); - break; - case 's': - // Case: %s (string) - token.maxWidth = ( hasPeriod ) ? token.precision : -1; - token.arg = String( token.arg ); - break; - case 'c': - // Case: %c (character) - if ( !isnan( token.arg ) ) { - num = parseInt( token.arg, 10 ); - if ( num < 0 || num > 127 ) { - throw new Error( 'invalid character code. Value: ' + token.arg ); - } - token.arg = ( isnan( num ) ) ? String( token.arg ) : fromCharCode( num ); // eslint-disable-line max-len - } - break; - case 'e': - case 'E': - case 'f': - case 'F': - case 'g': - case 'G': - // Case: %e, %E (scientific notation), %f, %F (decimal floating point), %g, %G (uses the shorter of %e/E or %f/F) - if ( !hasPeriod ) { - token.precision = 6; - } - f = parseFloat( token.arg ); - if ( !isFinite( f ) ) { // NOTE: We use the global `isFinite` function here instead of `@stdlib/math/base/assert/is-finite` in order to avoid circular dependencies. - if ( !isNumber( token.arg ) ) { - throw new Error( 'invalid floating-point number. Value: ' + out ); - } - // Case: NaN, Infinity, or -Infinity - f = token.arg; - token.padZeros = false; - } - token.arg = formatDouble( f, token ); - break; - default: - throw new Error( 'invalid specifier: ' + token.specifier ); - } - // Fit argument into field width... - if ( token.maxWidth >= 0 && token.arg.length > token.maxWidth ) { - token.arg = token.arg.substring( 0, token.maxWidth ); - } - if ( token.padZeros ) { - token.arg = zeroPad( token.arg, token.width || token.precision, token.padRight ); // eslint-disable-line max-len - } else if ( token.width ) { - token.arg = spacePad( token.arg, token.width, token.padRight ); - } - out += token.arg || ''; - pos += 1; - } - } - return out; -} - - -// EXPORTS // - -module.exports = formatInterpolate; diff --git a/base/format-interpolate/lib/space_pad.js b/base/format-interpolate/lib/space_pad.js deleted file mode 100644 index 1f136c15..00000000 --- a/base/format-interpolate/lib/space_pad.js +++ /dev/null @@ -1,65 +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. -*/ - -'use strict'; - -// FUNCTIONS // - -/** -* Returns `n` spaces. -* -* @private -* @param {number} n - number of spaces -* @returns {string} string of spaces -*/ -function spaces( n ) { - var out = ''; - var i; - for ( i = 0; i < n; i++ ) { - out += ' '; - } - return out; -} - - -// MAIN // - -/** -* Pads a token with spaces to the specified width. -* -* @private -* @param {string} str - token argument -* @param {number} width - token width -* @param {boolean} [right=false] - boolean indicating whether to pad to the right -* @returns {string} padded token argument -*/ -function spacePad( str, width, right ) { - var pad = width - str.length; - if ( pad < 0 ) { - return str; - } - str = ( right ) ? - str + spaces( pad ) : - spaces( pad ) + str; - return str; -} - - -// EXPORTS // - -module.exports = spacePad; diff --git a/base/format-interpolate/lib/zero_pad.js b/base/format-interpolate/lib/zero_pad.js deleted file mode 100644 index ba68db2d..00000000 --- a/base/format-interpolate/lib/zero_pad.js +++ /dev/null @@ -1,84 +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. -*/ - -'use strict'; - -// FUNCTIONS // - -/** -* Tests if a string starts with a minus sign (`-`). -* -* @private -* @param {string} str - input string -* @returns {boolean} boolean indicating if a string starts with a minus sign (`-`) -*/ -function startsWithMinus( str ) { - return str[ 0 ] === '-'; -} - -/** -* Returns a string of `n` zeros. -* -* @private -* @param {number} n - number of zeros -* @returns {string} string of zeros -*/ -function zeros( n ) { - var out = ''; - var i; - for ( i = 0; i < n; i++ ) { - out += '0'; - } - return out; -} - - -// MAIN // - -/** -* Pads a token with zeros to the specified width. -* -* @private -* @param {string} str - token argument -* @param {number} width - token width -* @param {boolean} [right=false] - boolean indicating whether to pad to the right -* @returns {string} padded token argument -*/ -function zeroPad( str, width, right ) { - var negative = false; - var pad = width - str.length; - if ( pad < 0 ) { - return str; - } - if ( startsWithMinus( str ) ) { - negative = true; - str = str.substr( 1 ); - } - str = ( right ) ? - str + zeros( pad ) : - zeros( pad ) + str; - if ( negative ) { - str = '-' + str; - } - return str; -} - - -// EXPORTS // - -module.exports = zeroPad; diff --git a/base/format-interpolate/package.json b/base/format-interpolate/package.json deleted file mode 100644 index c55d1f48..00000000 --- a/base/format-interpolate/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/base/format-interpolate", - "version": "0.0.0", - "description": "Generate string from a token array by interpolating values.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "format", - "formatting", - "fmt", - "tokens", - "tokenize", - "token", - "interpolate", - "interpolation" - ] -} diff --git a/base/format-interpolate/test/test.format_double.js b/base/format-interpolate/test/test.format_double.js deleted file mode 100644 index f04c880d..00000000 --- a/base/format-interpolate/test/test.format_double.js +++ /dev/null @@ -1,106 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var PI = require( '@stdlib/constants/float64/pi' ); -var formatDouble = require( './../lib/format_double.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof formatDouble, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a double-formatted token argument', function test( t ) { - var expected; - var actual; - var token; - - token = { - 'specifier': 'f', - 'arg': PI, - 'precision': 2 - }; - expected = '3.14'; - actual = formatDouble( PI, token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'F', - 'arg': PI, - 'precision': 4 - }; - expected = '3.1416'; - actual = formatDouble( PI, token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'e', - 'arg': PI, - 'precision': 2 - }; - expected = '3.14e+00'; - actual = formatDouble( PI, token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'E', - 'arg': PI, - 'precision': 2 - }; - expected = '3.14E+00'; - actual = formatDouble( PI, token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a double-formatted token argument (include sign)', function test( t ) { - var expected; - var actual; - var token; - - token = { - 'specifier': 'f', - 'arg': PI, - 'precision': 2, - 'sign': '+' - }; - expected = '+3.14'; - actual = formatDouble( PI, token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'F', - 'arg': PI, - 'precision': 4, - 'sign': '-' - }; - expected = '-3.1416'; - actual = formatDouble( PI, token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/base/format-interpolate/test/test.format_integer.js b/base/format-interpolate/test/test.format_integer.js deleted file mode 100644 index 9242698b..00000000 --- a/base/format-interpolate/test/test.format_integer.js +++ /dev/null @@ -1,170 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var formatInteger = require( './../lib/format_integer.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof formatInteger, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an integer-formatted token argument', function test( t ) { - var expected; - var actual; - var token; - - token = { - 'specifier': 'b', - 'arg': 3 - }; - expected = '11'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'o', - 'arg': 15 - }; - expected = '17'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'x', - 'arg': 15 - }; - expected = 'f'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'X', - 'arg': 15 - }; - expected = 'F'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an integer-formatted token argument (include sign)', function test( t ) { - var expected; - var actual; - var token; - - token = { - 'specifier': 'b', - 'arg': 3, - 'sign': '-' - }; - expected = '-11'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'o', - 'arg': 15, - 'sign': '+' - }; - expected = '+17'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an integer-formatted token argument (alternate form)', function test( t ) { - var expected; - var actual; - var token; - - token = { - 'specifier': 'b', - 'arg': 3, - 'alternate': true - }; - expected = '11'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'o', - 'arg': 15, - 'alternate': true - }; - expected = '017'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'x', - 'arg': 15, - 'alternate': true - }; - expected = '0xf'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'X', - 'arg': 15, - 'alternate': true - }; - expected = '0XF'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an integer-formatted token argument (precision)', function test( t ) { - var expected; - var actual; - var token; - - token = { - 'specifier': 'd', - 'arg': 10, - 'precision': 5 - }; - expected = '00010'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - token = { - 'specifier': 'd', - 'arg': 10, - 'precision': 5, - 'padRight': true - }; - expected = '10000'; - actual = formatInteger( token ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/base/format-interpolate/test/test.js b/base/format-interpolate/test/test.js deleted file mode 100644 index bbc19c55..00000000 --- a/base/format-interpolate/test/test.js +++ /dev/null @@ -1,1364 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var formatTokenize = require( './../../../base/format-tokenize' ); -var PI = require( '@stdlib/constants/float64/pi' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); -var formatInterpolate = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof formatInterpolate, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided an array', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 5, - NaN, - null, - void 0, - true, - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - formatInterpolate( value ); - }; - } -}); - -tape( 'the function throws an error if a format identifier object does not have a `specifier` property', function test( t ) { - var values; - var i; - - values = [ - {}, - { - 'precision': 3 - }, - { - 'width': 5 - } - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - formatInterpolate( [ 'beep', value ], 'boop' ); - }; - } -}); - -tape( 'the function returns an empty string when provided an empty array', function test( t ) { - var out = formatInterpolate( [] ); - t.strictEqual( out, '', 'returns an empty string' ); - t.end(); -}); - -tape( 'the function returns concatenated strings when provided an array of strings without format identifier objects', function test( t ) { - var tokens; - var out; - - tokens = [ - 'beep ', - 'boop' - ]; - out = formatInterpolate( tokens ); - t.strictEqual( out, tokens.join( '' ), 'returns expected string' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'beep' ); - expected = 'beep'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'boop' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%s %s baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'beep', 'boop' ); - expected = 'beep boop baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, minimum width)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%6s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'beep' ); - expected = ' beep'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %6s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'boop' ); - expected = 'beep boop'; - - str = '%2s %2s baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'beep', 'boop' ); - expected = 'beep boop baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, variable width)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%*s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 6, 'beep' ); - expected = ' beep'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %*s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 6, 'boop' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%*s %*s baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 6, 'beep', 4, 'boop' ); - expected = ' beep boop baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, minimum width, left-justified)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%-6s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'beep' ); - expected = 'beep '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %-6s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'boop' ); - expected = 'beep boop '; - - str = '%-2s %-2s baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'beep', 'boop' ); - expected = 'beep boop baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, precision)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%.2s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'beep' ); - expected = 'be'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %.2s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'boop' ); - expected = 'beep bo'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, precision, minimum width)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%6.2s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'beep' ); - expected = ' be'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %6.2s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'boop' ); - expected = 'beep bo'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%6.8s %4.2s baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'beep', 'boop' ); - expected = 'beep bo b'; - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, precision, minimum width, zero-padded)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%06.2s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'beep' ); - expected = '0000be'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %06.2s'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'boop' ); - expected = 'beep 0000bo'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%06.8s %04.2s baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'beep', 'boop' ); - expected = 'beep bo00 b'; - - t.end(); -}); - -tape( 'the function returns a formatted string (`c` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%c'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 70 ); - expected = 'F'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %c'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 75 ); - expected = 'beep K'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%c %c baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 70, 75 ); - expected = 'F K baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`c` specifier, string arguments)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%c'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'b' ); - expected = 'b'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %c'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'boop' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`c` specifier, minimum width)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%2c'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 80 ); - expected = ' P'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %4c'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 90 ); - expected = 'beep Z'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%2c %c baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 80, 90 ); - expected = ' P Z baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`c` specifier, minimum width, left-justified)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%-2c'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 80 ); - expected = 'P '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %-4c'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 90 ); - expected = 'beep Z '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%-2c %-c baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 80, 90 ); - expected = 'P Z baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`d` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%d'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3 ); - expected = '3'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %d'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5.8 ); - expected = 'beep 5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%d %d baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3, 5 ); - expected = '3 5 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`d` specifier, sign)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%+d'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3 ); - expected = '+3'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %+d'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5.8 ); - expected = 'beep +5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%+d %+d baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3, 5 ); - expected = '+3 +5 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%+d %+d baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, -3, -5 ); - expected = '-3 -5 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`d` specifier, minimum width)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%2d'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3 ); - expected = ' 3'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %4d'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%2d %d baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3.1, 5 ); - expected = ' 3 5 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`d` specifier, minimum width, left-justified)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%-2d'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3 ); - expected = '3 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %-4d'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5.2 ); - expected = 'beep 5 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%-3d baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3, 5 ); - expected = '3 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`d` specifier, minimum width, zero-padded)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%02d'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3 ); - expected = '03'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %04d'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5.1 ); - expected = 'beep 0005'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%02d %d baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3, 5 ); - expected = '03 5 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3.14 ); - expected = '3.140000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5.0 ); - expected = 'beep 5.000000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%f %f baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3.14, 5.0 ); - expected = '3.140000 5.000000 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%f %f baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PINF, NINF ); - expected = 'infinity -infinity baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, NaN ); - expected = 'nan'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`F` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%F'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3.14 ); - expected = '3.140000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %F'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5.0 ); - expected = 'beep 5.000000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%F %F baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3.14, 5.0 ); - expected = '3.140000 5.000000 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%F %F baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PINF, NINF ); - expected = 'INFINITY -INFINITY baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%F'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, NaN ); - expected = 'NAN'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, specified precision)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%.3f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PI ); - expected = '3.142'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %.3f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5.0 ); - expected = 'beep 5.000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%.10f %.10f baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PINF, NINF ); - expected = 'infinity -infinity baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%0.10f %0.10f baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PINF, NINF ); - expected = 'infinity -infinity baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%.4f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, NaN ); - expected = 'nan'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%0.4f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, NaN ); - expected = 'nan'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, variable precision)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%.*f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3, PI ); - expected = '3.142'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %.*f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3, 5.0 ); - expected = 'beep 5.000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%.*f %.*f baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3, PI, 3, PI ); - expected = '3.142 3.142 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%.*f %.*f baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 10, PINF, 10, NINF ); - expected = 'infinity -infinity baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%0.*f %0.*f baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 10, PINF, 10, NINF ); - expected = 'infinity -infinity baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%.*f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 4, NaN ); - expected = 'nan'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%0.*f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 4, NaN ); - expected = 'nan'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`g` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%g'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PI ); - expected = '3.14159'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %g'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 1.0003212e-10 ); - expected = 'beep 1.00032e-10'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%g %g baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PI, 1.0003212e-10 ); - expected = '3.14159 1.00032e-10 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`G` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%G'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PI ); - expected = '3.14159'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%3.G'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 100 ); - expected = '1E+02'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %G'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 1.0003212e-10 ); - expected = 'beep 1.00032E-10'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%G %G baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PI, 1.0003212e-10 ); - expected = '3.14159 1.00032E-10 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`G` specifier, alternate form)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%#G'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PI ); - expected = '3.14159'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#3.G'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 100 ); - expected = '1.E+02'; // always contains a decimal point! - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %#G'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 1.0003212e-10 ); - expected = 'beep 1.00032E-10'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#G %#G baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PI, 1.0003212e-10 ); - expected = '3.14159 1.00032E-10 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, minimum width)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%12f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3.14 ); - expected = ' 3.140000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %12f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5.0 ); - expected = 'beep 5.000000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, decimal precision)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%.3f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3.14 ); - expected = '3.140'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%.3f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PI ); - expected = '3.142'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %.3f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5.0 ); - expected = 'beep 5.000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, minimum width, decimal precision)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%8.3f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3.14 ); - expected = ' 3.140'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %8.3f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5.0 ); - expected = 'beep 5.000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%8.3f %.3f baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3.14, 5.0 ); - expected = ' 3.140 5.000 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%10.10f %10.10f baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PINF, NINF ); - expected = ' infinity -infinity baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%8.4f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, NaN ); - expected = ' nan'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, minimum width, left-justified, decimal precision)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%-8.3f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3.14 ); - expected = '3.140 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %-8.3f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5.0 ); - expected = 'beep 5.000 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%-8.3f %.3f baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3.14, 5.0 ); - expected = '3.140 5.000 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%-10.10f %10.10f baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, PINF, NINF ); - expected = 'infinity -infinity baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%-8.4f'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, NaN ); - expected = 'nan '; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`b` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%b'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3 ); - expected = '11'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %b'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 101'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%b %b baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3, 5 ); - expected = '11 101 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`b` specifier, alternate form)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%#b'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3 ); - expected = '11'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %#b'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 101'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#b %#b baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3, 5 ); - expected = '11 101 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`b` specifier, minimum width)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%12b'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3 ); - expected = ' 11'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %12b'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 101'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`b` specifier, minimum width, left-justified)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%-12b'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3 ); - expected = '11 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %-12b'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 101 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`b` specifier, minimum width, zero-padded)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%012b'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 3 ); - expected = '000000000011'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %012b'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 000000000101'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`o` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%o'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 12 ); - expected = '14'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %o'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%o %o baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 8, 9 ); - expected = '10 11 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`o` specifier, alternate form)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%#o'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 12 ); - expected = '014'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %#o'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 05'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#o %#o baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 8, 9 ); - expected = '010 011 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`x` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%x'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 12 ); - expected = 'c'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %x'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%x %x baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 14, 15 ); - expected = 'e f baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`x` specifier, alternate form)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%#x'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 12 ); - expected = '0xc'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %#x'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 0x5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#x %#x baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 14, 15 ); - expected = '0xe 0xf baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`X` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%X'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 12 ); - expected = 'C'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %X'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%X %X baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 14, 15 ); - expected = 'E F baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`X` specifier, alternate form)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%#X'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 12 ); - expected = '0XC'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %#X'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 5 ); - expected = 'beep 0X5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#X %#X baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 14, 15 ); - expected = '0XE 0XF baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`u` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%u'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 12 ); - expected = '12'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %u'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, -5 ); - expected = 'beep 4294967291'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%u %u baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 14, 15 ); - expected = '14 15 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`e` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%e'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 12 ); - expected = '1.200000e+01'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %e'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, -5 ); - expected = 'beep -5.000000e+00'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%e %e baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 14, 15 ); - expected = '1.400000e+01 1.500000e+01 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`e` specifier, minimum width, precision)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%12.2e'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 12 ); - expected = ' 1.20e+01'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %12.2e'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, -5 ); - expected = 'beep -5.00e+00'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%12.2e %12.2e baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 14, 15 ); - expected = ' 1.40e+01 1.50e+01 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`E` specifier)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%E'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 12 ); - expected = '1.200000E+01'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %E'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, -5 ); - expected = 'beep -5.000000E+00'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%E %E baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 14, 15 ); - expected = '1.400000E+01 1.500000E+01 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`E` specifier, minimum width, precision)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%12.2E'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 12 ); - expected = ' 1.20E+01'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %12.2E'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, -5 ); - expected = 'beep -5.00E+00'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%12.2E %12.2E baz'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 14, 15 ); - expected = ' 1.40E+01 1.50E+01 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, positional arguments)', function test( t ) { - var expected; - var tokens; - var actual; - var str; - - str = '%2$s %1$s!'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'World', 'Hello' ); - expected = 'Hello World!'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%2$s %1$s %1$s!'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'World', 'Hello' ); - expected = 'Hello World World!'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%3$s %2$s %1$s!'; - tokens = formatTokenize( str ); - actual = formatInterpolate( tokens, 'C', 'B', 'A' ); - expected = 'A B C!'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); diff --git a/base/format-interpolate/test/test.space_pad.js b/base/format-interpolate/test/test.space_pad.js deleted file mode 100644 index 9cabea2c..00000000 --- a/base/format-interpolate/test/test.space_pad.js +++ /dev/null @@ -1,84 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var spacePad = require( './../lib/space_pad.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof spacePad, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function pads an argument to a minimum width', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello World!'; - expected = 'Hello World!'; - actual = spacePad( str, 10 ); - t.strictEqual( actual, expected, 'does not pad' ); - - str = 'Hello World!'; - expected = ' Hello World!'; - actual = spacePad( str, 14 ); - t.strictEqual( actual, expected, 'pads' ); - - str = 'beep'; - expected = 'beep'; - actual = spacePad( str, 2 ); - t.strictEqual( actual, expected, 'does not pad' ); - - str = 'beep'; - expected = ' beep'; - actual = spacePad( str, 8 ); - t.strictEqual( actual, expected, 'pads' ); - - t.end(); -}); - -tape( 'the function pads an argument to a minimum width on the right', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello World!'; - expected = 'Hello World!'; - actual = spacePad( str, 10, true ); - t.strictEqual( actual, expected, 'does not pad' ); - - str = 'Hello World!'; - expected = 'Hello World! '; - actual = spacePad( str, 14, true ); - t.strictEqual( actual, expected, 'pads' ); - - str = 'beep'; - expected = 'beep '; - actual = spacePad( str, 8, true ); - t.strictEqual( actual, expected, 'pads' ); - - t.end(); -}); diff --git a/base/format-interpolate/test/test.zero_pad.js b/base/format-interpolate/test/test.zero_pad.js deleted file mode 100644 index 10bcdf74..00000000 --- a/base/format-interpolate/test/test.zero_pad.js +++ /dev/null @@ -1,69 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var zeroPad = require( './../lib/zero_pad.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof zeroPad, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function pads an argument with zeros to a minimum width', function test( t ) { - var expected; - var actual; - var str; - - str = '123'; - expected = '00123'; - actual = zeroPad( str, 5 ); - t.strictEqual( actual, expected, 'pads' ); - - str = '-10'; - expected = '-0010'; - actual = zeroPad( str, 5 ); - t.strictEqual( actual, expected, 'pads' ); - - t.end(); -}); - -tape( 'the function pads an argument with zeros to a minimum width on the right', function test( t ) { - var expected; - var actual; - var str; - - str = '123'; - expected = '12300'; - actual = zeroPad( str, 5, true ); - t.strictEqual( actual, expected, 'pads' ); - - str = '-10'; - expected = '-1000'; - actual = zeroPad( str, 5, true ); - t.strictEqual( actual, expected, 'pads' ); - - t.end(); -}); diff --git a/base/format-tokenize/README.md b/base/format-tokenize/README.md deleted file mode 100644 index 1416b8d8..00000000 --- a/base/format-tokenize/README.md +++ /dev/null @@ -1,112 +0,0 @@ - - -# formatTokenize - -> Tokenize a string into an array of string parts and format identifier objects. - -
- -
- - - -
- -## Usage - -```javascript -var formatTokenize = require( '@stdlib/string/base/format-tokenize' ); -``` - -#### formatTokenize( str ) - -Tokenizes a string into an array of string parts and format identifier objects. - -```javascript -var str = 'Hello, %s! My name is %s.'; -var out = formatTokenize( str ); -// returns [ 'Hello, ', {...}, '! My name is ', {...}, '.' ] -``` - -The format identifier objects have the following properties: - -| property | description | -| --------- | --------------------------------------------------------------------- | -| specifier | format specifier (single alphabetical character, lower- or uppercase) | -| flags | format flags (string with any of '0', ' ', '+', '-', '#') | -| width | minimum field width (integer or `'*'`) | -| precision | precision (integer or `'*'`) | -| mapping | positional mapping from format specifier to argument index | - -
- - - -
- -## Examples - - - -```javascript -var formatTokenize = require( '@stdlib/string/base/format-tokenize' ); - -var out = formatTokenize( 'Hello %s!' ); -// returns [ 'Hello ', {...}, '!' ] - -out = formatTokenize( 'Pi: ~%.2f' ); -// returns [ 'Pi: ~', {...} ] - -out = formatTokenize( 'Multiple flags: %#+s' ); -// returns [ 'Multiple flags: ', {...} ] -``` - -
- - - - - - - - - - - - - - diff --git a/base/format-tokenize/benchmark/benchmark.js b/base/format-tokenize/benchmark/benchmark.js deleted file mode 100644 index 292e5e95..00000000 --- a/base/format-tokenize/benchmark/benchmark.js +++ /dev/null @@ -1,58 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var formatTokenize = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Hello %s!', - 'Pi: ~%.2f', - 'Multiple flags: %#+s', - 'foo bar baz %s', - 'foo bar baz %s %s', - 'foo bar baz %d %f %u' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = formatTokenize( values[ i%values.length ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( out ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/format-tokenize/docs/repl.txt b/base/format-tokenize/docs/repl.txt deleted file mode 100644 index b87ec044..00000000 --- a/base/format-tokenize/docs/repl.txt +++ /dev/null @@ -1,27 +0,0 @@ - -{{alias}}( str ) - Tokenize a string into an array of string parts and format identifier - objects. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: Array - Array of string parts and format identifier objects. - - Examples - -------- - > var out = {{alias}}( 'Hello %s!' ) - [ 'Hello ', {...}, '!' ] - > out = {{alias}}( '%s %s %d' ) - [ {...}, ' ', {...}, ' ', {...}, ' ' ] - > out = {{alias}}( 'Pi: %.2f' ) - [ 'Pi: ', {...} ] - - See Also - -------- - diff --git a/base/format-tokenize/docs/types/index.d.ts b/base/format-tokenize/docs/types/index.d.ts deleted file mode 100644 index 12921a49..00000000 --- a/base/format-tokenize/docs/types/index.d.ts +++ /dev/null @@ -1,68 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Format identifier object. -*/ -interface FormatIdentifier { - /** - * Format specifier (one of 's', 'c', 'd', 'i', 'u', 'b', 'o', 'x', 'X', 'e', 'E', 'f', 'F', 'g', 'G'). - */ - specifier: string; - - /** - * Flags. - */ - flags?: string; - - /** - * Minimum field width (integer or `'*'`). - */ - width?: string; - - /** - * Precision (integer or `'*'`). - */ - precision?: string; - - /** - * Positional mapping from format specifier to argument index. - */ - mapping?: number; -} - -type StringOrToken = string | FormatIdentifier; - -/** -* Tokenizes a string into an array of string parts and format identifier objects. -* -* @param str - input string -* @returns tokens -* -* @example -* var tokens = formatTokenize( 'Hello %s!' ); -* // returns [ 'Hello ', {...}, '!' ] -*/ -declare function formatTokenize( str: string ): Array; - - -// EXPORTS // - -export = formatTokenize; diff --git a/base/format-tokenize/docs/types/test.ts b/base/format-tokenize/docs/types/test.ts deleted file mode 100644 index 4dd141ad..00000000 --- a/base/format-tokenize/docs/types/test.ts +++ /dev/null @@ -1,44 +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. -*/ - -import formatTokenize = require( './index' ); - - -// TESTS // - -// The function returns an array of string parts and format identifier objects... -{ - formatTokenize( 'Hello, %s!' ); // $ExpectType StringOrToken[] -} - -// The compiler throws an error if the function is provided an argument other than a string... -{ - formatTokenize( true ); // $ExpectError - formatTokenize( false ); // $ExpectError - formatTokenize( null ); // $ExpectError - formatTokenize( undefined ); // $ExpectError - formatTokenize( 5 ); // $ExpectError - formatTokenize( [] ); // $ExpectError - formatTokenize( {} ); // $ExpectError - formatTokenize( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - formatTokenize(); // $ExpectError -} diff --git a/base/format-tokenize/examples/index.js b/base/format-tokenize/examples/index.js deleted file mode 100644 index 70ca4596..00000000 --- a/base/format-tokenize/examples/index.js +++ /dev/null @@ -1,37 +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. -*/ - -'use strict'; - -var formatTokenize = require( './../lib' ); - -var out = formatTokenize( 'Hello %s!' ); -console.log( out ); -// => [ 'Hello ', {...}, '!' ] - -out = formatTokenize( 'Pi: ~%.2f' ); -console.log( out ); -// => [ 'Pi: ~', {...} ] - -out = formatTokenize( 'Multiple flags: %#+s' ); -console.log( out ); -// => [ 'Multiple flags: ', {...} ] - -out = formatTokenize( 'Percent: %d%%' ); -console.log( out ); -// => [ 'Percent: ', {...}, '%' ] diff --git a/base/format-tokenize/lib/index.js b/base/format-tokenize/lib/index.js deleted file mode 100644 index 0a924277..00000000 --- a/base/format-tokenize/lib/index.js +++ /dev/null @@ -1,41 +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. -*/ - -'use strict'; - -/** -* Tokenize a string into an array of string parts and format identifier objects. -* -* @module @stdlib/string/base/format-tokenize -* -* @example -* var formatTokenize = require( '@stdlib/string/base/format-tokenize' ); -* -* var str = 'Hello %s!'; -* var tokens = formatTokenize( str ); -* // returns [ 'Hello ', {...}, '!' ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/format-tokenize/lib/main.js b/base/format-tokenize/lib/main.js deleted file mode 100644 index f7366ec0..00000000 --- a/base/format-tokenize/lib/main.js +++ /dev/null @@ -1,95 +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. -*/ - -'use strict'; - -// VARIABLES // - -var RE = /%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g; - - -// FUNCTIONS // - -/** -* Parses a delimiter. -* -* @private -* @param {Array} match - regular expression match -* @returns {Object} delimiter token object -*/ -function parse( match ) { - var token = { - 'mapping': ( match[ 1 ] ) ? parseInt( match[ 1 ], 10 ) : void 0, - 'flags': match[ 2 ], - 'width': match[ 3 ], - 'precision': match[ 5 ], - 'specifier': match[ 6 ] - }; - if ( match[ 4 ] === '.' && match[ 5 ] === void 0 ) { - token.precision = '1'; - } - return token; -} - - -// MAIN // - -/** -* Tokenizes a string into an array of string parts and format identifier objects. -* -* @param {string} str - input string -* @returns {Array} tokens -* -* @example -* var tokens = formatTokenize( 'Hello %s!' ); -* // returns [ 'Hello ', {...}, '!' ] -*/ -function formatTokenize( str ) { - var content; - var tokens; - var match; - var prev; - - tokens = []; - prev = 0; - match = RE.exec( str ); - while ( match ) { - content = str.slice( prev, RE.lastIndex - match[ 0 ].length ); - if ( content.length ) { - tokens.push( content ); - } - // Check for an escaped percent sign `%%`... - if ( match[ 6 ] === '%' ) { - tokens.push( '%' ); - } else { - tokens.push( parse( match ) ); - } - prev = RE.lastIndex; - match = RE.exec( str ); - } - content = str.slice( prev ); - if ( content.length ) { - tokens.push( content ); - } - return tokens; -} - - -// EXPORTS // - -module.exports = formatTokenize; diff --git a/base/format-tokenize/package.json b/base/format-tokenize/package.json deleted file mode 100644 index 16eb8dc2..00000000 --- a/base/format-tokenize/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/format-tokenize", - "version": "0.0.0", - "description": "Tokenize a string into an array of string parts and format identifier objects.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "format", - "formatting", - "fmt", - "tokens", - "tokenize", - "token" - ] -} diff --git a/base/format-tokenize/test/test.js b/base/format-tokenize/test/test.js deleted file mode 100644 index aec6be29..00000000 --- a/base/format-tokenize/test/test.js +++ /dev/null @@ -1,333 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var formatTokenize = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof formatTokenize, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function tokenizes a string', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello %s!'; - expected = [ - 'Hello ', - { - 'flags': '', - 'mapping': void 0, - 'width': void 0, - 'precision': void 0, - 'specifier': 's' - }, - '!' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - str = 'Current year: %d'; - expected = [ - 'Current year: ', - { - 'flags': '', - 'mapping': void 0, - 'width': void 0, - 'precision': void 0, - 'specifier': 'd' - } - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - t.end(); -}); - -tape( 'the function tokenizes a string (extracting flags)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello %+s!'; - expected = [ - 'Hello ', - { - 'flags': '+', - 'mapping': void 0, - 'width': void 0, - 'precision': void 0, - 'specifier': 's' - }, - '!' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - str = 'Hello %-+s!'; - expected = [ - 'Hello ', - { - 'flags': '-+', - 'mapping': void 0, - 'width': void 0, - 'precision': void 0, - 'specifier': 's' - }, - '!' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - str = 'Hello %#+s!'; - expected = [ - 'Hello ', - { - 'flags': '#+', - 'mapping': void 0, - 'width': void 0, - 'precision': void 0, - 'specifier': 's' - }, - '!' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - t.end(); -}); - -tape( 'the function tokenizes a string (extracting positional arguments)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello %1$s!'; - expected = [ - 'Hello ', - { - 'flags': '', - 'mapping': 1, - 'width': void 0, - 'precision': void 0, - 'specifier': 's' - }, - '!' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - str = 'Hello %1$s %2$s!'; - expected = [ - 'Hello ', - { - 'flags': '', - 'mapping': 1, - 'width': void 0, - 'precision': void 0, - 'specifier': 's' - }, - ' ', - { - 'flags': '', - 'mapping': 2, - 'width': void 0, - 'precision': void 0, - 'specifier': 's' - }, - '!' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - t.end(); -}); - -tape( 'the function tokenizes a string (extracting width)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello %5s!'; - expected = [ - 'Hello ', - { - 'flags': '', - 'mapping': void 0, - 'width': '5', - 'precision': void 0, - 'specifier': 's' - }, - '!' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - str = 'Hello %05s!'; - expected = [ - 'Hello ', - { - 'flags': '0', - 'mapping': void 0, - 'width': '5', - 'precision': void 0, - 'specifier': 's' - }, - '!' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - str = 'Hello %5d!'; - expected = [ - 'Hello ', - { - 'flags': '', - 'mapping': void 0, - 'width': '5', - 'precision': void 0, - 'specifier': 'd' - }, - '!' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - str = 'Hello %05d!'; - expected = [ - 'Hello ', - { - 'flags': '0', - 'mapping': void 0, - 'width': '5', - 'precision': void 0, - 'specifier': 'd' - }, - '!' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - t.end(); -}); - -tape( 'the function tokenizes a string (extracting precision)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Pi: ~%.3f'; - expected = [ - 'Pi: ~', - { - 'flags': '', - 'mapping': void 0, - 'width': void 0, - 'precision': '3', - 'specifier': 'f' - } - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - str = 'Pi: ~%.3g'; - expected = [ - 'Pi: ~', - { - 'flags': '', - 'mapping': void 0, - 'width': void 0, - 'precision': '3', - 'specifier': 'g' - } - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - t.end(); -}); - -tape( 'the function tokenizes a string (extracting escaped percent sign)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Progress: 100%% complete'; - expected = [ - 'Progress: 100', - '%', - ' complete' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - str = 'Testing %%%% complete'; - expected = [ - 'Testing ', - '%', - '%', - ' complete' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - str = 'Rate: %d%% success'; - expected = [ - 'Rate: ', - { - 'flags': '', - 'mapping': void 0, - 'width': void 0, - 'precision': void 0, - 'specifier': 'd' - }, - '%', - ' success' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - str = 'Testing %%%d%% complete'; - expected = [ - 'Testing ', - '%', - { - 'flags': '', - 'mapping': void 0, - 'width': void 0, - 'precision': void 0, - 'specifier': 'd' - }, - '%', - ' complete' - ]; - actual = formatTokenize( str ); - t.deepEqual( actual, expected, 'deep equal' ); - - t.end(); -}); diff --git a/base/headercase/README.md b/base/headercase/README.md deleted file mode 100644 index f66511f1..00000000 --- a/base/headercase/README.md +++ /dev/null @@ -1,115 +0,0 @@ - - -# headercase - -> Convert a string to HTTP header case. - - - -
- -## Usage - -```javascript -var headercase = require( '@stdlib/string/base/headercase' ); -``` - -#### headercase( str ) - -Converts a string to HTTP header case. - -```javascript -var out = headercase( 'foo bar' ); -// returns 'Foo-Bar' - -out = headercase( 'IS_MOBILE' ); -// returns 'Is-Mobile' - -out = headercase( 'Hello World!' ); -// returns 'Hello-World' - -out = headercase( '--foo-bar--' ); -// returns 'Foo-Bar' -``` - -
- - - - - -
- -## Examples - -```javascript -var headercase = require( '@stdlib/string/base/headercase' ); - -var str = 'Hello World!'; -var out = headercase( str ); -// returns 'Hello-World' - -str = 'HELLO WORLD!'; -out = headercase( str ); -// returns 'Hello-World' - -str = 'To be, or not to be: that is the question.'; -out = headercase( str ); -// returns 'To-Be-Or-Not-To-Be-That-Is-The-Question' -``` - -
- - - - - - - - - - - - - - diff --git a/base/headercase/benchmark/benchmark.js b/base/headercase/benchmark/benchmark.js deleted file mode 100644 index ce6c4cdf..00000000 --- a/base/headercase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var headercase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = headercase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/headercase/docs/repl.txt b/base/headercase/docs/repl.txt deleted file mode 100644 index 4728f5f7..00000000 --- a/base/headercase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to HTTP header case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - HTTP header-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'Hello-World' - > out = {{alias}}( 'beep boop' ) - 'Beep-Boop' - - See Also - -------- diff --git a/base/headercase/docs/types/index.d.ts b/base/headercase/docs/types/index.d.ts deleted file mode 100644 index 09b82f0e..00000000 --- a/base/headercase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to HTTP header case. -* -* @param str - string to convert -* @returns HTTP header-cased string -* -* @example -* var str = headercase( 'Hello World!' ); -* // returns 'Hello-World' -* -* @example -* var str = headercase( 'foo_bar' ); -* // returns 'Foo-Bar' -* -* @example -* var str = headercase( 'foo-bar' ); -* // returns 'Foo-Bar' -*/ -declare function headercase( str: string ): string; - - -// EXPORTS // - -export = headercase; diff --git a/base/headercase/docs/types/test.ts b/base/headercase/docs/types/test.ts deleted file mode 100644 index 5af42715..00000000 --- a/base/headercase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import headercase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - headercase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - headercase( true ); // $ExpectError - headercase( false ); // $ExpectError - headercase( null ); // $ExpectError - headercase( undefined ); // $ExpectError - headercase( 5 ); // $ExpectError - headercase( [] ); // $ExpectError - headercase( {} ); // $ExpectError - headercase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - headercase(); // $ExpectError -} diff --git a/base/headercase/examples/index.js b/base/headercase/examples/index.js deleted file mode 100644 index e6b12f9d..00000000 --- a/base/headercase/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var headercase = require( './../lib' ); - -var str = 'Hello World!'; -var out = headercase( str ); -console.log( out ); -// => 'Hello-World' - -str = 'HELLO WORLD!'; -out = headercase( str ); -console.log( out ); -// => 'Hello-World' - -str = 'To be, or not to be: that is the question.'; -out = headercase( str ); -console.log( out ); -// => 'To-Be-Or-Not-To-Be-That-Is-The-Question' diff --git a/base/headercase/lib/index.js b/base/headercase/lib/index.js deleted file mode 100644 index 1ff6876d..00000000 --- a/base/headercase/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to HTTP header case. -* -* @module @stdlib/string/base/headercase -* -* @example -* var headercase = require( '@stdlib/string/base/headercase' ); -* -* var str = headercase( 'foo bar' ); -* // returns 'Foo-Bar' -* -* str = headercase( '--foo-bar--' ); -* // returns 'Foo-Bar' -* -* str = headercase( 'Hello World!' ); -* // returns 'Hello-World' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/headercase/lib/main.js b/base/headercase/lib/main.js deleted file mode 100644 index efb4ea48..00000000 --- a/base/headercase/lib/main.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var lowercase = require( './../../../base/lowercase' ); -var replace = require( './../../../base/replace' ); -var startcase = require( './../../../base/startcase' ); -var trim = require( './../../../base/trim' ); - - -// VARIABLES // - -var RE_WHITESPACE = /\s+/g; -var RE_SPECIAL = /[-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape -var RE_CAMEL = /([a-z0-9])([A-Z])/g; - - -// MAIN // - -/** -* Converts a string to HTTP header case. -* -* @param {string} str - string to convert -* @returns {string} HTTP header-cased string -* -* @example -* var out = headercase( 'foo bar' ); -* // returns 'Foo-Bar' -* -* @example -* var out = headercase( 'IS_MOBILE' ); -* // returns 'Is-Mobile' -* -* @example -* var out = headercase( 'Hello World!' ); -* // returns 'Hello-World' -* -* @example -* var out = headercase( '--foo-bar--' ); -* // returns 'Foo-Bar' -*/ -function headercase( str ) { - str = replace( str, RE_SPECIAL, ' ' ); - str = replace( str, RE_CAMEL, '$1 $2' ); - str = trim( str ); - str = lowercase( str ); - str = startcase( str ); - return replace( str, RE_WHITESPACE, '-' ); -} - - -// EXPORTS // - -module.exports = headercase; diff --git a/base/headercase/package.json b/base/headercase/package.json deleted file mode 100644 index b5cb11f0..00000000 --- a/base/headercase/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/headercase", - "version": "0.0.0", - "description": "Convert a string to HTTP header case.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "case", - "convert", - "headercase", - "header", - "http" - ], - "__stdlib__": {} -} diff --git a/base/headercase/test/test.js b/base/headercase/test/test.js deleted file mode 100644 index 155df96f..00000000 --- a/base/headercase/test/test.js +++ /dev/null @@ -1,223 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 headercase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof headercase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a string to HTTP header case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo', - 'foo-bar', - 'FOO BAR', - 'fooBar', - 'foo_bar', - 'fooBarBaz', - 'foo-bar-baz', - 'foo_bar_baz', - ' foo bar baz ', - 'foo bar baz qux', - 'foo_bar_baz_qux', - 'foo_bar baz qux' - ]; - - expected = [ - 'Foo', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar-Baz', - 'Foo-Bar-Baz', - 'Foo-Bar-Baz', - 'Foo-Bar-Baz', - 'Foo-Bar-Baz-Qux', - 'Foo-Bar-Baz-Qux', - 'Foo-Bar-Baz-Qux' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( headercase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a string to HTTP header case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'Hello World', - 'I am tiny little tea pot', - 'Big problems', - 'The quick brown fox jumps over the lazy dog' - ]; - - expected = [ - 'Hello-World', - 'I-Am-Tiny-Little-Tea-Pot', - 'Big-Problems', - 'The-Quick-Brown-Fox-Jumps-Over-The-Lazy-Dog' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( headercase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to HTTP header case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'fóoBár', - 'Привет мир', - '_Світ-прекрасний!', - 'Café esuna bella', - 'meu coração', - '#🥹 🤨', - '𩷶$𝒳 ', - '안녕하@세요' - ]; - - expected = [ - 'Fóo-Bár', - 'Привет-Мир', - 'Світ-Прекрасний', - 'Café-Esuna-Bella', - 'Meu-Coração', - '🥹-🤨', - '𩷶-𝒳', - '안녕하-세요' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( headercase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a string with special characters to HTTP header case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo-bar', - 'foo!bar', - 'foo@bar', - 'foo#bar', - 'foo$bar', - 'foo%bar', - 'foo^bar', - 'foo&bar', - 'foo*bar', - 'foo(bar', - 'foo)bar', - 'foo[bar', - 'foo]bar', - 'foo{bar', - 'foo}bar', - 'foo|bar', - 'foo~bar', - 'foo:"bar', - 'foo\'bar', - 'foobar', - 'foo?bar', - 'foo/bar' - ]; - - expected = [ - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar', - 'Foo-Bar' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( headercase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function leaves a string that is already in HTTP header case unchanged', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'Camel-Case', - 'Is-Mobile', - 'The-Quick-Brown-Fox-Jumps-Over-The-Lazy-Dog', - '🥹-🤨' - ]; - - expected = [ - 'Camel-Case', - 'Is-Mobile', - 'The-Quick-Brown-Fox-Jumps-Over-The-Lazy-Dog', - '🥹-🤨' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( headercase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); diff --git a/base/invcase/README.md b/base/invcase/README.md deleted file mode 100644 index de5f8cd6..00000000 --- a/base/invcase/README.md +++ /dev/null @@ -1,117 +0,0 @@ - - -# invcase - -> Convert a string to inverse case. - - - -
- -## Usage - -```javascript -var invcase = require( '@stdlib/string/base/invcase' ); -``` - -#### invcase( str ) - -Converts a string to inverse case. - -```javascript -var str = invcase( 'foo bar' ); -// returns 'FOO BAR' - -str = invcase( 'Foo Bar Baz' ); -// returns 'fOO bAR bAZ' - -str = invcase( 'foo BAR' ); -// returns 'FOO bar' -``` - -
- - - - - -
- -## Examples - -```javascript -var invcase = require( '@stdlib/string/base/invcase' ); - -var str = 'Hello World!'; -var out = invcase( str ); -// returns 'hELLO wORLD!' - -str = 'I am a tiny little teapot'; -out = invcase( str ); -// returns 'i AM A TINY LITTLE TEAPOT' - -str = 'with BIG problems'; -out = invcase( str ); -// returns 'WITH big PROBLEMS' - -str = 'To Be, Or NoT To Be: ThAt Is ThE QuEsTiOn.'; -out = invcase( str ); -// returns 'tO bE, oR nOt tO bE: tHaT iS tHe qUeStIoN.' - -str = 'isMobile'; -out = invcase( str ); -// returns 'ISmOBILE' -``` - -
- - - - - - - - - - - - - - diff --git a/base/invcase/benchmark/benchmark.js b/base/invcase/benchmark/benchmark.js deleted file mode 100644 index 9282857b..00000000 --- a/base/invcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var invcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = invcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/invcase/docs/repl.txt b/base/invcase/docs/repl.txt deleted file mode 100644 index 3a5b8804..00000000 --- a/base/invcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to inverse case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Inverse-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'hELLO wORLD!' - > out = {{alias}}( 'I am A tiny LITTLE teapot' ) - 'i AM a TINY little TEAPOT' - - See Also - -------- diff --git a/base/invcase/docs/types/index.d.ts b/base/invcase/docs/types/index.d.ts deleted file mode 100644 index ac57ec77..00000000 --- a/base/invcase/docs/types/index.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to inverse case. -* -* @param str - string to convert -* @returns inverse-cased string -* -* @example -* var str = invcase( 'FOO bar' ); -* // returns 'foo BAR' -* -* @example -* var str = invcase( 'beep' ); -* // returns 'BEEP' -* -* @example -* var str = invcase( 'beep boop' ); -* // returns 'BEEP BOOP' -* -* @example -* var str = invcase( 'Hello World!' ); -* // returns 'hELLO wORLD!' -*/ -declare function invcase( str: string ): string; - - -// EXPORTS // - -export = invcase; diff --git a/base/invcase/docs/types/test.ts b/base/invcase/docs/types/test.ts deleted file mode 100644 index 8a2c7852..00000000 --- a/base/invcase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import invcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - invcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - invcase( true ); // $ExpectError - invcase( false ); // $ExpectError - invcase( null ); // $ExpectError - invcase( undefined ); // $ExpectError - invcase( 5 ); // $ExpectError - invcase( [] ); // $ExpectError - invcase( {} ); // $ExpectError - invcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - invcase(); // $ExpectError -} diff --git a/base/invcase/examples/index.js b/base/invcase/examples/index.js deleted file mode 100644 index 7c2844d3..00000000 --- a/base/invcase/examples/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 invcase = require( './../lib' ); - -var str = 'HeLlO wOrLd!'; -var out = invcase( str ); -console.log( out ); -// => 'hElLo WoRlD!' - -str = 'I Am A Tiny Little Teapot'; -out = invcase( str ); -console.log( out ); -// => 'i aM a tINY lITTLE tEAPOT' - -str = 'with big problems'; -out = invcase( str ); -console.log( out ); -// => 'WITH BIG PROBLEMS' - -str = 'TO BE, OR NOT TO BE: that is the question.'; -out = invcase( str ); -console.log( out ); -// => 'to be, or not to be: THAT IS THE QUESTION.' - -str = 'isMobile'; -out = invcase( str ); -console.log( out ); -// => 'ISmOBILE' diff --git a/base/invcase/lib/index.js b/base/invcase/lib/index.js deleted file mode 100644 index 67776a29..00000000 --- a/base/invcase/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to inverse case. -* -* @module @stdlib/string/base/invcase -* -* @example -* var invcase = require( '@stdlib/string/base/invcase' ); -* -* var str = invcase( 'aBcDeF' ); -* // returns 'AbCdEf' -* -* str = invcase( 'Hello World!' ); -* // returns 'hELLO wORLD!' -* -* str = invcase( 'I am a robot' ); -* // returns 'i AM A ROBOT' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/invcase/lib/main.js b/base/invcase/lib/main.js deleted file mode 100644 index f23a7fad..00000000 --- a/base/invcase/lib/main.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var uppercase = require( './../../../base/uppercase' ); -var lowercase = require( './../../../base/lowercase' ); - - -// MAIN // - -/** -* Converts a string to inverse case. -* -* @param {string} str - string to convert -* @returns {string} inverse-cased string -* -* @example -* var str = invcase( 'beep' ); -* // returns 'BEEP' -* -* @example -* var str = invcase( 'beep BOOP' ); -* // returns 'BEEP boop' -* -* @example -* var str = invcase( 'isMobile' ); -* // returns 'ISmOBILE' -* -* @example -* var str = invcase( 'HeLlO wOrLd!' ); -* // returns 'hElLo WoRlD!' -*/ -function invcase( str ) { - var out; - var ch; - var s; - var i; - - out = []; - for ( i = 0; i < str.length; i++ ) { - ch = str[ i ]; - s = uppercase( ch ); - if ( s === ch ) { - s = lowercase( ch ); - } - out.push( s ); - } - return out.join( '' ); -} - - -// EXPORTS // - -module.exports = invcase; diff --git a/base/invcase/package.json b/base/invcase/package.json deleted file mode 100644 index 5d4f5417..00000000 --- a/base/invcase/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/invcase", - "version": "0.0.0", - "description": "Convert a string to inverse case.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "case", - "inverse", - "convert" - ], - "__stdlib__": {} -} diff --git a/base/invcase/test/test.js b/base/invcase/test/test.js deleted file mode 100644 index 11fc95c7..00000000 --- a/base/invcase/test/test.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 invcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof invcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a camel case string to an inverse case string', function test( t ) { - var expected; - var actual; - - expected = 'CAMELcASE'; - actual = invcase( 'camelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'ISmOBILE'; - actual = invcase( 'isMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function converts a string to inverse case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'Hello World', - 'I am tiny little tea pot', - 'BIG problems', - 'THE quick BROWN fox JUMPS over THE lazy DOG', - ' Whitespace ' - ]; - - expected = [ - 'hELLO wORLD', - 'i AM TINY LITTLE TEA POT', - 'big PROBLEMS', - 'the QUICK brown FOX jumps OVER the LAZY dog', - ' wHITESPACE ' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( invcase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to inverse case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'привет МИР', - 'Я МаЛеНьКаЯ лОшАдКа', - 'БОЛЬШИЕ проблемы', - 'БЫСТРЫЙ коричневый ФОНД', - 'Café ESUNA bEllA' - ]; - - expected = [ - 'ПРИВЕТ мир', - 'я мАлЕнЬкАя ЛоШаДкА', - 'большие ПРОБЛЕМЫ', - 'быстрый КОРИЧНЕВЫЙ фонд', - 'cAFÉ esuna BeLLa' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( invcase( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); diff --git a/base/kebabcase/README.md b/base/kebabcase/README.md deleted file mode 100644 index 32e90f7e..00000000 --- a/base/kebabcase/README.md +++ /dev/null @@ -1,130 +0,0 @@ - - -# kebabcase - -> Convert a string to kebab case. - - - -
- -## Usage - -```javascript -var kebabcase = require( '@stdlib/string/base/kebabcase' ); -``` - -#### kebabcase( str ) - -Converts a string to kebab case. - -```javascript -var str = kebabcase( 'Foo Bar' ); -// returns 'foo-bar' - -str = kebabcase( 'I am a tiny little house' ); -// returns 'i-am-a-tiny-little-house' - -str = kebabcase( 'Hello World!' ); -// returns 'hello-world' -``` - -
- - - - - -
- -## Examples - -```javascript -var kebabcase = require( '@stdlib/string/base/kebabcase' ); - -var str = 'foo bar baz'; -var out = kebabcase( str ); -// returns 'foo-bar-baz' - -str = 'foo_baz'; -out = kebabcase( str ); -// returns 'foo-baz' - -str = 'foo-bar-baz!'; -out = kebabcase( str ); -// returns 'foo-bar-baz' - -str = 'beep boop!'; -out = kebabcase( str ); -// returns 'beep-boop' - -str = 'foo-baz'; -out = kebabcase( str ); -// returns 'foo-baz' - -str = 'Welcome! 😀'; -out = kebabcase( str ); -// returns 'welcome-😀' -``` - -
- - - - - - - - - - - - - - diff --git a/base/kebabcase/benchmark/benchmark.js b/base/kebabcase/benchmark/benchmark.js deleted file mode 100644 index 0472b19a..00000000 --- a/base/kebabcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var kebabcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = kebabcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/kebabcase/docs/repl.txt b/base/kebabcase/docs/repl.txt deleted file mode 100644 index 1e1d8ea4..00000000 --- a/base/kebabcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to kebab case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Kebab-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'hello-world' - > out = {{alias}}( 'I am a tiny little teapot' ) - 'i-am-a-tiny-little-teapot' - - See Also - -------- diff --git a/base/kebabcase/docs/types/index.d.ts b/base/kebabcase/docs/types/index.d.ts deleted file mode 100644 index 69fd3493..00000000 --- a/base/kebabcase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to kebab case. -* -* @param str - string to convert -* @returns kebab-cased string -* -* @example -* var str = kebabcase( 'fooBar' ); -* // returns 'foo-bar' -* -* @example -* var str = kebabcase( 'foo_bar' ); -* // returns 'foo-bar' -* -* @example -* var str = kebabcase( 'foo-bar' ); -* // returns 'foo-bar' -*/ -declare function kebabcase( str: string ): string; - - -// EXPORTS // - -export = kebabcase; diff --git a/base/kebabcase/docs/types/test.ts b/base/kebabcase/docs/types/test.ts deleted file mode 100644 index b6fe6a76..00000000 --- a/base/kebabcase/docs/types/test.ts +++ /dev/null @@ -1,44 +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. -*/ - -import kebabcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - kebabcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - kebabcase( true ); // $ExpectError - kebabcase( false ); // $ExpectError - kebabcase( null ); // $ExpectError - kebabcase( undefined ); // $ExpectError - kebabcase( 5 ); // $ExpectError - kebabcase( [] ); // $ExpectError - kebabcase( {} ); // $ExpectError - kebabcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - kebabcase(); // $ExpectError -} diff --git a/base/kebabcase/examples/index.js b/base/kebabcase/examples/index.js deleted file mode 100644 index ee48ae05..00000000 --- a/base/kebabcase/examples/index.js +++ /dev/null @@ -1,51 +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. -*/ - -'use strict'; - -var kebabcase = require( './../lib' ); - -var str = 'foo bar baz'; -var out = kebabcase( str ); -console.log( out ); -// => 'foo-bar-baz' - -str = 'foo_baz'; -out = kebabcase( str ); -console.log( out ); -// => 'foo-baz' - -str = 'foo-bar-baz!'; -out = kebabcase( str ); -console.log( out ); -// => 'foo-bar-baz' - -str = 'beep boop!'; -out = kebabcase( str ); -console.log( out ); -// => 'beep-boop' - -str = 'foo-baz'; -out = kebabcase( str ); -console.log( out ); -// => 'foo-baz' - -str = 'Welcome! 😀'; -out = kebabcase( str ); -console.log( out ); -// => 'welcome-😀' diff --git a/base/kebabcase/lib/index.js b/base/kebabcase/lib/index.js deleted file mode 100644 index 66d28d99..00000000 --- a/base/kebabcase/lib/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -/** -* Convert a string to kebab case. -* -* @module @stdlib/string/base/kebabcase -* -* @example -* var kebabcase = require( '@stdlib/string/base/kebabcase' ); -* -* var str = kebabcase( 'Foo Bar' ); -* // returns 'foo-bar' -* -* str = kebabcase( 'I am a tiny little house' ); -* // returns 'i-am-a-tiny-little-house' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/kebabcase/lib/main.js b/base/kebabcase/lib/main.js deleted file mode 100644 index 242de3c9..00000000 --- a/base/kebabcase/lib/main.js +++ /dev/null @@ -1,74 +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. -*/ - -'use strict'; - -// MODULES // - -var lowercase = require( './../../../base/lowercase' ); -var replace = require( './../../../base/replace' ); -var trim = require( './../../../base/trim' ); - - -// VARIABLES // - -var RE_WHITESPACE = /\s+/g; -var RE_SPECIAL = /[!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape -var RE_CAMEL = /([a-z0-9])([A-Z])/g; - - -// MAIN // - -/** -* Converts a string to kebab case. -* -* @param {string} str - string to convert -* @returns {string} kebab-cased string -* -* @example -* var str = kebabCase( 'Hello World!' ); -* // returns 'hello-world' -* -* @example -* var str = kebabCase( 'foo bar' ); -* // returns 'foo-bar' -* -* @example -* var str = kebabCase( 'I am a tiny little teapot' ); -* // returns 'i-am-a-tiny-little-teapot' -* -* @example -* var str = kebabCase( 'BEEP boop' ); -* // returns 'beep-boop' -* -* @example -* var str = kebabCase( 'isMobile' ); -* // returns 'is-mobile' -*/ -function kebabCase( str ) { - str = replace( str, RE_SPECIAL, ' ' ); - str = replace( str, RE_CAMEL, '$1 $2' ); - str = trim( str ); - str = replace( str, RE_WHITESPACE, '-' ); - return lowercase( str ); -} - - -// EXPORTS // - -module.exports = kebabCase; diff --git a/base/kebabcase/package.json b/base/kebabcase/package.json deleted file mode 100644 index fa15f9cd..00000000 --- a/base/kebabcase/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/kebabcase", - "version": "0.0.0", - "description": "Convert a string to kebab case.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "case", - "convert", - "kebab" - ], - "__stdlib__": {} -} diff --git a/base/kebabcase/test/test.js b/base/kebabcase/test/test.js deleted file mode 100644 index ecdbcece..00000000 --- a/base/kebabcase/test/test.js +++ /dev/null @@ -1,196 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var kebabcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof kebabcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a string to kebab case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo', - 'foo-bar', - 'fooBar', - 'foo_bar', - 'foo-bar-baz', - 'foo_bar_baz', - 'foo bar baz', - 'foo bar baz qux', - 'foo_bar_baz_qux', - 'foo_bar baz qux' - ]; - - expected = [ - 'foo', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar-baz', - 'foo-bar-baz', - 'foo-bar-baz', - 'foo-bar-baz-qux', - 'foo-bar-baz-qux', - 'foo-bar-baz-qux' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( kebabcase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function converts a camel case string to kebab case', function test( t ) { - var expected; - var actual; - var str; - - str = 'helloWorld'; - expected = 'hello-world'; - actual = kebabcase( str ); - - str = 'isMobile'; - expected = 'is-mobile'; - actual = kebabcase( str ); - - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to kebab case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'fóoBár', - 'ру́сский язык', - '😀😀 😀', - 'ру́сский язы́к', - 'Привет мир', - '안녕하세요', - '你好世界', - '신규 서비스' - ]; - expected = [ - 'fóo-bár', - 'ру́сский-язык', - '😀😀-😀', - 'ру́сский-язы́к', - 'привет-мир', - '안녕하세요', - '你好世界', - '신규-서비스' - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( kebabcase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function converts a string with special characters to kebab case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo!bar', - 'foo@bar', - 'foo#bar', - 'foo$bar', - 'foo%bar', - 'foo^bar', - 'foo&bar', - 'foo*bar', - 'foo(bar', - 'foo)bar', - 'foo[bar', - 'foo]bar', - 'foo{bar', - 'foo}bar', - 'foo|bar', - 'foo~bar', - 'foo:"bar', - 'foo\'bar', - 'foobar', - 'foo?bar', - 'foo/bar' - ]; - - expected = [ - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( kebabcase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function leaves a string unchanged that is already in kebab case', function test( t ) { - var expected; - var actual; - - expected = 'foo-bar'; - actual = kebabcase( expected ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'client-side-rendering'; - actual = kebabcase( expected ); - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); diff --git a/base/last-code-point/README.md b/base/last-code-point/README.md deleted file mode 100644 index 5d0deb8e..00000000 --- a/base/last-code-point/README.md +++ /dev/null @@ -1,119 +0,0 @@ - - -# lastCodePoint - -> Return the last `n` Unicode code points of a string. - -
- -## Usage - -```javascript -var lastCodePoint = require( '@stdlib/string/base/last-code-point' ); -``` - -#### lastCodePoint( str, n ) - -Returns the last `n` Unicode code points of a string. - -```javascript -var s = lastCodePoint( 'JavaScript', 1 ); -// returns 't' - -s = lastCodePoint( 'Hello World', 5 ); -// returns 'World' - -s = lastCodePoint( 'Good Evening', 9 ); -// returns 'd Evening' - -s = lastCodePoint( 'foo bar', 10 ); -// returns 'foo bar' -``` - -
- - - -
- -## Examples - - - -```javascript -var lastCodePoint = require( '@stdlib/string/base/last-code-point' ); - -var str = lastCodePoint( 'Hello World', 1 ); -// returns 'd' - -str = lastCodePoint( 'JavaScript', 6 ); -// returns 'Script' - -str = lastCodePoint( 'ASCII', 2 ); -// returns 'II' - -str = lastCodePoint( 'index', 10 ); -// returns 'index' - -str = lastCodePoint( 'अनुच्छेद', 1 ); -// returns 'द' - -str = lastCodePoint( '六书/六書', 3 ); -// returns '/六書' -``` - -
- - - - - - - - - - - - - - diff --git a/base/last-code-point/benchmark/benchmark.js b/base/last-code-point/benchmark/benchmark.js deleted file mode 100644 index e0834d72..00000000 --- a/base/last-code-point/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var last = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'hello world', - 'new', - 'JavaScript', - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸', - 'अनुच्छेद' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = last( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/last-code-point/docs/repl.txt b/base/last-code-point/docs/repl.txt deleted file mode 100644 index 3cc6b092..00000000 --- a/base/last-code-point/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n ) - Returns the last `n` Unicode code points of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of Unicode code points to return. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'hello world', 1 ) - 'd' - > out = {{alias}}( 'JavaScript', 6 ) - 'Script' - > out = {{alias}}( 'अनुच्छेद', 1 ) - 'द' - - See Also - -------- - diff --git a/base/last-code-point/docs/types/index.d.ts b/base/last-code-point/docs/types/index.d.ts deleted file mode 100644 index 0f31876a..00000000 --- a/base/last-code-point/docs/types/index.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns the last `n` Unicode code points of a string. -* -* @param str - input string -* @param n - number of code points to return -* @returns output string -* -* @example -* var out = last( 'Hello World', 1 ); -* // returns 'd' -* -* @example -* var out = last( 'JavaScript', 6 ); -* // returns 'Script' -* -* @example -* var out = last( 'New', 5 ); -* // returns 'New' -* -* @example -* var out = last( 'अनुच्छेद', 1 ); -* // returns 'द' -*/ -declare function last( str: string, n: number ): string; - - -// EXPORTS // - -export = last; diff --git a/base/last-code-point/docs/types/test.ts b/base/last-code-point/docs/types/test.ts deleted file mode 100644 index 310a416d..00000000 --- a/base/last-code-point/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import last = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - last( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - last( true, 1 ); // $ExpectError - last( false, 1 ); // $ExpectError - last( null, 1 ); // $ExpectError - last( undefined, 1 ); // $ExpectError - last( 5, 1 ); // $ExpectError - last( [], 1 ); // $ExpectError - last( {}, 1 ); // $ExpectError - last( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - last( 'abc', true ); // $ExpectError - last( 'abc', false ); // $ExpectError - last( 'abc', null ); // $ExpectError - last( 'abc', 'abc' ); // $ExpectError - last( 'abc', [] ); // $ExpectError - last( 'abc', {} ); // $ExpectError - last( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - last(); // $ExpectError - last( 'abc' ); // $ExpectError - last( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/last-code-point/examples/index.js b/base/last-code-point/examples/index.js deleted file mode 100644 index 817b483b..00000000 --- a/base/last-code-point/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 lastCodePoint = require( './../lib' ); - -console.log( lastCodePoint( 'Hello World', 1 ) ); -// => 'd' - -console.log( lastCodePoint( 'JavaScript', 6 ) ); -// => 'Script' - -console.log( lastCodePoint( 'index', 10 ) ); -// => 'index' - -console.log( lastCodePoint( 'अनुच्छेद', 1 ) ); -// => 'द' - -console.log( lastCodePoint( '六书/六書', 3 ) ); -// => '/六書' diff --git a/base/last-code-point/lib/index.js b/base/last-code-point/lib/index.js deleted file mode 100644 index e6995579..00000000 --- a/base/last-code-point/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the last `n` Unicode code points of a string. -* -* @module @stdlib/string/base/last-code-point -* -* @example -* var last = require( '@stdlib/string/base/last-code-point' ); -* -* var out = last( 'Hello World', 1 ); -* // returns 'd' -* -* out = last( 'अनुच्छेद', 1 ); -* // returns 'द' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/last-code-point/lib/main.js b/base/last-code-point/lib/main.js deleted file mode 100644 index e8089a61..00000000 --- a/base/last-code-point/lib/main.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var RE_UTF16_SURROGATE_PAIR = require( '@stdlib/regexp/utf16-surrogate-pair' ).REGEXP; - - -// VARIABLES // - -var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/; // TODO: replace with stdlib pkg -var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/; // TODO: replace with stdlib pkg - - -// MAIN // - -/** -* Returns the last `n` Unicode code points of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of Unicode code points to return -* @returns {string} output string -* -* @example -* var out = last( 'Hello World', 1 ); -* // returns 'd' -* -* @example -* var out = last( 'ASCII', 2 ); -* // returns 'II' -* -* @example -* var out = last( 'JavaScript', 6 ); -* // returns 'Script' -*/ -function last( str, n ) { - var len; - var out; - var ch1; - var ch2; - var cnt; - var i; - len = str.length; - out = ''; - cnt = 0; - if ( str === '' || n === 0 ) { - return ''; - } - if ( n === 1 ) { - str = str.substring( len-2, len ); - if ( RE_UTF16_SURROGATE_PAIR.test( str ) ) { - return str; - } - return str[1]; - } - - // Process the string backwards one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point... - for ( i = len-1; i >= 0; i-- ) { - ch1 = str[ i ]; - out = ch1 + out; - cnt += 1; - - // Check for a low UTF-16 surrogate... - if ( RE_UTF16_LOW_SURROGATE.test( ch1 ) ) { - // Check for an unpaired surrogate at the start of the input string... - if ( i === 0 ) { - // We found an unpaired surrogate... - break; - } - // Check whether the low surrogate is paired with a high surrogate... - ch2 = str[ i-1 ]; - if ( RE_UTF16_HIGH_SURROGATE.test( ch2 ) ) { - // We found a surrogate pair: - out = ch2 + out; - i -= 1; // decrement the index to process the next code unit - } - } - // Check whether we've found the desired number of code points... - if ( cnt === n ) { - break; - } - } - return out; -} - - -// EXPORTS // - -module.exports = last; diff --git a/base/last-code-point/package.json b/base/last-code-point/package.json deleted file mode 100644 index 4ea5629c..00000000 --- a/base/last-code-point/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/last-code-point", - "version": "0.0.0", - "description": "Return the last Unicode code point of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "last", - "character", - "char", - "codepoint", - "unicode" - ] -} diff --git a/base/last-code-point/test/test.js b/base/last-code-point/test/test.js deleted file mode 100644 index 18b44ca2..00000000 --- a/base/last-code-point/test/test.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 tape = require( 'tape' ); -var last = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof last, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( last( '', 1 ), '', 'returns expected value' ); - t.strictEqual( last( '', 2 ), '', 'returns expected value' ); - t.strictEqual( last( '', 3 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided zero as the second argument', function test( t ) { - t.strictEqual( last( 'hello world', 0 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the last Unicode code point of a provided string (ascii)', function test( t ) { - var out; - - out = last( 'hello world', 1 ); - t.strictEqual( out, 'd', 'returns expected value' ); - - out = last( '!!!', 1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = last( 'JavaScript', 6 ); - t.strictEqual( out, 'Script', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the last Unicode code point of a provided string (Unicode)', function test( t ) { - var out; - - out = last( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'द', 'returns expected value' ); - - out = last( '六书/六書', 1 ); - t.strictEqual( out, '書', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the last `n` Unicode code points of a provided string', function test( t ) { - var out; - - out = last( 'hello world', 1 ); - t.strictEqual( out, 'd', 'returns expected value' ); - - out = last( 'hello world', 7 ); - t.strictEqual( out, 'o world', 'returns expected value' ); - - out = last( '!!!', 2 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = last( '六书/六書', 3 ); - t.strictEqual( out, '/六書', 'returns expected value' ); - - out = last( '六书/六書', 5 ); - t.strictEqual( out, '六书/六書', 'returns expected value' ); - - out = last( '六书/六書', 10 ); - t.strictEqual( out, '六书/六書', 'returns expected value' ); - - out = last( 'hello六书/六書', 6 ); - t.strictEqual( out, 'o六书/六書', 'returns expected value' ); - - out = last( 'hello六书/六書', 10 ); - t.strictEqual( out, 'hello六书/六書', 'returns expected value' ); - - out = last( '六书/hello六書', 15 ); - t.strictEqual( out, '六书/hello六書', 'returns expected value' ); - - out = last( '😄', 1 ); - t.strictEqual( out, '😄', 'returns expected value' ); - - out = last( '👍', 1 ); - t.strictEqual( out, '👍', 'returns expected value' ); - - out = last( 'abc😄def', 4 ); - t.strictEqual( out, '😄def', 'returns expected value' ); - - out = last( '😄😄😄', 2 ); - t.strictEqual( out, '😄😄', 'returns expected value' ); - - t.end(); -}); diff --git a/base/last-grapheme-cluster/README.md b/base/last-grapheme-cluster/README.md deleted file mode 100644 index da04206d..00000000 --- a/base/last-grapheme-cluster/README.md +++ /dev/null @@ -1,113 +0,0 @@ - - -# lastGraphemeCluster - -> Return the last `n` grapheme clusters (i.e., user-perceived characters) of a string. - -
- -## Usage - -```javascript -var lastGraphemeCluster = require( '@stdlib/string/base/last-grapheme-cluster' ); -``` - -#### lastGraphemeCluster( str, n ) - -Returns the last `n` grapheme clusters (i.e., user-perceived characters) of a string. - -```javascript -var out = lastGraphemeCluster( 'Hello World', 1 ); -// returns 'd' - -out = lastGraphemeCluster( 'Evening', 3 ); -// returns 'ing' - -out = lastGraphemeCluster( 'foo bar', 10 ); -// returns 'foo bar' -``` - -
- - - -
- -## Examples - - - -```javascript -var lastGraphemeCluster = require( '@stdlib/string/base/last-grapheme-cluster' ); - -var str = lastGraphemeCluster( 'Hello World!', 1 ); -// returns '!' - -str = lastGraphemeCluster( 'JavaScript', 6 ); -// returns 'Script' - -str = lastGraphemeCluster( 'stdlib', 10 ); -// returns 'stdlib' - -str = lastGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ); -// returns '🐰🐸' - -str = lastGraphemeCluster( '六书/六書', 2 ); -// returns '六書' -``` - -
- - - - - - - - - - - - - - diff --git a/base/last-grapheme-cluster/benchmark/benchmark.js b/base/last-grapheme-cluster/benchmark/benchmark.js deleted file mode 100644 index 677642f3..00000000 --- a/base/last-grapheme-cluster/benchmark/benchmark.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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var last = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - '六書', - 'xyz abc', - '🐶🐮🐷🐰🐸', - '🌷🌷🌷🌷🌷' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = last( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/last-grapheme-cluster/docs/repl.txt b/base/last-grapheme-cluster/docs/repl.txt deleted file mode 100644 index 50e902a5..00000000 --- a/base/last-grapheme-cluster/docs/repl.txt +++ /dev/null @@ -1,30 +0,0 @@ - -{{alias}}( str, n ) - Returns the last `n` grapheme clusters (i.e., user-perceived characters) of - a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of grapheme clusters to return. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 1 ) - 'p' - > out = {{alias}}( 'Boop', 2 ) - 'op' - > out = {{alias}}( 'JavaScript', 6 ) - 'Script' - - See Also - -------- - diff --git a/base/last-grapheme-cluster/docs/types/index.d.ts b/base/last-grapheme-cluster/docs/types/index.d.ts deleted file mode 100644 index 2009262f..00000000 --- a/base/last-grapheme-cluster/docs/types/index.d.ts +++ /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. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the last `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @param str - input string -* @param n - number of grapheme clusters to return -* @returns output string -* -* @example -* var out = last( 'Hello World', 1 ); -* // returns 'd' -* -* @example -* var out = last( 'Evening', 3 ); -* // returns 'ing' -* -* @example -* var out = last( 'JavaScript', 6 ); -* // returns 'Script' -* -* @example -* var out = last( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐰🐸' -* -* @example -* var out = last( 'foo bar', 5 ); -* // returns 'o bar' -*/ -declare function last( str: string, n: number ): string; - - -// EXPORTS // - -export = last; diff --git a/base/last-grapheme-cluster/docs/types/test.ts b/base/last-grapheme-cluster/docs/types/test.ts deleted file mode 100644 index 310a416d..00000000 --- a/base/last-grapheme-cluster/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import last = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - last( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - last( true, 1 ); // $ExpectError - last( false, 1 ); // $ExpectError - last( null, 1 ); // $ExpectError - last( undefined, 1 ); // $ExpectError - last( 5, 1 ); // $ExpectError - last( [], 1 ); // $ExpectError - last( {}, 1 ); // $ExpectError - last( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - last( 'abc', true ); // $ExpectError - last( 'abc', false ); // $ExpectError - last( 'abc', null ); // $ExpectError - last( 'abc', 'abc' ); // $ExpectError - last( 'abc', [] ); // $ExpectError - last( 'abc', {} ); // $ExpectError - last( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - last(); // $ExpectError - last( 'abc' ); // $ExpectError - last( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/last-grapheme-cluster/examples/index.js b/base/last-grapheme-cluster/examples/index.js deleted file mode 100644 index db262395..00000000 --- a/base/last-grapheme-cluster/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 lastGraphemeCluster = require( './../lib' ); - -console.log( lastGraphemeCluster( 'Hello World!', 1 ) ); -// => '!' - -console.log( lastGraphemeCluster( 'JavaScript', 6 ) ); -// => 'Script' - -console.log( lastGraphemeCluster( 'stdlib', 10 ) ); -// => 'stdlib' - -console.log( lastGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ) ); -// => '🐰🐸' - -console.log( lastGraphemeCluster( '六书/六書', 2 ) ); -// => '六書' diff --git a/base/last-grapheme-cluster/lib/index.js b/base/last-grapheme-cluster/lib/index.js deleted file mode 100644 index 67787317..00000000 --- a/base/last-grapheme-cluster/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the last `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @module @stdlib/string/base/last-grapheme-cluster -* -* @example -* var last = require( '@stdlib/string/base/last-grapheme-cluster' ); -* -* var out = last( 'Hello', 1 ); -* // returns 'o' -* -* out = last( 'JavaScript', 6 ); -* // returns 'Script' -* -* out = last( '🐮🐷🐸🐵', 2 ); -* // returns '🐸🐵' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/last-grapheme-cluster/lib/main.js b/base/last-grapheme-cluster/lib/main.js deleted file mode 100644 index b77c7b13..00000000 --- a/base/last-grapheme-cluster/lib/main.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 nextGraphemeClusterBreak = require( './../../../next-grapheme-cluster-break' ); -var CircularBuffer = require( '@stdlib/dstructs/circular-buffer' ); -var zeros = require( '@stdlib/array/base/zeros' ); - - -// MAIN // - -/** -* Returns the last `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of grapheme clusters to return -* @returns {string} output string -* -* @example -* var out = last( 'Hello World', 1 ); -* // returns 'd' -* -* @example -* var out = last( 'Evening', 3 ); -* // returns 'ing' -* -* @example -* var out = last( 'JavaScript', 6 ); -* // returns 'Script' -* -* @example -* var out = last( '六书/六書', 1 ); -* // returns '書' -* -* @example -* var out = last( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐰🐸' -*/ -function last( str, n ) { - var count; - var cbuf; - var buf; - var i; - - if ( n === 0 || str === '' ) { - return ''; - } - // Resolve the first cluster break: - i = nextGraphemeClusterBreak( str, 0 ); - - // If we received a sentinel value, return the input string, as there are no more cluster breaks to iterate over... - if ( i === -1 ) { - return str; - } - // Initialize a buffer for keeping track of cluster break indices: - buf = zeros( n ); - - // Wrap the buffer to create a circular buffer serving as a FIFO stack where we can keep at most `n` indices as we iterate from left-to-right: - cbuf = new CircularBuffer( buf ); - - // Add the first character index: - cbuf.push( 0 ); - - // Add the index of the first grapheme cluster break to our buffer: - cbuf.push( i ); - - // Slide a window over the string from left-to-right... - count = 0; - while ( true ) { - count += 1; - i = nextGraphemeClusterBreak( str, i ); - if ( i === -1 ) { - break; - } - cbuf.push( i ); - } - // Resolve the leftmost index: - i = buf[ (count+1)%n ]; // count+1 as count%n corresponds to the index of the "newest" element in the circular buffer and count+1 is the next element to replace (i.e., the "oldest" index) - - // Return the last `n` grapheme clusters: - return str.substring( i ); -} - - -// EXPORTS // - -module.exports = last; diff --git a/base/last-grapheme-cluster/package.json b/base/last-grapheme-cluster/package.json deleted file mode 100644 index 590dad30..00000000 --- a/base/last-grapheme-cluster/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/last-grapheme-cluster", - "version": "0.0.0", - "description": "Return the last grapheme cluster (i.e., user-perceived character) of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "last", - "character", - "char", - "grapheme", - "cluster", - "unicode" - ] -} diff --git a/base/last-grapheme-cluster/test/test.js b/base/last-grapheme-cluster/test/test.js deleted file mode 100644 index 328eb893..00000000 --- a/base/last-grapheme-cluster/test/test.js +++ /dev/null @@ -1,129 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 last = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof last, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( last( '', 1 ), '', 'returns expected value' ); - t.strictEqual( last( '', 2 ), '', 'returns expected value' ); - t.strictEqual( last( '', 3 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided zero as the second argument', function test( t ) { - t.strictEqual( last( 'hello world', 0 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the last grapheme cluster of a provided string (ascii)', function test( t ) { - var out; - - out = last( 'hello world', 1 ); - t.strictEqual( out, 'd', 'returns expected value' ); - - out = last( 'h', 1 ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = last( '!!!', 1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = last( 'JavaScript', 1 ); - t.strictEqual( out, 't', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the last grapheme cluster of a provided string (Unicode)', function test( t ) { - var out; - - out = last( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'द', 'returns expected value' ); - - out = last( '六书/六書', 1 ); - t.strictEqual( out, '書', 'returns expected value' ); - - out = last( '書', 1 ); - t.strictEqual( out, '書', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the last grapheme cluster of a provided string (emoji)', function test( t ) { - var out; - - out = last( '🌷', 1 ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - out = last( '🏝️🌷', 1 ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the last `n` grapheme clusters of a provided string', function test( t ) { - var out; - - out = last( 'hello world', 1 ); - t.strictEqual( out, 'd', 'returns expected value' ); - - out = last( 'hello world', 7 ); - t.strictEqual( out, 'o world', 'returns expected value' ); - - out = last( 'JavaScript', 15 ); - t.strictEqual( out, 'JavaScript', 'returns expected value' ); - - out = last( '!!!', 1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = last( '!!!', 2 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = last( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'द', 'returns expected value' ); - - out = last( 'अनुच्छेद+o', 3 ); - t.strictEqual( out, 'द+o', 'returns expected value' ); - - out = last( '六书/六書', 2 ); - t.strictEqual( out, '六書', 'returns expected value' ); - - out = last( '六书/六書()!', 4 ); - t.strictEqual( out, '書()!', 'returns expected value' ); - - out = last( '六书/六書', 10 ); - t.strictEqual( out, '六书/六書', 'returns expected value' ); - - out = last( '🌷🌷🌷🌷🌷', 2 ); - t.strictEqual( out, '🌷🌷', 'returns expected value' ); - - t.end(); -}); diff --git a/base/last/README.md b/base/last/README.md deleted file mode 100644 index a5c4f5d7..00000000 --- a/base/last/README.md +++ /dev/null @@ -1,110 +0,0 @@ - - -# last - -> Return the last `n` UTF-16 code units of a string. - -
- -## Usage - -```javascript -var last = require( '@stdlib/string/base/last' ); -``` - -#### last( str, n ) - -Returns the last `n` UTF-16 code units of a string. - -```javascript -var s = last( 'hello world', 1 ); -// returns 'd' - -s = last( 'this is stdlib', 1 ); -// returns 'b' - -s = last( 'foo', 2 ); -// returns 'oo' - -s = last( 'foo bar', 10 ); -// returns 'foo bar' -``` - -
- - - -
- -## Examples - - - -```javascript -var last = require( '@stdlib/string/base/last' ); - -var str = last( 'elections', 1 ); -// returns 's' - -str = last( 'JavaScript', 1 ); -// returns 't' - -str = last( 'good night', 5 ); -// returns 'night' -``` - -
- - - - - - - - - - - - - - diff --git a/base/last/benchmark/benchmark.js b/base/last/benchmark/benchmark.js deleted file mode 100644 index 22888402..00000000 --- a/base/last/benchmark/benchmark.js +++ /dev/null @@ -1,60 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var last = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'hello world', - 'abc', - '', - 'Javascript', - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = last( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/last/docs/repl.txt b/base/last/docs/repl.txt deleted file mode 100644 index 215c0c32..00000000 --- a/base/last/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n ) - Returns the last `n` UTF-16 code units of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of UTF-16 code units to return. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'hello', 1 ) - 'o' - > out = {{alias}}( 'JavaScript', 6 ) - 'Script' - > out = {{alias}}( 'foo bar', 10 ) - 'foo bar' - - See Also - -------- - diff --git a/base/last/docs/types/index.d.ts b/base/last/docs/types/index.d.ts deleted file mode 100644 index 0d4da1ca..00000000 --- a/base/last/docs/types/index.d.ts +++ /dev/null @@ -1,49 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns the last `n` UTF-16 code units of a string. -* -* @param str - input string -* @param n - number of code units to return -* @returns output string -* -* @example -* var s = last( 'hello world', 1 ); -* // returns 'd' -* -* @example -* var s = last( 'foo', 2 ); -* // returns 'oo' -* -* @example -* var s = last( 'JavaScript', 6 ); -* // returns 'Script' -* -* @example -* var s = last( 'foo bar', 10 ); -* // returns 'foo bar' -*/ -declare function last( str: string, n: number ): string; - - -// EXPORTS // - -export = last; diff --git a/base/last/docs/types/test.ts b/base/last/docs/types/test.ts deleted file mode 100644 index 310a416d..00000000 --- a/base/last/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import last = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - last( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - last( true, 1 ); // $ExpectError - last( false, 1 ); // $ExpectError - last( null, 1 ); // $ExpectError - last( undefined, 1 ); // $ExpectError - last( 5, 1 ); // $ExpectError - last( [], 1 ); // $ExpectError - last( {}, 1 ); // $ExpectError - last( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - last( 'abc', true ); // $ExpectError - last( 'abc', false ); // $ExpectError - last( 'abc', null ); // $ExpectError - last( 'abc', 'abc' ); // $ExpectError - last( 'abc', [] ); // $ExpectError - last( 'abc', {} ); // $ExpectError - last( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - last(); // $ExpectError - last( 'abc' ); // $ExpectError - last( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/last/examples/index.js b/base/last/examples/index.js deleted file mode 100644 index 614b8257..00000000 --- a/base/last/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 last = require( './../lib' ); - -console.log( last( 'hello world', 1 ) ); -// => 'd' - -console.log( last( 'JavaScript', 6 ) ); -// => 'Script' - -console.log( last( 'New', 6 ) ); -// => 'New' - -console.log( last( 'EVENING', 5 ) ); -// => 'ENING' diff --git a/base/last/lib/index.js b/base/last/lib/index.js deleted file mode 100644 index 63f776f8..00000000 --- a/base/last/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the last `n` UTF-16 code units of a string. -* -* @module @stdlib/string/base/last -* -* @example -* var last = require( '@stdlib/string/base/last' ); -* -* var s = last( 'hello world', 1 ); -* // returns 'd' -* -* var out = last( 'JavaScript', 6 ); -* // returns 'Script' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/last/lib/main.js b/base/last/lib/main.js deleted file mode 100644 index 0aa1cbfd..00000000 --- a/base/last/lib/main.js +++ /dev/null @@ -1,54 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Returns the last `n` UTF-16 code units of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of UTF-16 code units to return -* @returns {string} output string -* -* @example -* var s = last( 'hello world', 1 ); -* // returns 'd' -* -* @example -* var s = last( 'this is stdlib', 1 ); -* // returns 'b' -* -* @example -* var out = last( 'JavaScript', 6 ); -* // returns 'Script' -* -* @example -* var out = last( 'New', 6 ); -* // returns 'New' -*/ -function last( str, n ) { - var len = str.length; - return str.substring( len - n, len ); -} - - -// EXPORTS // - -module.exports = last; diff --git a/base/last/package.json b/base/last/package.json deleted file mode 100644 index a2691fac..00000000 --- a/base/last/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/last", - "version": "0.0.0", - "description": "Return the last UTF-16 code unit of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "last", - "character", - "char", - "codeunit", - "unicode" - ] -} diff --git a/base/last/test/test.js b/base/last/test/test.js deleted file mode 100644 index a238babe..00000000 --- a/base/last/test/test.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'; - -// MODULES // - -var tape = require( 'tape' ); -var last = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof last, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( last( '', 1 ), '', 'returns expected value' ); - t.strictEqual( last( '', 2 ), '', 'returns expected value' ); - t.strictEqual( last( '', 3 ), '', 'returns expected value' ); - t.strictEqual( last( '', 10 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided zero as the second argument', function test( t ) { - t.strictEqual( last( 'hello world', 0 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the last UTF-16 code unit of a provided string', function test( t ) { - var s; - - s = last( 'hello world', 1 ); - t.strictEqual( s, 'd', 'returns expected value' ); - - s = last( 'JavaScript', 1 ); - t.strictEqual( s, 't', 'returns expected value' ); - - s = last( 'EVENING', 1 ); - t.strictEqual( s, 'G', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the last `n` UTF-16 code units of a provided string', function test( t ) { - var s; - - s = last( 'hello world', 1 ); - t.strictEqual( s, 'd', 'returns expected value' ); - - s = last( 'hello world', 5 ); - t.strictEqual( s, 'world', 'returns expected value' ); - - s = last( 'new', 3 ); - t.strictEqual( s, 'new', 'returns expected value' ); - - s = last( '<--->', 2 ); - t.strictEqual( s, '->', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the original string if `n` is greater than the length of the string', function test( t ) { - var s; - - s = last( 'hello world', 20 ); - t.strictEqual( s, 'hello world', 'returns expected value' ); - - s = last( 'new', 5 ); - t.strictEqual( s, 'new', 'returns expected value' ); - - s = last( 'green', 8 ); - t.strictEqual( s, 'green', 'returns expected value' ); - - t.end(); -}); diff --git a/base/left-pad/README.md b/base/left-pad/README.md deleted file mode 100644 index 5c692592..00000000 --- a/base/left-pad/README.md +++ /dev/null @@ -1,159 +0,0 @@ - - -# lpad - -> Left pad a string. - -
- -## Usage - -```javascript -var lpad = require( '@stdlib/string/base/left-pad' ); -``` - -#### lpad( str, len, pad ) - -Left pads a string such that the padded string has a length of **at least** `len`. - -```javascript -var str = lpad( 'a', 5, ' ' ); -// returns ' a' - -str = lpad( 'beep', 10, 'b' ); -// returns 'bbbbbbbeep' - -str = lpad( 'boop', 12, 'beep' ); -// returns 'beepbeepboop' -``` - -
- - - -
- -## Notes - -- An output string is **not** guaranteed to have a length of **exactly** `len`, but to have a length of **at least** `len`. To generate a padded string having a length equal to `len` - - ```javascript - var str = lpad( 'boop', 10, 'beep' ); // => length 12 - // returns 'beepbeepboop' - - str = str.substring( 0, 10 ); // => length 10 - // returns 'beepbeepbo' - - str = str.substring( str.length-10 ); // => length 10 - // returns 'epbeepboop' - ``` - -- This function differs from [`String.prototype.padStart`][mdn-string-padstart] in the following ways: - - - The function is **not** guaranteed to return a string having a length exactly equal to `len` (as explained above). - - The function does **not** truncate `pad` (from the end) in order to ensure the returned string has length `len`. - - To replicate [`String.prototype.padStart`][mdn-string-padstart] truncation behavior - - ```javascript - var floorb = require( '@stdlib/math/base/special/floorb' ); - - function padStart( str, len, pad ) { - var n; - if ( len <= str.length ) { - return str; - } - n = floorb( len-str.length, 1, pad.length ) + str.length; - return pad.substring( 0, len-n ) + lpad( str, n, pad ); - } - - var str = padStart( 'boop', 10, 'beep' ); - // returns 'bebeepboop' - ``` - -
- - - -
- -## Examples - - - -```javascript -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var papply = require( '@stdlib/utils/papply' ); -var papplyRight = require( '@stdlib/utils/papply-right' ); -var naryFunction = require( '@stdlib/utils/nary-function' ); -var map = require( '@stdlib/utils/map' ); -var logEach = require( '@stdlib/console/log-each' ); -var lpad = require( '@stdlib/string/base/left-pad' ); - -// Define a string to pad: -var str = 'beep'; - -// Generate random lengths: -var lens = discreteUniform( 10, str.length, str.length+10 ); - -// Create a function for creating padded strings: -var fcn = naryFunction( papply( papplyRight( lpad, 'b' ), str ), 1 ); - -// Generate padded strings: -var out = map( lens, fcn ); - -// Print results: -logEach( '%s', out ); -``` - -
- - - - - - - - - - - - - - diff --git a/base/left-pad/benchmark/benchmark.builtin.js b/base/left-pad/benchmark/benchmark.builtin.js deleted file mode 100644 index 5b38bd83..00000000 --- a/base/left-pad/benchmark/benchmark.builtin.js +++ /dev/null @@ -1,106 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var opts = { - 'skip': typeof String.prototype.padStart !== 'function' -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - string length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'a', - 'b', - 'c' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = 'beep'.padStart( len, values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - 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 = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - len = 10 * i; - f = createBenchmark( len ); - bench( format( '%s::builtin:len=%d', pkg, len ), opts, f ); - } -} - -main(); diff --git a/base/left-pad/benchmark/benchmark.js b/base/left-pad/benchmark/benchmark.js deleted file mode 100644 index ce87c6f6..00000000 --- a/base/left-pad/benchmark/benchmark.js +++ /dev/null @@ -1,100 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var lpad = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - string length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'a', - 'b', - 'c' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = lpad( 'beep', len, values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - 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 = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - len = 10 * i; - f = createBenchmark( len ); - bench( format( '%s:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/base/left-pad/docs/repl.txt b/base/left-pad/docs/repl.txt deleted file mode 100644 index cb527601..00000000 --- a/base/left-pad/docs/repl.txt +++ /dev/null @@ -1,38 +0,0 @@ - -{{alias}}( str, len, pad ) - Left pads a string such that the padded string has a length of at least - `len`. - - An output string is not guaranteed to have a length of exactly `len`, but to - have a length of at least `len`. To generate a padded string having a length - equal to `len`, post-process a padded string by trimming off excess - characters. - - Parameters - ---------- - str: string - Input string. - - len: integer - Minimum string length. - - pad: string - String used to pad. - - Returns - ------- - out: string - Padded string. - - Examples - -------- - > var out = {{alias}}( 'a', 5, ' ' ) - ' a' - > out = {{alias}}( 'beep', 10, 'b' ) - 'bbbbbbbeep' - > out = {{alias}}( 'boop', 12, 'beep' ) - 'beepbeepboop' - - See Also - -------- - diff --git a/base/left-pad/docs/types/index.d.ts b/base/left-pad/docs/types/index.d.ts deleted file mode 100644 index c941e82b..00000000 --- a/base/left-pad/docs/types/index.d.ts +++ /dev/null @@ -1,50 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Left pads a string such that the padded string has a length of at least `len`. -* -* ## Notes -* -* - An output string is not guaranteed to have a length of exactly `len`, but to have a length of at least `len`. To generate a padded string having a length equal to `len`, post-process a padded string by trimming off excess characters. -* -* @param str - string to pad -* @param len - minimum string length -* @param pad - string used to pad -* @returns padded string -* -* @example -* var str = lpad( 'a', 5, ' ' ); -* // returns ' a' -* -* @example -* var str = lpad( 'beep', 10, 'b' ); -* // returns 'bbbbbbbeep' -* -* @example -* var str = lpad( 'boop', 12, 'beep' ); -* // returns 'beepbeepboop' -*/ -declare function lpad( str: string, len: number, pad: string ): string; - - -// EXPORTS // - -export = lpad; diff --git a/base/left-pad/docs/types/test.ts b/base/left-pad/docs/types/test.ts deleted file mode 100644 index 40b1bc72..00000000 --- a/base/left-pad/docs/types/test.ts +++ /dev/null @@ -1,59 +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. -*/ - -import lpad = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - lpad( 'abd', 5, ' ' ); // $ExpectType string - lpad( 'abd', 4, 'x' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - lpad( true, 6, ' ' ); // $ExpectError - lpad( false, 6, ' ' ); // $ExpectError - lpad( 3, 6, ' ' ); // $ExpectError - lpad( [], 6, ' ' ); // $ExpectError - lpad( {}, 6, ' ' ); // $ExpectError - lpad( ( x: number ): number => x, 6, ' ' ); // $ExpectError - - lpad( 'abd', true, ' ' ); // $ExpectError - lpad( 'abd', false, ' ' ); // $ExpectError - lpad( 'abd', 'abc', ' ' ); // $ExpectError - lpad( 'abd', [], 0, ' ' ); // $ExpectError - lpad( 'abd', {}, 0, ' ' ); // $ExpectError - lpad( 'abd', ( x: number ): number => x, 0, ' ' ); // $ExpectError - - lpad( 'abd', 6, true ); // $ExpectError - lpad( 'abd', 6, false ); // $ExpectError - lpad( 'abd', 6, 123 ); // $ExpectError - lpad( 'abd', 6, [] ); // $ExpectError - lpad( 'abd', 6, {} ); // $ExpectError - lpad( 'abd', 6, /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - lpad(); // $ExpectError - lpad( 'abc' ); // $ExpectError - lpad( 'abc', 6 ); // $ExpectError -} diff --git a/base/left-pad/examples/index.js b/base/left-pad/examples/index.js deleted file mode 100644 index 33b060a1..00000000 --- a/base/left-pad/examples/index.js +++ /dev/null @@ -1,42 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var papply = require( '@stdlib/utils/papply' ); -var papplyRight = require( '@stdlib/utils/papply-right' ); -var naryFunction = require( '@stdlib/utils/nary-function' ); -var map = require( '@stdlib/utils/map' ); -var logEach = require( '@stdlib/console/log-each' ); -var lpad = require( './../lib' ); - -// Define a string to pad: -var str = 'beep'; - -// Generate random lengths: -var lens = discreteUniform( 10, str.length, str.length+10 ); - -// Create a function for creating padded strings: -var fcn = naryFunction( papply( papplyRight( lpad, 'b' ), str ), 1 ); - -// Generate padded strings: -var out = map( lens, fcn ); - -// Print results: -logEach( '%s', out ); diff --git a/base/left-pad/lib/index.js b/base/left-pad/lib/index.js deleted file mode 100644 index caf65532..00000000 --- a/base/left-pad/lib/index.js +++ /dev/null @@ -1,46 +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. -*/ - -'use strict'; - -/** -* Left pad a string such that the padded string has a length of at least `len`. -* -* @module @stdlib/string/base/left-pad -* -* @example -* var lpad = require( '@stdlib/string/base/left-pad' ); -* -* var str = lpad( 'a', 5, ' ' ); -* // returns ' a' -* -* str = lpad( 'beep', 10, 'b' ); -* // returns 'bbbbbbbeep' -* -* str = lpad( 'boop', 12, 'beep' ); -* // returns 'beepbeepboop' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/left-pad/lib/main.js b/base/left-pad/lib/main.js deleted file mode 100644 index f12f0c14..00000000 --- a/base/left-pad/lib/main.js +++ /dev/null @@ -1,61 +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. -*/ - -'use strict'; - -// MODULES // - -var repeat = require( './../../../base/repeat' ); -var ceil = require( '@stdlib/math/base/special/ceil' ); - - -// MAIN // - -/** -* Left pads a string such that the padded string has a length of at least `len`. -* -* @param {string} str - string to pad -* @param {NonNegativeInteger} len - minimum string length -* @param {string} pad - string used to pad -* @returns {string} padded string -* -* @example -* var str = lpad( 'a', 5, ' ' ); -* // returns ' a' -* -* @example -* var str = lpad( 'beep', 10, 'b' ); -* // returns 'bbbbbbbeep' -* -* @example -* var str = lpad( 'boop', 12, 'beep' ); -* // returns 'beepbeepboop' -*/ -function lpad( str, len, pad ) { - var n = ( len - str.length ) / pad.length; - if ( n <= 0 ) { - return str; - } - n = ceil( n ); - return repeat( pad, n ) + str; -} - - -// EXPORTS // - -module.exports = lpad; diff --git a/base/left-pad/package.json b/base/left-pad/package.json deleted file mode 100644 index 6c373ca0..00000000 --- a/base/left-pad/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/left-pad", - "version": "0.0.0", - "description": "Left pad a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "pad", - "string", - "str", - "padding", - "lpad", - "left" - ] -} diff --git a/base/left-pad/test/test.js b/base/left-pad/test/test.js deleted file mode 100644 index 99b3e0f5..00000000 --- a/base/left-pad/test/test.js +++ /dev/null @@ -1,57 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var lpad = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof lpad, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function left pads a string with spaces', function test( t ) { - var str = lpad( 'a', 5, ' ' ); - t.strictEqual( str, ' a', 'left padded with spaces' ); - t.end(); -}); - -tape( 'the function supports left padding a string with a custom pad string', function test( t ) { - var str = lpad( 'beep', 10, 'b' ); - t.strictEqual( str, 'bbbbbbbeep', 'left padded to desired length' ); - t.end(); -}); - -tape( 'the function left pads a string such that an output string may exceed the specified length (minimum bound)', function test( t ) { - var str = lpad( 'a', 5, 'beepboop' ); - t.strictEqual( str, 'beepboopa', 'left padded and length exceeds minimum length' ); - t.end(); -}); - -tape( 'if the specified string length is less than or equal to the input string length, the function returns the input string', function test( t ) { - t.strictEqual( lpad( 'boop', 2, 'beep' ), 'boop', 'returns input string (<)' ); - t.strictEqual( lpad( 'boop', 4, 'beep' ), 'boop', 'returns input string (=)' ); - t.end(); -}); diff --git a/base/left-trim/README.md b/base/left-trim/README.md deleted file mode 100644 index df0b72ed..00000000 --- a/base/left-trim/README.md +++ /dev/null @@ -1,126 +0,0 @@ - - -# ltrim - -> Trim whitespace characters from the beginning of a string. - -
- -## Usage - -```javascript -var ltrim = require( '@stdlib/string/base/left-trim' ); -``` - -#### ltrim( str ) - -Trims whitespace from the beginning of a string. - -```javascript -var out = ltrim( ' \r\n\t Beep \t\t\n ' ); -// returns 'Beep \t\t\n ' -``` - -
- - - -
- -## Notes - -- Following [Unicode 6.3.0][unicode] and later, "whitespace" is defined as the following characters: - - - `\f` - - `\n` - - `\r` - - `\t` - - `\v` - - `\u0020` - - `\u00a0` - - `\u1680` - - `\u2000-\u200a` - - `\u2028` - - `\u2029` - - `\u202f` - - `\u205f` - - `\u3000` - - `\ufeff` - -
- - - -
- -## Examples - - - -```javascript -var ltrim = require( '@stdlib/string/base/left-trim' ); - -var str = ltrim( ' Whitespace ' ); -// returns 'Whitespace ' - -str = ltrim( '\t\t\tTabs\t\t\t' ); -// returns 'Tabs\t\t\t' - -str = ltrim( '\n\n\nNew Lines\n\n\n' ); -// returns 'New Lines\n\n\n' -``` - -
- - - - - - - - - - - - - - diff --git a/base/left-trim/benchmark/benchmark.js b/base/left-trim/benchmark/benchmark.js deleted file mode 100644 index 35445e64..00000000 --- a/base/left-trim/benchmark/benchmark.js +++ /dev/null @@ -1,90 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var ltrim = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( typeof String.prototype.trimLeft !== 'function' ) -}; -var whitespace = '\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff'; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - whitespace + 'beep boop', - whitespace + 'foo bar', - whitespace + 'xyz' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = ltrim( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::built-in', pkg ), opts, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - whitespace + 'beep boop', - whitespace + 'foo bar', - whitespace + 'xyz' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = values[ i%values.length ].trimLeft(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/left-trim/benchmark/benchmark.polyfill.js b/base/left-trim/benchmark/benchmark.polyfill.js deleted file mode 100644 index 0304867b..00000000 --- a/base/left-trim/benchmark/benchmark.polyfill.js +++ /dev/null @@ -1,61 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var ltrim = require( './../lib/polyfill.js' ); - - -// VARIABLES // - -var whitespace = '\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff'; - - -// MAIN // - -bench( format( '%s::polyfill', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - whitespace + 'beep boop', - whitespace + 'foo bar', - whitespace + 'xyz' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = ltrim( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/left-trim/docs/repl.txt b/base/left-trim/docs/repl.txt deleted file mode 100644 index 35b1914c..00000000 --- a/base/left-trim/docs/repl.txt +++ /dev/null @@ -1,40 +0,0 @@ - -{{alias}}( str ) - Trims whitespace from the beginning of a string. - - "Whitespace" is defined as the following characters: - - - \f - - \n - - \r - - \t - - \v - - \u0020 - - \u00a0 - - \u1680 - - \u2000-\u200a - - \u2028 - - \u2029 - - \u202f - - \u205f - - \u3000 - - \ufeff - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Trimmed string. - - Examples - -------- - > var out = {{alias}}( ' \r\n\t Beep \t\t\n ' ) - 'Beep \t\t\n ' - - See Also - -------- - diff --git a/base/left-trim/docs/types/index.d.ts b/base/left-trim/docs/types/index.d.ts deleted file mode 100644 index adbf4cd9..00000000 --- a/base/left-trim/docs/types/index.d.ts +++ /dev/null @@ -1,44 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Trims whitespace characters from the beginning of a string. -* -* @param str - input string -* @returns trimmed string -* -* @example -* var out = ltrim( ' Whitespace ' ); -* // returns 'Whitespace ' -* -* @example -* var out = ltrim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs\t\t\t' -* -* @example -* var out = ltrim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines\n\n\n' -*/ -declare function ltrim( str: string ): string; - - -// EXPORTS // - -export = ltrim; diff --git a/base/left-trim/docs/types/test.ts b/base/left-trim/docs/types/test.ts deleted file mode 100644 index d4f95668..00000000 --- a/base/left-trim/docs/types/test.ts +++ /dev/null @@ -1,44 +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. -*/ - -import ltrim = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - ltrim( ' Whitespace ' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - ltrim( true ); // $ExpectError - ltrim( false ); // $ExpectError - ltrim( null ); // $ExpectError - ltrim( undefined ); // $ExpectError - ltrim( 5 ); // $ExpectError - ltrim( [] ); // $ExpectError - ltrim( {} ); // $ExpectError - ltrim( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - ltrim(); // $ExpectError -} diff --git a/base/left-trim/examples/index.js b/base/left-trim/examples/index.js deleted file mode 100644 index ba02168b..00000000 --- a/base/left-trim/examples/index.js +++ /dev/null @@ -1,30 +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. -*/ - -'use strict'; - -var ltrim = require( './../lib' ); - -console.log( ltrim( ' Whitespace ' ) ); -// => 'Whitespace ' - -console.log( ltrim( '\t\t\tTabs\t\t\t' ) ); -// => 'Tabs\t\t\t' - -console.log( ltrim( '\n\n\nNew Lines\n\n\n' ) ); -// => 'New Lines\n\n\n' diff --git a/base/left-trim/lib/builtin.js b/base/left-trim/lib/builtin.js deleted file mode 100644 index e5eb050c..00000000 --- a/base/left-trim/lib/builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var ltrim = String.prototype.trimLeft; - - -// EXPORTS // - -module.exports = ltrim; diff --git a/base/left-trim/lib/has_builtin.js b/base/left-trim/lib/has_builtin.js deleted file mode 100644 index 24c16fda..00000000 --- a/base/left-trim/lib/has_builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var bool = ( typeof String.prototype.trimLeft !== 'undefined' ); - - -// EXPORTS // - -module.exports = bool; diff --git a/base/left-trim/lib/index.js b/base/left-trim/lib/index.js deleted file mode 100644 index 6b1119ef..00000000 --- a/base/left-trim/lib/index.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -/** -* Trim whitespace characters from the beginning of a string. -* -* @module @stdlib/string/base/left-trim -* -* @example -* var ltrim = require( '@stdlib/string/base/left-trim' ); -* -* var out = ltrim( ' Whitespace ' ); -* // returns 'Whitespace ' -* -* out = ltrim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs\t\t\t' -*/ - -// MODULES // - -var HAS_BUILTIN = require( './has_builtin.js' ); -var polyfill = require( './polyfill.js' ); -var main = require( './main.js' ); - - -// MAIN // - -var ltrim; -if ( HAS_BUILTIN ) { - ltrim = main; -} else { - ltrim = polyfill; -} - - -// EXPORTS // - -module.exports = ltrim; diff --git a/base/left-trim/lib/main.js b/base/left-trim/lib/main.js deleted file mode 100644 index c8f24b58..00000000 --- a/base/left-trim/lib/main.js +++ /dev/null @@ -1,53 +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. -*/ - -'use strict'; - -// MODULES // - -var builtin = require( './builtin.js' ); - - -// MAIN // - -/** -* Trims whitespace characters from the beginning of a string. -* -* @param {string} str - input string -* @returns {string} trimmed string -* -* @example -* var out = ltrim( ' Whitespace ' ); -* // returns 'Whitespace ' -* -* @example -* var out = ltrim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs\t\t\t' -* -* @example -* var out = ltrim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines\n\n\n' -*/ -function ltrim( str ) { - return builtin.call( str ); -} - - -// EXPORTS // - -module.exports = ltrim; diff --git a/base/left-trim/lib/polyfill.js b/base/left-trim/lib/polyfill.js deleted file mode 100644 index 60ce6efa..00000000 --- a/base/left-trim/lib/polyfill.js +++ /dev/null @@ -1,60 +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. -*/ - -'use strict'; - -// MODULES // - -var replace = require( './../../../base/replace' ); - - -// VARIABLES // - -// The following regular expression should suffice to polyfill (most?) all environments. -var RE = /^[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/; - - -// MAIN // - -/** -* Trims whitespace characters from the beginning of a string. -* -* @private -* @param {string} str - input string -* @returns {string} trimmed string -* -* @example -* var out = ltrim( ' Whitespace ' ); -* // returns 'Whitespace ' -* -* @example -* var out = ltrim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs\t\t\t' -* -* @example -* var out = ltrim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines\n\n\n' -*/ -function ltrim( str ) { - return replace( str, RE, '' ); -} - - -// EXPORTS // - -module.exports = ltrim; diff --git a/base/left-trim/package.json b/base/left-trim/package.json deleted file mode 100644 index 9cf9ab40..00000000 --- a/base/left-trim/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/left-trim", - "version": "0.0.0", - "description": "Trim whitespace characters from the beginning of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "whitespace", - "remove", - "trim", - "left", - "left trim", - "trimming" - ] -} diff --git a/base/left-trim/test/test.js b/base/left-trim/test/test.js deleted file mode 100644 index dbcc8095..00000000 --- a/base/left-trim/test/test.js +++ /dev/null @@ -1,178 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var polyfill = require( './../lib/polyfill.js' ); -var main = require( './../lib/main.js' ); -var ltrim = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ltrim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the main export is a polyfill if an environment does not support String.prototype.trimLeft', function test( t ) { - var ltrim = proxyquire( './../lib', { - './has_builtin.js': false - }); - t.strictEqual( ltrim, polyfill, 'returns expected value' ); - t.end(); -}); - -tape( 'the main export is a wrapper around a builtin if an environment supports String.prototype.trimLeft', function test( t ) { - var ltrim = proxyquire( './../lib', { - './has_builtin.js': true - }); - t.strictEqual( ltrim, main, 'returns expected value' ); - t.end(); -}); - -tape( 'the function removes all whitespace characters at the beginning of a string', function test( t ) { - var expected; - var actual; - - expected = 'Whitespace '; - actual = ltrim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'Tabs\t\t\t'; - actual = ltrim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = 'New Lines\n\n\n'; - actual = ltrim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = 'New Lines\r\n\r\n\r\n'; - actual = ltrim( '\r\n\r\n\r\nNew Lines\r\n\r\n\r\n' ); - t.strictEqual( actual, expected, 'removes all newline and carriage return characters' ); - - expected = 'Beep \r\n \t'; - actual = ltrim( ' \t\r\n Beep \r\n \t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = ltrim( '\fbeep' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = ltrim( '\nbeep' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = ltrim( '\tbeep' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = ltrim( '\vbeep' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = ltrim( '\u1680beep' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = ltrim( '\u2000beep' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = ltrim( '\u2001beep' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = ltrim( '\u2002beep' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = ltrim( '\u2003beep' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = ltrim( '\u2004beep' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = ltrim( '\u2005beep' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = ltrim( '\u2006beep' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = ltrim( '\u2007beep' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = ltrim( '\u2008beep' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = ltrim( '\u2009beep' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = ltrim( '\u200abeep' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = ltrim( '\u2028beep' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = ltrim( '\u2029beep' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = ltrim( '\u202fbeep' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = ltrim( '\u205fbeep' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = ltrim( '\u3000beep' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = ltrim( '\ufeffbeep' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); - -tape( 'the function does not remove the Mongolian space separator in accordance with Unicode 6.3.0 and later', function test( t ) { - var expected; - var actual; - - expected = '\u180ebeep'; - actual = ltrim( '\u180ebeep' ); - t.strictEqual( actual, expected, 'does not remove \\u180e' ); - - t.end(); -}); diff --git a/base/left-trim/test/test.main.js b/base/left-trim/test/test.main.js deleted file mode 100644 index 2873695f..00000000 --- a/base/left-trim/test/test.main.js +++ /dev/null @@ -1,167 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var HAS_BUILTIN = require( './../lib/has_builtin.js' ); -var ltrim = require( './../lib/main.js' ); - - -// VARIABLES // - -var opts = { - 'skip': !HAS_BUILTIN -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ltrim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function removes all whitespace characters at the beginning of a string', function test( t ) { - var expected; - var actual; - - expected = 'Whitespace '; - actual = ltrim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'Tabs\t\t\t'; - actual = ltrim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = 'New Lines\n\n\n'; - actual = ltrim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = 'New Lines\r\n\r\n\r\n'; - actual = ltrim( '\r\n\r\n\r\nNew Lines\r\n\r\n\r\n' ); - t.strictEqual( actual, expected, 'removes all newline and carriage return characters' ); - - expected = 'Beep \r\n \t'; - actual = ltrim( ' \t\r\n Beep \r\n \t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = ltrim( '\fbeep' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = ltrim( '\nbeep' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = ltrim( '\tbeep' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = ltrim( '\vbeep' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = ltrim( '\u1680beep' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = ltrim( '\u2000beep' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = ltrim( '\u2001beep' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = ltrim( '\u2002beep' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = ltrim( '\u2003beep' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = ltrim( '\u2004beep' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = ltrim( '\u2005beep' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = ltrim( '\u2006beep' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = ltrim( '\u2007beep' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = ltrim( '\u2008beep' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = ltrim( '\u2009beep' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = ltrim( '\u200abeep' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = ltrim( '\u2028beep' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = ltrim( '\u2029beep' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = ltrim( '\u202fbeep' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = ltrim( '\u205fbeep' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = ltrim( '\u3000beep' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = ltrim( '\ufeffbeep' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); - -tape( 'the function does not remove the Mongolian space separator in accordance with Unicode 6.3.0 and later', opts, function test( t ) { - var expected; - var actual; - - expected = '\u180ebeep'; - actual = ltrim( '\u180ebeep' ); - t.strictEqual( actual, expected, 'does not remove \\u180e' ); - - t.end(); -}); diff --git a/base/left-trim/test/test.polyfill.js b/base/left-trim/test/test.polyfill.js deleted file mode 100644 index cc1f93c4..00000000 --- a/base/left-trim/test/test.polyfill.js +++ /dev/null @@ -1,159 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var ltrim = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ltrim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function removes all whitespace characters at the beginning of a string', function test( t ) { - var expected; - var actual; - - expected = 'Whitespace '; - actual = ltrim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'Tabs\t\t\t'; - actual = ltrim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = 'New Lines\n\n\n'; - actual = ltrim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = 'New Lines\r\n\r\n\r\n'; - actual = ltrim( '\r\n\r\n\r\nNew Lines\r\n\r\n\r\n' ); - t.strictEqual( actual, expected, 'removes all newline and carriage return characters' ); - - expected = 'Beep \r\n \t'; - actual = ltrim( ' \t\r\n Beep \r\n \t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = ltrim( '\fbeep' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = ltrim( '\nbeep' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = ltrim( '\tbeep' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = ltrim( '\vbeep' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = ltrim( '\u1680beep' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = ltrim( '\u2000beep' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = ltrim( '\u2001beep' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = ltrim( '\u2002beep' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = ltrim( '\u2003beep' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = ltrim( '\u2004beep' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = ltrim( '\u2005beep' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = ltrim( '\u2006beep' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = ltrim( '\u2007beep' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = ltrim( '\u2008beep' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = ltrim( '\u2009beep' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = ltrim( '\u200abeep' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = ltrim( '\u2028beep' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = ltrim( '\u2029beep' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = ltrim( '\u202fbeep' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = ltrim( '\u205fbeep' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = ltrim( '\u3000beep' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = ltrim( '\ufeffbeep' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); - -tape( 'the function does not remove the Mongolian space separator in accordance with Unicode 6.3.0 and later', function test( t ) { - var expected; - var actual; - - expected = '\u180ebeep'; - actual = ltrim( '\u180ebeep' ); - t.strictEqual( actual, expected, 'does not remove \\u180e' ); - - t.end(); -}); diff --git a/base/lib/index.js b/base/lib/index.js deleted file mode 100644 index 1556dd80..00000000 --- a/base/lib/index.js +++ /dev/null @@ -1,573 +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. -*/ - -'use strict'; - -/* -* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); - - -// MAIN // - -/** -* Top-level namespace. -* -* @namespace ns -*/ -var ns = {}; - -/** -* @name altcase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/altcase} -*/ -setReadOnly( ns, 'altcase', require( './../../base/altcase' ) ); - -/** -* @name atob -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/atob} -*/ -setReadOnly( ns, 'atob', require( './../../base/atob' ) ); - -/** -* @name base64ToUint8Array -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/base64-to-uint8array} -*/ -setReadOnly( ns, 'base64ToUint8Array', require( './../../base/base64-to-uint8array' ) ); - -/** -* @name camelcase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/camelcase} -*/ -setReadOnly( ns, 'camelcase', require( './../../base/camelcase' ) ); - -/** -* @name capitalize -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/capitalize} -*/ -setReadOnly( ns, 'capitalize', require( './../../base/capitalize' ) ); - -/** -* @name codePointAt -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/code-point-at} -*/ -setReadOnly( ns, 'codePointAt', require( './../../base/code-point-at' ) ); - -/** -* @name constantcase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/constantcase} -*/ -setReadOnly( ns, 'constantcase', require( './../../base/constantcase' ) ); - -/** -* @name distances -* @memberof ns -* @readonly -* @type {Namespace} -* @see {@link module:@stdlib/string/base/distances} -*/ -setReadOnly( ns, 'distances', require( './../../base/distances' ) ); - -/** -* @name dotcase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/dotcase} -*/ -setReadOnly( ns, 'dotcase', require( './../../base/dotcase' ) ); - -/** -* @name endsWith -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/ends-with} -*/ -setReadOnly( ns, 'endsWith', require( './../../base/ends-with' ) ); - -/** -* @name first -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/first} -*/ -setReadOnly( ns, 'first', require( './../../base/first' ) ); - -/** -* @name firstCodePoint -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/first-code-point} -*/ -setReadOnly( ns, 'firstCodePoint', require( './../../base/first-code-point' ) ); - -/** -* @name firstGraphemeCluster -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/first-grapheme-cluster} -*/ -setReadOnly( ns, 'firstGraphemeCluster', require( './../../base/first-grapheme-cluster' ) ); - -/** -* @name forEach -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/for-each} -*/ -setReadOnly( ns, 'forEach', require( './../../base/for-each' ) ); - -/** -* @name forEachCodePoint -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/for-each-code-point} -*/ -setReadOnly( ns, 'forEachCodePoint', require( './../../base/for-each-code-point' ) ); - -/** -* @name forEachCodePointRight -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/for-each-code-point-right} -*/ -setReadOnly( ns, 'forEachCodePointRight', require( './../../base/for-each-code-point-right' ) ); - -/** -* @name forEachGraphemeCluster -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/for-each-grapheme-cluster} -*/ -setReadOnly( ns, 'forEachGraphemeCluster', require( './../../base/for-each-grapheme-cluster' ) ); - -/** -* @name forEachRight -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/for-each-right} -*/ -setReadOnly( ns, 'forEachRight', require( './../../base/for-each-right' ) ); - -/** -* @name formatInterpolate -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/format-interpolate} -*/ -setReadOnly( ns, 'formatInterpolate', require( './../../base/format-interpolate' ) ); - -/** -* @name formatTokenize -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/format-tokenize} -*/ -setReadOnly( ns, 'formatTokenize', require( './../../base/format-tokenize' ) ); - -/** -* @name headercase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/headercase} -*/ -setReadOnly( ns, 'headercase', require( './../../base/headercase' ) ); - -/** -* @name invcase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/invcase} -*/ -setReadOnly( ns, 'invcase', require( './../../base/invcase' ) ); - -/** -* @name kebabcase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/kebabcase} -*/ -setReadOnly( ns, 'kebabcase', require( './../../base/kebabcase' ) ); - -/** -* @name last -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/last} -*/ -setReadOnly( ns, 'last', require( './../../base/last' ) ); - -/** -* @name lastCodePoint -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/last-code-point} -*/ -setReadOnly( ns, 'lastCodePoint', require( './../../base/last-code-point' ) ); - -/** -* @name lastGraphemeCluster -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/last-grapheme-cluster} -*/ -setReadOnly( ns, 'lastGraphemeCluster', require( './../../base/last-grapheme-cluster' ) ); - -/** -* @name lpad -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/left-pad} -*/ -setReadOnly( ns, 'lpad', require( './../../base/left-pad' ) ); - -/** -* @name ltrim -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/left-trim} -*/ -setReadOnly( ns, 'ltrim', require( './../../base/left-trim' ) ); - -/** -* @name lowercase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/lowercase} -*/ -setReadOnly( ns, 'lowercase', require( './../../base/lowercase' ) ); - -/** -* @name pascalcase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/pascalcase} -*/ -setReadOnly( ns, 'pascalcase', require( './../../base/pascalcase' ) ); - -/** -* @name percentEncode -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/percent-encode} -*/ -setReadOnly( ns, 'percentEncode', require( './../../base/percent-encode' ) ); - -/** -* @name removeFirst -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/remove-first} -*/ -setReadOnly( ns, 'removeFirst', require( './../../base/remove-first' ) ); - -/** -* @name removeFirstCodePoint -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/remove-first-code-point} -*/ -setReadOnly( ns, 'removeFirstCodePoint', require( './../../base/remove-first-code-point' ) ); - -/** -* @name removeFirstGraphemeCluster -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/remove-first-grapheme-cluster} -*/ -setReadOnly( ns, 'removeFirstGraphemeCluster', require( './../../base/remove-first-grapheme-cluster' ) ); - -/** -* @name removeLast -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/remove-last} -*/ -setReadOnly( ns, 'removeLast', require( './../../base/remove-last' ) ); - -/** -* @name removeLastCodePoint -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/remove-last-code-point} -*/ -setReadOnly( ns, 'removeLastCodePoint', require( './../../base/remove-last-code-point' ) ); - -/** -* @name removeLastGraphemeCluster -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/remove-last-grapheme-cluster} -*/ -setReadOnly( ns, 'removeLastGraphemeCluster', require( './../../base/remove-last-grapheme-cluster' ) ); - -/** -* @name repeat -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/repeat} -*/ -setReadOnly( ns, 'repeat', require( './../../base/repeat' ) ); - -/** -* @name replace -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/replace} -*/ -setReadOnly( ns, 'replace', require( './../../base/replace' ) ); - -/** -* @name replaceAfter -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/replace-after} -*/ -setReadOnly( ns, 'replaceAfter', require( './../../base/replace-after' ) ); - -/** -* @name replaceAfterLast -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/replace-after-last} -*/ -setReadOnly( ns, 'replaceAfterLast', require( './../../base/replace-after-last' ) ); - -/** -* @name replaceBefore -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/replace-before} -*/ -setReadOnly( ns, 'replaceBefore', require( './../../base/replace-before' ) ); - -/** -* @name replaceBeforeLast -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/replace-before-last} -*/ -setReadOnly( ns, 'replaceBeforeLast', require( './../../base/replace-before-last' ) ); - -/** -* @name reverse -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/reverse} -*/ -setReadOnly( ns, 'reverse', require( './../../base/reverse' ) ); - -/** -* @name reverseCodePoints -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/reverse-code-points} -*/ -setReadOnly( ns, 'reverseCodePoints', require( './../../base/reverse-code-points' ) ); - -/** -* @name reverseGraphemeClusters -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/reverse-grapheme-clusters} -*/ -setReadOnly( ns, 'reverseGraphemeClusters', require( './../../base/reverse-grapheme-clusters' ) ); - -/** -* @name rpad -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/right-pad} -*/ -setReadOnly( ns, 'rpad', require( './../../base/right-pad' ) ); - -/** -* @name rtrim -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/right-trim} -*/ -setReadOnly( ns, 'rtrim', require( './../../base/right-trim' ) ); - -/** -* @name slice -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/slice} -*/ -setReadOnly( ns, 'slice', require( './../../base/slice' ) ); - -/** -* @name sliceCodePoints -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/slice-code-points} -*/ -setReadOnly( ns, 'sliceCodePoints', require( './../../base/slice-code-points' ) ); - -/** -* @name sliceGraphemeClusters -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/slice-grapheme-clusters} -*/ -setReadOnly( ns, 'sliceGraphemeClusters', require( './../../base/slice-grapheme-clusters' ) ); - -/** -* @name snakecase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/snakecase} -*/ -setReadOnly( ns, 'snakecase', require( './../../base/snakecase' ) ); - -/** -* @name startcase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/startcase} -*/ -setReadOnly( ns, 'startcase', require( './../../base/startcase' ) ); - -/** -* @name startsWith -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/starts-with} -*/ -setReadOnly( ns, 'startsWith', require( './../../base/starts-with' ) ); - -/** -* @name stickycase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/stickycase} -*/ -setReadOnly( ns, 'stickycase', require( './../../base/stickycase' ) ); - -/** -* @name trim -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/trim} -*/ -setReadOnly( ns, 'trim', require( './../../base/trim' ) ); - -/** -* @name truncateMiddle -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/truncate-middle} -*/ -setReadOnly( ns, 'truncateMiddle', require( './../../base/truncate-middle' ) ); - -/** -* @name uncapitalize -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/uncapitalize} -*/ -setReadOnly( ns, 'uncapitalize', require( './../../base/uncapitalize' ) ); - -/** -* @name uppercase -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base/uppercase} -*/ -setReadOnly( ns, 'uppercase', require( './../../base/uppercase' ) ); - - -// EXPORTS // - -module.exports = ns; diff --git a/base/lowercase/README.md b/base/lowercase/README.md deleted file mode 100644 index b612f5cb..00000000 --- a/base/lowercase/README.md +++ /dev/null @@ -1,110 +0,0 @@ - - -# lowercase - -> Convert a string to lowercase. - -
- -
- - - -
- -## Usage - -```javascript -var lowercase = require( '@stdlib/string/base/lowercase' ); -``` - -#### lowercase( str ) - -Converts a string to lowercase. - -```javascript -var str = lowercase( 'bEEp' ); -// returns 'beep' -``` - -
- - - -
- -## Examples - - - -```javascript -var lowercase = require( '@stdlib/string/base/lowercase' ); - -var str = lowercase( 'Beep' ); -// returns 'beep' - -str = lowercase( 'BeEp' ); -// returns 'beep' - -str = lowercase( 'Beep BOOP' ); -// returns 'beep boop' - -str = lowercase( '$**_Beep_BoOp_**$' ); -// returns '$**_beep_boop_**$' - -str = lowercase( '' ); -// returns '' -``` - -
- - - - - - - - - - - - - - diff --git a/base/lowercase/benchmark/benchmark.js b/base/lowercase/benchmark/benchmark.js deleted file mode 100644 index a44a905e..00000000 --- a/base/lowercase/benchmark/benchmark.js +++ /dev/null @@ -1,82 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var lowercase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'BEEP BOOP', - 'FOO BAR', - 'XYZ ABC' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = lowercase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::builtin', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'BEEP BOOP', - 'FOO BAR', - 'XYZ ABC' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = values[ i%values.length ].toLowerCase(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/lowercase/docs/repl.txt b/base/lowercase/docs/repl.txt deleted file mode 100644 index 3781869c..00000000 --- a/base/lowercase/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( str ) - Converts a string to lowercase. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Lowercase string. - - Examples - -------- - > var out = {{alias}}( 'bEEp' ) - 'beep' - - See Also - -------- - diff --git a/base/lowercase/docs/types/index.d.ts b/base/lowercase/docs/types/index.d.ts deleted file mode 100644 index b73454a5..00000000 --- a/base/lowercase/docs/types/index.d.ts +++ /dev/null @@ -1,36 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to lowercase. -* -* @param str - string to convert -* @returns lowercase string -* -* @example -* var str = lowercase( 'bEEp' ); -* // returns 'beep' -*/ -declare function lowercase( str: S ): Lowercase; - - -// EXPORTS // - -export = lowercase; diff --git a/base/lowercase/docs/types/test.ts b/base/lowercase/docs/types/test.ts deleted file mode 100644 index 50fbe9a6..00000000 --- a/base/lowercase/docs/types/test.ts +++ /dev/null @@ -1,46 +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. -*/ - -import lowercase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - lowercase( 'ABC' ); // $ExpectType "abc" - lowercase( 'Beep BOOP' ); // $ExpectType "beep boop" - lowercase( 'abc' as string ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - lowercase( true ); // $ExpectError - lowercase( false ); // $ExpectError - lowercase( null ); // $ExpectError - lowercase( undefined ); // $ExpectError - lowercase( 5 ); // $ExpectError - lowercase( [] ); // $ExpectError - lowercase( {} ); // $ExpectError - lowercase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - lowercase(); // $ExpectError -} diff --git a/base/lowercase/examples/index.js b/base/lowercase/examples/index.js deleted file mode 100644 index 0fe76339..00000000 --- a/base/lowercase/examples/index.js +++ /dev/null @@ -1,41 +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. -*/ - -'use strict'; - -var lowercase = require( './../lib' ); - -var str = lowercase( 'Beep' ); -console.log( str ); -// => 'beep' - -str = lowercase( 'BeEp' ); -console.log( str ); -// => 'beep' - -str = lowercase( 'Beep BOOP' ); -console.log( str ); -// => 'beep boop' - -str = lowercase( '$**_Beep_BoOp_**$' ); -console.log( str ); -// => '$**_beep_boop_**$' - -str = lowercase( '' ); -console.log( str ); -// => '' diff --git a/base/lowercase/lib/index.js b/base/lowercase/lib/index.js deleted file mode 100644 index 078dfce4..00000000 --- a/base/lowercase/lib/index.js +++ /dev/null @@ -1,40 +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. -*/ - -'use strict'; - -/** -* Convert a string to lowercase. -* -* @module @stdlib/string/base/lowercase -* -* @example -* var lowercase = require( '@stdlib/string/base/lowercase' ); -* -* var str = lowercase( 'bEEp' ); -* // returns 'beep' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/lowercase/lib/main.js b/base/lowercase/lib/main.js deleted file mode 100644 index dc4690de..00000000 --- a/base/lowercase/lib/main.js +++ /dev/null @@ -1,40 +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. -*/ - -'use strict'; - -// MAIN // - -/** -* Converts a string to lowercase. -* -* @param {string} str - string to convert -* @returns {string} lowercase string -* -* @example -* var str = lowercase( 'bEEp' ); -* // returns 'beep' -*/ -function lowercase( str ) { - return str.toLowerCase(); -} - - -// EXPORTS // - -module.exports = lowercase; diff --git a/base/lowercase/package.json b/base/lowercase/package.json deleted file mode 100644 index 6c1e65ca..00000000 --- a/base/lowercase/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/lowercase", - "version": "0.0.0", - "description": "Convert a string to lowercase.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "lower", - "case", - "lowercase", - "convert", - "string", - "str" - ] -} diff --git a/base/lowercase/test/test.js b/base/lowercase/test/test.js deleted file mode 100644 index 67b43a2c..00000000 --- a/base/lowercase/test/test.js +++ /dev/null @@ -1,62 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var lowercase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof lowercase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a string to lowercase', function test( t ) { - var expected; - var values; - var actual; - var i; - - values = [ - 'beep', - 'Beep', - 'BeEp', - 'Beep BOOP', - '$**_Beep_BoOp_**$', - '' - ]; - expected = [ - 'beep', - 'beep', - 'beep', - 'beep boop', - '$**_beep_boop_**$', - '' - ]; - for ( i = 0; i < values.length; i++ ) { - actual = lowercase( values[i] ); - t.strictEqual( actual, expected[i], 'converts string to '+expected[i] ); - } - t.end(); -}); diff --git a/base/package.json b/base/package.json deleted file mode 100644 index 8e752f50..00000000 --- a/base/package.json +++ /dev/null @@ -1,61 +0,0 @@ -{ - "name": "@stdlib/string/base", - "version": "0.0.0", - "description": "Base (i.e., lower-level) string functions.", - "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": { - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "base" - ] -} diff --git a/base/pascalcase/README.md b/base/pascalcase/README.md deleted file mode 100644 index 067360c3..00000000 --- a/base/pascalcase/README.md +++ /dev/null @@ -1,115 +0,0 @@ - - -# pascalcase - -> Convert a string to Pascal case. - - - -
- -## Usage - -```javascript -var pascalcase = require( '@stdlib/string/base/pascalcase' ); -``` - -#### pascalcase( str ) - -Converts a string to Pascal case. - -```javascript -var out = pascalcase( 'foo bar' ); -// returns 'FooBar' - -out = pascalcase( 'IS_MOBILE' ); -// returns 'IsMobile' - -out = pascalcase( 'Hello World!' ); -// returns 'HelloWorld' - -out = pascalcase( '--foo-bar--' ); -// returns 'FooBar' -``` - -
- - - - - -
- -## Examples - -```javascript -var pascalcase = require( '@stdlib/string/base/pascalcase' ); - -var str = 'Hello World!'; -var out = pascalcase( str ); -// returns 'HelloWorld' - -str = 'HELLO WORLD!'; -out = pascalcase( str ); -// returns 'HelloWorld' - -str = 'To be, or not to be: that is the question.'; -out = pascalcase( str ); -// returns 'ToBeOrNotToBeThatIsTheQuestion' -``` - -
- - - - - - - - - - - - - - diff --git a/base/pascalcase/benchmark/benchmark.js b/base/pascalcase/benchmark/benchmark.js deleted file mode 100644 index 5d348e8f..00000000 --- a/base/pascalcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var pascalcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = pascalcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/pascalcase/docs/repl.txt b/base/pascalcase/docs/repl.txt deleted file mode 100644 index 1f9edcf5..00000000 --- a/base/pascalcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to Pascal case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Pascal-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'HelloWorld' - > out = {{alias}}( 'beep boop' ) - 'BeepBoop' - - See Also - -------- diff --git a/base/pascalcase/docs/types/index.d.ts b/base/pascalcase/docs/types/index.d.ts deleted file mode 100644 index e1c96abd..00000000 --- a/base/pascalcase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to Pascal case. -* -* @param str - string to convert -* @returns Pascal-cased string -* -* @example -* var str = pascalcase( 'Hello World!' ); -* // returns 'HelloWorld' -* -* @example -* var str = pascalcase( 'foo_bar' ); -* // returns 'FooBar' -* -* @example -* var str = pascalcase( 'foo-bar' ); -* // returns 'FooBar' -*/ -declare function pascalcase( str: string ): string; - - -// EXPORTS // - -export = pascalcase; diff --git a/base/pascalcase/docs/types/test.ts b/base/pascalcase/docs/types/test.ts deleted file mode 100644 index ef314ba0..00000000 --- a/base/pascalcase/docs/types/test.ts +++ /dev/null @@ -1,44 +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. -*/ - -import pascalcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - pascalcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - pascalcase( true ); // $ExpectError - pascalcase( false ); // $ExpectError - pascalcase( null ); // $ExpectError - pascalcase( undefined ); // $ExpectError - pascalcase( 5 ); // $ExpectError - pascalcase( [] ); // $ExpectError - pascalcase( {} ); // $ExpectError - pascalcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - pascalcase(); // $ExpectError -} diff --git a/base/pascalcase/examples/index.js b/base/pascalcase/examples/index.js deleted file mode 100644 index 3d46be8f..00000000 --- a/base/pascalcase/examples/index.js +++ /dev/null @@ -1,36 +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. -*/ - -'use strict'; - -var pascalcase = require( './../lib' ); - -var str = 'Hello World!'; -var out = pascalcase( str ); -console.log( out ); -// => 'HelloWorld' - -str = 'HELLO WORLD!'; -out = pascalcase( str ); -console.log( out ); -// => 'HelloWorld' - -str = 'To be, or not to be: that is the question.'; -out = pascalcase( str ); -console.log( out ); -// => 'ToBeOrNotToBeThatIsTheQuestion' diff --git a/base/pascalcase/lib/index.js b/base/pascalcase/lib/index.js deleted file mode 100644 index cf07437b..00000000 --- a/base/pascalcase/lib/index.js +++ /dev/null @@ -1,46 +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. -*/ - -'use strict'; - -/** -* Convert a string to Pascal case. -* -* @module @stdlib/string/base/pascalcase -* -* @example -* var pascalcase = require( '@stdlib/string/base/pascalcase' ); -* -* var str = pascalcase( 'foo bar' ); -* // returns 'FooBar' -* -* str = pascalcase( '--foo-bar--' ); -* // returns 'FooBar' -* -* str = pascalcase( 'Hello World!' ); -* // returns 'HelloWorld' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/pascalcase/lib/main.js b/base/pascalcase/lib/main.js deleted file mode 100644 index b649fe83..00000000 --- a/base/pascalcase/lib/main.js +++ /dev/null @@ -1,87 +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. -*/ - -'use strict'; - -// MODULES // - -var capitalize = require( './../../../base/capitalize' ); -var lowercase = require( './../../../base/lowercase' ); -var replace = require( './../../../base/replace' ); -var trim = require( './../../../base/trim' ); - - -// VARIABLES // - -var RE_WHITESPACE = /\s+/g; -var RE_SPECIAL = /[-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape -var RE_TO_PASCAL = /(?:\s|^)([^\s]+)(?=\s|$)/g; -var RE_CAMEL = /([a-z0-9])([A-Z])/g; - - -// FUNCTIONS // - -/** -* Callback invoked upon a match. -* -* @private -* @param {string} match - entire match -* @param {string} p1 - first capture group -* @returns {string} capitalized capture group -*/ -function replacer( match, p1 ) { - return capitalize( lowercase( p1 ) ); -} - - -// MAIN // - -/** -* Converts a string to Pascal case. -* -* @param {string} str - string to convert -* @returns {string} Pascal-cased string -* -* @example -* var out = pascalcase( 'foo bar' ); -* // returns 'FooBar' -* -* @example -* var out = pascalcase( 'IS_MOBILE' ); -* // returns 'IsMobile' -* -* @example -* var out = pascalcase( 'Hello World!' ); -* // returns 'HelloWorld' -* -* @example -* var out = pascalcase( '--foo-bar--' ); -* // returns 'FooBar' -*/ -function pascalcase( str ) { - str = replace( str, RE_SPECIAL, ' ' ); - str = replace( str, RE_WHITESPACE, ' ' ); - str = replace( str, RE_CAMEL, '$1 $2' ); - str = trim( str ); - return replace( str, RE_TO_PASCAL, replacer ); -} - - -// EXPORTS // - -module.exports = pascalcase; diff --git a/base/pascalcase/package.json b/base/pascalcase/package.json deleted file mode 100644 index 74982298..00000000 --- a/base/pascalcase/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/pascalcase", - "version": "0.0.0", - "description": "Convert a string to Pascal case.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "case", - "convert", - "pascalcase", - "pascal" - ], - "__stdlib__": {} -} diff --git a/base/pascalcase/test/test.js b/base/pascalcase/test/test.js deleted file mode 100644 index b60dd856..00000000 --- a/base/pascalcase/test/test.js +++ /dev/null @@ -1,175 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var pascalcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof pascalcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a string to Pascal case', function test( t ) { - var expected; - var actual; - - expected = 'FooBar'; - actual = pascalcase( 'foo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'FooBar'; - actual = pascalcase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'FooBar'; - actual = pascalcase( 'foo.bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'HelloWorld'; - actual = pascalcase( 'Hello World!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'BEepBOop'; - actual = pascalcase( 'bEep bOOP' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to Pascal case', function test( t ) { - var expected; - var actual; - - expected = 'FóoBar'; - actual = pascalcase( 'fóo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'FóoBar'; - actual = pascalcase( 'fóo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'FóoBar'; - actual = pascalcase( 'fóo.bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'HélloWórld'; - actual = pascalcase( 'héllo Wórld!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in constant case to Pascal case', function test( t ) { - var expected; - var actual; - - expected = 'FooBar'; - actual = pascalcase( 'FOO_BAR' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMostlyCamelCase'; - actual = pascalcase( 'IS_MOSTLY_CAMEL_CASE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMobile'; - actual = pascalcase( 'IS_MOBILE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsNodeRepl'; - actual = pascalcase( 'IS_NODE_REPL' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in kebab case to Pascal case', function test( t ) { - var expected; - var actual; - - expected = 'FooBar'; - actual = pascalcase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMostlyCamelCase'; - actual = pascalcase( 'is-mostly-camel-case' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMobile'; - actual = pascalcase( 'is-mobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsNodeRepl'; - actual = pascalcase( 'is-node-repl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in camel case to Pascal case', function test( t ) { - var expected; - var actual; - - expected = 'FooBar'; - actual = pascalcase( 'fooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMostlyCamelCase'; - actual = pascalcase( 'isMostlyCamelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMobile'; - actual = pascalcase( 'isMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsNodeRepl'; - actual = pascalcase( 'isNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a string that is already in Pascal case unchanged', function test( t ) { - var expected; - var actual; - - expected = 'FooBar'; - actual = pascalcase( 'FooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMostlyCamelCase'; - actual = pascalcase( 'IsMostlyCamelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMobile'; - actual = pascalcase( 'IsMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsNodeRepl'; - actual = pascalcase( 'IsNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/base/percent-encode/README.md b/base/percent-encode/README.md deleted file mode 100644 index c37a8034..00000000 --- a/base/percent-encode/README.md +++ /dev/null @@ -1,132 +0,0 @@ - - -# percentEncode - -> [Percent-encode][percent-encoding] a [UTF-16][utf-16] encoded string according to [RFC 3986][rfc-3986-percent-encoding]. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var percentEncode = require( '@stdlib/string/base/percent-encode' ); -``` - -#### percentEncode( str ) - -[Percent-encodes][percent-encoding] a [UTF-16][utf-16] encoded string according to [RFC 3986][rfc-3986-percent-encoding]. - -```javascript -var out = percentEncode( '☃' ); -// returns '%E2%98%83' -``` - -
- - - - - -
- -## Notes - -- The function [percent-encodes][percent-encoding] an **entire** string. Hence, if provided a URI, the function [percent-encodes][percent-encoding] the entire URI. - - ```javascript - var out = percentEncode( 'https://en.wikipedia.org/wiki/Mode_(statistics)' ); - // returns 'https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FMode_%28statistics%29' - ``` - - To [percent-encode][percent-encoding] a URI, split the URI into separate components, [percent-encode][percent-encoding] relevant components, and then reassemble. - -
- - - - - -
- -## Examples - - - -```javascript -var percentEncode = require( '@stdlib/string/base/percent-encode' ); - -var values = [ - 'Ladies + Gentlemen', - 'An encoded string!', - 'Dogs, Cats & Mice', - '☃', - 'æ', - '𐐷' -]; -var i; -for ( i = 0; i < values.length; i++ ) { - console.log( '%s: %s', values[ i ], percentEncode( values[ i ] ) ); -} -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/percent-encode/benchmark/benchmark.js b/base/percent-encode/benchmark/benchmark.js deleted file mode 100644 index 5633005d..00000000 --- a/base/percent-encode/benchmark/benchmark.js +++ /dev/null @@ -1,58 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var percentEncode = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Ladies + Gentlemen', - 'An encoded string!', - 'Dogs, Cats & Mice', - '☃', - 'æ', - '𐐷' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = percentEncode( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/percent-encode/docs/repl.txt b/base/percent-encode/docs/repl.txt deleted file mode 100644 index 2c3caa06..00000000 --- a/base/percent-encode/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( str ) - Percent-encodes a UTF-16 encoded string according to RFC 3986. - - Parameters - ---------- - str: string - UTF-16 encoded string. - - Returns - ------- - out: string - Percent-encoded string. - - Examples - -------- - > var out = {{alias}}( '☃' ) - '%E2%98%83' - - See Also - -------- - diff --git a/base/percent-encode/docs/types/index.d.ts b/base/percent-encode/docs/types/index.d.ts deleted file mode 100644 index ab471d67..00000000 --- a/base/percent-encode/docs/types/index.d.ts +++ /dev/null @@ -1,40 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Percent-encodes a UTF-16 encoded string according to [RFC 3986][1]. -* -* [1]: https://tools.ietf.org/html/rfc3986#section-2.1 -* -* @param str - string to percent-encode -* @returns percent-encoded string -* -* @example -* var str1 = 'Ladies + Gentlemen'; -* -* var str2 = percentEncode( str1 ); -* // returns 'Ladies%20%2B%20Gentlemen' -*/ -declare function percentEncode( str: string ): string; - - -// EXPORTS // - -export = percentEncode; diff --git a/base/percent-encode/docs/types/test.ts b/base/percent-encode/docs/types/test.ts deleted file mode 100644 index 89179e0f..00000000 --- a/base/percent-encode/docs/types/test.ts +++ /dev/null @@ -1,44 +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. -*/ - -import percentEncode = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - percentEncode( 'Ladies + Gentlemen' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - percentEncode( true ); // $ExpectError - percentEncode( false ); // $ExpectError - percentEncode( null ); // $ExpectError - percentEncode( undefined ); // $ExpectError - percentEncode( 5 ); // $ExpectError - percentEncode( [] ); // $ExpectError - percentEncode( {} ); // $ExpectError - percentEncode( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - percentEncode(); // $ExpectError -} diff --git a/base/percent-encode/examples/index.js b/base/percent-encode/examples/index.js deleted file mode 100644 index b7678063..00000000 --- a/base/percent-encode/examples/index.js +++ /dev/null @@ -1,34 +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. -*/ - -'use strict'; - -var percentEncode = require( './../lib' ); - -var values = [ - 'Ladies + Gentlemen', - 'An encoded string!', - 'Dogs, Cats & Mice', - '☃', - 'æ', - '𐐷' -]; -var i; -for ( i = 0; i < values.length; i++ ) { - console.log( '%s: %s', values[ i ], percentEncode( values[ i ] ) ); -} diff --git a/base/percent-encode/lib/index.js b/base/percent-encode/lib/index.js deleted file mode 100644 index a3e80d6c..00000000 --- a/base/percent-encode/lib/index.js +++ /dev/null @@ -1,42 +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. -*/ - -'use strict'; - -/** -* Percent-encode a UTF-16 encoded string according to RFC 3986. -* -* @module @stdlib/string/base/percent-encode -* -* @example -* var percentEncode = require( '@stdlib/string/base/percent-encode' ); -* -* var str1 = 'Ladies + Gentlemen'; -* -* var str2 = percentEncode( str1 ); -* // returns 'Ladies%20%2B%20Gentlemen' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/percent-encode/lib/main.js b/base/percent-encode/lib/main.js deleted file mode 100644 index 44f8ba85..00000000 --- a/base/percent-encode/lib/main.js +++ /dev/null @@ -1,100 +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. -*/ - -'use strict'; - -// MODULES // - -var utf16ToUTF8Array = require( './../../../utf16-to-utf8-array' ); - - -// VARIABLES // - -// Character codes: -var UNDERSCORE = 95|0; -var PERIOD = 46|0; -var HYPHEN = 45|0; -var TILDE = 126|0; -var ZERO = 48|0; -var NINE = 57|0; -var A = 65|0; -var Z = 90|0; -var a = 97|0; -var z = 122|0; - - -// MAIN // - -/** -* Percent-encodes a UTF-16 encoded string according to [RFC 3986][1]. -* -* [1]: https://tools.ietf.org/html/rfc3986#section-2.1 -* -* @param {string} str - string to percent-encode -* @returns {string} percent-encoded string -* -* @example -* var str1 = 'Ladies + Gentlemen'; -* -* var str2 = percentEncode( str1 ); -* // returns 'Ladies%20%2B%20Gentlemen' -*/ -function percentEncode( str ) { - var byte; - var out; - var len; - var buf; - var i; - - // Convert to an array of octets using UTF-8 encoding (see https://tools.ietf.org/html/rfc3986#section-2.5): - buf = utf16ToUTF8Array( str ); - - // Encode the string... - len = buf.length; - out = ''; - for ( i = 0; i < len; i++ ) { - byte = buf[ i ]; - if ( - // ASCII Digits: - ( byte >= ZERO && byte <= NINE ) || - - // ASCII uppercase letters: - ( byte >= A && byte <= Z ) || - - // ASCII lowercase letters: - ( byte >= a && byte <= z ) || - - // ASCII unreserved characters (see https://tools.ietf.org/html/rfc3986#section-2.3): - byte === HYPHEN || - byte === PERIOD || - byte === UNDERSCORE || - byte === TILDE - ) { - out += str.charAt( i ); - } else { - // Convert an octet to hexadecimal and uppercase according to the RFC (see https://tools.ietf.org/html/rfc3986#section-2.1): - out += '%' + byte.toString( 16 ).toUpperCase(); - } - } - return out; -} - - -// EXPORTS // - -module.exports = percentEncode; diff --git a/base/percent-encode/package.json b/base/percent-encode/package.json deleted file mode 100644 index 6bca09e8..00000000 --- a/base/percent-encode/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@stdlib/string/base/percent-encode", - "version": "0.0.0", - "description": "Percent-encode a UTF-16 encoded string according to RFC 3986.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "base", - "utf-16", - "utf16", - "utf8", - "utf-8", - "percent", - "encode", - "percent-encode", - "percent-encoding", - "encoding", - "escape", - "uri", - "url" - ] -} diff --git a/base/percent-encode/test/test.js b/base/percent-encode/test/test.js deleted file mode 100644 index 42cbb3bb..00000000 --- a/base/percent-encode/test/test.js +++ /dev/null @@ -1,69 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var percentEncode = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof percentEncode, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function percent-encodes a string', function test( t ) { - var expected; - var values; - var out; - var i; - - // Some test values are from https://dev.twitter.com/oauth/overview/percent-encoding-parameters. - values = [ - 'Ladies + Gentlemen', - 'An encoded string!', - 'Dogs, Cats & Mice', - '☃', - 'æ', - '𐐷', - '()', - 'https://en.wikipedia.org/wiki/Mode_(statistics)' - ]; - - expected = [ - 'Ladies%20%2B%20Gentlemen', - 'An%20encoded%20string%21', - 'Dogs%2C%20Cats%20%26%20Mice', - '%E2%98%83', - '%C3%A6', - '%F0%90%90%B7', - '%28%29', - 'https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FMode_%28statistics%29' - ]; - - for ( i = 0; i < values.length; i++ ) { - out = percentEncode( values[ i ] ); - t.strictEqual( out, expected[ i ], 'returns expected value for '+values[i] ); - } - t.end(); -}); diff --git a/base/remove-first-code-point/README.md b/base/remove-first-code-point/README.md deleted file mode 100644 index 678f7019..00000000 --- a/base/remove-first-code-point/README.md +++ /dev/null @@ -1,113 +0,0 @@ - - -# removeFirstCodePoint - -> Remove the first `n` Unicode code points of a string. - -
- -## Usage - -```javascript -var removeFirstCodePoint = require( '@stdlib/string/base/remove-first-code-point' ); -``` - -#### removeFirstCodePoint( str, n ) - -Removes the first `n` Unicode code points of a string. - -```javascript -var out = removeFirstCodePoint( 'last man standing', 1 ); -// returns 'ast man standing' - -out = removeFirstCodePoint( 'Hidden Treasures', 1 ); -// returns 'idden Treasures' - -out = removeFirstCodePoint( 'foo bar', 5 ); -// returns 'ar' - -out = removeFirstCodePoint( 'foo bar', 10 ); -// returns '' -``` - -
- - - -
- -## Examples - - - -```javascript -var removeFirstCodePoint = require( '@stdlib/string/base/remove-first-code-point' ); - -var str = removeFirstCodePoint( 'presidential election', 1 ); -// returns 'residential election' - -str = removeFirstCodePoint( 'JavaScript', 1 ); -// returns 'avaScript' - -str = removeFirstCodePoint( 'The Last of the Mohicans', 5 ); -// returns 'ast of the Mohicans' - -str = removeFirstCodePoint( 'अनुच्छेद', 1 ); -// returns 'नुच्छेद' -``` - -
- - - - - - - - - - - - - - diff --git a/base/remove-first-code-point/benchmark/benchmark.js b/base/remove-first-code-point/benchmark/benchmark.js deleted file mode 100644 index 09dcbbb3..00000000 --- a/base/remove-first-code-point/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var removeFirst = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeFirst( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/remove-first-code-point/docs/repl.txt b/base/remove-first-code-point/docs/repl.txt deleted file mode 100644 index fdfcd0a4..00000000 --- a/base/remove-first-code-point/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n ) - Removes the first `n` Unicode code points of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of Unicode code points to remove. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 1 ) - 'eep' - > out = {{alias}}( 'Boop', 1 ) - 'oop' - > out = {{alias}}( 'foo bar', 5 ) - 'ar' - - See Also - -------- - diff --git a/base/remove-first-code-point/docs/types/index.d.ts b/base/remove-first-code-point/docs/types/index.d.ts deleted file mode 100644 index 597e3bc6..00000000 --- a/base/remove-first-code-point/docs/types/index.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Removes the first `n` Unicode code points of a string. -* -* @param str - input string -* @param n - number of code points to remove -* @returns output string -* -* @example -* var out = removeFirst( 'last man standing', 1 ); -* // returns 'ast man standing' -* -* @example -* var out = removeFirst( 'presidential election', 1 ); -* // returns 'residential election' -* -* @example -* var out = removeFirst( 'JavaScript', 1 ); -* // returns 'avaScript' -* -* @example -* var out = removeFirst( 'Hidden Treasures', 1 ); -* // returns 'idden Treasures' -* -* @example -* var out = removeFirst( 'foo bar', 5 ); -* // returns 'ar' -*/ -declare function removeFirst( str: string, n: number ): string; - - -// EXPORTS // - -export = removeFirst; diff --git a/base/remove-first-code-point/docs/types/test.ts b/base/remove-first-code-point/docs/types/test.ts deleted file mode 100644 index df237372..00000000 --- a/base/remove-first-code-point/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import removeFirst = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - removeFirst( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - removeFirst( true, 1 ); // $ExpectError - removeFirst( false, 1 ); // $ExpectError - removeFirst( null, 1 ); // $ExpectError - removeFirst( undefined, 1 ); // $ExpectError - removeFirst( 5, 1 ); // $ExpectError - removeFirst( [], 1 ); // $ExpectError - removeFirst( {}, 1 ); // $ExpectError - removeFirst( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - removeFirst( 'abc', true ); // $ExpectError - removeFirst( 'abc', false ); // $ExpectError - removeFirst( 'abc', null ); // $ExpectError - removeFirst( 'abc', 'abc' ); // $ExpectError - removeFirst( 'abc', [] ); // $ExpectError - removeFirst( 'abc', {} ); // $ExpectError - removeFirst( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - removeFirst(); // $ExpectError - removeFirst( 'abc' ); // $ExpectError - removeFirst( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/remove-first-code-point/examples/index.js b/base/remove-first-code-point/examples/index.js deleted file mode 100644 index 203c3047..00000000 --- a/base/remove-first-code-point/examples/index.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'; - -var removeFirstCodePoint = require( './../lib' ); - -console.log( removeFirstCodePoint( 'presidential election', 1 ) ); -// => 'residential election' - -console.log( removeFirstCodePoint( 'JavaScript', 1 ) ); -// => 'avaScript' - -console.log( removeFirstCodePoint( 'The Last of the Mohicans', 5 ) ); -// => 'ast of the Mohicans' - -console.log( removeFirstCodePoint( 'अनुच्छेद', 1 ) ); -// => 'नुच्छेद' diff --git a/base/remove-first-code-point/lib/index.js b/base/remove-first-code-point/lib/index.js deleted file mode 100644 index 5753e529..00000000 --- a/base/remove-first-code-point/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Remove the first `n` Unicode code points of a string. -* -* @module @stdlib/string/base/remove-first-code-point -* -* @example -* var removeFirst = require( '@stdlib/string/base/remove-first-code-point' ); -* -* var out = removeFirst( 'last man standing', 1 ); -* // returns 'ast man standing' -* -* out = removeFirst( 'Hidden Treasures', 1 ); -* // returns 'idden Treasures' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/remove-first-code-point/lib/main.js b/base/remove-first-code-point/lib/main.js deleted file mode 100644 index cdf29f94..00000000 --- a/base/remove-first-code-point/lib/main.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// VARIABLES // - -var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/; // TODO: replace with stdlib pkg -var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/; // TODO: replace with stdlib pkg - - -// MAIN // - -/** -* Removes the first `n` Unicode code points of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of Unicode code points to remove -* @returns {string} output string -* -* @example -* var out = removeFirst( 'last man standing', 1 ); -* // returns 'ast man standing' -* -* @example -* var out = removeFirst( 'presidential election', 1 ); -* // returns 'residential election' -* -* @example -* var out = removeFirst( 'JavaScript', 1 ); -* // returns 'avaScript' -* -* @example -* var out = removeFirst( 'Hidden Treasures', 1 ); -* // returns 'idden Treasures' -*/ -function removeFirst( str, n ) { - var len; - var ch1; - var ch2; - var cnt; - var i; - if ( n === 0 ) { - return str; - } - len = str.length; - cnt = 0; - - // Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point... - for ( i = 0; i < len; i++ ) { - ch1 = str[ i ]; - cnt += 1; - - // Check for a high UTF-16 surrogate... - if ( RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) { - // Check for an unpaired surrogate at the end of the input string... - if ( i === len-1 ) { - // We found an unpaired surrogate... - break; - } - // Check whether the high surrogate is paired with a low surrogate... - ch2 = str[ i+1 ]; - if ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) { - // We found a surrogate pair: - i += 1; // bump the index to process the next code unit - } - } - // Check whether we've found the desired number of code points... - if ( cnt === n ) { - break; - } - } - return str.substring( i + 1, str.length ); -} - - -// EXPORTS // - -module.exports = removeFirst; diff --git a/base/remove-first-code-point/package.json b/base/remove-first-code-point/package.json deleted file mode 100644 index bd5f53e9..00000000 --- a/base/remove-first-code-point/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/remove-first-code-point", - "version": "0.0.0", - "description": "Remove the first Unicode code point of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "first", - "character", - "char", - "codepoint", - "unicode" - ] -} diff --git a/base/remove-first-code-point/test/test.js b/base/remove-first-code-point/test/test.js deleted file mode 100644 index a4bd6b92..00000000 --- a/base/remove-first-code-point/test/test.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 removeFirst = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof removeFirst, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( removeFirst( '', 1 ), '', 'returns expected value' ); - t.strictEqual( removeFirst( '', 2 ), '', 'returns expected value' ); - t.strictEqual( removeFirst( '', 3 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the input string if provided zero as the second argument', function test( t ) { - t.strictEqual( removeFirst( 'hello world', 0 ), 'hello world', 'returns expected value' ); - t.end(); -}); - -tape( 'the function removes the first Unicode code point of a provided string (ascii)', function test( t ) { - var out; - - out = removeFirst( 'hello world', 1 ); - t.strictEqual( out, 'ello world', 'returns expected value' ); - - out = removeFirst( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeFirst( 'Hello World', 1 ); - t.strictEqual( out, 'ello World', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function removes the first Unicode code point of a provided string (Unicode)', function test( t ) { - var out; - - out = removeFirst( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - out = removeFirst( '六书/六書', 1 ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - out = removeFirst( '𐒻𐓟', 1 ); - t.strictEqual( out, '𐓟', 'returns expected value' ); - - out = removeFirst( '\uD800', 1 ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports removing the first `n` Unicode code points of a provided string', function test( t ) { - var out; - - out = removeFirst( 'hello world', 1 ); - t.strictEqual( out, 'ello world', 'returns expected value' ); - - out = removeFirst( 'hello world', 7 ); - t.strictEqual( out, 'orld', 'returns expected value' ); - - out = removeFirst( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeFirst( '!!!', 2 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = removeFirst( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - out = removeFirst( '六书/六書', 3 ); - t.strictEqual( out, '六書', 'returns expected value' ); - - out = removeFirst( '𐓟𐒻𐓟', 2 ); - t.strictEqual( out, '𐓟', 'returns expected value' ); - - t.end(); -}); diff --git a/base/remove-first-grapheme-cluster/README.md b/base/remove-first-grapheme-cluster/README.md deleted file mode 100644 index d58b49d0..00000000 --- a/base/remove-first-grapheme-cluster/README.md +++ /dev/null @@ -1,122 +0,0 @@ - - -# removeFirstGraphemeCluster - -> Remove the first `n` grapheme clusters (i.e., user-perceived characters) of a string. - -
- -## Usage - - - -```javascript -var removeFirstGraphemeCluster = require( '@stdlib/string/base/remove-first-grapheme-cluster' ); -``` - -#### removeFirstGraphemeCluster( str, n ) - -Removes the first `n` grapheme clusters (i.e., user-perceived characters) of a string. - - - -```javascript -var out = removeFirstGraphemeCluster( 'last man standing', 1 ); -// returns 'ast man standing' - -out = removeFirstGraphemeCluster( 'Hidden Treasures', 1 ); -// returns 'idden Treasures' - -out = removeFirstGraphemeCluster( 'foo bar', 5 ); -// returns 'ar' - -out = removeFirstGraphemeCluster( 'foo bar', 10 ); -// returns '' -``` - -
- - - -
- -## Examples - - - - - -```javascript -var removeFirstGraphemeCluster = require( '@stdlib/string/base/remove-first-grapheme-cluster' ); - -var str = removeFirstGraphemeCluster( 'presidential election', 1 ); -// returns 'residential election' - -str = removeFirstGraphemeCluster( 'JavaScript', 1 ); -// returns 'avaScript' - -str = removeFirstGraphemeCluster( 'The Last of the Mohicans', 5 ); -// returns 'ast of the Mohicans' - -str = removeFirstGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ); -// returns '🐷🐰🐸' - -str = removeFirstGraphemeCluster( '🐶🐮🐷🐰🐸', 10 ); -// returns '' -``` - -
- - - - - - - - - - - - - - diff --git a/base/remove-first-grapheme-cluster/benchmark/benchmark.js b/base/remove-first-grapheme-cluster/benchmark/benchmark.js deleted file mode 100644 index 09dcbbb3..00000000 --- a/base/remove-first-grapheme-cluster/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var removeFirst = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeFirst( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/remove-first-grapheme-cluster/docs/repl.txt b/base/remove-first-grapheme-cluster/docs/repl.txt deleted file mode 100644 index 5822f77a..00000000 --- a/base/remove-first-grapheme-cluster/docs/repl.txt +++ /dev/null @@ -1,30 +0,0 @@ - -{{alias}}( str, n ) - Removes the first `n` grapheme clusters (i.e., user-perceived characters) - of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of grapheme clusters to remove. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 1 ) - 'eep' - > out = {{alias}}( 'Boop', 1 ) - 'oop' - > out = {{alias}}( 'foo bar', 5 ) - 'ar' - - See Also - -------- - diff --git a/base/remove-first-grapheme-cluster/docs/types/index.d.ts b/base/remove-first-grapheme-cluster/docs/types/index.d.ts deleted file mode 100644 index 71860949..00000000 --- a/base/remove-first-grapheme-cluster/docs/types/index.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Removes the first `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @param str - input string -* @param n - number of grapheme clusters to remove -* @returns output string -* -* @example -* var out = removeFirst( 'last man standing', 1 ); -* // returns 'ast man standing' -* -* @example -* var out = removeFirst( 'presidential election', 1 ); -* // returns 'residential election' -* -* @example -* var out = removeFirst( 'JavaScript', 1 ); -* // returns 'avaScript' -* -* @example -* var out = removeFirst( 'Hidden Treasures', 1 ); -* // returns 'idden Treasures' -* -* @example -* var out = removeFirst( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐷🐰🐸' -* -* @example -* var out = removeFirst( 'foo bar', 5 ); -* // returns 'ar' -*/ -declare function removeFirst( str: string, n: number ): string; - - -// EXPORTS // - -export = removeFirst; diff --git a/base/remove-first-grapheme-cluster/docs/types/test.ts b/base/remove-first-grapheme-cluster/docs/types/test.ts deleted file mode 100644 index df237372..00000000 --- a/base/remove-first-grapheme-cluster/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import removeFirst = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - removeFirst( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - removeFirst( true, 1 ); // $ExpectError - removeFirst( false, 1 ); // $ExpectError - removeFirst( null, 1 ); // $ExpectError - removeFirst( undefined, 1 ); // $ExpectError - removeFirst( 5, 1 ); // $ExpectError - removeFirst( [], 1 ); // $ExpectError - removeFirst( {}, 1 ); // $ExpectError - removeFirst( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - removeFirst( 'abc', true ); // $ExpectError - removeFirst( 'abc', false ); // $ExpectError - removeFirst( 'abc', null ); // $ExpectError - removeFirst( 'abc', 'abc' ); // $ExpectError - removeFirst( 'abc', [] ); // $ExpectError - removeFirst( 'abc', {} ); // $ExpectError - removeFirst( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - removeFirst(); // $ExpectError - removeFirst( 'abc' ); // $ExpectError - removeFirst( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/remove-first-grapheme-cluster/examples/index.js b/base/remove-first-grapheme-cluster/examples/index.js deleted file mode 100644 index d73ff883..00000000 --- a/base/remove-first-grapheme-cluster/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var removeFirstGraphemeCluster = require( './../lib' ); // eslint-disable-line id-length - -console.log( removeFirstGraphemeCluster( 'presidential election', 1 ) ); -// => 'residential election' - -console.log( removeFirstGraphemeCluster( 'JavaScript', 1 ) ); -// => 'avaScript' - -console.log( removeFirstGraphemeCluster( 'The Last of the Mohicans', 5 ) ); -// => 'ast of the Mohicans' - -console.log( removeFirstGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ) ); -// => '🐷🐰🐸' - -console.log( removeFirstGraphemeCluster( '🐶🐮🐷🐰🐸', 10 ) ); -// => '' diff --git a/base/remove-first-grapheme-cluster/lib/index.js b/base/remove-first-grapheme-cluster/lib/index.js deleted file mode 100644 index 73280537..00000000 --- a/base/remove-first-grapheme-cluster/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Remove the first `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @module @stdlib/string/base/remove-first-grapheme-cluster -* -* @example -* var removeFirst = require( '@stdlib/string/base/remove-first-grapheme-cluster' ); -* -* var out = removeFirst( 'last man standing', 1 ); -* // returns 'ast man standing' -* -* out = removeFirst( 'Hidden Treasures', 1 ); -* // returns 'idden Treasures' -* -* out = removeFirst( '🐮🐷🐸🐵', 2 ); -* // returns '🐸🐵' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/remove-first-grapheme-cluster/lib/main.js b/base/remove-first-grapheme-cluster/lib/main.js deleted file mode 100644 index 46234e99..00000000 --- a/base/remove-first-grapheme-cluster/lib/main.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var nextGraphemeClusterBreak = require( './../../../next-grapheme-cluster-break' ); - - -// MAIN // - -/** -* Removes the first `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of grapheme clusters to remove -* @returns {string} output string -* -* @example -* var out = removeFirst( 'last man standing', 1 ); -* // returns 'ast man standing' -* -* @example -* var out = removeFirst( 'presidential election', 1 ); -* // returns 'residential election' -* -* @example -* var out = removeFirst( 'JavaScript', 1 ); -* // returns 'avaScript' -* -* @example -* var out = removeFirst( 'Hidden Treasures', 1 ); -* // returns 'idden Treasures' -* -* @example -* var out = removeFirst( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐷🐰🐸' -* -* @example -* var out = removeFirst( 'foo bar', 5 ); -* // returns 'ar' -*/ -function removeFirst( str, n ) { - var i = 0; - while ( n > 0 ) { - i = nextGraphemeClusterBreak( str, i ); - n -= 1; - } - // Value of `i` will be -1 if and only if `str` is an empty string or `str` has only 1 extended grapheme cluster... - if ( str === '' || i === -1 ) { - return ''; - } - return str.substring( i, str.length ); -} - - -// EXPORTS // - -module.exports = removeFirst; diff --git a/base/remove-first-grapheme-cluster/package.json b/base/remove-first-grapheme-cluster/package.json deleted file mode 100644 index c9b278e7..00000000 --- a/base/remove-first-grapheme-cluster/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/remove-first-grapheme-cluster", - "version": "0.0.0", - "description": "Remove the first grapheme cluster (i.e., user-perceived character) of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "first", - "character", - "char", - "grapheme", - "cluster", - "unicode" - ] -} diff --git a/base/remove-first-grapheme-cluster/test/test.js b/base/remove-first-grapheme-cluster/test/test.js deleted file mode 100644 index 134f6c21..00000000 --- a/base/remove-first-grapheme-cluster/test/test.js +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 removeFirst = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof removeFirst, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( removeFirst( '', 1 ), '', 'returns expected value' ); - t.strictEqual( removeFirst( '', 2 ), '', 'returns expected value' ); - t.strictEqual( removeFirst( '', 3 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the input string if provided zero as the second argument', function test( t ) { - t.strictEqual( removeFirst( 'hello world', 0 ), 'hello world', 'returns expected value' ); - t.end(); -}); - -tape( 'the function removes the first grapheme cluster of a provided string (ascii)', function test( t ) { - var out; - - out = removeFirst( 'hello world', 1 ); - t.strictEqual( out, 'ello world', 'returns expected value' ); - - out = removeFirst( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeFirst( 'Hello World', 1 ); - t.strictEqual( out, 'ello World', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function removes the first grapheme cluster of a provided string (Unicode)', function test( t ) { - var out; - - out = removeFirst( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - out = removeFirst( '六书/六書', 1 ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function removes the first grapheme cluster of a provided string (emoji)', function test( t ) { - var out; - - out = removeFirst( '🌷', 1 ); - t.strictEqual( out, '', 'returns expected value' ); - - out = removeFirst( '🏝️🌷', 1 ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports removing the first `n` grapheme clusters of a provided string', function test( t ) { - var out; - - out = removeFirst( 'hello world', 1 ); - t.strictEqual( out, 'ello world', 'returns expected value' ); - - out = removeFirst( 'hello world', 7 ); - t.strictEqual( out, 'orld', 'returns expected value' ); - - out = removeFirst( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeFirst( '!!!', 2 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = removeFirst( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - out = removeFirst( '六书/六書', 1 ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - out = removeFirst( '🌷🌷🌷🌷🌷', 2 ); - t.strictEqual( out, '🌷🌷🌷', 'returns expected value' ); - - t.end(); -}); diff --git a/base/remove-first/README.md b/base/remove-first/README.md deleted file mode 100644 index 583dcda8..00000000 --- a/base/remove-first/README.md +++ /dev/null @@ -1,110 +0,0 @@ - - -# removeFirst - -> Remove the first `n` UTF-16 code units of a string. - -
- -## Usage - -```javascript -var removeFirst = require( '@stdlib/string/base/remove-first' ); -``` - -#### removeFirst( str, n ) - -Removes the first `n` UTF-16 code units of a string. - -```javascript -var out = removeFirst( 'last man standing', 1 ); -// returns 'ast man standing' - -out = removeFirst( 'Hidden Treasures', 1 ); -// returns 'idden Treasures' - -out = removeFirst( 'foo bar', 5 ); -// returns 'ar' - -out = removeFirst( 'foo bar', 10 ); -// returns '' -``` - -
- - - -
- -## Examples - - - -```javascript -var removeFirst = require( '@stdlib/string/base/remove-first' ); - -var str = removeFirst( 'presidential election', 1 ); -// returns 'residential election' - -str = removeFirst( 'JavaScript', 1 ); -// returns 'avaScript' - -str = removeFirst( 'The Last of the Mohicans', 5 ); -// returns 'ast of the Mohicans' -``` - -
- - - - - - - - - - - - - - diff --git a/base/remove-first/benchmark/benchmark.js b/base/remove-first/benchmark/benchmark.js deleted file mode 100644 index 09dcbbb3..00000000 --- a/base/remove-first/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var removeFirst = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeFirst( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/remove-first/docs/repl.txt b/base/remove-first/docs/repl.txt deleted file mode 100644 index 631fa05c..00000000 --- a/base/remove-first/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n ) - Removes the first `n` UTF-16 code units of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of UTF-16 code units to remove. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 1 ) - 'eep' - > out = {{alias}}( 'Boop', 1 ) - 'oop' - > out = {{alias}}( 'foo bar', 5 ) - 'ar' - - See Also - -------- - diff --git a/base/remove-first/docs/types/index.d.ts b/base/remove-first/docs/types/index.d.ts deleted file mode 100644 index 8e691d0f..00000000 --- a/base/remove-first/docs/types/index.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Removes the first `n` UTF-16 code units of a string. -* -* @param str - input string -* @param n - number of code units to remove -* @returns output string -* -* @example -* var out = removeFirst( 'last man standing', 1 ); -* // returns 'ast man standing' -* -* @example -* var out = removeFirst( 'presidential election', 1 ); -* // returns 'residential election' -* -* @example -* var out = removeFirst( 'JavaScript', 1 ); -* // returns 'avaScript' -* -* @example -* var out = removeFirst( 'Hidden Treasures', 1 ); -* // returns 'idden Treasures' -* -* @example -* var out = removeFirst( 'foo bar', 5 ); -* // returns 'ar' -*/ -declare function removeFirst( str: string, n: number ): string; - - -// EXPORTS // - -export = removeFirst; diff --git a/base/remove-first/docs/types/test.ts b/base/remove-first/docs/types/test.ts deleted file mode 100644 index df237372..00000000 --- a/base/remove-first/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import removeFirst = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - removeFirst( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - removeFirst( true, 1 ); // $ExpectError - removeFirst( false, 1 ); // $ExpectError - removeFirst( null, 1 ); // $ExpectError - removeFirst( undefined, 1 ); // $ExpectError - removeFirst( 5, 1 ); // $ExpectError - removeFirst( [], 1 ); // $ExpectError - removeFirst( {}, 1 ); // $ExpectError - removeFirst( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - removeFirst( 'abc', true ); // $ExpectError - removeFirst( 'abc', false ); // $ExpectError - removeFirst( 'abc', null ); // $ExpectError - removeFirst( 'abc', 'abc' ); // $ExpectError - removeFirst( 'abc', [] ); // $ExpectError - removeFirst( 'abc', {} ); // $ExpectError - removeFirst( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - removeFirst(); // $ExpectError - removeFirst( 'abc' ); // $ExpectError - removeFirst( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/remove-first/examples/index.js b/base/remove-first/examples/index.js deleted file mode 100644 index fc2932fc..00000000 --- a/base/remove-first/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 removeFirst = require( './../lib' ); - -console.log( removeFirst( 'presidential election', 1 ) ); -// => 'residential election' - -console.log( removeFirst( 'JavaScript', 1 ) ); -// => 'avaScript' - -console.log( removeFirst( 'The Last of the Mohicans', 5 ) ); -// => 'ast of the Mohicans' diff --git a/base/remove-first/lib/index.js b/base/remove-first/lib/index.js deleted file mode 100644 index 7546a7a3..00000000 --- a/base/remove-first/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Remove the first `n` UTF-16 code units of a string. -* -* @module @stdlib/string/base/remove-first -* -* @example -* var removeFirst = require( '@stdlib/string/base/remove-first' ); -* -* var out = removeFirst( 'last man standing', 1 ); -* // returns 'ast man standing' -* -* out = removeFirst( 'Hidden Treasures', 1 ); -* // returns 'idden Treasures' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/remove-first/lib/main.js b/base/remove-first/lib/main.js deleted file mode 100644 index 08b2bf03..00000000 --- a/base/remove-first/lib/main.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Removes the first `n` UTF-16 code units of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of UTF-16 code units to remove -* @returns {string} output string -* -* @example -* var out = removeFirst( 'last man standing', 1 ); -* // returns 'ast man standing' -* -* @example -* var out = removeFirst( 'presidential election', 1 ); -* // returns 'residential election' -* -* @example -* var out = removeFirst( 'JavaScript', 1 ); -* // returns 'avaScript' -* -* @example -* var out = removeFirst( 'Hidden Treasures', 1 ); -* // returns 'idden Treasures' -*/ -function removeFirst( str, n ) { - return str.substring( n, str.length ); -} - - -// EXPORTS // - -module.exports = removeFirst; diff --git a/base/remove-first/package.json b/base/remove-first/package.json deleted file mode 100644 index e1832990..00000000 --- a/base/remove-first/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/remove-first", - "version": "0.0.0", - "description": "Remove the first UTF-16 code unit of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "first", - "character", - "char", - "codeunit", - "unicode" - ] -} diff --git a/base/remove-first/test/test.js b/base/remove-first/test/test.js deleted file mode 100644 index 79000a4c..00000000 --- a/base/remove-first/test/test.js +++ /dev/null @@ -1,78 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 removeFirst = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof removeFirst, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( removeFirst( '', 1 ), '', 'returns expected value' ); - t.strictEqual( removeFirst( '', 2 ), '', 'returns expected value' ); - t.strictEqual( removeFirst( '', 3 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the input string if provided zero as the second argument', function test( t ) { - t.strictEqual( removeFirst( 'hello world', 0 ), 'hello world', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the string without the first UTF-16 code unit', function test( t ) { - var out; - - out = removeFirst( 'hello world', 1 ); - t.strictEqual( out, 'ello world', 'returns expected value' ); - - out = removeFirst( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeFirst( 'Hello World', 1 ); - t.strictEqual( out, 'ello World', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports removing the first `n` UTF-16 code units of a provided string', function test( t ) { - var out; - - out = removeFirst( 'hello world', 1 ); - t.strictEqual( out, 'ello world', 'returns expected value' ); - - out = removeFirst( 'hello world', 7 ); - t.strictEqual( out, 'orld', 'returns expected value' ); - - out = removeFirst( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeFirst( '!!!', 2 ); - t.strictEqual( out, '!', 'returns expected value' ); - - t.end(); -}); diff --git a/base/remove-last-code-point/README.md b/base/remove-last-code-point/README.md deleted file mode 100644 index cec86d0f..00000000 --- a/base/remove-last-code-point/README.md +++ /dev/null @@ -1,113 +0,0 @@ - - -# removeLastCodePoint - -> Remove the last `n` Unicode code points of a string. - -
- -## Usage - -```javascript -var removeLastCodePoint = require( '@stdlib/string/base/remove-last-code-point' ); -``` - -#### removeLastCodePoint( str, n ) - -Removes the last `n` Unicode code points of a string. - -```javascript -var out = removeLastCodePoint( 'last man standing', 1 ); -// returns 'last man standin' - -out = removeLastCodePoint( 'Hidden Treasures', 1 ); -// returns 'Hidden Treasure' - -out = removeLastCodePoint( 'foo bar', 5 ); -// returns 'fo' - -out = removeLastCodePoint( 'foo bar', 10 ); -// returns '' -``` - -
- - - -
- -## Examples - - - -```javascript -var removeLastCodePoint = require( '@stdlib/string/base/remove-last-code-point' ); - -var str = removeLastCodePoint( 'presidential election', 1 ); -// returns 'presidential electio' - -str = removeLastCodePoint( 'JavaScript', 1 ); -// returns 'JavaScrip' - -str = removeLastCodePoint( 'The Last of the Mohicans', 5 ); -// returns 'The Last of the Moh' - -str = removeLastCodePoint( 'अनुच्छेद', 1 ); -// returns 'अनुच्छे' -``` - -
- - - - - - - - - - - - - - diff --git a/base/remove-last-code-point/benchmark/benchmark.js b/base/remove-last-code-point/benchmark/benchmark.js deleted file mode 100644 index 1f34ea03..00000000 --- a/base/remove-last-code-point/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var removeLast = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeLast( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/remove-last-code-point/docs/repl.txt b/base/remove-last-code-point/docs/repl.txt deleted file mode 100644 index a08ea552..00000000 --- a/base/remove-last-code-point/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n ) - Removes the last `n` Unicode code points of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of Unicode code points to remove. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 1 ) - 'bee' - > out = {{alias}}( 'Boop', 1 ) - 'Boo' - > out = {{alias}}( 'foo bar', 5 ) - 'fo' - - See Also - -------- - diff --git a/base/remove-last-code-point/docs/types/index.d.ts b/base/remove-last-code-point/docs/types/index.d.ts deleted file mode 100644 index ea3fe002..00000000 --- a/base/remove-last-code-point/docs/types/index.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Removes the last `n` Unicode code points of a string. -* -* @param str - input string -* @param n - number of code points to remove -* @returns output string -* -* @example -* var out = removeLast( 'last man standing', 1 ); -* // returns 'last man standin' -* -* @example -* var out = removeLast( 'presidential election', 1 ); -* // returns 'presidential electio' -* -* @example -* var out = removeLast( 'JavaScript', 1 ); -* // returns 'JavaScrip' -* -* @example -* var out = removeLast( 'Hidden Treasures', 1 ); -* // returns 'Hidden Treasure' -* -* @example -* var out = removeLast( 'foo bar', 5 ); -* // returns 'fo' -*/ -declare function removeLast( str: string, n: number ): string; - - -// EXPORTS // - -export = removeLast; diff --git a/base/remove-last-code-point/docs/types/test.ts b/base/remove-last-code-point/docs/types/test.ts deleted file mode 100644 index fd426d23..00000000 --- a/base/remove-last-code-point/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import removeLast = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - removeLast( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - removeLast( true, 1 ); // $ExpectError - removeLast( false, 1 ); // $ExpectError - removeLast( null, 1 ); // $ExpectError - removeLast( undefined, 1 ); // $ExpectError - removeLast( 5, 1 ); // $ExpectError - removeLast( [], 1 ); // $ExpectError - removeLast( {}, 1 ); // $ExpectError - removeLast( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - removeLast( 'abc', true ); // $ExpectError - removeLast( 'abc', false ); // $ExpectError - removeLast( 'abc', null ); // $ExpectError - removeLast( 'abc', 'abc' ); // $ExpectError - removeLast( 'abc', [] ); // $ExpectError - removeLast( 'abc', {} ); // $ExpectError - removeLast( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - removeLast(); // $ExpectError - removeLast( 'abc' ); // $ExpectError - removeLast( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/remove-last-code-point/examples/index.js b/base/remove-last-code-point/examples/index.js deleted file mode 100644 index 085633ea..00000000 --- a/base/remove-last-code-point/examples/index.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'; - -var removeLastCodePoint = require( './../lib' ); - -console.log( removeLastCodePoint( 'presidential election', 1 ) ); -// => 'presidential electio' - -console.log( removeLastCodePoint( 'JavaScript', 1 ) ); -// => 'JavaScrip' - -console.log( removeLastCodePoint( 'The Last of the Mohicans', 5 ) ); -// => 'The Last of the Moh' - -console.log( removeLastCodePoint( 'अनुच्छेद', 1 ) ); -// => 'अनुच्छे' diff --git a/base/remove-last-code-point/lib/index.js b/base/remove-last-code-point/lib/index.js deleted file mode 100644 index 1403394f..00000000 --- a/base/remove-last-code-point/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Remove the last `n` Unicode code points of a string. -* -* @module @stdlib/string/base/remove-last-code-point -* -* @example -* var removeLast = require( '@stdlib/string/base/remove-last-code-point' ); -* -* var out = removeLast( 'last man standing', 1 ); -* // returns 'last man standin' -* -* out = removeLast( 'Hidden Treasures', 1 ); -* // returns 'Hidden Treasure' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/remove-last-code-point/lib/main.js b/base/remove-last-code-point/lib/main.js deleted file mode 100644 index fc341870..00000000 --- a/base/remove-last-code-point/lib/main.js +++ /dev/null @@ -1,94 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// VARIABLES // - -var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/; // TODO: replace with stdlib pkg -var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/; // TODO: replace with stdlib pkg - - -// MAIN // - -/** -* Removes the last `n` Unicode code points of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of Unicode code points to remove -* @returns {string} output string -* -* @example -* var out = removeLast( 'last man standing', 1 ); -* // returns 'last man standin' -* -* @example -* var out = removeLast( 'presidential election', 1 ); -* // returns 'presidential electio' -* -* @example -* var out = removeLast( 'JavaScript', 1 ); -* // returns 'JavaScrip' -* -* @example -* var out = removeLast( 'Hidden Treasures', 1 ); -* // returns 'Hidden Treasure' -*/ -function removeLast( str, n ) { - var len; - var ch1; - var ch2; - var cnt; - var i; - if ( n === 0 ) { - return str; - } - len = str.length; - cnt = 0; - - // Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point... - for ( i = len - 1; i >= 0; i-- ) { - ch1 = str[ i ]; - cnt += 1; - - // Check for a low UTF-16 surrogate... - if ( RE_UTF16_LOW_SURROGATE.test( ch1 ) ) { - // Check for an unpaired surrogate at the end of the input string... - if ( i === 0 ) { - // We found an unpaired surrogate... - break; - } - // Check whether the high surrogate is paired with a low surrogate... - ch2 = str[ i-1 ]; - if ( RE_UTF16_HIGH_SURROGATE.test( ch2 ) ) { - // We found a surrogate pair: - i -= 1; // bump the index to process the next code unit - } - } - // Check whether we've found the desired number of code points... - if ( cnt === n ) { - break; - } - } - return str.substring( 0, i ); -} - - -// EXPORTS // - -module.exports = removeLast; diff --git a/base/remove-last-code-point/package.json b/base/remove-last-code-point/package.json deleted file mode 100644 index b0450658..00000000 --- a/base/remove-last-code-point/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/remove-last-code-point", - "version": "0.0.0", - "description": "Remove the last Unicode code point of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "last", - "character", - "char", - "codepoint", - "unicode" - ] -} diff --git a/base/remove-last-code-point/test/test.js b/base/remove-last-code-point/test/test.js deleted file mode 100644 index c97f4342..00000000 --- a/base/remove-last-code-point/test/test.js +++ /dev/null @@ -1,105 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 removeLast = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof removeLast, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( removeLast( '', 1 ), '', 'returns expected value' ); - t.strictEqual( removeLast( '', 2 ), '', 'returns expected value' ); - t.strictEqual( removeLast( '', 3 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the input string if provided zero as the second argument', function test( t ) { - t.strictEqual( removeLast( 'hello world', 0 ), 'hello world', 'returns expected value' ); - t.end(); -}); - -tape( 'the function removes the last Unicode code point of a provided string (ascii)', function test( t ) { - var out; - - out = removeLast( 'hello world', 1 ); - t.strictEqual( out, 'hello worl', 'returns expected value' ); - - out = removeLast( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeLast( 'Hello World', 1 ); - t.strictEqual( out, 'Hello Worl', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function removes the last Unicode code point of a provided string (Unicode)', function test( t ) { - var out; - - out = removeLast( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'अनुच्छे', 'returns expected value' ); - - out = removeLast( '六书/六書', 1 ); - t.strictEqual( out, '六书/六', 'returns expected value' ); - - out = removeLast( '𐒻𐓟', 1 ); - t.strictEqual( out, '𐒻', 'returns expected value' ); - - out = removeLast( '\uDC00', 1 ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports removing the last `n` Unicode code points of a provided string', function test( t ) { - var out; - - out = removeLast( 'hello world', 1 ); - t.strictEqual( out, 'hello worl', 'returns expected value' ); - - out = removeLast( 'hello world', 7 ); - t.strictEqual( out, 'hell', 'returns expected value' ); - - out = removeLast( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeLast( '!!!', 2 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = removeLast( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'अनुच्छे', 'returns expected value' ); - - out = removeLast( '六书/六書', 3 ); - t.strictEqual( out, '六书', 'returns expected value' ); - - out = removeLast( '𐒻𐓟𐓟', 2 ); - t.strictEqual( out, '𐒻', 'returns expected value' ); - - t.end(); -}); diff --git a/base/remove-last-grapheme-cluster/README.md b/base/remove-last-grapheme-cluster/README.md deleted file mode 100644 index cb028127..00000000 --- a/base/remove-last-grapheme-cluster/README.md +++ /dev/null @@ -1,122 +0,0 @@ - - -# removeLastGraphemeCluster - -> Remove the last `n` grapheme clusters (i.e., user-perceived characters) of a string. - -
- -## Usage - - - -```javascript -var removeLastGraphemeCluster = require( '@stdlib/string/base/remove-last-grapheme-cluster' ); -``` - -#### removeLastGraphemeCluster( str, n ) - -Removes the last `n` grapheme clusters (i.e., user-perceived characters) of a string. - - - -```javascript -var out = removeLastGraphemeCluster( 'last man standing', 1 ); -// returns 'last man standin' - -out = removeLastGraphemeCluster( 'Hidden Treasures', 1 ); -// returns 'Hidden Treasure' - -out = removeLastGraphemeCluster( 'foo bar', 5 ); -// returns 'fo' - -out = removeLastGraphemeCluster( 'foo bar', 10 ); -// returns '' -``` - -
- - - -
- -## Examples - - - - - -```javascript -var removeLastGraphemeCluster = require( '@stdlib/string/base/remove-last-grapheme-cluster' ); - -var str = removeLastGraphemeCluster( 'presidential election', 1 ); -// returns 'presidential electio' - -str = removeLastGraphemeCluster( 'JavaScript', 1 ); -// returns 'JavaScrip' - -str = removeLastGraphemeCluster( 'The Last of the Mohicans', 5 ); -// returns 'The Last of the Moh' - -str = removeLastGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ); -// returns '🐶🐮🐷' - -str = removeLastGraphemeCluster( '🐶🐮🐷🐰🐸', 10 ); -// returns '' -``` - -
- - - - - - - - - - - - - - diff --git a/base/remove-last-grapheme-cluster/benchmark/benchmark.js b/base/remove-last-grapheme-cluster/benchmark/benchmark.js deleted file mode 100644 index 1f34ea03..00000000 --- a/base/remove-last-grapheme-cluster/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var removeLast = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeLast( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/remove-last-grapheme-cluster/docs/repl.txt b/base/remove-last-grapheme-cluster/docs/repl.txt deleted file mode 100644 index 24ce266c..00000000 --- a/base/remove-last-grapheme-cluster/docs/repl.txt +++ /dev/null @@ -1,30 +0,0 @@ - -{{alias}}( str, n ) - Removes the last `n` grapheme clusters (i.e., user-perceived characters) - of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of grapheme clusters to remove. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 1 ) - 'bee' - > out = {{alias}}( 'Boop', 1 ) - 'Boo' - > out = {{alias}}( 'foo bar', 5 ) - 'fo' - - See Also - -------- - diff --git a/base/remove-last-grapheme-cluster/docs/types/index.d.ts b/base/remove-last-grapheme-cluster/docs/types/index.d.ts deleted file mode 100644 index d6b01be2..00000000 --- a/base/remove-last-grapheme-cluster/docs/types/index.d.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Removes the last `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @param str - input string -* @param n - number of grapheme clusters to remove -* @returns output string -* -* @example -* var out = removeLast( 'last man standing', 1 ); -* // returns 'last man standin' -* -* @example -* var out = removeLast( 'presidential election', 1 ); -* // returns 'presidential electio' -* -* @example -* var out = removeLast( 'JavaScript', 1 ); -* // returns 'JavaScrip' -* -* @example -* var out = removeLast( 'Hidden Treasures', 1 ); -* // returns 'Hidden Treasure' -* -* @example -* var out = removeLast( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐶🐮🐷' -* -* @example -* var out = removeLast( 'foo bar', 5 ); -* // returns 'fo' -*/ -declare function removeLast( str: string, n: number ): string; - - -// EXPORTS // - -export = removeLast; diff --git a/base/remove-last-grapheme-cluster/docs/types/test.ts b/base/remove-last-grapheme-cluster/docs/types/test.ts deleted file mode 100644 index fd426d23..00000000 --- a/base/remove-last-grapheme-cluster/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import removeLast = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - removeLast( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - removeLast( true, 1 ); // $ExpectError - removeLast( false, 1 ); // $ExpectError - removeLast( null, 1 ); // $ExpectError - removeLast( undefined, 1 ); // $ExpectError - removeLast( 5, 1 ); // $ExpectError - removeLast( [], 1 ); // $ExpectError - removeLast( {}, 1 ); // $ExpectError - removeLast( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - removeLast( 'abc', true ); // $ExpectError - removeLast( 'abc', false ); // $ExpectError - removeLast( 'abc', null ); // $ExpectError - removeLast( 'abc', 'abc' ); // $ExpectError - removeLast( 'abc', [] ); // $ExpectError - removeLast( 'abc', {} ); // $ExpectError - removeLast( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - removeLast(); // $ExpectError - removeLast( 'abc' ); // $ExpectError - removeLast( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/remove-last-grapheme-cluster/examples/index.js b/base/remove-last-grapheme-cluster/examples/index.js deleted file mode 100644 index eb2a0ca8..00000000 --- a/base/remove-last-grapheme-cluster/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var removeLastGraphemeCluster = require( './../lib' ); - -console.log( removeLastGraphemeCluster( 'presidential election', 1 ) ); -// => 'presidential electio' - -console.log( removeLastGraphemeCluster( 'JavaScript', 1 ) ); -// => 'JavaScrip' - -console.log( removeLastGraphemeCluster( 'The Last of the Mohicans', 5 ) ); -// => 'The Last of the Moh' - -console.log( removeLastGraphemeCluster( '🐶🐮🐷🐰🐸', 2 ) ); -// => '🐶🐮🐷' - -console.log( removeLastGraphemeCluster( '🐶🐮🐷🐰🐸', 10 ) ); -// => '' diff --git a/base/remove-last-grapheme-cluster/lib/index.js b/base/remove-last-grapheme-cluster/lib/index.js deleted file mode 100644 index b157bfda..00000000 --- a/base/remove-last-grapheme-cluster/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Remove the last `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @module @stdlib/string/base/remove-last-grapheme-cluster -* -* @example -* var removeLast = require( '@stdlib/string/base/remove-last-grapheme-cluster' ); -* -* var out = removeLast( 'last man standing', 1 ); -* // returns 'last man standin' -* -* out = removeLast( 'Hidden Treasures', 1 ); -* // returns 'Hidden Treasure' -* -* out = removeLast( '🐮🐷🐸🐵', 2 ); -* // returns '🐮🐷' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/remove-last-grapheme-cluster/lib/main.js b/base/remove-last-grapheme-cluster/lib/main.js deleted file mode 100644 index 2702c5c8..00000000 --- a/base/remove-last-grapheme-cluster/lib/main.js +++ /dev/null @@ -1,86 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var nextGraphemeClusterBreak = require( './../../../next-grapheme-cluster-break' ); -var numGraphemeClusters = require( './../../../num-grapheme-clusters' ); - - -// MAIN // - -/** -* Removes the last `n` grapheme clusters (i.e., user-perceived characters) of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of grapheme clusters to remove -* @returns {string} output string -* -* @example -* var out = removeLast( 'last man standing', 1 ); -* // returns 'last man standin' -* -* @example -* var out = removeLast( 'presidential election', 1 ); -* // returns 'presidential electio' -* -* @example -* var out = removeLast( 'JavaScript', 1 ); -* // returns 'JavaScrip' -* -* @example -* var out = removeLast( 'Hidden Treasures', 1 ); -* // returns 'Hidden Treasure' -* -* @example -* var out = removeLast( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐶🐮🐷' -* -* @example -* var out = removeLast( 'foo bar', 5 ); -* // returns 'fo' -*/ -function removeLast( str, n ) { - var total; - var num; - var i; - - if ( n === 0 ) { - return str; - } - - total = numGraphemeClusters( str ); - if ( str === '' || total < n ) { - return ''; - } - - i = 0; - num = 0; - while ( num < total - n ) { - i = nextGraphemeClusterBreak( str, i ); - num += 1; - } - return str.substring( 0, i ); -} - - -// EXPORTS // - -module.exports = removeLast; diff --git a/base/remove-last-grapheme-cluster/package.json b/base/remove-last-grapheme-cluster/package.json deleted file mode 100644 index 8d11cb71..00000000 --- a/base/remove-last-grapheme-cluster/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/remove-last-grapheme-cluster", - "version": "0.0.0", - "description": "Remove the last grapheme cluster (i.e., user-perceived character) of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "last", - "character", - "char", - "grapheme", - "cluster", - "unicode" - ] -} diff --git a/base/remove-last-grapheme-cluster/test/test.js b/base/remove-last-grapheme-cluster/test/test.js deleted file mode 100644 index 9224525c..00000000 --- a/base/remove-last-grapheme-cluster/test/test.js +++ /dev/null @@ -1,114 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 removeLast = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof removeLast, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( removeLast( '', 1 ), '', 'returns expected value' ); - t.strictEqual( removeLast( '', 2 ), '', 'returns expected value' ); - t.strictEqual( removeLast( '', 3 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the input string if provided zero as the second argument', function test( t ) { - t.strictEqual( removeLast( 'hello world', 0 ), 'hello world', 'returns expected value' ); - t.end(); -}); - -tape( 'the function removes the last grapheme cluster of a provided string (ascii)', function test( t ) { - var out; - - out = removeLast( 'hello world', 1 ); - t.strictEqual( out, 'hello worl', 'returns expected value' ); - - out = removeLast( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeLast( 'Hello World', 1 ); - t.strictEqual( out, 'Hello Worl', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function removes the last grapheme cluster of a provided string (Unicode)', function test( t ) { - var out; - - out = removeLast( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'अनुच्छे', 'returns expected value' ); - - out = removeLast( '六书/六書', 1 ); - t.strictEqual( out, '六书/六', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function removes the last grapheme cluster of a provided string (emoji)', function test( t ) { - var out; - - out = removeLast( '🌷', 1 ); - t.strictEqual( out, '', 'returns expected value' ); - - out = removeLast( '🏝️🌷', 1 ); - t.strictEqual( out, '🏝️', 'returns expected value' ); - - out = removeLast( '👉🏿', 1 ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports removing the last `n` grapheme clusters of a provided string', function test( t ) { - var out; - - out = removeLast( 'hello world', 1 ); - t.strictEqual( out, 'hello worl', 'returns expected value' ); - - out = removeLast( 'hello world', 7 ); - t.strictEqual( out, 'hell', 'returns expected value' ); - - out = removeLast( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeLast( '!!!', 2 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = removeLast( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'अनुच्छे', 'returns expected value' ); - - out = removeLast( '六书/六書', 1 ); - t.strictEqual( out, '六书/六', 'returns expected value' ); - - out = removeLast( '🌷🌷🌷🌷🌷', 2 ); - t.strictEqual( out, '🌷🌷🌷', 'returns expected value' ); - - t.end(); -}); diff --git a/base/remove-last/README.md b/base/remove-last/README.md deleted file mode 100644 index 92921650..00000000 --- a/base/remove-last/README.md +++ /dev/null @@ -1,110 +0,0 @@ - - -# removeLast - -> Remove the last `n` UTF-16 code units of a string. - -
- -## Usage - -```javascript -var removeLast = require( '@stdlib/string/base/remove-last' ); -``` - -#### removeLast( str, n ) - -Removes the last `n` UTF-16 code units of a string. - -```javascript -var out = removeLast( 'last man standing', 1 ); -// returns 'last man standin' - -out = removeLast( 'Hidden Treasures', 1 ); -// returns 'Hidden Treasure' - -out = removeLast( 'foo bar', 5 ); -// returns 'fo' - -out = removeLast( 'foo bar', 10 ); -// returns '' -``` - -
- - - -
- -## Examples - - - -```javascript -var removeLast = require( '@stdlib/string/base/remove-last' ); - -var str = removeLast( 'presidential election', 1 ); -// returns 'presidential electio' - -str = removeLast( 'JavaScript', 1 ); -// returns 'JavaScrip' - -str = removeLast( 'The Last of the Mohicans', 5 ); -// returns 'The Last of the Moh' -``` - -
- - - - - - - - - - - - - - diff --git a/base/remove-last/benchmark/benchmark.js b/base/remove-last/benchmark/benchmark.js deleted file mode 100644 index 1f34ea03..00000000 --- a/base/remove-last/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var removeLast = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeLast( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/remove-last/docs/repl.txt b/base/remove-last/docs/repl.txt deleted file mode 100644 index ef06292c..00000000 --- a/base/remove-last/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n ) - Removes the last `n` UTF-16 code units of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of UTF-16 code units to remove. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 1 ) - 'bee' - > out = {{alias}}( 'Boop', 1 ) - 'Boo' - > out = {{alias}}( 'foo bar', 5 ) - 'fo' - - See Also - -------- - diff --git a/base/remove-last/docs/types/index.d.ts b/base/remove-last/docs/types/index.d.ts deleted file mode 100644 index 4356e4e0..00000000 --- a/base/remove-last/docs/types/index.d.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Removes the last `n` UTF-16 code units of a string. -* -* @param str - input string -* @param n - number of code units to remove -* @returns output string -* -* @example -* var out = removeLast( 'last man standing', 1 ); -* // returns 'last man standin' -* -* @example -* var out = removeLast( 'presidential election', 1 ); -* // returns 'presidential electio' -* -* @example -* var out = removeLast( 'JavaScript', 1 ); -* // returns 'JavaScrip' -* -* @example -* var out = removeLast( 'Hidden Treasures', 1 ); -* // returns 'Hidden Treasure' -* -* @example -* var out = removeLast( 'foo bar', 5 ); -* // returns 'fo' -*/ -declare function removeLast( str: string, n: number ): string; - - -// EXPORTS // - -export = removeLast; diff --git a/base/remove-last/docs/types/test.ts b/base/remove-last/docs/types/test.ts deleted file mode 100644 index fd426d23..00000000 --- a/base/remove-last/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import removeLast = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - removeLast( 'abc', 1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - removeLast( true, 1 ); // $ExpectError - removeLast( false, 1 ); // $ExpectError - removeLast( null, 1 ); // $ExpectError - removeLast( undefined, 1 ); // $ExpectError - removeLast( 5, 1 ); // $ExpectError - removeLast( [], 1 ); // $ExpectError - removeLast( {}, 1 ); // $ExpectError - removeLast( ( x: number ): number => x, 1 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - removeLast( 'abc', true ); // $ExpectError - removeLast( 'abc', false ); // $ExpectError - removeLast( 'abc', null ); // $ExpectError - removeLast( 'abc', 'abc' ); // $ExpectError - removeLast( 'abc', [] ); // $ExpectError - removeLast( 'abc', {} ); // $ExpectError - removeLast( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - removeLast(); // $ExpectError - removeLast( 'abc' ); // $ExpectError - removeLast( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/remove-last/examples/index.js b/base/remove-last/examples/index.js deleted file mode 100644 index b56142f0..00000000 --- a/base/remove-last/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 removeLast = require( './../lib' ); - -console.log( removeLast( 'presidential election', 1 ) ); -// => 'presidential electio' - -console.log( removeLast( 'JavaScript', 1 ) ); -// => 'JavaScrip' - -console.log( removeLast( 'The Last of the Mohicans', 5 ) ); -// => 'The Last of the Moh' diff --git a/base/remove-last/lib/index.js b/base/remove-last/lib/index.js deleted file mode 100644 index 37557490..00000000 --- a/base/remove-last/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Remove the last `n` UTF-16 code units of a string. -* -* @module @stdlib/string/base/remove-last -* -* @example -* var removeLast = require( '@stdlib/string/base/remove-last' ); -* -* var out = removeLast( 'last man standing', 1 ); -* // returns 'last man standin' -* -* out = removeLast( 'Hidden Treasures', 1 ); -* // returns 'Hidden Treasure' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/remove-last/lib/main.js b/base/remove-last/lib/main.js deleted file mode 100644 index 2bf0fb1c..00000000 --- a/base/remove-last/lib/main.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Removes the last `n` UTF-16 code units of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of UTF-16 code units to remove -* @returns {string} output string -* -* @example -* var out = removeLast( 'last man standing', 1 ); -* // returns 'last man standin' -* -* @example -* var out = removeLast( 'presidential election', 1 ); -* // returns 'presidential electio' -* -* @example -* var out = removeLast( 'JavaScript', 1 ); -* // returns 'JavaScrip' -* -* @example -* var out = removeLast( 'Hidden Treasures', 1 ); -* // returns 'Hidden Treasure' -*/ -function removeLast( str, n ) { - return str.substring( 0, str.length - n ); -} - - -// EXPORTS // - -module.exports = removeLast; diff --git a/base/remove-last/package.json b/base/remove-last/package.json deleted file mode 100644 index be0d590d..00000000 --- a/base/remove-last/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/remove-last", - "version": "0.0.0", - "description": "Remove the last UTF-16 code unit of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "last", - "character", - "char", - "codeunit", - "unicode" - ] -} diff --git a/base/remove-last/test/test.js b/base/remove-last/test/test.js deleted file mode 100644 index 9bb74610..00000000 --- a/base/remove-last/test/test.js +++ /dev/null @@ -1,78 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 removeLast = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof removeLast, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( removeLast( '', 1 ), '', 'returns expected value' ); - t.strictEqual( removeLast( '', 2 ), '', 'returns expected value' ); - t.strictEqual( removeLast( '', 3 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the input string if provided zero as the second argument', function test( t ) { - t.strictEqual( removeLast( 'hello world', 0 ), 'hello world', 'returns expected value' ); - t.end(); -}); - -tape( 'the function removes the last UTF-16 code unit from a provided string', function test( t ) { - var out; - - out = removeLast( 'hello world', 1 ); - t.strictEqual( out, 'hello worl', 'returns expected value' ); - - out = removeLast( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeLast( 'Hello World', 1 ); - t.strictEqual( out, 'Hello Worl', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports removing the last `n` UTF-16 code units of a provided string', function test( t ) { - var out; - - out = removeLast( 'hello world', 1 ); - t.strictEqual( out, 'hello worl', 'returns expected value' ); - - out = removeLast( 'hello world', 7 ); - t.strictEqual( out, 'hell', 'returns expected value' ); - - out = removeLast( '!!!', 1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeLast( '!!!', 2 ); - t.strictEqual( out, '!', 'returns expected value' ); - - t.end(); -}); diff --git a/base/repeat/README.md b/base/repeat/README.md deleted file mode 100644 index af32a4ba..00000000 --- a/base/repeat/README.md +++ /dev/null @@ -1,86 +0,0 @@ - - -# repeat - -> Repeat a string a specified number of times and return the concatenated result. - -
- -## Usage - -```javascript -var repeat = require( '@stdlib/string/base/repeat' ); -``` - -#### repeat( str, n ) - -Repeats a string `n` times and returns the concatenated result. - -```javascript -var str = repeat( 'a', 5 ); -// returns 'aaaaa' - -str = repeat( '', 100 ); -// returns '' - -str = repeat( 'beep', 0 ); -// returns '' -``` - -
- - - -
- -## Examples - - - -```javascript -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var repeat = require( '@stdlib/string/base/repeat' ); - -var i; -for ( i = 0; i < 100; i++ ) { - console.log( repeat( 'beep', discreteUniform( 0, 3 ) ) ); -} -``` - -
- - - - - - - - - - - - - - diff --git a/base/repeat/benchmark/benchmark.builtin.js b/base/repeat/benchmark/benchmark.builtin.js deleted file mode 100644 index a0718f2b..00000000 --- a/base/repeat/benchmark/benchmark.builtin.js +++ /dev/null @@ -1,108 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var repeat = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': typeof String.prototype.repeat !== 'function' -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} n - number of repeats -* @returns {Function} benchmark function -*/ -function createBenchmark( n ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep', - 'boop', - 'baap', - 'biip' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = repeat( values[ i%values.length ], n ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var n; - var f; - var i; - - min = 1; // 10*min - max = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - n = 10 * i; - f = createBenchmark( n ); - bench( format( '%s::builtin:n=%d', pkg, n ), opts, f ); - } -} - -main(); diff --git a/base/repeat/benchmark/benchmark.js b/base/repeat/benchmark/benchmark.js deleted file mode 100644 index f9167662..00000000 --- a/base/repeat/benchmark/benchmark.js +++ /dev/null @@ -1,101 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var repeat = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} n - number of repeats -* @returns {Function} benchmark function -*/ -function createBenchmark( n ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep', - 'boop', - 'baap', - 'biip' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = repeat( values[ i%values.length ], n ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var n; - var f; - var i; - - min = 1; // 10*min - max = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - n = 10 * i; - f = createBenchmark( n ); - bench( format( '%s:n=%d', pkg, n ), f ); - } -} - -main(); diff --git a/base/repeat/docs/repl.txt b/base/repeat/docs/repl.txt deleted file mode 100644 index 188080f1..00000000 --- a/base/repeat/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n ) - Repeats a string `n` times and returns the concatenated result. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of repetitions. - - Returns - ------- - out: string - Repeated string. - - Examples - -------- - > var out = {{alias}}( 'a', 5 ) - 'aaaaa' - > out = {{alias}}( '', 100 ) - '' - > out = {{alias}}( 'beep', 0 ) - '' - - See Also - -------- - diff --git a/base/repeat/docs/types/index.d.ts b/base/repeat/docs/types/index.d.ts deleted file mode 100644 index f62912bf..00000000 --- a/base/repeat/docs/types/index.d.ts +++ /dev/null @@ -1,45 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Repeats a string `n` times and returns the concatenated result. -* -* @param str - string to repeat -* @param n - number of times to repeat the string -* @returns repeated string -* -* @example -* var str = repeat( 'a', 5 ); -* // returns 'aaaaa' -* -* @example -* var str = repeat( '', 100 ); -* // returns '' -* -* @example -* var str = repeat( 'beep', 0 ); -* // returns '' -*/ -declare function repeat( str: string, n: number ): string; - - -// EXPORTS // - -export = repeat; diff --git a/base/repeat/docs/types/test.ts b/base/repeat/docs/types/test.ts deleted file mode 100644 index e64acbc5..00000000 --- a/base/repeat/docs/types/test.ts +++ /dev/null @@ -1,57 +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. -*/ - -import repeat = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - repeat( 'a', 2 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided values other than a string and a number... -{ - repeat( true, 3 ); // $ExpectError - repeat( false, 2 ); // $ExpectError - repeat( 3, 1 ); // $ExpectError - repeat( [], 1 ); // $ExpectError - repeat( {}, 2 ); // $ExpectError - repeat( ( x: number ): number => x, 2 ); // $ExpectError - - repeat( 'a', true ); // $ExpectError - repeat( 'a', false ); // $ExpectError - repeat( 'a', '5' ); // $ExpectError - repeat( 'a', [] ); // $ExpectError - repeat( 'a', {} ); // $ExpectError - repeat( 'a', ( x: number ): number => x ); // $ExpectError - - repeat( [], true ); // $ExpectError - repeat( {}, false ); // $ExpectError - repeat( false, '5' ); // $ExpectError - repeat( {}, [] ); // $ExpectError - repeat( '5', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - repeat(); // $ExpectError - repeat( 3 ); // $ExpectError - repeat( 'abc' ); // $ExpectError -} diff --git a/base/repeat/examples/index.js b/base/repeat/examples/index.js deleted file mode 100644 index 992b8d5f..00000000 --- a/base/repeat/examples/index.js +++ /dev/null @@ -1,27 +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. -*/ - -'use strict'; - -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var repeat = require( './../lib' ); - -var i; -for ( i = 0; i < 100; i++ ) { - console.log( repeat( 'beep', discreteUniform( 0, 3 ) ) ); -} diff --git a/base/repeat/lib/builtin.js b/base/repeat/lib/builtin.js deleted file mode 100644 index 8b9f2e99..00000000 --- a/base/repeat/lib/builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var repeat = String.prototype.repeat; - - -// EXPORTS // - -module.exports = repeat; diff --git a/base/repeat/lib/has_builtin.js b/base/repeat/lib/has_builtin.js deleted file mode 100644 index 9ee0e80a..00000000 --- a/base/repeat/lib/has_builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var bool = ( typeof String.prototype.repeat !== 'undefined' ); - - -// EXPORTS // - -module.exports = bool; diff --git a/base/repeat/lib/index.js b/base/repeat/lib/index.js deleted file mode 100644 index f062e3f6..00000000 --- a/base/repeat/lib/index.js +++ /dev/null @@ -1,58 +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. -*/ - -'use strict'; - -/** -* Repeat a string a specified number of times and return the concatenated result. -* -* @module @stdlib/string/base/repeat -* -* @example -* var replace = require( '@stdlib/string/base/repeat' ); -* -* var str = repeat( 'a', 5 ); -* // returns 'aaaaa' -* -* str = repeat( '', 100 ); -* // returns '' -* -* str = repeat( 'beep', 0 ); -* // returns '' -*/ - -// MODULES // - -var HAS_BUILTIN = require( './has_builtin.js' ); -var polyfill = require( './polyfill.js' ); -var main = require( './main.js' ); - - -// MAIN // - -var repeat; -if ( HAS_BUILTIN ) { - repeat = main; -} else { - repeat = polyfill; -} - - -// EXPORTS // - -module.exports = repeat; diff --git a/base/repeat/lib/main.js b/base/repeat/lib/main.js deleted file mode 100644 index fb43a086..00000000 --- a/base/repeat/lib/main.js +++ /dev/null @@ -1,54 +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. -*/ - -'use strict'; - -// MODULES // - -var builtin = require( './builtin.js' ); - - -// MAIN // - -/** -* Repeats a string a specified number of times and returns the concatenated result. -* -* @param {string} str - string to repeat -* @param {NonNegativeInteger} n - number of times to repeat the string -* @returns {string} repeated string -* -* @example -* var str = repeat( 'a', 5 ); -* // returns 'aaaaa' -* -* @example -* var str = repeat( '', 100 ); -* // returns '' -* -* @example -* var str = repeat( 'beep', 0 ); -* // returns '' -*/ -function repeat( str, n ) { - return builtin.call( str, n ); -} - - -// EXPORTS // - -module.exports = repeat; diff --git a/base/repeat/lib/polyfill.js b/base/repeat/lib/polyfill.js deleted file mode 100644 index edb44d92..00000000 --- a/base/repeat/lib/polyfill.js +++ /dev/null @@ -1,108 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2022 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Repeats a string a specified number of times and returns the concatenated result. -* -* ## Method -* -* The algorithmic trick used in the implementation is to treat string concatenation the same as binary addition (i.e., any natural number (nonnegative integer) can be expressed as a sum of powers of two). -* -* For example, -* -* ```text -* n = 10 => 1010 => 2^3 + 2^0 + 2^1 + 2^0 -* ``` -* -* We can produce a 10-repeat string by "adding" the results of a 8-repeat string and a 2-repeat string. -* -* The implementation is then as follows: -* -* 1. Let `s` be the string to be repeated and `o` be an output string. -* -* 2. Initialize an output string `o`. -* -* 3. Check the least significant bit to determine if the current `s` string should be "added" to the output "total". -* -* - if the bit is a one, add -* - otherwise, move on -* -* 4. Double the string `s` by adding `s` to `s`. -* -* 5. Right-shift the bits of `n`. -* -* 6. Check if we have shifted off all bits. -* -* - if yes, done. -* - otherwise, move on -* -* 7. Repeat 3-6. -* -* The result is that, as the string is repeated, we continually check to see if the doubled string is one which we want to add to our "total". -* -* The algorithm runs in `O(log_2(n))` compared to `O(n)`. -* -* @private -* @param {string} str - string to repeat -* @param {NonNegativeInteger} n - number of times to repeat the string -* @returns {string} repeated string -* -* @example -* var str = repeat( 'a', 5 ); -* // returns 'aaaaa' -* -* @example -* var str = repeat( '', 100 ); -* // returns '' -* -* @example -* var str = repeat( 'beep', 0 ); -* // returns '' -*/ -function repeat( str, n ) { - var rpt; - var cnt; - if ( str.length === 0 || n === 0 ) { - return ''; - } - rpt = ''; - cnt = n; - for ( ; ; ) { - // If the count is odd, append the current concatenated string: - if ( (cnt&1) === 1 ) { - rpt += str; - } - // Right-shift the bits: - cnt >>>= 1; - if ( cnt === 0 ) { - break; - } - // Double the string: - str += str; - } - return rpt; -} - - -// EXPORTS // - -module.exports = repeat; diff --git a/base/repeat/package.json b/base/repeat/package.json deleted file mode 100644 index feaee848..00000000 --- a/base/repeat/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@stdlib/string/base/repeat", - "version": "0.0.0", - "description": "Repeat a string a specified number of times and return the concatenated result.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "repeat", - "string", - "str", - "rep", - "tile", - "replicate", - "concatenate", - "concat", - "copy", - "repstr", - "cli" - ] -} diff --git a/base/repeat/test/test.js b/base/repeat/test/test.js deleted file mode 100644 index daa447c3..00000000 --- a/base/repeat/test/test.js +++ /dev/null @@ -1,74 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var polyfill = require( './../lib/polyfill.js' ); -var main = require( './../lib/main.js' ); -var repeat = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof repeat, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the main export is a polyfill if an environment does not support String.prototype.repeat', function test( t ) { - var repeat = proxyquire( './../lib', { - './has_builtin.js': false - }); - t.strictEqual( repeat, polyfill, 'returns expected value' ); - t.end(); -}); - -tape( 'the main export is a wrapper around a builtin if an environment supports String.prototype.repeat', function test( t ) { - var repeat = proxyquire( './../lib', { - './has_builtin.js': true - }); - t.strictEqual( repeat, main, 'returns expected value' ); - t.end(); -}); - -tape( 'the function repeats an input string a specified number of times', function test( t ) { - var str; - - str = repeat( 'a', 5 ); - t.strictEqual( str, 'aaaaa', 'repeated 5 times' ); - - str = repeat( 'beep', 2 ); - t.strictEqual( str, 'beepbeep', 'repeated 2 times' ); - - t.end(); -}); - -tape( 'if provided an empty string, the function returns an empty string', function test( t ) { - t.strictEqual( repeat( '', 100 ), '', 'returns an empty string' ); - t.end(); -}); - -tape( 'if repeat number is 0, the function returns an empty string', function test( t ) { - t.strictEqual( repeat( 'a', 0 ), '', 'returns empty string' ); - t.end(); -}); diff --git a/base/repeat/test/test.main.js b/base/repeat/test/test.main.js deleted file mode 100644 index f18c39ad..00000000 --- a/base/repeat/test/test.main.js +++ /dev/null @@ -1,63 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var HAS_BUILTIN = require( './../lib/has_builtin.js' ); -var repeat = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': !HAS_BUILTIN -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof repeat, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function repeats an input string a specified number of times', opts, function test( t ) { - var str; - - str = repeat( 'a', 5 ); - t.strictEqual( str, 'aaaaa', 'repeated 5 times' ); - - str = repeat( 'beep', 2 ); - t.strictEqual( str, 'beepbeep', 'repeated 2 times' ); - - t.end(); -}); - -tape( 'if provided an empty string, the function returns an empty string', opts, function test( t ) { - t.strictEqual( repeat( '', 100 ), '', 'returns an empty string' ); - t.end(); -}); - -tape( 'if repeat number is 0, the function returns an empty string', opts, function test( t ) { - t.strictEqual( repeat( 'a', 0 ), '', 'returns empty string' ); - t.end(); -}); diff --git a/base/repeat/test/test.polyfill.js b/base/repeat/test/test.polyfill.js deleted file mode 100644 index 6bb09281..00000000 --- a/base/repeat/test/test.polyfill.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var repeat = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof repeat, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function repeats an input string a specified number of times', function test( t ) { - var str; - - str = repeat( 'a', 5 ); - t.strictEqual( str, 'aaaaa', 'repeated 5 times' ); - - str = repeat( 'beep', 2 ); - t.strictEqual( str, 'beepbeep', 'repeated 2 times' ); - - t.end(); -}); - -tape( 'if provided an empty string, the function returns an empty string', function test( t ) { - t.strictEqual( repeat( '', 100 ), '', 'returns an empty string' ); - t.end(); -}); - -tape( 'if repeat number is 0, the function returns an empty string', function test( t ) { - t.strictEqual( repeat( 'a', 0 ), '', 'returns empty string' ); - t.end(); -}); diff --git a/base/replace-after-last/README.md b/base/replace-after-last/README.md deleted file mode 100644 index 2954564c..00000000 --- a/base/replace-after-last/README.md +++ /dev/null @@ -1,164 +0,0 @@ - - -# replaceAfterLast - -> Replace the substring after the last occurrence of a specified search string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var replaceAfterLast = require( '@stdlib/string/base/replace-after-last' ); -``` - -#### replaceAfterLast( str, search, replacement, fromIndex ) - -Replaces the substring after the last occurrence of a specified search string. - -```javascript -var str = 'beep boop'; -var out = replaceAfterLast( str, ' ', 'loop', str.length ); -// returns 'beep loop' - -out = replaceAfterLast( str, 'o', 'bar', str.length ); -// returns 'beep boobar' -``` - -To begin searching from a specific index, provide a corresponding `fromIndex` argument. - -```javascript -var out = replaceAfterLast( 'beep boop beep', ' ', 'loop', 6 ); -// returns 'beep loop' -``` - -If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. - -```javascript -var out = replaceAfterLast( 'beep boop beep', ' ', 'loop', -1 ); -// returns 'beep boop loop' -``` - -
- - - - - -
- -## Notes - -- If a search string is not present in a provided string, the function returns the provided string unchanged. -- If a search string is an empty string, the function returns the provided string unchanged. -- If `fromIndex` resolves to an index which is less than `0`, the function returns the provided string unchanged. - -
- - - - - -
- -## Examples - - - -```javascript -var replaceAfterLast = require( '@stdlib/string/base/replace-after-last' ); - -var str = 'beep boop'; -var out = replaceAfterLast( str, 'p', 'see', str.length ); -// returns 'beep boopsee' - -str = 'Hello World!'; -out = replaceAfterLast( str, 'xyz', 'foo', str.length ); -// returns 'Hello World!' - -str = 'Hello World!'; -out = replaceAfterLast( str, '', 'foo', str.length ); -// returns 'Hello World!' - -str = ''; -out = replaceAfterLast( str, 'xyz', 'foo', str.length ); -// returns '' - -str = 'beep boop beep baz'; -out = replaceAfterLast( str, 'beep', 'foo', 5 ); -// return 'beepfoo' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/replace-after-last/benchmark/benchmark.js b/base/replace-after-last/benchmark/benchmark.js deleted file mode 100644 index 5c83fa02..00000000 --- a/base/replace-after-last/benchmark/benchmark.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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var replaceAfterLast = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'foo', - 'bar', - 'beep', - 'boop' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = replaceAfterLast( str, 'T', values[ i%values.length ], str.length ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/replace-after-last/docs/repl.txt b/base/replace-after-last/docs/repl.txt deleted file mode 100644 index 9e798b5e..00000000 --- a/base/replace-after-last/docs/repl.txt +++ /dev/null @@ -1,45 +0,0 @@ - -{{alias}}( str, search, replacement, fromIndex ) - Replaces the substring after the last occurrence of a specified search - string. - - If unable to find a search string, the function returns the input string - unchanged. - - The function scans an input string from the starting index to the beginning - of the string (i.e., backward). - - Parameters - ---------- - str: string - Input string. - - search: string - Search string. - - replacement: string - Replacement string. - - fromIndex: integer - Starting index (inclusive). If less than zero, the starting index is - resolved relative to the last string character, with the last string - character corresponding to `fromIndex = -1`. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var str = 'beep boop'; - > var out = {{alias}}( str, ' ', 'foo', str.length ) - 'beep foo' - > out = {{alias}}( str, 'o', 'foo', str.length ) - 'beep boofoo' - > out = {{alias}}( 'Hello World!', 'o', 'foo', 5 ) - 'Hellofoo' - - See Also - -------- - diff --git a/base/replace-after-last/docs/types/index.d.ts b/base/replace-after-last/docs/types/index.d.ts deleted file mode 100644 index ad5862a6..00000000 --- a/base/replace-after-last/docs/types/index.d.ts +++ /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. -*/ - -// TypeScript Version: 4.1 - -/** -* Replaces the substring after the last occurrence of a specified search string. -* -* ## Notes -* -* - The function scans a provided string from the starting index to the beginning of the string (i.e., backward). -* - If unable to find search string, the function returns the input string unchanged. -* - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. -* -* @param str - input string -* @param search - search string -* @param replacement - replacement string -* @param fromIndex - index from which to start searching -* @returns output string -* -* @example -* var str = 'beep boop'; -* var out = replaceAfterLast( str, ' ', 'foo', str.length ); -* // returns 'beep foo' -* -* @example -* var str = 'beep boop'; -* var out = replaceAfterLast( str, 'p', 'foo', str.length ); -* // returns 'beep boopfoo' -* -* @example -* var str = 'Hello World!'; -* var out = replaceAfterLast( str, '', 'foo', str.length ); -* // returns 'Hello World!' -* -* @example -* var str = 'Hello World!'; -* var out = replaceAfterLast( str, 'xyz', 'foo', str.length ); -* // returns 'Hello World!' -* -* @example -* var str = 'beep boop baz'; -* var out = replaceAfterLast( str, 'p b', 'foo', str.length ); -* // returns 'beep boop bfoo' -* -* @example -* var str = 'beep boop baz'; -* var out = replaceAfterLast( str, 'p b', 'foo', 6 ); -* // returns 'beep bfoo' -*/ -declare function replaceAfterLast( str: string, search: string, replacement: string, fromIndex: number ): string; - - -// EXPORTS // - -export = replaceAfterLast; diff --git a/base/replace-after-last/docs/types/test.ts b/base/replace-after-last/docs/types/test.ts deleted file mode 100644 index 5e008fd2..00000000 --- a/base/replace-after-last/docs/types/test.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import replaceAfterLast = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - replaceAfterLast( 'beep boop', ' ', 'foo', 10 ); // $ExpectType string - replaceAfterLast( 'beep boop', 'xyz', 'foo', 10 ); // $ExpectType string - replaceAfterLast( 'beep boop', '', 'foo', 10 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - replaceAfterLast( true, 'd', 'foo', 100 ); // $ExpectError - replaceAfterLast( false, 'd' , 'foo', 100 ); // $ExpectError - replaceAfterLast( 3, 'd' , 'foo', 100 ); // $ExpectError - replaceAfterLast( [], 'd' , 'foo', 100 ); // $ExpectError - replaceAfterLast( {}, 'd' , 'foo', 100 ); // $ExpectError - replaceAfterLast( ( x: number ): number => x, 'd', 'foo', 100 ); // $ExpectError - - replaceAfterLast( 'abc', true, 'foo', 10 ); // $ExpectError - replaceAfterLast( 'abc', false, 'foo', 10 ); // $ExpectError - replaceAfterLast( 'abc', 5 , 'foo', 10 ); // $ExpectError - replaceAfterLast( 'abc', [], 'foo', 10 ); // $ExpectError - replaceAfterLast( 'abc', {} , 'foo', 10 ); // $ExpectError - replaceAfterLast( 'abc', ( x: number ): number => x , 'foo', 10 ); // $ExpectError - - replaceAfterLast( 'abc', 'd', true, 10 ); // $ExpectError - replaceAfterLast( 'abc', 'd', false, 10 ); // $ExpectError - replaceAfterLast( 'abc', 'd', 5, 10 ); // $ExpectError - replaceAfterLast( 'abc', 'd', [], 10 ); // $ExpectError - replaceAfterLast( 'abc', 'd', {}, 10 ); // $ExpectError - replaceAfterLast( 'abc', 'd', ( x: number ): number => x, 10 ); // $ExpectError - - replaceAfterLast( 'abc', 'd', 'foo', true ); // $ExpectError - replaceAfterLast( 'abc', 'd', 'foo', false ); // $ExpectError - replaceAfterLast( 'abc', 'd', 'foo', '5' ); // $ExpectError - replaceAfterLast( 'abc', 'd', 'foo', [] ); // $ExpectError - replaceAfterLast( 'abc', 'd', 'foo', {} ); // $ExpectError - replaceAfterLast( 'abc', 'd', 'foo', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - replaceAfterLast(); // $ExpectError - replaceAfterLast( 'abc' ); // $ExpectError - replaceAfterLast( 'abc', 'd' ); // $ExpectError - replaceAfterLast( 'abc', 'd', 'foo' ); // $ExpectError - replaceAfterLast( 'abc', 'd', 'foo', 4, 4 ); // $ExpectError -} diff --git a/base/replace-after-last/examples/index.js b/base/replace-after-last/examples/index.js deleted file mode 100644 index 48acaabb..00000000 --- a/base/replace-after-last/examples/index.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'; - -var replaceAfterLast = require( './../lib' ); - -var str = 'beep boop'; -var out = replaceAfterLast( str, 'p', 'see', str.length ); -console.log( out ); -// => 'beep boopsee' - -str = 'Hello World!'; -out = replaceAfterLast( str, 'xyz', 'foo', str.length ); -console.log( out ); -// => 'Hello World!' - -str = 'Hello World!'; -out = replaceAfterLast( str, '', 'foo', str.length ); -console.log( out ); -// => 'Hello World!' - -str = ''; -out = replaceAfterLast( str, 'xyz', 'foo', str.length ); -console.log( out ); -// => '' - -str = 'beep boop baz'; -out = replaceAfterLast( str, 'p b', 'foo', str.length ); -console.log( out ); -// => 'beep boop bfoo' - -str = 'beep boop baz'; -out = replaceAfterLast( str, 'p b', 'foo', 6 ); -console.log( out ); -// => 'beep bfoo' diff --git a/base/replace-after-last/lib/index.js b/base/replace-after-last/lib/index.js deleted file mode 100644 index 533d2b95..00000000 --- a/base/replace-after-last/lib/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Replace the substring after the last occurrence of a specified search string. -* -* @module @stdlib/string/base/replace-after-last -* -* @example -* var replaceAfterLast = require( '@stdlib/string/base/replace-after-last' ); -* -* var str = 'beep boop'; -* -* var out = replaceAfterLast( str, ' ', 'foo', str.length ); -* // returns 'beep foo' -* -* out = replaceAfterLast( str, 'o', 'bar', str.length ); -* // returns 'beep boobar' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/replace-after-last/lib/main.js b/base/replace-after-last/lib/main.js deleted file mode 100644 index 704d1055..00000000 --- a/base/replace-after-last/lib/main.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Replaces the substring after the last occurrence of a specified search string. -* -* @param {string} str - input string -* @param {string} search - search string -* @param {string} replacement - replacement string -* @param {integer} fromIndex - index from which to start searching -* @returns {string} string -* -* @example -* var str = 'beep boop'; -* var out = replaceAfterLast( str, ' ', 'foo', str.length ); -* // returns 'beep foo' -* -* @example -* var str = 'beep boop'; -* var out = replaceAfterLast( str, 'p', 'foo', str.length ); -* // returns 'beep boopfoo' -* -* @example -* var str = 'Hello World!'; -* var out = replaceAfterLast( str, '', 'foo', str.length ); -* // returns 'Hello World!' -* -* @example -* var str = 'Hello World!'; -* var out = replaceAfterLast( str, 'xyz', 'foo', str.length ); -* // returns 'Hello World!' -* -* @example -* var str = 'beep boop baz'; -* var out = replaceAfterLast( str, 'p b', 'foo', str.length ); -* // returns 'beep boop bfoo' -* -* @example -* var str = 'beep boop baz'; -* var out = replaceAfterLast( str, 'p b', 'foo', 6 ); -* // returns 'beep bfoo' -*/ -function replaceAfterLast( str, search, replacement, fromIndex ) { - var idx; - if ( fromIndex < 0 ) { - fromIndex += str.length; - if ( fromIndex < 0 ) { - return str; - } - } - idx = str.lastIndexOf( search, fromIndex ); - if ( str === '' || search === '' || replacement === '' || idx < 0 ) { - return str; - } - return str.substring( 0, idx + search.length ) + replacement; -} - - -// EXPORTS // - -module.exports = replaceAfterLast; diff --git a/base/replace-after-last/package.json b/base/replace-after-last/package.json deleted file mode 100644 index f6269b27..00000000 --- a/base/replace-after-last/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/base/replace-after-last", - "version": "0.0.0", - "description": "Replace the substring after the last occurrence of a specified search string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "replace", - "search", - "substring", - "substr", - "after", - "last", - "match" - ] -} diff --git a/base/replace-after-last/test/test.js b/base/replace-after-last/test/test.js deleted file mode 100644 index 25a444ec..00000000 --- a/base/replace-after-last/test/test.js +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 replaceAfterLast = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof replaceAfterLast, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function replaces the substring after the last occurrence of a specified search string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = replaceAfterLast( str, ' ', 'foo', str.length ); - expected = 'beep foo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = replaceAfterLast( str, 'p', 'foo', str.length ); - expected = 'beep boopfoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'Hello, World!'; - actual = replaceAfterLast( str, 'o', 'foo', str.length ); - expected = 'Hello, Wofoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function replaces the substring after the last occurrence of a specified search string (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep 😀 boop 😀 baz'; - actual = replaceAfterLast( str, '😀', 'foo', str.length ); - expected = 'beep 😀 boop 😀foo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🤖 Robot army 🤖!'; - actual = replaceAfterLast( str, '🤖', 'foo', str.length ); - expected = '🤖 Robot army 🤖foo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🐺 Wolf brothers 🐺'; - actual = replaceAfterLast( str, 'o', 'foo', str.length ); - expected = '🐺 Wolf brofoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function replaces the substring after a provided search string (custom start index)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop baz'; - actual = replaceAfterLast( str, ' ', 'foo', 6 ); - expected = 'beep foo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceAfterLast( str, 'p', 'foo', 6 ); - expected = 'beepfoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceAfterLast( str, 'beep', 'foo', -3 ); - expected = 'beepfoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceAfterLast( str, 'beep', 'foo', -100 ); - expected = 'beep boop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceAfterLast( str, 'beep', 'foo', 20 ); - expected = 'beepfoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is not found', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = replaceAfterLast( str, 'z', 'foo', str.length ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = replaceAfterLast( str, 'baz', 'foo', str.length ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is the empty string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = replaceAfterLast( str, '', 'foo', str.length ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/base/replace-after/README.md b/base/replace-after/README.md deleted file mode 100644 index c4c21718..00000000 --- a/base/replace-after/README.md +++ /dev/null @@ -1,158 +0,0 @@ - - -# replaceAfter - -> Replace the substring after the first occurrence of a specified search string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var replaceAfter = require( '@stdlib/string/base/replace-after' ); -``` - -#### replaceAfter( str, search, replacement, fromIndex ) - -Replaces the substring after the first occurrence of a specified search string. - -```javascript -var out = replaceAfter( 'beep boop', ' ', 'loop', 0 ); -// returns 'beep loop' - -out = replaceAfter( 'beep boop', 'o', 'bar', 0 ); -// returns 'beep bobar' -``` - -To begin searching from a specific index, provide a corresponding `fromIndex` argument. - -```javascript -var out = replaceAfter( 'beep boop beep baz', 'beep', 'foo', 5 ); -// return 'beep boop beepfoo' -``` - -If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. - -```javascript -var out = replaceAfter( 'beep boop beep', ' ', 'loop', -6 ); -// returns 'beep boop loop' -``` - -
- - - - - -
- -## Notes - -- If a search string is not present in a provided string, the function returns the provided string unchanged. -- If a search string is an empty string, the function returns the provided string unchanged. -- If `fromIndex` resolves to an index which is greater than or equal to `str.length`, the function returns the provided string unchanged. - -
- - - - - -
- -## Examples - - - -```javascript -var replaceAfter = require( '@stdlib/string/base/replace-after' ); - -var out = replaceAfter( 'beep boop', 'p', 'see', 0 ); -// returns 'beepsee' - -out = replaceAfter( 'Hello World!', 'xyz', 'foo', 0 ); -// returns 'Hello World!' - -out = replaceAfter( 'Hello World!', '', 'foo', 0 ); -// returns 'Hello World!' - -out = replaceAfter( '', 'xyz', 'foo', 0 ); -// returns '' - -out = replaceAfter( 'beep boop beep baz', 'beep', 'foo', 5 ); -// return 'beep boop beepfoo' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/replace-after/benchmark/benchmark.js b/base/replace-after/benchmark/benchmark.js deleted file mode 100644 index 7845c566..00000000 --- a/base/replace-after/benchmark/benchmark.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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var replaceAfter = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'foo', - 'bar', - 'beep', - 'boop' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = replaceAfter( str, '.', values[ i%values.length ], 0 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/replace-after/docs/repl.txt b/base/replace-after/docs/repl.txt deleted file mode 100644 index 50e72511..00000000 --- a/base/replace-after/docs/repl.txt +++ /dev/null @@ -1,43 +0,0 @@ - -{{alias}}( str, search, replacement, fromIndex ) - Replaces the substring after the first occurrence of a specified search - string. - - If unable to find a search string, the function returns the input string - unchanged. - - Parameters - ---------- - str: string - Input string. - - search: string - Search string. - - replacement: string - Replacement string. - - fromIndex: integer - Starting index (inclusive). If less than zero, the starting index is - resolved relative to the last string character, with the last string - character corresponding to `fromIndex = -1`. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep boop', ' ', 'foo', 0 ) - 'beep foo' - > out = {{alias}}( 'beep boop', 'o', 'foo', 0 ) - 'beep bofoo' - > out = {{alias}}( 'Hello World!', 'o', 'foo', 5 ) - 'Hello Wofoo' - > out = {{alias}}( 'beep boop beep baz', 'beep', 'foo', 5 ) - 'beep boop beepfoo' - - See Also - -------- - diff --git a/base/replace-after/docs/types/index.d.ts b/base/replace-after/docs/types/index.d.ts deleted file mode 100644 index 2e4e4afb..00000000 --- a/base/replace-after/docs/types/index.d.ts +++ /dev/null @@ -1,64 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Replaces the substring after the first occurrence of a specified search string. -* -* ## Notes -* -* - If unable to find search string, the function returns the input string unchanged. -* - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. -* -* @param str - input string -* @param search - search string -* @param replacement - replacement string -* @param fromIndex - index at which to start the search -* @returns output string -* -* @example -* var out = replaceAfter( 'beep boop', ' ', 'foo', 0 ); -* // returns 'beep foo' -* -* @example -* var out = replaceAfter( 'beep boop', 'p', 'foo', 5 ); -* // returns 'beep boopfoo' -* -* @example -* var out = replaceAfter( 'Hello World!', '', 'foo', 0 ); -* // returns 'Hello World!' -* -* @example -* var out = replaceAfter( 'Hello World!', 'xyz', 'foo', 0 ); -* // returns 'Hello World!' -* -* @example -* var out = replaceAfter( 'beep boop', ' ', 'foo' , 5 ); -* // returns 'beep boop' -* -* @example -* var out = replaceAfter( 'beep boop beep baz', 'beep', 'foo' , 5 ); -* // returns 'beep boop beepfoo' -*/ -declare function replaceAfter( str: string, search: string, replacement: string, fromIndex: number ): string; - - -// EXPORTS // - -export = replaceAfter; diff --git a/base/replace-after/docs/types/test.ts b/base/replace-after/docs/types/test.ts deleted file mode 100644 index 97a9fd49..00000000 --- a/base/replace-after/docs/types/test.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import replaceAfter = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - replaceAfter( 'beep boop', ' ', 'foo', 0 ); // $ExpectType string - replaceAfter( 'beep boop', 'xyz', 'foo', 0 ); // $ExpectType string - replaceAfter( 'beep boop', '', 'foo', 0 ); // $ExpectType string - replaceAfter( 'beep boop', '', 'foo', 5 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - replaceAfter( true, 'd', 'foo', 0 ); // $ExpectError - replaceAfter( false, 'd' , 'foo', 0 ); // $ExpectError - replaceAfter( 3, 'd' , 'foo', 0 ); // $ExpectError - replaceAfter( [], 'd' , 'foo', 0 ); // $ExpectError - replaceAfter( {}, 'd' , 'foo', 0 ); // $ExpectError - replaceAfter( ( x: number ): number => x, 'd', 'foo', 0 ); // $ExpectError - - replaceAfter( 'abc', true, 'foo', 0 ); // $ExpectError - replaceAfter( 'abc', false, 'foo', 0 ); // $ExpectError - replaceAfter( 'abc', 5 , 'foo', 0 ); // $ExpectError - replaceAfter( 'abc', [], 'foo', 0 ); // $ExpectError - replaceAfter( 'abc', {} , 'foo', 0 ); // $ExpectError - replaceAfter( 'abc', ( x: number ): number => x , 'foo', 0 ); // $ExpectError - - replaceAfter( 'abc', 'd', true, 0 ); // $ExpectError - replaceAfter( 'abc', 'd', false, 0 ); // $ExpectError - replaceAfter( 'abc', 'd', 5, 0 ); // $ExpectError - replaceAfter( 'abc', 'd', [], 0 ); // $ExpectError - replaceAfter( 'abc', 'd', {}, 0 ); // $ExpectError - replaceAfter( 'abc', 'd', ( x: number ): number => x, 0 ); // $ExpectError - - replaceAfter( 'abc', 'd', 'foo', true ); // $ExpectError - replaceAfter( 'abc', 'd', 'foo', false ); // $ExpectError - replaceAfter( 'abc', 'd', 'foo', '5' ); // $ExpectError - replaceAfter( 'abc', 'd', 'foo', [] ); // $ExpectError - replaceAfter( 'abc', 'd', 'foo', {} ); // $ExpectError - replaceAfter( 'abc', 'd', 'foo', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - replaceAfter(); // $ExpectError - replaceAfter( 'abc' ); // $ExpectError - replaceAfter( 'abc', 'd' ); // $ExpectError - replaceAfter( 'abc', 'd', 'd', 1, 1 ); // $ExpectError -} diff --git a/base/replace-after/examples/index.js b/base/replace-after/examples/index.js deleted file mode 100644 index f8e57dd0..00000000 --- a/base/replace-after/examples/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 replaceAfter = require( './../lib' ); - -var out = replaceAfter( 'beep boop', 'p', 'see', 0 ); -console.log( out ); -// => 'beepsee' - -out = replaceAfter( 'beep boop', 'p', 'see', 5 ); -console.log( out ); -// => 'beep boopsee' - -out = replaceAfter( 'Hello World!', 'xyz', 'foo', 0 ); -console.log( out ); -// => 'Hello World!' - -out = replaceAfter( 'Hello World!', '', 'foo', 0 ); -console.log( out ); -// => 'Hello World!' - -out = replaceAfter( '', 'xyz', 'foo', 0 ); -console.log( out ); -// => '' - -out = replaceAfter( 'beep boop', ' ', 'foo', 5 ); -console.log( out ); -// => 'beep boop' - -out = replaceAfter( 'beep boop beep baz', 'beep', 'foo', 5 ); -console.log( out ); -// => 'beep boop beepfoo' diff --git a/base/replace-after/lib/index.js b/base/replace-after/lib/index.js deleted file mode 100644 index 8b97518b..00000000 --- a/base/replace-after/lib/index.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'; - -/** -* Replace the substring after the first occurrence of a specified search string. -* -* @module @stdlib/string/base/replace-after -* -* @example -* var replaceAfter = require( '@stdlib/string/base/replace-after' ); -* -* var str = 'beep boop'; -* -* var out = replaceAfter( str, ' ', 'foo', 0 ); -* // returns 'beep foo' -* -* out = replaceAfter( str, 'o', 'bar', 0 ); -* // returns 'beep bobar' -* -* var out = replaceAfter( 'beep boop', ' ', 'foo', 5 ); -* // returns 'beep boop' -* -* var out = replaceAfter( 'beep boop beep baz', 'beep', 'foo', 5 ); -* // returns 'beep boop beepfoo' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/replace-after/lib/main.js b/base/replace-after/lib/main.js deleted file mode 100644 index b78bd823..00000000 --- a/base/replace-after/lib/main.js +++ /dev/null @@ -1,73 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Replaces the substring after the first occurrence of a specified search string. -* -* @param {string} str - input string -* @param {string} search - search string -* @param {string} replacement - replacement string -* @param {integer} fromIndex - index at which to start the search -* @returns {string} output string -* -* @example -* var out = replaceAfter( 'beep boop', ' ', 'foo', 0 ); -* // returns 'beep foo' -* -* @example -* var out = replaceAfter( 'beep boop', 'p', 'foo', 5 ); -* // returns 'beep boopfoo' -* -* @example -* var out = replaceAfter( 'Hello World!', '', 'foo', 0 ); -* // returns 'Hello World!' -* -* @example -* var out = replaceAfter( 'Hello World!', 'xyz', 'foo', 0 ); -* // returns 'Hello World!' -* -* @example -* var out = replaceAfter( 'beep boop', ' ', 'foo', 5 ); -* // returns 'beep boop' -* -* @example -* var out = replaceAfter( 'beep boop beep baz', 'beep', 'foo', 5 ); -* // returns 'beep boop beepfoo' -*/ -function replaceAfter( str, search, replacement, fromIndex ) { - var idx; - if ( fromIndex < 0 ) { - fromIndex += str.length; - } else if ( fromIndex >= str.length ) { - return str; - } - idx = str.indexOf( search, fromIndex ); - if ( str === '' || search === '' || replacement === '' || idx < 0 ) { - return str; - } - return str.substring( 0, idx + search.length ) + replacement; -} - - -// EXPORTS // - -module.exports = replaceAfter; diff --git a/base/replace-after/package.json b/base/replace-after/package.json deleted file mode 100644 index 07094952..00000000 --- a/base/replace-after/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/replace-after", - "version": "0.0.0", - "description": "Replace the substring after the first occurrence of a specified search string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "replace", - "search", - "substring", - "substr", - "after", - "match" - ] -} diff --git a/base/replace-after/test/test.js b/base/replace-after/test/test.js deleted file mode 100644 index 4a776e15..00000000 --- a/base/replace-after/test/test.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 replaceAfter = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof replaceAfter, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function replaces the substring after the first occurrence of a specified search string', function test( t ) { - var expected; - var actual; - - actual = replaceAfter( 'beep boop', ' ', 'foo', 0 ); - expected = 'beep foo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceAfter( 'beep boop', 'p', 'foo', 0 ); - expected = 'beepfoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceAfter( 'Hello, World!', 'o', 'foo', 0 ); - expected = 'Hellofoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function replaces the substring after the first occurrence of a specified search string (Unicode characters)', function test( t ) { - var expected; - var actual; - - actual = replaceAfter( 'beep 😀 boop 😀 baz', '😀', 'foo', 0 ); - expected = 'beep 😀foo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceAfter( '🤖 Robot army 🤖!', '🤖', 'foo', 0 ); - expected = '🤖foo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceAfter( '🐺 Wolf brothers 🐺', 'o', 'foo', 0 ); - expected = '🐺 Wofoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function replaces the substring after a provided search string (custom start index)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop baz'; - actual = replaceAfter( str, ' ', 'foo', 6 ); - expected = 'beep boop foo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceAfter( str, 'p', 'foo', 6 ); - expected = 'beep boopfoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceAfter( str, 'baz', 'foo', -5 ); - expected = 'beep boop bazfoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceAfter( str, 'beep', 'foo', -20 ); - expected = 'beepfoo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceAfter( str, ' ', 'foo', 1000 ); - expected = 'beep boop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is not found', function test( t ) { - var expected; - var actual; - - actual = replaceAfter( 'beep boop', 'z', 'foo', 0 ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceAfter( 'beep boop', 'baz', 'foo', 0 ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is the empty string', function test( t ) { - var expected; - var actual; - - actual = replaceAfter( 'beep boop', '', 'foo', 0 ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/base/replace-before-last/README.md b/base/replace-before-last/README.md deleted file mode 100644 index 180282e1..00000000 --- a/base/replace-before-last/README.md +++ /dev/null @@ -1,160 +0,0 @@ - - -# replaceBeforeLast - -> Replace the substring before the last occurrence of a specified search string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var replaceBeforeLast = require( '@stdlib/string/base/replace-before-last' ); -``` - -#### replaceBeforeLast( str, search, replacement, fromIndex ) - -Replaces the substring before the last occurrence of a specified search string. - -```javascript -var str = 'beep boop'; -var out = replaceBeforeLast( str, ' ', 'loop', str.length ); -// returns 'loop boop' - -out = replaceBeforeLast( str, 'o', 'bar', str.length ); -// returns 'barop' -``` - -To begin searching from a specific index, provide a corresponding `fromIndex` argument. - -```javascript -var out = replaceBeforeLast( 'beep boop beep', ' ', 'loop', 5 ); -// returns 'loop boop beep' -``` - -If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. - -```javascript -var out = replaceBeforeLast( 'beep boop beep', ' ', 'loop', -1 ); -// returns 'loop beep' -``` - -
- - - - - -
- -## Notes - -- If a search string is not present in a provided string, the function returns the provided string unchanged. -- If a search string is an empty string, the function returns the provided string unchanged. -- If `fromIndex` resolves to an index which is less than `0`, the function returns the provided string unchanged. - -
- - - - - -
- -## Examples - - - -```javascript -var replaceBeforeLast = require( '@stdlib/string/base/replace-before-last' ); - -var str = 'beep boop'; -var out = replaceBeforeLast( str, 'p', 'see', str.length ); -// returns 'seep' - -str = 'Hello World!'; -out = replaceBeforeLast( str, 'xyz', 'foo', str.length ); -// returns 'Hello World!' - -str = 'Hello World!'; -out = replaceBeforeLast( str, '', 'foo', str.length ); -// returns 'Hello World!' - -str = ''; -out = replaceBeforeLast( str, 'xyz', 'foo', str.length ); -// returns '' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/replace-before-last/benchmark/benchmark.js b/base/replace-before-last/benchmark/benchmark.js deleted file mode 100644 index 052ee531..00000000 --- a/base/replace-before-last/benchmark/benchmark.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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var replaceBeforeLast = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'foo', - 'bar', - 'beep', - 'boop' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = replaceBeforeLast( str, 'T', values[ i%values.length ], str.length ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/replace-before-last/docs/repl.txt b/base/replace-before-last/docs/repl.txt deleted file mode 100644 index 9e11df56..00000000 --- a/base/replace-before-last/docs/repl.txt +++ /dev/null @@ -1,45 +0,0 @@ - -{{alias}}( str, search, replacement, fromIndex ) - Replaces the substring before the last occurrence of a specified search - string. - - If unable to find a search string, the function returns the input string - unchanged. - - The function scans an input string from the starting index to the beginning - of the string (i.e., backward). - - Parameters - ---------- - str: string - Input string. - - search: string - Search string. - - replacement: string - Replacement string. - - fromIndex: integer - Starting index (inclusive). If less than zero, the starting index is - resolved relative to the last string character, with the last string - character corresponding to `fromIndex = -1`. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var str = 'beep boop'; - > var out = {{alias}}( str, ' ', 'foo', str.length ) - 'foo boop' - > out = {{alias}}( str, 'o', 'foo', str.length ) - 'fooop' - > out = {{alias}}( 'Hello World!', 'o', 'foo', 5 ) - 'fooo World!' - - See Also - -------- - diff --git a/base/replace-before-last/docs/types/index.d.ts b/base/replace-before-last/docs/types/index.d.ts deleted file mode 100644 index 4ff708b1..00000000 --- a/base/replace-before-last/docs/types/index.d.ts +++ /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. -*/ - -// TypeScript Version: 4.1 - -/** -* Replaces the substring before the last occurrence of a specified search string. -* -* ## Notes -* -* - The function scans a provided string from the starting index to the beginning of the string (i.e., backward). -* - If unable to find search string, the function returns the input string unchanged. -* - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. -* -* @param str - input string -* @param search - search string -* @param replacement - replacement string -* @param fromIndex - index from which to start searching -* @returns output string -* -* @example -* var str = 'beep boop'; -* var out = replaceBeforeLast( str, ' ', 'foo', str.length ); -* // returns 'foo boop' -* -* @example -* var str = 'beep boop'; -* var out = replaceBeforeLast( str, 'p', 'foo', str.length ); -* // returns 'foop' -* -* @example -* var str = 'Hello World!'; -* var out = replaceBeforeLast( str, '', 'foo', str.length ); -* // returns 'Hello World!' -* -* @example -* var str = 'Hello World!'; -* var out = replaceBeforeLast( str, 'xyz', 'foo', str.length ); -* // returns 'Hello World!' -* -* @example -* var str = 'beep boop baz'; -* var out = replaceBeforeLast( str, 'p b', 'foo', str.length ); -* // returns 'foop baz' -* -* @example -* var str = 'beep boop baz'; -* var out = replaceBeforeLast( str, 'p b', 'foo', 6 ); -* // returns 'foop boop baz' -*/ -declare function replaceBeforeLast( str: string, search: string, replacement: string, fromIndex: number ): string; - - -// EXPORTS // - -export = replaceBeforeLast; diff --git a/base/replace-before-last/docs/types/test.ts b/base/replace-before-last/docs/types/test.ts deleted file mode 100644 index 4e76a173..00000000 --- a/base/replace-before-last/docs/types/test.ts +++ /dev/null @@ -1,69 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import replaceBeforeLast = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - replaceBeforeLast( 'beep boop', ' ', 'foo', 10 ); // $ExpectType string - replaceBeforeLast( 'beep boop', 'xyz', 'foo', 10 ); // $ExpectType string - replaceBeforeLast( 'beep boop', '', 'foo', 10 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - replaceBeforeLast( true, 'd', 'foo', 100 ); // $ExpectError - replaceBeforeLast( false, 'd' , 'foo', 100 ); // $ExpectError - replaceBeforeLast( 3, 'd' , 'foo', 100 ); // $ExpectError - replaceBeforeLast( [], 'd' , 'foo', 100 ); // $ExpectError - replaceBeforeLast( {}, 'd' , 'foo', 100 ); // $ExpectError - replaceBeforeLast( ( x: number ): number => x, 'd', 'foo', 100 ); // $ExpectError - - replaceBeforeLast( 'abc', true, 'foo', 10 ); // $ExpectError - replaceBeforeLast( 'abc', false, 'foo', 10 ); // $ExpectError - replaceBeforeLast( 'abc', 5 , 'foo', 10 ); // $ExpectError - replaceBeforeLast( 'abc', [], 'foo', 10 ); // $ExpectError - replaceBeforeLast( 'abc', {} , 'foo', 10 ); // $ExpectError - replaceBeforeLast( 'abc', ( x: number ): number => x , 'foo', 10 ); // $ExpectError - - replaceBeforeLast( 'abc', 'd', true, 10 ); // $ExpectError - replaceBeforeLast( 'abc', 'd', false, 10 ); // $ExpectError - replaceBeforeLast( 'abc', 'd', 5, 10 ); // $ExpectError - replaceBeforeLast( 'abc', 'd', [], 10 ); // $ExpectError - replaceBeforeLast( 'abc', 'd', {}, 10 ); // $ExpectError - replaceBeforeLast( 'abc', 'd', ( x: number ): number => x, 10 ); // $ExpectError - - replaceBeforeLast( 'abc', 'd', 'foo', true ); // $ExpectError - replaceBeforeLast( 'abc', 'd', 'foo', false ); // $ExpectError - replaceBeforeLast( 'abc', 'd', 'foo', '5' ); // $ExpectError - replaceBeforeLast( 'abc', 'd', 'foo', [] ); // $ExpectError - replaceBeforeLast( 'abc', 'd', 'foo', {} ); // $ExpectError - replaceBeforeLast( 'abc', 'd', 'foo', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - replaceBeforeLast(); // $ExpectError - replaceBeforeLast( 'abc' ); // $ExpectError - replaceBeforeLast( 'abc', 'd' ); // $ExpectError - replaceBeforeLast( 'abc', 'd', 'foo' ); // $ExpectError - replaceBeforeLast( 'abc', 'd', 'foo', 4, 4 ); // $ExpectError -} diff --git a/base/replace-before-last/examples/index.js b/base/replace-before-last/examples/index.js deleted file mode 100644 index 7e11cb4c..00000000 --- a/base/replace-before-last/examples/index.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'; - -var replaceBeforeLast = require( './../lib' ); - -var str = 'beep boop'; -var out = replaceBeforeLast( str, 'p', 'see', str.length ); -console.log( out ); -// => 'seep' - -str = 'Hello World!'; -out = replaceBeforeLast( str, 'xyz', 'foo', str.length ); -console.log( out ); -// => 'Hello World!' - -str = 'Hello World!'; -out = replaceBeforeLast( str, '', 'foo', str.length ); -console.log( out ); -// => 'Hello World!' - -str = ''; -out = replaceBeforeLast( str, 'xyz', 'foo', str.length ); -console.log( out ); -// => '' - -str = 'beep boop baz'; -out = replaceBeforeLast( str, 'p b', 'foo', str.length ); -console.log( out ); -// => 'foop baz' - -str = 'beep boop baz'; -out = replaceBeforeLast( str, 'p b', 'foo', 6 ); -console.log( out ); -// => 'foop boop baz' diff --git a/base/replace-before-last/lib/index.js b/base/replace-before-last/lib/index.js deleted file mode 100644 index b29877c0..00000000 --- a/base/replace-before-last/lib/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Replace the substring before the last occurrence of a specified search string. -* -* @module @stdlib/string/base/replace-before-last -* -* @example -* var replaceBeforeLast = require( '@stdlib/string/base/replace-before-last' ); -* -* var str = 'beep boop'; -* -* var out = replaceBeforeLast( str, ' ', 'foo', str.length ); -* // returns 'foo boop' -* -* out = replaceBeforeLast( str, 'o', 'bar', str.length ); -* // returns 'barop' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/replace-before-last/lib/main.js b/base/replace-before-last/lib/main.js deleted file mode 100644 index 89a12e24..00000000 --- a/base/replace-before-last/lib/main.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Replaces the substring before the last occurrence of a specified search string. -* -* @param {string} str - input string -* @param {string} search - search string -* @param {string} replacement - replacement string -* @param {integer} fromIndex - index from which to start searching -* @returns {string} string -* -* @example -* var str = 'beep boop'; -* var out = replaceBeforeLast( str, ' ', 'foo', str.length ); -* // returns 'foo boop' -* -* @example -* var str = 'beep boop'; -* var out = replaceBeforeLast( str, 'p', 'foo', str.length ); -* // returns 'foop' -* -* @example -* var str = 'Hello World!'; -* var out = replaceBeforeLast( str, '', 'foo', str.length ); -* // returns 'Hello World!' -* -* @example -* var str = 'Hello World!'; -* var out = replaceBeforeLast( str, 'xyz', 'foo', str.length ); -* // returns 'Hello World!' -* -* @example -* var str = 'beep boop baz'; -* var out = replaceBeforeLast( str, 'p b', 'foo', str.length ); -* // returns 'foop baz' -* -* @example -* var str = 'beep boop baz'; -* var out = replaceBeforeLast( str, 'p b', 'foo', 6 ); -* // returns 'foop boop baz' -*/ -function replaceBeforeLast( str, search, replacement, fromIndex ) { - var idx; - if ( fromIndex < 0 ) { - fromIndex += str.length; - if ( fromIndex < 0 ) { - return str; - } - } - idx = str.lastIndexOf( search, fromIndex ); - if ( str === '' || search === '' || replacement === '' || idx < 0 ) { - return str; - } - return replacement + str.substring( idx ); -} - - -// EXPORTS // - -module.exports = replaceBeforeLast; diff --git a/base/replace-before-last/package.json b/base/replace-before-last/package.json deleted file mode 100644 index ed5cd1dd..00000000 --- a/base/replace-before-last/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/base/replace-before-last", - "version": "0.0.0", - "description": "Replace the substring before the last occurrence of a specified search string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "replace", - "search", - "substring", - "substr", - "before", - "last", - "match" - ] -} diff --git a/base/replace-before-last/test/test.js b/base/replace-before-last/test/test.js deleted file mode 100644 index 23857648..00000000 --- a/base/replace-before-last/test/test.js +++ /dev/null @@ -1,143 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 replaceBeforeLast = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof replaceBeforeLast, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function replaces the substring before the last occurrence of a specified search string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = replaceBeforeLast( str, ' ', 'foo', str.length ); - expected = 'foo boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = replaceBeforeLast( str, 'p', 'foo', str.length ); - expected = 'foop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'Hello, World!'; - actual = replaceBeforeLast( str, 'o', 'foo', str.length ); - expected = 'fooorld!'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function replaces the substring before the last occurrence of a specified search string (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep 😀 boop 😀 baz'; - actual = replaceBeforeLast( str, '😀', 'foo', str.length ); - expected = 'foo😀 baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🤖 Robot army 🤖!'; - actual = replaceBeforeLast( str, '🤖', 'foo', str.length ); - expected = 'foo🤖!'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🐺 Wolf brothers 🐺'; - actual = replaceBeforeLast( str, 'o', 'foo', str.length ); - expected = 'fooothers 🐺'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function replaces the substring before a provided search string (custom start index)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop baz'; - actual = replaceBeforeLast( str, ' ', 'foo', 9 ); - expected = 'foo baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceBeforeLast( str, 'p', 'foo', 6 ); - expected = 'foop boop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceBeforeLast( str, 'beep', 'foo', -2 ); - expected = 'foobeep boop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceBeforeLast( str, 'beep', 'foo', -20 ); - expected = 'beep boop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceBeforeLast( str, 'beep', 'foo', 20 ); - expected = 'foobeep boop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is not found', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = replaceBeforeLast( str, 'z', 'foo', str.length ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = replaceBeforeLast( str, 'baz', 'foo', str.length ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is the empty string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = replaceBeforeLast( str, '', 'foo', str.length ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/base/replace-before/README.md b/base/replace-before/README.md deleted file mode 100644 index 4eb898d3..00000000 --- a/base/replace-before/README.md +++ /dev/null @@ -1,155 +0,0 @@ - - -# replaceBefore - -> Replace the substring before the first occurrence of a specified search string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var replaceBefore = require( '@stdlib/string/base/replace-before' ); -``` - -#### replaceBefore( str, search, replacement, fromIndex ) - -Replaces the substring before the first occurrence of a specified search string. - -```javascript -var out = replaceBefore( 'beep boop', ' ', 'loop', 0 ); -// returns 'loop boop' - -out = replaceBefore( 'beep boop', 'o', 'bar', 0 ); -// returns 'baroop' -``` - -To begin searching from a specific index, provide a corresponding `fromIndex` argument. - -```javascript -var out = replaceBefore( 'beep boop', 'p', 'bar', 5 ); -// returns 'barp' -``` - -If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. - -```javascript -var out = replaceBefore( 'beep boop beep', ' ', 'loop', -6 ); -// returns 'loop beep' -``` - -
- - - - - -
- -## Notes - -- If a search string is not present in a provided string, the function returns the provided string unchanged. -- If a search string is an empty string, the function returns the provided string unchanged. -- If `fromIndex` resolves to an index which is greater than or equal to `str.length`, the function returns the provided string unchanged. - -
- - - - - -
- -## Examples - - - -```javascript -var replaceBefore = require( '@stdlib/string/base/replace-before' ); - -var out = replaceBefore( 'beep boop', 'p', 'see', 0 ); -// returns 'seep boop' - -out = replaceBefore( 'Hello World!', 'xyz', 'foo', 0 ); -// returns 'Hello World!' - -out = replaceBefore( 'Hello World!', '', 'foo', 0 ); -// returns 'Hello World!' - -out = replaceBefore( '', 'xyz', 'foo', 0 ); -// returns '' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/replace-before/benchmark/benchmark.js b/base/replace-before/benchmark/benchmark.js deleted file mode 100644 index a9c9e1dc..00000000 --- a/base/replace-before/benchmark/benchmark.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var replaceBefore = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'foo', - 'bar', - 'beep', - 'boop' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = replaceBefore( str, '.', values[ i%values.length ], 0 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/replace-before/docs/repl.txt b/base/replace-before/docs/repl.txt deleted file mode 100644 index f6398c74..00000000 --- a/base/replace-before/docs/repl.txt +++ /dev/null @@ -1,39 +0,0 @@ - -{{alias}}( str, search, replacement, fromIndex ) - Replaces the substring before the first occurrence of a specified search - string. - - If unable to find a search string, the function returns the input string - unchanged. - - Parameters - ---------- - str: string - Input string. - - search: string - Search string. - - replacement: string - Replacement string. - - fromIndex: integer - Starting index (inclusive). If less than zero, the starting index is - resolved relative to the last string character, with the last string - character corresponding to `fromIndex = -1`. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep boop', ' ', 'foo', 0 ) - 'foo boop' - > out = {{alias}}( 'beep boop', 'o', 'foo', 0 ) - 'foooop' - - See Also - -------- - diff --git a/base/replace-before/docs/types/index.d.ts b/base/replace-before/docs/types/index.d.ts deleted file mode 100644 index 6e1ce62a..00000000 --- a/base/replace-before/docs/types/index.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Replaces the substring before the first occurrence of a specified search string. -* -* ## Notes -* -* - If unable to find search string, the function returns the input string unchanged. -* - If `fromIndex` is less than zero, the starting index is resolved relative to the last string character, with the last string character corresponding to `fromIndex = -1`. -* -* @param str - input string -* @param search - search string -* @param replacement - replacement string -* @param fromIndex - index at which to start the search -* @returns output string -* -* @example -* var out = replaceBefore( 'beep boop', ' ', 'foo', 0 ); -* // returns 'foo boop' -* -* @example -* var out = replaceBefore( 'beep boop', 'p', 'foo', 5 ); -* // returns 'foop' -* -* @example -* var out = replaceBefore( 'Hello World!', '', 'foo', 0 ); -* // returns 'Hello World!' -* -* @example -* var out = replaceBefore( 'Hello World!', 'xyz', 'foo', 0 ); -* // returns 'Hello World!' -*/ -declare function replaceBefore( str: string, search: string, replacement: string, fromIndex: number ): string; - - -// EXPORTS // - -export = replaceBefore; diff --git a/base/replace-before/docs/types/test.ts b/base/replace-before/docs/types/test.ts deleted file mode 100644 index e47a4626..00000000 --- a/base/replace-before/docs/types/test.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import replaceBefore = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - replaceBefore( 'beep boop', ' ', 'foo', 0 ); // $ExpectType string - replaceBefore( 'beep boop', 'xyz', 'foo', 0 ); // $ExpectType string - replaceBefore( 'beep boop', '', 'foo', 0 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - replaceBefore( true, 'd', 'foo', 0 ); // $ExpectError - replaceBefore( false, 'd' , 'foo', 0 ); // $ExpectError - replaceBefore( 3, 'd' , 'foo', 0 ); // $ExpectError - replaceBefore( [], 'd' , 'foo', 0 ); // $ExpectError - replaceBefore( {}, 'd' , 'foo', 0 ); // $ExpectError - replaceBefore( ( x: number ): number => x, 'd', 'foo', 0 ); // $ExpectError - - replaceBefore( 'abc', true, 'foo', 0 ); // $ExpectError - replaceBefore( 'abc', false, 'foo', 0 ); // $ExpectError - replaceBefore( 'abc', 5 , 'foo', 0 ); // $ExpectError - replaceBefore( 'abc', [], 'foo', 0 ); // $ExpectError - replaceBefore( 'abc', {} , 'foo', 0 ); // $ExpectError - replaceBefore( 'abc', ( x: number ): number => x , 'foo', 0 ); // $ExpectError - - replaceBefore( 'abc', 'd', true, 0 ); // $ExpectError - replaceBefore( 'abc', 'd', false, 0 ); // $ExpectError - replaceBefore( 'abc', 'd', 5, 0 ); // $ExpectError - replaceBefore( 'abc', 'd', [], 0 ); // $ExpectError - replaceBefore( 'abc', 'd', {}, 0 ); // $ExpectError - replaceBefore( 'abc', 'd', ( x: number ): number => x, 0 ); // $ExpectError - - replaceBefore( 'abc', 'd', 'foo', true ); // $ExpectError - replaceBefore( 'abc', 'd', 'foo', false ); // $ExpectError - replaceBefore( 'abc', 'd', 'foo', '5' ); // $ExpectError - replaceBefore( 'abc', 'd', 'foo', [] ); // $ExpectError - replaceBefore( 'abc', 'd', 'foo', {} ); // $ExpectError - replaceBefore( 'abc', 'd', 'foo', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - replaceBefore(); // $ExpectError - replaceBefore( 'abc' ); // $ExpectError - replaceBefore( 'abc', 'd' ); // $ExpectError - replaceBefore( 'abc', 'd', 'foo', 1, 1 ); // $ExpectError -} diff --git a/base/replace-before/examples/index.js b/base/replace-before/examples/index.js deleted file mode 100644 index 1faab496..00000000 --- a/base/replace-before/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 replaceBefore = require( './../lib' ); - -var out = replaceBefore( 'beep boop', 'p', 'see', 0 ); -console.log( out ); -// => 'seep boop' - -out = replaceBefore( 'Hello World!', 'xyz', 'foo', 0 ); -console.log( out ); -// => 'Hello World!' - -out = replaceBefore( 'Hello World!', '', 'foo', 0 ); -console.log( out ); -// => 'Hello World!' - -out = replaceBefore( '', 'xyz', 'foo', 0 ); -console.log( out ); -// => '' diff --git a/base/replace-before/lib/index.js b/base/replace-before/lib/index.js deleted file mode 100644 index 5578417f..00000000 --- a/base/replace-before/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Replace the substring before the first occurrence of a specified search string. -* -* @module @stdlib/string/base/replace-before -* -* @example -* var replaceBefore = require( '@stdlib/string/base/replace-before' ); -* -* var out = replaceBefore( 'beep boop', ' ', 'foo', 0 ); -* // returns 'foo boop' -* -* out = replaceBefore( 'beep boop', 'o', 'bar', 0 ); -* // returns 'baroop' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/replace-before/lib/main.js b/base/replace-before/lib/main.js deleted file mode 100644 index 1eb1e440..00000000 --- a/base/replace-before/lib/main.js +++ /dev/null @@ -1,65 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Replaces the substring before the first occurrence of a specified search string. -* -* @param {string} str - input string -* @param {string} search - search string -* @param {string} replacement - replacement string -* @param {integer} fromIndex - index at which to start the search -* @returns {string} string -* -* @example -* var out = replaceBefore( 'beep boop', ' ', 'foo', 0 ); -* // returns 'foo boop' -* -* @example -* var out = replaceBefore( 'beep boop', 'p', 'foo', 5 ); -* // returns 'foop' -* -* @example -* var out = replaceBefore( 'Hello World!', '', 'foo', 0 ); -* // returns 'Hello World!' -* -* @example -* var out = replaceBefore( 'Hello World!', 'xyz', 'foo', 0 ); -* // returns 'Hello World!' -*/ -function replaceBefore( str, search, replacement, fromIndex ) { - var idx; - if ( fromIndex < 0 ) { - fromIndex += str.length; - } else if ( fromIndex >= str.length ) { - return str; - } - idx = str.indexOf( search, fromIndex ); - if ( str === '' || search === '' || replacement === '' || idx < 0 ) { - return str; - } - return replacement + str.substring( idx ); -} - - -// EXPORTS // - -module.exports = replaceBefore; diff --git a/base/replace-before/package.json b/base/replace-before/package.json deleted file mode 100644 index 0cf99097..00000000 --- a/base/replace-before/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/replace-before", - "version": "0.0.0", - "description": "Replace the substring before the first occurrence of a specified search string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "replace", - "search", - "substring", - "substr", - "before", - "match" - ] -} diff --git a/base/replace-before/test/test.js b/base/replace-before/test/test.js deleted file mode 100644 index 6e2205de..00000000 --- a/base/replace-before/test/test.js +++ /dev/null @@ -1,135 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 replaceBefore = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof replaceBefore, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function replaces the substring before the first occurrence of a specified search string', function test( t ) { - var expected; - var actual; - - actual = replaceBefore( 'beep boop', ' ', 'foo', 0 ); - expected = 'foo boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceBefore( 'beep boop', 'p', 'foo', 0 ); - expected = 'foop boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceBefore( 'Hello, World!', 'o', 'foo', 0 ); - expected = 'fooo, World!'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function replaces the substring before the first occurrence of a specified search string (Unicode characters)', function test( t ) { - var expected; - var actual; - - actual = replaceBefore( 'beep 😀 boop 😀 baz', '😀', 'foo', 0 ); - expected = 'foo😀 boop 😀 baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceBefore( '🤖 Robot army 🤖!', '🤖', 'foo', 0 ); - expected = 'foo🤖 Robot army 🤖!'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceBefore( '🐺 Wolf brothers 🐺', 'o', 'foo', 0 ); - expected = 'fooolf brothers 🐺'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function replaces the substring before a provided search string (custom start index)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop baz'; - actual = replaceBefore( str, ' ', 'foo', 6 ); - expected = 'foo baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceBefore( str, 'p', 'foo', 6 ); - expected = 'foop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceBefore( str, 'beep', 'foo', -2 ); - expected = 'beep boop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceBefore( str, 'baz', 'foo', -5 ); - expected = 'foobaz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceBefore( str, 'beep', 'foo', 20 ); - expected = 'beep boop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = replaceBefore( str, 'beep', 'foo', -200 ); - expected = 'foobeep boop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is not found', function test( t ) { - var expected; - var actual; - - actual = replaceBefore( 'beep boop', 'z', 'foo', 0 ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceBefore( 'beep boop', 'baz', 'foo', 0 ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is the empty string', function test( t ) { - var expected; - var actual; - - actual = replaceBefore( 'beep boop', '', 'foo', 0 ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/base/replace/README.md b/base/replace/README.md deleted file mode 100644 index 40ce6e0d..00000000 --- a/base/replace/README.md +++ /dev/null @@ -1,131 +0,0 @@ - - -# replace - -> Replace search occurrences with a replacement string. - -
- -## Usage - -```javascript -var replace = require( '@stdlib/string/base/replace' ); -``` - -#### replace( str, search, newval ) - -Replaces search occurrences with a replacement string. - -```javascript -var out = replace( 'beep', /e/g, 'o' ); -// returns 'boop' -``` - -If provided a function as the third argument, the function is invoked for each match, and the function's return value is used as the replacement string. - -```javascript -function replacer( match, p1 ) { - return '/' + p1 + '/'; -} -var str = 'Oranges and lemons'; -var out = replace( str, /([^\s]+)/gi, replacer ); -// returns '/Oranges/ /and/ /lemons/' -``` - -
- - - -
- -## Notes - -- The function assumes that the `search` argument is a [regular expression][mdn-regexp]. Accordingly, the function should **not** be used as a general drop-in replacement for [`String.prototype.replace`][mdn-string-replace]. - -
- - - -
- -## Examples - - - -```javascript -var capitalize = require( '@stdlib/string/base/capitalize' ); -var replace = require( '@stdlib/string/base/replace' ); - -var out = replace( 'Hello World', /world/i, 'Mr. President' ); -// returns 'Hello Mr. President' - -function replacer( match, p1 ) { - return capitalize( p1 ); -} -var str = 'Oranges and lemons say the bells of St. Clement\'s'; -out = replace( str, /([^\s]*)/gi, replacer ); -// returns 'Oranges And Lemons Say The Bells Of St. Clement\'s' -``` - -
- - - - - - - - - - - - - - diff --git a/base/replace/benchmark/benchmark.js b/base/replace/benchmark/benchmark.js deleted file mode 100644 index 32d85477..00000000 --- a/base/replace/benchmark/benchmark.js +++ /dev/null @@ -1,142 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var replace = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::regexp', pkg ), function benchmark( b ) { - var values; - var out; - var str; - var re; - var i; - - values = [ - 'abc', - 'def', - 'hig' - ]; - str = 'To be, or not to be, that is the question.'; - re = /be/g; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = replace( str, re, values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::replacer', pkg ), function benchmark( b ) { - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = replace( str, 'be', replacer ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function replacer( match, p1 ) { - return '/' + p1 + '/'; - } -}); - -bench( format( '%s::builtin,regexp', pkg ), function benchmark( b ) { - var values; - var out; - var str; - var re; - var i; - - values = [ - 'abc', - 'def', - 'hig' - ]; - str = 'To be, or not to be, that is the question.'; - re = /be/g; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = str.replace( re, values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::builtin,replacer', pkg ), function benchmark( b ) { - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = str.replace( 'be', replacer ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function replacer( match, p1 ) { - return '/' + p1 + '/'; - } -}); diff --git a/base/replace/docs/repl.txt b/base/replace/docs/repl.txt deleted file mode 100644 index c22ac40d..00000000 --- a/base/replace/docs/repl.txt +++ /dev/null @@ -1,34 +0,0 @@ - -{{alias}}( str, search, newval ) - Replaces search occurrences with a replacement string. - - Parameters - ---------- - str: string - Input string. - - search: RegExp - Search expression. - - newval: string|Function - Replacement value or function. - - Returns - ------- - out: string - String containing replacement(s). - - Examples - -------- - > function replacer( match, p1 ) { return '/'+p1+'/'; }; - > var str = 'Oranges and lemons'; - > var out = {{alias}}( str, /([^\s]+)/gi, replacer ) - '/Oranges/ /and/ /lemons/' - - // Replace only first match: - > out = {{alias}}( 'beep', /e/, 'o' ) - 'boep' - - See Also - -------- - diff --git a/base/replace/docs/types/index.d.ts b/base/replace/docs/types/index.d.ts deleted file mode 100644 index 07c6d18c..00000000 --- a/base/replace/docs/types/index.d.ts +++ /dev/null @@ -1,51 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Replaces search occurrences with a replacement string. -* -* @param str - input string -* @param search - search expression -* @param newval - replacement value or function -* @returns new string containing replacement(s) -* -* @example -* var str = 'Hello World'; -* var out = replace( str, /world/i, 'Mr. President' ); -* // returns 'Hello Mr. President' -* -* @example -* var capitalize = require( '@stdlib/string/base/capitalize' ); -* -* var str = 'Oranges and lemons say the bells of St. Clement\'s'; -* -* function replacer( match, p1 ) { -* return capitalize( p1 ); -* } -* -* var out = replace( str, /([^\s]*)/gi, replacer ); -* // returns 'Oranges And Lemons Say The Bells Of St. Clement\'s' -*/ -declare function replace( str: string, search: RegExp, newval: string | Function ): string; - - -// EXPORTS // - -export = replace; diff --git a/base/replace/docs/types/test.ts b/base/replace/docs/types/test.ts deleted file mode 100644 index ff337767..00000000 --- a/base/replace/docs/types/test.ts +++ /dev/null @@ -1,60 +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. -*/ - -import replace = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - replace( 'abd', /[a-z]/, '1' ); // $ExpectType string - replace( 'abd', /[a-z]/, (): string => 'z' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - replace( true, /[a-z]/, 'a' ); // $ExpectError - replace( false, /[a-z]/, 'a' ); // $ExpectError - replace( 3, /[a-z]/, 'a' ); // $ExpectError - replace( [], /[a-z]/, 'a' ); // $ExpectError - replace( {}, /[a-z]/, 'a' ); // $ExpectError - replace( ( x: number ): number => x, /[a-z]/, 'a' ); // $ExpectError - - replace( 'abd', '', 'c' ); // $ExpectError - replace( 'abd', true, 'c' ); // $ExpectError - replace( 'abd', false, 'c' ); // $ExpectError - replace( 'abd', 5, 'c' ); // $ExpectError - replace( 'abd', [], 'c' ); // $ExpectError - replace( 'abd', {}, 'c' ); // $ExpectError - replace( 'abd', ( x: number ): number => x, 'c' ); // $ExpectError - - replace( 'abd', /[a-z]/, true ); // $ExpectError - replace( 'abd', /[a-z]/, false ); // $ExpectError - replace( 'abd', /[a-z]/, 5 ); // $ExpectError - replace( 'abd', /[a-z]/, [] ); // $ExpectError - replace( 'abd', /[a-z]/, {} ); // $ExpectError - replace( 'abd', /[a-z]/, /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - replace(); // $ExpectError - replace( 'abc' ); // $ExpectError - replace( 'abc', /[a-z]/ ); // $ExpectError -} diff --git a/base/replace/examples/index.js b/base/replace/examples/index.js deleted file mode 100644 index 4fbe9851..00000000 --- a/base/replace/examples/index.js +++ /dev/null @@ -1,34 +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. -*/ - -'use strict'; - -var capitalize = require( './../../../base/capitalize' ); -var replace = require( './../lib' ); - -var out = replace( 'Hello World', /world/i, 'Mr. President' ); -console.log( out ); -// => 'Hello Mr. President' - -function replacer( match, p1 ) { - return capitalize( p1 ); -} -var str = 'Oranges and lemons say the bells of St. Clement\'s'; -out = replace( str, /([^\s]*)/gi, replacer ); -console.log( out ); -// => 'Oranges And Lemons Say The Bells Of St. Clement\'s' diff --git a/base/replace/lib/index.js b/base/replace/lib/index.js deleted file mode 100644 index 907e6d96..00000000 --- a/base/replace/lib/index.js +++ /dev/null @@ -1,41 +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. -*/ - -'use strict'; - -/** -* Replace search occurrences with a replacement string. -* -* @module @stdlib/string/base/replace -* -* @example -* var replace = require( '@stdlib/string/base/replace' ); -* -* var str = 'Hello World'; -* var out = replace( str, /world/i, 'Mr. President' ); -* // returns 'Hello Mr. President' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/replace/lib/main.js b/base/replace/lib/main.js deleted file mode 100644 index 7b65550f..00000000 --- a/base/replace/lib/main.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MAIN // - -/** -* Replaces search occurrences with a replacement string. -* -* @param {string} str - input string -* @param {RegExp} search - search expression -* @param {(string|Function)} newval - replacement value or function -* @returns {string} new string containing replacement(s) -* -* @example -* var str = 'Hello World'; -* var out = replace( str, /world/i, 'Mr. President' ); -* // returns 'Hello Mr. President' -* -* @example -* var capitalize = require( '@stdlib/string/base/capitalize' ); -* -* var str = 'Oranges and lemons say the bells of St. Clement\'s'; -* -* function replacer( match, p1 ) { -* return capitalize( p1 ); -* } -* -* var out = replace( str, /([^\s]*)/gi, replacer ); -* // returns 'Oranges And Lemons Say The Bells Of St. Clement\'s' -*/ -function replace( str, search, newval ) { - return str.replace( search, newval ); -} - - -// EXPORTS // - -module.exports = replace; diff --git a/base/replace/package.json b/base/replace/package.json deleted file mode 100644 index bac15365..00000000 --- a/base/replace/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/base/replace", - "version": "0.0.0", - "description": "Replace search occurrences with a replacement string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "search", - "replace", - "regex", - "regular expression", - "regexp", - "regular", - "expression" - ] -} diff --git a/base/replace/test/test.js b/base/replace/test/test.js deleted file mode 100644 index 55a27797..00000000 --- a/base/replace/test/test.js +++ /dev/null @@ -1,66 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var replace = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof replace, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function replaces matches of a regular expression', function test( t ) { - var expected; - var out; - - out = replace( 'aBcDeFgHiJkLmNoPqRsTuVwXYZ', /[A-Z]+/, '' ); - expected = 'acDeFgHiJkLmNoPqRsTuVwXYZ'; - t.strictEqual( out, expected, 'replaces letters matching the regular expression (first occurrence)' ); - - out = replace( 'aBcDeFgHiJkLmNoPqRsTuVwXYZ', /[A-Z]+/g, '' ); - expected = 'acegikmoqsuw'; - t.strictEqual( out, expected, 'replaces letters matching the regular expression (global)' ); - - t.end(); -}); - -tape( 'the function replaces matches with values returned by a replacer function', function test( t ) { - var expected; - var out; - var str; - - str = 'Oranges and lemons say the bells of St. Clement\'s'; - out = replace( str, /([^\s]+)/gi, replacer ); - - expected = '/Oranges/ /and/ /lemons/ /say/ /the/ /bells/ /of/ /St./ /Clement\'s/'; - t.strictEqual( out, expected, 'replaces matches using replacer function' ); - - t.end(); - - function replacer( match, p1 ) { - return '/' + p1 + '/'; - } -}); diff --git a/base/reverse-code-points/README.md b/base/reverse-code-points/README.md deleted file mode 100644 index cd7602d5..00000000 --- a/base/reverse-code-points/README.md +++ /dev/null @@ -1,107 +0,0 @@ - - -# reverseCodePoints - -> Reverse the Unicode code points of a string. - -
- -## Usage - -```javascript -var reverseCodePoints = require( '@stdlib/string/base/reverse-code-points' ); -``` - -#### reverseCodePoints( str ) - -Reverses the Unicode code points of a string. - -```javascript -var out = reverseCodePoints( 'last man standing' ); -// returns 'gnidnats nam tsal' - -out = reverseCodePoints( 'Hidden Treasures' ); -// returns 'serusaerT neddiH' - -out = reverseCodePoints( 'foo bar' ); -// returns 'rab oof' -``` - -
- - - -
- -## Examples - - - -```javascript -var reverseCodePoints = require( '@stdlib/string/base/reverse-code-points' ); - -var str = reverseCodePoints( 'presidential election' ); -// returns 'noitcele laitnediserp' - -str = reverseCodePoints( 'JavaScript' ); -// returns 'tpircSavaJ' - -str = reverseCodePoints( 'The Last of the Mohicans' ); -// returns 'snacihoM eht fo tsaL ehT' - -str = reverseCodePoints( 'अनुच्छेद' ); -// returns 'देछ्चुनअ' -``` - -
- - - - - - - - - - - - - - diff --git a/base/reverse-code-points/benchmark/benchmark.js b/base/reverse-code-points/benchmark/benchmark.js deleted file mode 100644 index 052ff1d5..00000000 --- a/base/reverse-code-points/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var reverse = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = reverse( values[ i%values.length ], 1 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/reverse-code-points/docs/repl.txt b/base/reverse-code-points/docs/repl.txt deleted file mode 100644 index afb19a2d..00000000 --- a/base/reverse-code-points/docs/repl.txt +++ /dev/null @@ -1,26 +0,0 @@ - -{{alias}}( str ) - Reverses the Unicode code points of a string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep' ) - 'peeb' - > out = {{alias}}( 'Boop' ) - 'pooB' - > out = {{alias}}( 'foo bar' ) - 'rab oof' - - See Also - -------- - diff --git a/base/reverse-code-points/docs/types/index.d.ts b/base/reverse-code-points/docs/types/index.d.ts deleted file mode 100644 index 89449751..00000000 --- a/base/reverse-code-points/docs/types/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Reverses the Unicode code points of a string. -* -* @param str - input string -* @returns output string -* -* @example -* var out = reverse( 'last man standing' ); -* // returns 'gnidnats nam tsal' -* -* @example -* var out = reverse( 'presidential election' ); -* // returns 'noitcele laitnediserp' -* -* @example -* var out = reverse( 'JavaScript' ); -* // returns 'tpircSavaJ' -* -* @example -* var out = reverse( 'Hidden Treasures' ); -* // returns 'serusaerT neddiH' -* -* @example -* var out = reverse( 'foo bar' ); -* // returns 'rab oof' -*/ -declare function reverse( str: string ): string; - - -// EXPORTS // - -export = reverse; diff --git a/base/reverse-code-points/docs/types/test.ts b/base/reverse-code-points/docs/types/test.ts deleted file mode 100644 index 116ee34c..00000000 --- a/base/reverse-code-points/docs/types/test.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import reverse = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - reverse( 'abc' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - reverse( true ); // $ExpectError - reverse( false ); // $ExpectError - reverse( null ); // $ExpectError - reverse( undefined ); // $ExpectError - reverse( 5 ); // $ExpectError - reverse( [] ); // $ExpectError - reverse( {} ); // $ExpectError - reverse( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - reverse(); // $ExpectError - reverse( 'abc', 1 ); // $ExpectError - reverse( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/reverse-code-points/examples/index.js b/base/reverse-code-points/examples/index.js deleted file mode 100644 index b56a85dd..00000000 --- a/base/reverse-code-points/examples/index.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'; - -var reverse = require( './../lib' ); - -console.log( reverse( 'presidential election' ) ); -// => 'noitcele laitnediserp' - -console.log( reverse( 'JavaScript' ) ); -// => 'tpircSavaJ' - -console.log( reverse( 'The Last of the Mohicans' ) ); -// => 'snacihoM eht fo tsaL ehT' - -console.log( reverse( 'अनुच्छेद' ) ); -// => 'देछ्चुनअ' diff --git a/base/reverse-code-points/lib/index.js b/base/reverse-code-points/lib/index.js deleted file mode 100644 index ac59f2e6..00000000 --- a/base/reverse-code-points/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Reverse the Unicode code points of a string. -* -* @module @stdlib/string/base/reverse-code-points -* -* @example -* var reverse = require( '@stdlib/string/base/reverse-code-points' ); -* -* var out = reverse( 'last man standing' ); -* // returns 'gnidnats nam tsal' -* -* out = reverse( 'Hidden Treasures' ); -* // returns 'serusaerT neddiH' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/reverse-code-points/lib/main.js b/base/reverse-code-points/lib/main.js deleted file mode 100644 index 5f6360b0..00000000 --- a/base/reverse-code-points/lib/main.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// VARIABLES // - -var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/; // TODO: replace with stdlib pkg -var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/; // TODO: replace with stdlib pkg - - -// MAIN // - -/** -* Reverses the Unicode code points of a string. -* -* @param {string} str - input string -* @returns {string} output string -* -* @example -* var out = reverse( 'last man standing' ); -* // returns 'gnidnats nam tsal' -* -* @example -* var out = reverse( 'presidential election' ); -* // returns 'noitcele laitnediserp' -* -* @example -* var out = reverse( 'JavaScript' ); -* // returns 'tpircSavaJ' -* -* @example -* var out = reverse( 'Hidden Treasures' ); -* // returns 'serusaerT neddiH' -*/ -function reverse( str ) { - var len; - var out; - var ch1; - var ch2; - var i; - - len = str.length; - out = ''; - - // Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point... - for ( i = 0; i < len; i++ ) { - ch1 = str[ i ]; - - // Check for a high UTF-16 surrogate... - if ( RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) { - // Check for an unpaired surrogate at the end of the input string... - if ( i === len-1 ) { - // We found an unpaired surrogate... - out = ch1 + out; - break; - } - // Check whether the high surrogate is paired with a low surrogate... - ch2 = str[ i+1 ]; - if ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) { - // We found a surrogate pair: - out = ch1 + ch2 + out; - i += 1; // bump the index to process the next code unit - } else { - out = ch1 + out; - } - } else { - out = ch1 + out; - } - } - return out; -} - - -// EXPORTS // - -module.exports = reverse; diff --git a/base/reverse-code-points/package.json b/base/reverse-code-points/package.json deleted file mode 100644 index 4a59877e..00000000 --- a/base/reverse-code-points/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/reverse-code-points", - "version": "0.0.0", - "description": "Reverse the Unicode code points of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "reverse", - "character", - "char", - "codepoint", - "unicode" - ] -} diff --git a/base/reverse-code-points/test/test.js b/base/reverse-code-points/test/test.js deleted file mode 100644 index 7f7866d1..00000000 --- a/base/reverse-code-points/test/test.js +++ /dev/null @@ -1,80 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 reverse = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof reverse, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( reverse( '' ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function reverses the Unicode code points of a provided string (ascii)', function test( t ) { - var out; - - out = reverse( 'hello world' ); - t.strictEqual( out, 'dlrow olleh', 'returns expected value' ); - - out = reverse( '!!!*' ); - t.strictEqual( out, '*!!!', 'returns expected value' ); - - out = reverse( 'Hello World' ); - t.strictEqual( out, 'dlroW olleH', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function reverses the Unicode code points of a provided string (Unicode)', function test( t ) { - var out; - - out = reverse( 'अनुच्छेद' ); - t.strictEqual( out, 'देछ्चुनअ', 'returns expected value' ); - - out = reverse( '六书/六書' ); - t.strictEqual( out, '書六/书六', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function reverses the Unicode code points of a provided string (surrogate pair)', function test( t ) { - var out; - - out = reverse( 'foo\uD834\uDF06bar' ); - t.strictEqual( out, 'rab\uD834\uDF06oof', 'returns expected value' ); - - out = reverse( 'foo\uD834bar\uDF06baz' ); - t.strictEqual( out, 'zab\uDF06rab\uD834oof', 'returns expected value' ); - - out = reverse( 'foo\uD834bar\uDF06\uD834' ); - t.strictEqual( out, '\uD834\uDF06rab\uD834oof', 'returns expected value' ); - - t.end(); -}); diff --git a/base/reverse-grapheme-clusters/README.md b/base/reverse-grapheme-clusters/README.md deleted file mode 100644 index e9452ac9..00000000 --- a/base/reverse-grapheme-clusters/README.md +++ /dev/null @@ -1,107 +0,0 @@ - - -# reverseGraphemeClusters - -> Reverse the grapheme clusters (i.e., user-perceived characters) of a string. - -
- -## Usage - -```javascript -var reverseGraphemeClusters = require( '@stdlib/string/base/reverse-grapheme-clusters' ); -``` - -#### reverseGraphemeClusters( str ) - -Reverses the grapheme clusters (i.e., user-perceived characters) of a string. - -```javascript -var out = reverseGraphemeClusters( 'last man standing' ); -// returns 'gnidnats nam tsal' - -out = reverseGraphemeClusters( 'Hidden Treasures' ); -// returns 'serusaerT neddiH' - -out = reverseGraphemeClusters( 'foo bar' ); -// returns 'rab oof' -``` - -
- - - -
- -## Examples - - - -```javascript -var reverseGraphemeClusters = require( '@stdlib/string/base/reverse-grapheme-clusters' ); - -var str = reverseGraphemeClusters( 'presidential election' ); -// returns 'noitcele laitnediserp' - -str = reverseGraphemeClusters( 'JavaScript' ); -// returns 'tpircSavaJ' - -str = reverseGraphemeClusters( 'The Last of the Mohicans' ); -// returns 'snacihoM eht fo tsaL ehT' - -str = reverseGraphemeClusters( '🐶🐮🐷🐰🐸' ); -// returns '🐸🐰🐷🐮🐶' -``` - -
- - - - - - - - - - - - - - diff --git a/base/reverse-grapheme-clusters/benchmark/benchmark.js b/base/reverse-grapheme-clusters/benchmark/benchmark.js deleted file mode 100644 index 8f45bcfe..00000000 --- a/base/reverse-grapheme-clusters/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var reverse = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = reverse( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/reverse-grapheme-clusters/docs/repl.txt b/base/reverse-grapheme-clusters/docs/repl.txt deleted file mode 100644 index 960ed717..00000000 --- a/base/reverse-grapheme-clusters/docs/repl.txt +++ /dev/null @@ -1,27 +0,0 @@ - -{{alias}}( str ) - Reverses the grapheme clusters (i.e., user-perceived characters) of a - string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep' ) - 'peeb' - > out = {{alias}}( 'Boop' ) - 'pooB' - > out = {{alias}}( 'foo bar' ) - 'rab oof' - - See Also - -------- - diff --git a/base/reverse-grapheme-clusters/docs/types/index.d.ts b/base/reverse-grapheme-clusters/docs/types/index.d.ts deleted file mode 100644 index f3229746..00000000 --- a/base/reverse-grapheme-clusters/docs/types/index.d.ts +++ /dev/null @@ -1,56 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Reverses the grapheme clusters (i.e., user-perceived characters) of a string. -* -* @param str - input string -* @returns output string -* -* @example -* var out = reverse( 'last man standing' ); -* // returns 'gnidnats nam tsal' -* -* @example -* var out = reverse( 'presidential election' ); -* // returns 'noitcele laitnediserp' -* -* @example -* var out = reverse( 'JavaScript' ); -* // returns 'tpircSavaJ' -* -* @example -* var out = reverse( 'Hidden Treasures' ); -* // returns 'serusaerT neddiH' -* -* @example -* var out = reverse( '🐶🐮🐷🐰🐸' ); -* // returns '🐸🐰🐷🐮🐶' -* -* @example -* var out = reverse( 'foo bar' ); -* // returns 'rab oof' -*/ -declare function reverse( str: string ): string; - - -// EXPORTS // - -export = reverse; diff --git a/base/reverse-grapheme-clusters/docs/types/test.ts b/base/reverse-grapheme-clusters/docs/types/test.ts deleted file mode 100644 index f6d42b97..00000000 --- a/base/reverse-grapheme-clusters/docs/types/test.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import reverse = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - reverse( 'abc' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - reverse( true ); // $ExpectError - reverse( false ); // $ExpectError - reverse( null ); // $ExpectError - reverse( undefined ); // $ExpectError - reverse( 5 ); // $ExpectError - reverse( [] ); // $ExpectError - reverse( {} ); // $ExpectError - reverse( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - reverse(); // $ExpectError - reverse( 'abc', 2 ); // $ExpectError - reverse( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/reverse-grapheme-clusters/examples/index.js b/base/reverse-grapheme-clusters/examples/index.js deleted file mode 100644 index 2f92c987..00000000 --- a/base/reverse-grapheme-clusters/examples/index.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'; - -var reverseGraphemeClusters = require( './../lib' ); - -console.log( reverseGraphemeClusters( 'presidential election' ) ); -// => 'noitcele laitnediserp' - -console.log( reverseGraphemeClusters( 'JavaScript' ) ); -// => 'tpircSavaJ' - -console.log( reverseGraphemeClusters( 'The Last of the Mohicans' ) ); -// => 'snacihoM eht fo tsaL ehT' - -console.log( reverseGraphemeClusters( '🐶🐮🐷🐰🐸' ) ); -// => '🐸🐰🐷🐮🐶' diff --git a/base/reverse-grapheme-clusters/lib/index.js b/base/reverse-grapheme-clusters/lib/index.js deleted file mode 100644 index 61489380..00000000 --- a/base/reverse-grapheme-clusters/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Reverse the grapheme clusters (i.e., user-perceived characters) of a string. -* -* @module @stdlib/string/base/reverse-grapheme-clusters -* -* @example -* var reverse = require( '@stdlib/string/base/reverse-grapheme-clusters' ); -* -* var out = reverse( 'last man standing' ); -* // returns 'gnidnats nam tsal' -* -* out = reverse( 'Hidden Treasures' ); -* // returns 'serusaerT neddiH' -* -* out = reverse( '🐶🐮🐷🐰🐸' ); -* // returns '🐸🐰🐷🐮🐶' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/reverse-grapheme-clusters/lib/main.js b/base/reverse-grapheme-clusters/lib/main.js deleted file mode 100644 index 5e19495d..00000000 --- a/base/reverse-grapheme-clusters/lib/main.js +++ /dev/null @@ -1,81 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var nextGraphemeClusterBreak = require( './../../../next-grapheme-cluster-break' ); - - -// MAIN // - -/** -* Reverses the grapheme clusters (i.e., user-perceived characters) of a string. -* -* @param {string} str - input string -* @returns {string} output string -* -* @example -* var out = reverse( 'last man standing' ); -* // returns 'gnidnats nam tsal' -* -* @example -* var out = reverse( 'presidential election' ); -* // returns 'noitcele laitnediserp' -* -* @example -* var out = reverse( 'JavaScript' ); -* // returns 'tpircSavaJ' -* -* @example -* var out = reverse( 'Hidden Treasures' ); -* // returns 'serusaerT neddiH' -* -* @example -* var out = reverse( '🐶🐮🐷🐰🐸' ); -* // returns '🐸🐰🐷🐮🐶' -*/ -function reverse( str ) { - var cluster; - var out; - var idx; - var brk; - var i; - - out = ''; - idx = 0; - while ( idx < str.length ) { - brk = nextGraphemeClusterBreak( str, idx ); - if ( brk === -1 ) { - brk = str.length; - } - cluster = ''; - for ( i = idx; i < brk; i++ ) { - cluster += str.charAt( i ); - } - out = cluster + out; - idx = brk; - } - return out; -} - - -// EXPORTS // - -module.exports = reverse; diff --git a/base/reverse-grapheme-clusters/package.json b/base/reverse-grapheme-clusters/package.json deleted file mode 100644 index dd9070a9..00000000 --- a/base/reverse-grapheme-clusters/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/reverse-grapheme-clusters", - "version": "0.0.0", - "description": "Reverse the grapheme clusters (i.e., user-perceived characters) of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "reverse", - "character", - "char", - "grapheme", - "cluster", - "unicode" - ] -} diff --git a/base/reverse-grapheme-clusters/test/test.js b/base/reverse-grapheme-clusters/test/test.js deleted file mode 100644 index 564d45a2..00000000 --- a/base/reverse-grapheme-clusters/test/test.js +++ /dev/null @@ -1,77 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 reverse = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof reverse, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( reverse( '' ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function reverses the grapheme clusters of a provided string (ascii)', function test( t ) { - var out; - - out = reverse( 'hello world' ); - t.strictEqual( out, 'dlrow olleh', 'returns expected value' ); - - out = reverse( '!!!*' ); - t.strictEqual( out, '*!!!', 'returns expected value' ); - - out = reverse( 'Hello World' ); - t.strictEqual( out, 'dlroW olleH', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function reverses the grapheme clusters of a provided string (Unicode)', function test( t ) { - var out; - - out = reverse( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'दछेच्नुअ', 'returns expected value' ); - - out = reverse( '六书/六書', 1 ); - t.strictEqual( out, '書六/书六', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function reverses the grapheme clusters of a provided string (emoji)', function test( t ) { - var out; - - out = reverse( '🌷', 1 ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - out = reverse( '🏝️🌷', 1 ); - t.strictEqual( out, '🌷🏝️', 'returns expected value' ); - - t.end(); -}); diff --git a/base/reverse/README.md b/base/reverse/README.md deleted file mode 100644 index ca6e834e..00000000 --- a/base/reverse/README.md +++ /dev/null @@ -1,104 +0,0 @@ - - -# reverse - -> reverse the UTF-16 code units of a string. - -
- -## Usage - -```javascript -var reverse = require( '@stdlib/string/base/reverse' ); -``` - -#### reverse( str ) - -Reverses the UTF-16 code units of a string. - -```javascript -var out = reverse( 'last man standing' ); -// returns 'gnidnats nam tsal' - -out = reverse( 'Hidden Treasures' ); -// returns 'serusaerT neddiH' - -out = reverse( 'foo bar' ); -// returns 'rab oof' -``` - -
- - - -
- -## Examples - - - -```javascript -var reverse = require( '@stdlib/string/base/reverse' ); - -var str = reverse( 'presidential election' ); -// returns 'noitcele laitnediserp' - -str = reverse( 'JavaScript' ); -// returns 'tpircSavaJ' - -str = reverse( 'The Last of the Mohicans' ); -// returns 'snacihoM eht fo tsaL ehT' -``` - -
- - - - - - - - - - - - - - diff --git a/base/reverse/benchmark/benchmark.js b/base/reverse/benchmark/benchmark.js deleted file mode 100644 index 8f45bcfe..00000000 --- a/base/reverse/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var reverse = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = reverse( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/reverse/docs/repl.txt b/base/reverse/docs/repl.txt deleted file mode 100644 index 0bac948a..00000000 --- a/base/reverse/docs/repl.txt +++ /dev/null @@ -1,26 +0,0 @@ - -{{alias}}( str ) - Reverses the UTF-16 code units of a string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep' ) - 'peeb' - > out = {{alias}}( 'Boop' ) - 'pooB' - > out = {{alias}}( 'foo bar' ) - 'rab oof' - - See Also - -------- - diff --git a/base/reverse/docs/types/index.d.ts b/base/reverse/docs/types/index.d.ts deleted file mode 100644 index 9300e8be..00000000 --- a/base/reverse/docs/types/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Reverses the UTF-16 code units of a string. -* -* @param str - input string -* @returns output string -* -* @example -* var out = reverse( 'last man standing' ); -* // returns 'gnidnats nam tsal' -* -* @example -* var out = reverse( 'presidential election' ); -* // returns 'noitcele laitnediserp' -* -* @example -* var out = reverse( 'JavaScript' ); -* // returns 'tpircSavaJ' -* -* @example -* var out = reverse( 'Hidden Treasures' ); -* // returns 'serusaerT neddiH' -* -* @example -* var out = reverse( 'foo bar' ); -* // returns 'rab oof' -*/ -declare function reverse( str: string ): string; - - -// EXPORTS // - -export = reverse; diff --git a/base/reverse/docs/types/test.ts b/base/reverse/docs/types/test.ts deleted file mode 100644 index 116ee34c..00000000 --- a/base/reverse/docs/types/test.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import reverse = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - reverse( 'abc' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - reverse( true ); // $ExpectError - reverse( false ); // $ExpectError - reverse( null ); // $ExpectError - reverse( undefined ); // $ExpectError - reverse( 5 ); // $ExpectError - reverse( [] ); // $ExpectError - reverse( {} ); // $ExpectError - reverse( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - reverse(); // $ExpectError - reverse( 'abc', 1 ); // $ExpectError - reverse( 'abc', 1, 2 ); // $ExpectError -} diff --git a/base/reverse/examples/index.js b/base/reverse/examples/index.js deleted file mode 100644 index 1c473d63..00000000 --- a/base/reverse/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 reverse = require( './../lib' ); - -console.log( reverse( 'presidential election' ) ); -// => 'noitcele laitnediserp' - -console.log( reverse( 'JavaScript' ) ); -// => 'tpircSavaJ' - -console.log( reverse( 'The Last of the Mohicans' ) ); -// => 'snacihoM eht fo tsaL ehT' diff --git a/base/reverse/lib/index.js b/base/reverse/lib/index.js deleted file mode 100644 index a6f52cb4..00000000 --- a/base/reverse/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Reverse the UTF-16 code units of a string. -* -* @module @stdlib/string/base/reverse -* -* @example -* var reverse = require( '@stdlib/string/base/reverse' ); -* -* var out = reverse( 'last man standing' ); -* // returns 'gnidnats nam tsal' -* -* out = reverse( 'Hidden Treasures' ); -* // returns 'serusaerT neddiH' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/reverse/lib/main.js b/base/reverse/lib/main.js deleted file mode 100644 index f8e3dcd7..00000000 --- a/base/reverse/lib/main.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Reverses the UTF-16 code units of a string. -* -* @param {string} str - input string -* @returns {string} output string -* -* @example -* var out = reverse( 'last man standing' ); -* // returns 'gnidnats nam tsal' -* -* @example -* var out = reverse( 'presidential election' ); -* // returns 'noitcele laitnediserp' -* -* @example -* var out = reverse( 'JavaScript' ); -* // returns 'tpircSavaJ' -* -* @example -* var out = reverse( 'Hidden Treasures' ); -* // returns 'serusaerT neddiH' -*/ -function reverse( str ) { - var out; - var i; - - out = ''; - for ( i = str.length - 1; i >= 0; i-- ) { - out += str[ i ]; - } - return out; -} - - -// EXPORTS // - -module.exports = reverse; diff --git a/base/reverse/package.json b/base/reverse/package.json deleted file mode 100644 index 41b2e85f..00000000 --- a/base/reverse/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/reverse", - "version": "0.0.0", - "description": "Reverse the UTF-16 code units of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "reverse", - "character", - "char", - "codeunit", - "unicode" - ] -} diff --git a/base/reverse/test/test.js b/base/reverse/test/test.js deleted file mode 100644 index 51934d51..00000000 --- a/base/reverse/test/test.js +++ /dev/null @@ -1,53 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 reverse = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof reverse, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( reverse( '' ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns reversed UTF-16 code units of the string', function test( t ) { - var out; - - out = reverse( 'hello world' ); - t.strictEqual( out, 'dlrow olleh', 'returns expected value' ); - - out = reverse( '!!!*' ); - t.strictEqual( out, '*!!!', 'returns expected value' ); - - out = reverse( 'Hello World' ); - t.strictEqual( out, 'dlroW olleH', 'returns expected value' ); - - t.end(); -}); diff --git a/base/right-pad/README.md b/base/right-pad/README.md deleted file mode 100644 index 6e0c8a77..00000000 --- a/base/right-pad/README.md +++ /dev/null @@ -1,134 +0,0 @@ - - -# rpad - -> Right pad a string. - -
- -## Usage - -```javascript -var rpad = require( '@stdlib/string/base/right-pad' ); -``` - -#### rpad( str, len, pad ) - -Right pads a string such that the padded string has a length of **at least** `len`. - -```javascript -var str = rpad( 'a', 5, ' ' ); -// returns 'a ' - -str = rpad( 'beep', 10, 'b' ); -// returns 'beepbbbbbb' - -str = rpad( 'boop', 12, 'beep' ); -// returns 'boopbeepbeep' -``` - -
- - - -
- -## Notes - -- An output string is **not** guaranteed to have a length of **exactly** `len`, but to have a length of **at least** `len`. To generate a padded string having a length equal to `len` - - ```javascript - var str = rpad( 'boop', 10, 'beep' ); // => length 12 - // returns 'boopbeepbeep' - - str = str.substring( 0, 10 ); // => length 10 - // returns 'boopbeepbe' - - str = str.substring( str.length-10 ); // => length 10 - // returns 'opbeepbeep' - ``` - -
- - - -
- -## Examples - - - -```javascript -var discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var papply = require( '@stdlib/utils/papply' ); -var papplyRight = require( '@stdlib/utils/papply-right' ); -var naryFunction = require( '@stdlib/utils/nary-function' ); -var map = require( '@stdlib/utils/map' ); -var logEach = require( '@stdlib/console/log-each' ); -var rpad = require( '@stdlib/string/base/right-pad' ); - -// Define a string to pad: -var str = 'beep'; - -// Generate random lengths: -var lens = discreteUniform( 10, str.length, str.length+10 ); - -// Create a function for creating padded strings: -var fcn = naryFunction( papply( papplyRight( rpad, 'b' ), str ), 1 ); - -// Generate padded strings: -var out = map( lens, fcn ); - -// Print results: -logEach( '%s', out ); -``` - -
- - - - - - - - - - - - - - diff --git a/base/right-pad/benchmark/benchmark.builtin.js b/base/right-pad/benchmark/benchmark.builtin.js deleted file mode 100644 index 09a771b1..00000000 --- a/base/right-pad/benchmark/benchmark.builtin.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var opts = { - 'skip': typeof String.prototype.padEnd !== 'function' -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - string length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'a', - 'b', - 'c' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = 'beep'.padEnd( len, values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - 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 = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - len = 10 * i; - f = createBenchmark( len ); - bench( format( '%s::builtin:len=%d', pkg, len ), opts, f ); - } -} - -main(); diff --git a/base/right-pad/benchmark/benchmark.js b/base/right-pad/benchmark/benchmark.js deleted file mode 100644 index bb7bef32..00000000 --- a/base/right-pad/benchmark/benchmark.js +++ /dev/null @@ -1,100 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var rpad = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - string length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'a', - 'b', - 'c' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = rpad( 'beep', len, values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - 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 = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - len = 10 * i; - f = createBenchmark( len ); - bench( format( '%s:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/base/right-pad/docs/repl.txt b/base/right-pad/docs/repl.txt deleted file mode 100644 index 9e38b98c..00000000 --- a/base/right-pad/docs/repl.txt +++ /dev/null @@ -1,38 +0,0 @@ - -{{alias}}( str, len, pad ) - Right pads a string such that the padded string has a length of at least - `len`. - - An output string is not guaranteed to have a length of exactly `len`, but to - have a length of at least `len`. To generate a padded string having a length - equal to `len`, post-process a padded string by trimming off excess - characters. - - Parameters - ---------- - str: string - Input string. - - len: integer - Minimum string length. - - pad: string - String used to pad. - - Returns - ------- - out: string - Padded string. - - Examples - -------- - > var out = {{alias}}( 'a', 5, ' ' ) - 'a ' - > out = {{alias}}( 'beep', 10, 'b' ) - 'beepbbbbbb' - > out = {{alias}}( 'boop', 12, 'beep' ) - 'boopbeepbeep' - - See Also - -------- - diff --git a/base/right-pad/docs/types/index.d.ts b/base/right-pad/docs/types/index.d.ts deleted file mode 100644 index 3861dbbc..00000000 --- a/base/right-pad/docs/types/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Right pads a string such that the padded string has a length of at least `len`. -* -* ## Notes -* -* - An output string is not guaranteed to have a length of exactly `len`, but to have a length of at least `len`. To generate a padded string having a length equal to `len`, post-process a padded string by trimming off excess characters. -* -* @param str - string to pad -* @param len - minimum string length -* @param pad - string used to pad -* @returns padded string -* -* @example -* var str = rpad( 'a', 5, ' ' ); -* // returns 'a ' -* -* @example -* var str = rpad( 'beep', 10, 'b' ); -* // returns 'beepbbbbbb' -* -* @example -* var str = rpad( 'boop', 12, 'beep' ); -* // returns 'boopbeepbeep' -*/ -declare function rpad( str: string, len: number, pad: string ): string; - - -// EXPORTS // - -export = rpad; diff --git a/base/right-pad/docs/types/test.ts b/base/right-pad/docs/types/test.ts deleted file mode 100644 index 22984f17..00000000 --- a/base/right-pad/docs/types/test.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import rpad = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - rpad( 'abd', 5, ' ' ); // $ExpectType string - rpad( 'abd', 4, 'x' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - rpad( true, 6, ' ' ); // $ExpectError - rpad( false, 6, ' ' ); // $ExpectError - rpad( 3, 6, ' ' ); // $ExpectError - rpad( [], 6, ' ' ); // $ExpectError - rpad( {}, 6, ' ' ); // $ExpectError - rpad( ( x: number ): number => x, 6, ' ' ); // $ExpectError - - rpad( 'abd', true, ' ' ); // $ExpectError - rpad( 'abd', false, ' ' ); // $ExpectError - rpad( 'abd', 'abc', ' ' ); // $ExpectError - rpad( 'abd', [], 0, ' ' ); // $ExpectError - rpad( 'abd', {}, 0, ' ' ); // $ExpectError - rpad( 'abd', ( x: number ): number => x, 0, ' ' ); // $ExpectError - - rpad( 'abd', 6, true ); // $ExpectError - rpad( 'abd', 6, false ); // $ExpectError - rpad( 'abd', 6, 123 ); // $ExpectError - rpad( 'abd', 6, [] ); // $ExpectError - rpad( 'abd', 6, {} ); // $ExpectError - rpad( 'abd', 6, /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - rpad(); // $ExpectError - rpad( 'abc' ); // $ExpectError - rpad( 'abc', 6 ); // $ExpectError -} diff --git a/base/right-pad/examples/index.js b/base/right-pad/examples/index.js deleted file mode 100644 index e9ed8168..00000000 --- a/base/right-pad/examples/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 discreteUniform = require( '@stdlib/random/array/discrete-uniform' ); -var papply = require( '@stdlib/utils/papply' ); -var papplyRight = require( '@stdlib/utils/papply-right' ); -var naryFunction = require( '@stdlib/utils/nary-function' ); -var map = require( '@stdlib/utils/map' ); -var logEach = require( '@stdlib/console/log-each' ); -var rpad = require( './../lib' ); - -// Define a string to pad: -var str = 'beep'; - -// Generate random lengths: -var lens = discreteUniform( 10, str.length, str.length+10 ); - -// Create a function for creating padded strings: -var fcn = naryFunction( papply( papplyRight( rpad, 'b' ), str ), 1 ); - -// Generate padded strings: -var out = map( lens, fcn ); - -// Print results: -logEach( '%s', out ); diff --git a/base/right-pad/lib/index.js b/base/right-pad/lib/index.js deleted file mode 100644 index bb5f26b1..00000000 --- a/base/right-pad/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Right pad a string such that the padded string has a length of at least `len`. -* -* @module @stdlib/string/base/right-pad -* -* @example -* var rpad = require( '@stdlib/string/base/right-pad' ); -* -* var str = rpad( 'a', 5, ' ' ); -* // returns 'a ' -* -* str = rpad( 'beep', 10, 'b' ); -* // returns 'beepbbbbbb' -* -* str = rpad( 'boop', 12, 'beep' ); -* // returns 'boopbeepbeep' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/right-pad/lib/main.js b/base/right-pad/lib/main.js deleted file mode 100644 index c867edf7..00000000 --- a/base/right-pad/lib/main.js +++ /dev/null @@ -1,61 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var repeat = require( './../../../base/repeat' ); -var ceil = require( '@stdlib/math/base/special/ceil' ); - - -// MAIN // - -/** -* Right pads a string such that the padded string has a length of at least `len`. -* -* @param {string} str - string to pad -* @param {NonNegativeInteger} len - minimum string length -* @param {string} pad - string used to pad -* @returns {string} padded string -* -* @example -* var str = rpad( 'a', 5, ' ' ); -* // returns 'a ' -* -* @example -* var str = rpad( 'beep', 10, 'b' ); -* // returns 'beepbbbbbb' -* -* @example -* var str = rpad( 'boop', 12, 'beep' ); -* // returns 'boopbeepbeep' -*/ -function rpad( str, len, pad ) { - var n = ( len - str.length ) / pad.length; - if ( n <= 0 ) { - return str; - } - n = ceil( n ); - return str + repeat( pad, n ); -} - - -// EXPORTS // - -module.exports = rpad; diff --git a/base/right-pad/package.json b/base/right-pad/package.json deleted file mode 100644 index 3cf7ea7d..00000000 --- a/base/right-pad/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/right-pad", - "version": "0.0.0", - "description": "Right pad a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "pad", - "string", - "str", - "padding", - "rpad", - "right" - ] -} diff --git a/base/right-pad/test/test.js b/base/right-pad/test/test.js deleted file mode 100644 index f7321fc9..00000000 --- a/base/right-pad/test/test.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var rpad = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof rpad, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function right pads a string with spaces', function test( t ) { - var str = rpad( 'a', 5, ' ' ); - t.strictEqual( str, 'a ', 'right padded with spaces' ); - t.end(); -}); - -tape( 'the function supports right padding a string with a custom pad string', function test( t ) { - var str = rpad( 'beep', 10, 'b' ); - t.strictEqual( str, 'beepbbbbbb', 'right padded to desired length' ); - t.end(); -}); - -tape( 'the function right pads a string such that an output string may exceed the specified length (minimum bound)', function test( t ) { - var str = rpad( 'a', 5, 'beepboop' ); - t.strictEqual( str, 'abeepboop', 'right padded and length exceeds minimum length' ); - t.end(); -}); - -tape( 'if the specified string length is less than or equal to the input string length, the function returns the input string', function test( t ) { - t.strictEqual( rpad( 'boop', 2, 'beep' ), 'boop', 'returns input string (<)' ); - t.strictEqual( rpad( 'boop', 4, 'beep' ), 'boop', 'returns input string (=)' ); - t.end(); -}); diff --git a/base/right-trim/README.md b/base/right-trim/README.md deleted file mode 100644 index 8bea321b..00000000 --- a/base/right-trim/README.md +++ /dev/null @@ -1,123 +0,0 @@ - - -# rtrim - -> Trim whitespace characters from the end of a string. - -
- -## Usage - -```javascript -var rtrim = require( '@stdlib/string/base/right-trim' ); -``` - -#### rtrim( str ) - -Trims whitespace from the end of a string. - -```javascript -var out = rtrim( ' \t\t\n Beep \r\n\t ' ); -// returns ' \t\t\n Beep' -``` - -
- - - -
- -## Notes - -- Following [Unicode 6.3.0][unicode] and later, "whitespace" is defined as the following characters: - - - `\f` - - `\n` - - `\r` - - `\t` - - `\v` - - `\u0020` - - `\u00a0` - - `\u1680` - - `\u2000-\u200a` - - `\u2028` - - `\u2029` - - `\u202f` - - `\u205f` - - `\u3000` - - `\ufeff` - -
- - - -
- -## Examples - - - -```javascript -var rtrim = require( '@stdlib/string/base/right-trim' ); - -var out = rtrim( ' Whitespace ' ); -// returns ' Whitespace' - -out = rtrim( '\t\t\tTabs\t\t\t' ); -// returns '\t\t\tTabs' - -out = rtrim( '\n\n\nNew Lines\n\n\n' ); -// returns '\n\n\nNew Lines' -``` - -
- - - - - - - - - - - - - - diff --git a/base/right-trim/benchmark/benchmark.js b/base/right-trim/benchmark/benchmark.js deleted file mode 100644 index bd14db6c..00000000 --- a/base/right-trim/benchmark/benchmark.js +++ /dev/null @@ -1,90 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var rtrim = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( typeof String.prototype.trimRight !== 'function' ) -}; -var whitespace = '\\f\\n\\r\\t\\v\\u0020\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff'; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop' + whitespace, - 'foo bar' + whitespace, - 'abc xyz' + whitespace - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = rtrim( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::built-in', pkg ), opts, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop' + whitespace, - 'foo bar' + whitespace, - 'abc xyz' + whitespace - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = values[ i%values.length ].trimRight(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/right-trim/benchmark/benchmark.polyfill.js b/base/right-trim/benchmark/benchmark.polyfill.js deleted file mode 100644 index 9461e885..00000000 --- a/base/right-trim/benchmark/benchmark.polyfill.js +++ /dev/null @@ -1,61 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var rtrim = require( './../lib/polyfill.js' ); - - -// VARIABLES // - -var whitespace = '\\f\\n\\r\\t\\v\\u0020\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff'; - - -// MAIN // - -bench( format( '%s::polyfill', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop' + whitespace, - 'foo bar' + whitespace, - 'abc xyz' + whitespace - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = rtrim( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/right-trim/docs/repl.txt b/base/right-trim/docs/repl.txt deleted file mode 100644 index b3e12745..00000000 --- a/base/right-trim/docs/repl.txt +++ /dev/null @@ -1,40 +0,0 @@ - -{{alias}}( str ) - Trims whitespace from the end of a string. - - "Whitespace" is defined as the following characters: - - - \f - - \n - - \r - - \t - - \v - - \u0020 - - \u00a0 - - \u1680 - - \u2000-\u200a - - \u2028 - - \u2029 - - \u202f - - \u205f - - \u3000 - - \ufeff - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Trimmed string. - - Examples - -------- - > var out = {{alias}}( ' \t\t\n Beep \r\n\t ' ) - ' \t\t\n Beep' - - See Also - -------- - diff --git a/base/right-trim/docs/types/index.d.ts b/base/right-trim/docs/types/index.d.ts deleted file mode 100644 index 61a6af8d..00000000 --- a/base/right-trim/docs/types/index.d.ts +++ /dev/null @@ -1,44 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Trims whitespace characters from the end of a string. -* -* @param str - input string -* @returns trimmed string -* -* @example -* var out = rtrim( ' Whitespace ' ); -* // returns ' Whitespace' -* -* @example -* var out = rtrim( '\t\t\tTabs\t\t\t' ); -* // returns '\t\t\tTabs' -* -* @example -* var out = rtrim( '\n\n\nNew Lines\n\n\n' ); -* // returns '\n\n\nNew Lines' -*/ -declare function rtrim( str: string ): string; - - -// EXPORTS // - -export = rtrim; diff --git a/base/right-trim/docs/types/test.ts b/base/right-trim/docs/types/test.ts deleted file mode 100644 index 9fa5aeab..00000000 --- a/base/right-trim/docs/types/test.ts +++ /dev/null @@ -1,44 +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. -*/ - -import rtrim = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - rtrim( ' Whitespace ' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - rtrim( true ); // $ExpectError - rtrim( false ); // $ExpectError - rtrim( null ); // $ExpectError - rtrim( undefined ); // $ExpectError - rtrim( 5 ); // $ExpectError - rtrim( [] ); // $ExpectError - rtrim( {} ); // $ExpectError - rtrim( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - rtrim(); // $ExpectError -} diff --git a/base/right-trim/examples/index.js b/base/right-trim/examples/index.js deleted file mode 100644 index 4e8856de..00000000 --- a/base/right-trim/examples/index.js +++ /dev/null @@ -1,30 +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. -*/ - -'use strict'; - -var rtrim = require( './../lib' ); - -console.log( rtrim( ' Whitespace ' ) ); -// => ' Whitespace' - -console.log( rtrim( '\t\t\tTabs\t\t\t' ) ); -// => '\t\t\tTabs' - -console.log( rtrim( '\n\n\nNew Lines\n\n\n' ) ); -// => '\n\n\nNew Lines' diff --git a/base/right-trim/lib/builtin.js b/base/right-trim/lib/builtin.js deleted file mode 100644 index 1fbd4050..00000000 --- a/base/right-trim/lib/builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var rtrim = String.prototype.trimRight; - - -// EXPORTS // - -module.exports = rtrim; diff --git a/base/right-trim/lib/has_builtin.js b/base/right-trim/lib/has_builtin.js deleted file mode 100644 index ff9af3be..00000000 --- a/base/right-trim/lib/has_builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var bool = ( typeof String.prototype.trimRight !== 'undefined' ); - - -// EXPORTS // - -module.exports = bool; diff --git a/base/right-trim/lib/index.js b/base/right-trim/lib/index.js deleted file mode 100644 index e1168932..00000000 --- a/base/right-trim/lib/index.js +++ /dev/null @@ -1,58 +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. -*/ - -'use strict'; - -/** -* Trim whitespace characters from the end of a string. -* -* @module @stdlib/string/base/right-trim -* -* @example -* var rtrim = require( '@stdlib/string/base/right-trim' ); -* -* var out = rtrim( ' Whitespace ' ); -* // returns ' Whitespace' -* -* out = rtrim( '\t\t\tTabs\t\t\t' ); -* // returns '\t\t\tTabs' -* -* out = rtrim( '\n\n\nNew Lines\n\n\n' ); -* // returns '\n\n\nNew Lines' -*/ - -// MODULES // - -var HAS_BUILTIN = require( './has_builtin.js' ); -var polyfill = require( './polyfill.js' ); -var main = require( './main.js' ); - - -// MAIN // - -var rtrim; -if ( HAS_BUILTIN ) { - rtrim = main; -} else { - rtrim = polyfill; -} - - -// EXPORTS // - -module.exports = rtrim; diff --git a/base/right-trim/lib/main.js b/base/right-trim/lib/main.js deleted file mode 100644 index 7d4080dd..00000000 --- a/base/right-trim/lib/main.js +++ /dev/null @@ -1,53 +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. -*/ - -'use strict'; - -// MODULES // - -var builtin = require( './builtin.js' ); - - -// MAIN // - -/** -* Trims whitespace from the end of a string. -* -* @param {string} str - input string -* @returns {string} trimmed string -* -* @example -* var out = rtrim( ' Whitespace ' ); -* // returns ' Whitespace' -* -* @example -* var out = rtrim( '\t\t\tTabs\t\t\t' ); -* // returns '\t\t\tTabs' -* -* @example -* var out = rtrim( '\n\n\nNew Lines\n\n\n' ); -* // returns '\n\n\nNew Lines' -*/ -function rtrim( str ) { - return builtin.call( str ); -} - - -// EXPORTS // - -module.exports = rtrim; diff --git a/base/right-trim/lib/polyfill.js b/base/right-trim/lib/polyfill.js deleted file mode 100644 index 1050f263..00000000 --- a/base/right-trim/lib/polyfill.js +++ /dev/null @@ -1,60 +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. -*/ - -'use strict'; - -// MODULES // - -var replace = require( './../../../base/replace' ); - - -// VARIABLES // - -// The following regular expression should suffice to polyfill (most?) all environments. -var RE = /[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+$/; - - -// MAIN // - -/** -* Trims whitespace from the end of a string. -* -* @private -* @param {string} str - input string -* @returns {string} trimmed string -* -* @example -* var out = rtrim( ' Whitespace ' ); -* // returns ' Whitespace' -* -* @example -* var out = rtrim( '\t\t\tTabs\t\t\t' ); -* // returns '\t\t\tTabs' -* -* @example -* var out = rtrim( '\n\n\nNew Lines\n\n\n' ); -* // returns '\n\n\nNew Lines' -*/ -function rtrim( str ) { - return replace( str, RE, '' ); -} - - -// EXPORTS // - -module.exports = rtrim; diff --git a/base/right-trim/package.json b/base/right-trim/package.json deleted file mode 100644 index bc35d7a0..00000000 --- a/base/right-trim/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/right-trim", - "version": "0.0.0", - "description": "Trim whitespace characters from the end of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "whitespace", - "remove", - "trim", - "trimming", - "replace" - ] -} diff --git a/base/right-trim/test/test.js b/base/right-trim/test/test.js deleted file mode 100644 index 712d1335..00000000 --- a/base/right-trim/test/test.js +++ /dev/null @@ -1,174 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var polyfill = require( './../lib/polyfill.js' ); -var main = require( './../lib/main.js' ); -var rtrim = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof rtrim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the main export is a polyfill if an environment does not support String.prototype.trimRight', function test( t ) { - var rtrim = proxyquire( './../lib', { - './has_builtin.js': false - }); - t.strictEqual( rtrim, polyfill, 'returns expected value' ); - t.end(); -}); - -tape( 'the main export is a wrapper around a builtin if an environment supports String.prototype.trimRight', function test( t ) { - var rtrim = proxyquire( './../lib', { - './has_builtin.js': true - }); - t.strictEqual( rtrim, main, 'returns expected value' ); - t.end(); -}); - -tape( 'the function removes all whitespace characters at the end of a string', function test( t ) { - var expected; - var actual; - - expected = ' Whitespace'; - actual = rtrim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '\t\t\tTabs'; - actual = rtrim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = '\n\n\nNew Lines'; - actual = rtrim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = ' \r\n \tBeep'; - actual = rtrim( ' \r\n \tBeep \r\n\t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = rtrim( 'beep\f' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = rtrim( 'beep\n' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = rtrim( 'beep\t' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = rtrim( 'beep\v' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = rtrim( 'beep\u1680' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2000' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2001' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2002' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2003' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2004' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2005' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2006' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2007' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2008' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2009' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = rtrim( 'beep\u200a' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2028' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2029' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = rtrim( 'beep\u202f' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = rtrim( 'beep\u205f' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = rtrim( 'beep\u3000' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = rtrim( 'beep\ufeff' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); - -tape( 'the function does not trim the Mongolian space separator in accordance with Unicode 6.3.0 and later', function test( t ) { - var expected; - var actual; - - expected = 'beep\u180e'; - actual = rtrim( 'beep\u180e' ); - t.strictEqual( actual, expected, 'does not remove \\u180e' ); - - t.end(); -}); diff --git a/base/right-trim/test/test.main.js b/base/right-trim/test/test.main.js deleted file mode 100644 index f667db03..00000000 --- a/base/right-trim/test/test.main.js +++ /dev/null @@ -1,163 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var HAS_BUILTIN = require( './../lib/has_builtin.js' ); -var rtrim = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': !HAS_BUILTIN -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof rtrim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function removes all whitespace characters at the end of a string', opts, function test( t ) { - var expected; - var actual; - - expected = ' Whitespace'; - actual = rtrim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '\t\t\tTabs'; - actual = rtrim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = '\n\n\nNew Lines'; - actual = rtrim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = ' \r\n \tBeep'; - actual = rtrim( ' \r\n \tBeep \r\n\t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = rtrim( 'beep\f' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = rtrim( 'beep\n' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = rtrim( 'beep\t' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = rtrim( 'beep\v' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = rtrim( 'beep\u1680' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2000' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2001' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2002' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2003' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2004' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2005' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2006' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2007' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2008' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2009' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = rtrim( 'beep\u200a' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2028' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2029' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = rtrim( 'beep\u202f' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = rtrim( 'beep\u205f' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = rtrim( 'beep\u3000' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = rtrim( 'beep\ufeff' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); - -tape( 'the function does not trim the Mongolian space separator in accordance with Unicode 6.3.0 and later', opts, function test( t ) { - var expected; - var actual; - - expected = 'beep\u180e'; - actual = rtrim( 'beep\u180e' ); - t.strictEqual( actual, expected, 'does not remove \\u180e' ); - - t.end(); -}); diff --git a/base/right-trim/test/test.polyfill.js b/base/right-trim/test/test.polyfill.js deleted file mode 100644 index e842dd7d..00000000 --- a/base/right-trim/test/test.polyfill.js +++ /dev/null @@ -1,155 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var rtrim = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof rtrim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function removes all whitespace characters at the end of a string', function test( t ) { - var expected; - var actual; - - expected = ' Whitespace'; - actual = rtrim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '\t\t\tTabs'; - actual = rtrim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = '\n\n\nNew Lines'; - actual = rtrim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = ' \r\n \tBeep'; - actual = rtrim( ' \r\n \tBeep \r\n\t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = rtrim( 'beep\f' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = rtrim( 'beep\n' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = rtrim( 'beep\t' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = rtrim( 'beep\v' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = rtrim( 'beep\u1680' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2000' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2001' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2002' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2003' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2004' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2005' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2006' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2007' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2008' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2009' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = rtrim( 'beep\u200a' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2028' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2029' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = rtrim( 'beep\u202f' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = rtrim( 'beep\u205f' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = rtrim( 'beep\u3000' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = rtrim( 'beep\ufeff' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); - -tape( 'the function does not trim the Mongolian space separator in accordance with Unicode 6.3.0 and later', function test( t ) { - var expected; - var actual; - - expected = 'beep\u180e'; - actual = rtrim( 'beep\u180e' ); - t.strictEqual( actual, expected, 'does not remove \\u180e' ); - - t.end(); -}); diff --git a/base/slice-code-points/README.md b/base/slice-code-points/README.md deleted file mode 100644 index bd375ca5..00000000 --- a/base/slice-code-points/README.md +++ /dev/null @@ -1,90 +0,0 @@ - - -# sliceCodePoints - -> Slice a string based on Unicode code point indices. - -
- -## Usage - -```javascript -var sliceCodePoints = require( '@stdlib/string/base/slice-code-points' ); -``` - -#### sliceCodePoints( str, start, end ) - -Slices a string based on Unicode code point indices. - -```javascript -var out = sliceCodePoints( 'Hello 👋 World', 0, 7 ); -// returns 'Hello 👋' - -out = sliceCodePoints( '👋👋👋', 1, 2 ); -// returns '👋' -``` - -The function accepts the following arguments: - -- **str**: input string. -- **start**: the `ith` Unicode code point to start a slice (inclusive). -- **end**: the `jth` Unicode code point to end a slice (exclusive). - -
- - - -
- -## Examples - -```javascript -var sliceCodePoints = require( '@stdlib/string/base/slice-code-points' ); - -console.log( sliceCodePoints( 'Hello 👋 World', 0, 7 ) ); -// => 'Hello 👋' - -console.log( sliceCodePoints( 'last man standing', 1, 17 ) ); -// => 'ast man standing' - -console.log( sliceCodePoints( '六书/六書', 1, 14 ) ); -// => '书/六書' -``` - -
- - - - - - - - - - - - - - diff --git a/base/slice-code-points/benchmark/benchmark.js b/base/slice-code-points/benchmark/benchmark.js deleted file mode 100644 index 525025ed..00000000 --- a/base/slice-code-points/benchmark/benchmark.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var sliceCodePoints = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Iñtërnâtiônàlizætiøn', - 'presidential election', - '🐶🐮🐷🐰🐸', - 'Hello 👋 World', - 'अनुच्छेद' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sliceCodePoints( values[ i%values.length ], 1, 3 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/slice-code-points/docs/repl.txt b/base/slice-code-points/docs/repl.txt deleted file mode 100644 index 6647a36a..00000000 --- a/base/slice-code-points/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, start, end ) - Slices a string based on Unicode code point indices. - - Parameters - ---------- - str: string - Input string. - start: integer - The `ith` Unicode code point to start a slice (inclusive). - end: integer - The `jth` Unicode code point to end a slice (exclusive). - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'Hello 👋 World', 1, 3 ) - 'el' - > out = {{alias}}( '👋👋👋', 1, 2 ) - '👋' - > out = {{alias}}( '六书/六書', 1, 14 ) - '书/六書' - - See Also - -------- diff --git a/base/slice-code-points/docs/types/index.d.ts b/base/slice-code-points/docs/types/index.d.ts deleted file mode 100644 index 6779de9d..00000000 --- a/base/slice-code-points/docs/types/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Slices a string based on Unicode code point indices. -* -* @param str - input string -* @param start - the `ith` Unicode code point to start a slice (inclusive) -* @param end - the `jth` Unicode code point to end a slice (exclusive) -* @returns output string -* -* @example -* var out = sliceCodePoints( 'Hello 👋 World', 1, 3 ); -* // returns 'el' -* -* @example -* var out = sliceCodePoints( '👋👋👋', 1, 2 ); -* // returns '👋' -*/ -declare function sliceCodePoints( str: string, start: number, end: number ): string; - - -// EXPORTS // - -export = sliceCodePoints; diff --git a/base/slice-code-points/docs/types/test.ts b/base/slice-code-points/docs/types/test.ts deleted file mode 100644 index 5e7baf15..00000000 --- a/base/slice-code-points/docs/types/test.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import sliceCodePoints = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - sliceCodePoints( 'abc', 1, 2 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - sliceCodePoints( true, 1, 2 ); // $ExpectError - sliceCodePoints( false, 1, 2 ); // $ExpectError - sliceCodePoints( null, 1, 2 ); // $ExpectError - sliceCodePoints( undefined, 1, 2 ); // $ExpectError - sliceCodePoints( 5, 1, 2 ); // $ExpectError - sliceCodePoints( [], 1, 2 ); // $ExpectError - sliceCodePoints( {}, 1, 2 ); // $ExpectError - sliceCodePoints( ( x: number ): number => x, 1, 2 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - sliceCodePoints( 'abc', true, 2 ); // $ExpectError - sliceCodePoints( 'abc', false, 2 ); // $ExpectError - sliceCodePoints( 'abc', null, 2 ); // $ExpectError - sliceCodePoints( 'abc', 'abc', 2 ); // $ExpectError - sliceCodePoints( 'abc', [], 2 ); // $ExpectError - sliceCodePoints( 'abc', {}, 2 ); // $ExpectError - sliceCodePoints( 'abc', ( x: number ): number => x, 2 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument that is not a number... -{ - sliceCodePoints( 'abc', 1, true ); // $ExpectError - sliceCodePoints( 'abc', 1, false ); // $ExpectError - sliceCodePoints( 'abc', 1, null ); // $ExpectError - sliceCodePoints( 'abc', 1, 'abc' ); // $ExpectError - sliceCodePoints( 'abc', 1, [] ); // $ExpectError - sliceCodePoints( 'abc', 1, {} ); // $ExpectError - sliceCodePoints( 'abc', 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - sliceCodePoints(); // $ExpectError - sliceCodePoints( 'abc' ); // $ExpectError - sliceCodePoints( 'abc', 1, 2, {} ); // $ExpectError -} diff --git a/base/slice-code-points/examples/index.js b/base/slice-code-points/examples/index.js deleted file mode 100644 index 25556534..00000000 --- a/base/slice-code-points/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sliceCodePoints = require( './../lib' ); - -console.log( sliceCodePoints( 'Hello 👋 World', 0, 7 ) ); -// => 'Hello 👋' - -console.log( sliceCodePoints( 'last man standing', 1, 17 ) ); -// => 'ast man standing' - -console.log( sliceCodePoints( '六书/六書', 1, 14 ) ); -// => '书/六書' diff --git a/base/slice-code-points/lib/index.js b/base/slice-code-points/lib/index.js deleted file mode 100644 index 2020cfff..00000000 --- a/base/slice-code-points/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Slice a string based on Unicode code point indices. -* -* @module @stdlib/string/base/slice-code-points -* -* @example -* var sliceCodePoints = require( '@stdlib/string/base/slice-code-points' ); -* -* var out = sliceCodePoints( 'Hello 👋 World', 1, 3 ); -* // returns 'el' -* -* out = sliceCodePoints( '👋👋👋', 1, 2 ); -* // returns '👋' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/slice-code-points/lib/main.js b/base/slice-code-points/lib/main.js deleted file mode 100644 index 122c30b1..00000000 --- a/base/slice-code-points/lib/main.js +++ /dev/null @@ -1,107 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var numCodePoints = require( './../../../num-code-points' ); -var max = require( '@stdlib/math/base/special/fast/max' ); - - -// VARIABLES // - -var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/; // TODO: replace with stdlib pkg -var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/; // TODO: replace with stdlib pkg - - -// MAIN // - -/** -* Slices a string based on Unicode code points. -* -* @param {string} str - input string -* @param {integer} start - the `ith` Unicode code point to start a slice (inclusive) -* @param {integer} end - the `jth` Unicode code point to end a slice (exclusive) -* @returns {string} output string -* -* @example -* var out = sliceCodePoints( 'Hello 👋 World', 1, 3 ); -* // returns 'el' -* -* out = sliceCodePoints( '👋👋👋', 1, 2 ); -* // returns '👋' -*/ -function sliceCodePoints( str, start, end ) { - var totalCodePoints; - var codePoints; - var len; - var ch1; - var ch2; - var idx; - var ch; - var i; - - len = str.length; - if ( len === 0 ) { - return ''; - } - totalCodePoints = numCodePoints( str ); - if ( start < 0 ) { - start = max( totalCodePoints + start, 0 ); - } - if ( end < 0 ) { - end = max( totalCodePoints + end, 0 ); - } else if ( end > totalCodePoints ) { - end = totalCodePoints; - } - if ( start >= totalCodePoints || end <= start ) { - return ''; - } - codePoints = ''; - idx = 0; - - // Process the string one Unicode code unit at a time and handle UTF-16 surrogate pairs as a single Unicode code point... - for ( i = 0; i < len && idx < end; i++ ) { - ch1 = str[ i ]; - ch = ch1; - - // Check for a UTF-16 surrogate pair... - if ( i < len-1 && RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) { - // Check whether the high surrogate is paired with a low surrogate... - ch2 = str[ i+1 ]; - if ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) { - // We found a surrogate pair: - ch += ch2; - i += 1; // bump the index to process the next code unit - } - } - // Note: `ch` may be a lone surrogate (e.g., a low surrogate without a preceding high surrogate or a high surrogate at the end of the input string). - - if ( idx >= start && idx < end ) { - codePoints += ch; - } - idx += 1; - } - return codePoints; -} - - -// EXPORTS // - -module.exports = sliceCodePoints; diff --git a/base/slice-code-points/package.json b/base/slice-code-points/package.json deleted file mode 100644 index ab489539..00000000 --- a/base/slice-code-points/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/slice-code-points", - "version": "0.0.0", - "description": "Slice a string based on Unicode code points.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "base", - "slice", - "substring", - "unicode", - "code", - "point", - "codepoint", - "utilities", - "utility", - "utils", - "util" - ] -} diff --git a/base/slice-code-points/test/test.js b/base/slice-code-points/test/test.js deleted file mode 100644 index 89f71fbc..00000000 --- a/base/slice-code-points/test/test.js +++ /dev/null @@ -1,149 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var sliceCodePoints = require( './../lib/main.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sliceCodePoints, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 3', function test( t ) { - t.strictEqual( sliceCodePoints.length, 3, 'the function has an arity of 3' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( sliceCodePoints( '', 1, 2 ), '', 'returns expected value' ); - t.strictEqual( sliceCodePoints( '', 2, 3 ), '', 'returns expected value' ); - t.strictEqual( sliceCodePoints( '', 3, 4 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function slices a string based on code point indices', function test( t ) { - var str; - var out; - - str = 'Hello World'; - out = sliceCodePoints( str, 1, 5 ); - t.strictEqual( out, 'ello', 'returns expected value' ); - - str = 'Hello 👋 World'; - out = sliceCodePoints( str, 5, 7 ); - t.strictEqual( out, ' 👋', 'returns expected value' ); - - str = 'अनुच्छेद'; - out = sliceCodePoints( str, 1, str.length ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - str = '六书/六書'; - out = sliceCodePoints( str, 1, str.length ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - str = '𐒻𐓟'; - out = sliceCodePoints( str, 1, str.length ); - t.strictEqual( out, '𐓟', 'returns expected value' ); - - str = '\uD800'; - out = sliceCodePoints( str, 1, 2 ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing negative indices', function test( t ) { - var str; - var out; - - str = 'Hello World'; - out = sliceCodePoints( str, -5, -1 ); - t.strictEqual( out, 'Worl', 'returns expected value' ); - - str = 'Hello 👋 World'; - out = sliceCodePoints( str, 0, -6 ); - t.strictEqual( out, 'Hello 👋', 'returns expected value' ); - - str = 'अनुच्छेद'; - out = sliceCodePoints( str, -7, str.length ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - str = '六书/六書'; - out = sliceCodePoints( str, -4, str.length ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - str = '𐒻𐓟'; - out = sliceCodePoints( str, -1, str.length ); - t.strictEqual( out, '𐓟', 'returns expected value' ); - - str = '\uD800'; - out = sliceCodePoints( str, -1, str.length ); - t.strictEqual( out, '\uD800', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function handles surrogate pairs correctly', function test( t ) { - var out; - - out = sliceCodePoints( '👋👋👋', 0, 1 ); - t.strictEqual( out, '👋', 'returns expected value' ); - - out = sliceCodePoints( '👋👋👋', 1, 2 ); - t.strictEqual( out, '👋', 'returns expected value' ); - - out = sliceCodePoints( '👋a👋b👋', 1, 4 ); - t.strictEqual( out, 'a👋b', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function handles lone surrogates', function test( t ) { - var out; - - out = sliceCodePoints( '\uD800abc', 0, 2 ); - t.strictEqual( out, '\uD800a', 'returns expected value for lone high surrogate' ); - - out = sliceCodePoints( '\uDC00abc', 0, 2 ); - t.strictEqual( out, '\uDC00a', 'returns expected value for lone low surrogate' ); - - t.end(); -}); - -tape( 'the function truncates the end index to the string length', function test( t ) { - var out; - - out = sliceCodePoints( 'hello', 0, 10 ); - t.strictEqual( out, 'hello', 'returns expected value' ); - - out = sliceCodePoints( '六书/六書', 1, 10 ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - out = sliceCodePoints( '🏝️🌷', 0, 5 ); - t.strictEqual( out, '🏝️🌷', 'returns expected value' ); - - t.end(); -}); diff --git a/base/slice-grapheme-clusters/README.md b/base/slice-grapheme-clusters/README.md deleted file mode 100644 index d236fdf7..00000000 --- a/base/slice-grapheme-clusters/README.md +++ /dev/null @@ -1,134 +0,0 @@ - - -# sliceGraphemeClusters - -> Slice a string based on grapheme cluster (i.e., user-perceived character) indices. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var sliceGraphemeClusters = require( '@stdlib/string/base/slice-grapheme-clusters' ); -``` - -#### sliceGraphemeClusters( str, start, end ) - -Slices a string based on grapheme cluster (i.e., user-perceived character) indices. - -```javascript -var out = sliceGraphemeClusters( 'Hello World', 0, 5 ); -// returns 'Hello' - -out = sliceGraphemeClusters( '👋👋👋', 0, 2 ); -// returns '👋👋' - -out = sliceGraphemeClusters( '六书/六書', 1, 5 ); -// returns '书/六書' - -out = sliceGraphemeClusters( '🌷🍕👉🏿', 1, 2 ); -// returns '🍕' -``` - -The function accepts the following arguments: - -- **str**: input string. -- **start**: the `ith` grapheme cluster to start a slice (inclusive). -- **end**: the `jth` grapheme cluster to end a slice (exclusive). - -
- - - - - -
- -
- - - - - -
- -## Examples - -```javascript -var sliceGraphemeClusters = require( '@stdlib/string/base/slice-grapheme-clusters' ); - -console.log( sliceGraphemeClusters( 'Hello World', 0, 5 ) ); -// => 'Hello' - -console.log( sliceGraphemeClusters( 'Hello World', -5, -1 ) ); -// => 'Worl' - -console.log( sliceGraphemeClusters( '👋👋👋', 0, 2 ) ); -// => '👋👋' - -console.log( sliceGraphemeClusters( '六书/六書', 1, 5 ) ); -// => '书/六書' - -console.log( sliceGraphemeClusters( '👨‍👩‍👧‍👦👨‍👩‍👧‍👦👨‍👩‍👧‍👦', 0, 2 ) ); -// => '👨‍👩‍👧‍👦👨‍👩‍👧‍👦' -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/base/slice-grapheme-clusters/benchmark/benchmark.js b/base/slice-grapheme-clusters/benchmark/benchmark.js deleted file mode 100644 index 9e9c7cec..00000000 --- a/base/slice-grapheme-clusters/benchmark/benchmark.js +++ /dev/null @@ -1,57 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var sliceGraphemeClusters = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Iñtërnâtiônàlizætiøn', - 'presidential election', - '🐶🐮🐷🐰🐸', - 'Hello 👋 World', - 'अनुच्छेद' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = sliceGraphemeClusters( values[ i%values.length ], 1, 3 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/slice-grapheme-clusters/docs/repl.txt b/base/slice-grapheme-clusters/docs/repl.txt deleted file mode 100644 index 58dca427..00000000 --- a/base/slice-grapheme-clusters/docs/repl.txt +++ /dev/null @@ -1,34 +0,0 @@ - -{{alias}}( str, start, end ) - Slices a string based on grapheme cluster (i.e., user-perceived character) - indices. - - Parameters - ---------- - str: string - Input string. - - start: integer - The `ith` grapheme cluster to start a slice (inclusive). - - end: integer - The `jth` grapheme cluster to end a slice (exclusive). - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 0, 2 ) - 'be' - > out = {{alias}}( 'Boop', 1, 3 ) - 'oo' - > out = {{alias}}( 'foo bar', 4, 7 ) - 'bar' - > out = {{alias}}( '🐶🐮🐷🐰🐸', 0, 2 ) - '🐶🐮' - - See Also - -------- diff --git a/base/slice-grapheme-clusters/docs/types/index.d.ts b/base/slice-grapheme-clusters/docs/types/index.d.ts deleted file mode 100644 index 541305ad..00000000 --- a/base/slice-grapheme-clusters/docs/types/index.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Slices a string based on grapheme cluster (i.e., user-perceived character) indices. -* -* @param str - input string -* @param start - the `ith` grapheme cluster to start a slice (inclusive) -* @param end - the `jth` grapheme cluster to end a slice (exclusive) -* @returns output string -* -* @example -* var out = sliceGraphemeClusters( 'Hello World', 0, 5 ); -* // returns 'Hello' -* -* out = sliceGraphemeClusters( '👋👋👋', 0, 2 ); -* // returns '👋👋' -* -* out = sliceGraphemeClusters( 'अनुच्छेद', 1, 3 ); -* // returns 'नुच्' -* -* out = sliceGraphemeClusters( 'Hello World', -5, -1 ); -* // returns 'Worl' -*/ -declare function sliceGraphemeClusters( str: string, start: number, end: number ): string; - - -// EXPORTS // - -export = sliceGraphemeClusters; diff --git a/base/slice-grapheme-clusters/docs/types/test.ts b/base/slice-grapheme-clusters/docs/types/test.ts deleted file mode 100644 index 45ee9815..00000000 --- a/base/slice-grapheme-clusters/docs/types/test.ts +++ /dev/null @@ -1,72 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import sliceGraphemeClusters = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - sliceGraphemeClusters( 'beep', 0, 2 ); // $ExpectType string - sliceGraphemeClusters( 'Boop', 1, 3 ); // $ExpectType string - sliceGraphemeClusters( 'foo bar', 4, 7 ); // $ExpectType string - sliceGraphemeClusters( '🐶🐮🐷🐰🐸', 1, 3 ); // $ExpectType string - sliceGraphemeClusters( '🐶🐮🐷🐰🐸', -3, -1 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument that is not a string... -{ - sliceGraphemeClusters( true, 1, 2 ); // $ExpectError - sliceGraphemeClusters( false, 1, 2 ); // $ExpectError - sliceGraphemeClusters( null, 1, 2 ); // $ExpectError - sliceGraphemeClusters( undefined, 1, 2 ); // $ExpectError - sliceGraphemeClusters( 5, 1, 2 ); // $ExpectError - sliceGraphemeClusters( [], 1, 2 ); // $ExpectError - sliceGraphemeClusters( {}, 1, 2 ); // $ExpectError - sliceGraphemeClusters( ( x: number ): number => x, 1, 2 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - sliceGraphemeClusters( 'abc', true, 2 ); // $ExpectError - sliceGraphemeClusters( 'abc', false, 2 ); // $ExpectError - sliceGraphemeClusters( 'abc', null, 2 ); // $ExpectError - sliceGraphemeClusters( 'abc', 'abc', 2 ); // $ExpectError - sliceGraphemeClusters( 'abc', [], 2 ); // $ExpectError - sliceGraphemeClusters( 'abc', {}, 2 ); // $ExpectError - sliceGraphemeClusters( 'abc', ( x: number ): number => x, 2 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument that is not a number... -{ - sliceGraphemeClusters( 'abc', 1, true ); // $ExpectError - sliceGraphemeClusters( 'abc', 1, false ); // $ExpectError - sliceGraphemeClusters( 'abc', 1, null ); // $ExpectError - sliceGraphemeClusters( 'abc', 1, 'abc' ); // $ExpectError - sliceGraphemeClusters( 'abc', 1, [] ); // $ExpectError - sliceGraphemeClusters( 'abc', 1, {} ); // $ExpectError - sliceGraphemeClusters( 'abc', 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - sliceGraphemeClusters(); // $ExpectError - sliceGraphemeClusters( 'abc' ); // $ExpectError - sliceGraphemeClusters( 'abc', 1, 2, {} ); // $ExpectError -} diff --git a/base/slice-grapheme-clusters/examples/index.js b/base/slice-grapheme-clusters/examples/index.js deleted file mode 100644 index c3d88355..00000000 --- a/base/slice-grapheme-clusters/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var sliceGraphemeClusters = require( './../lib' ); - -console.log( sliceGraphemeClusters( 'Hello World', 0, 5 ) ); -// => 'Hello' - -console.log( sliceGraphemeClusters( 'Hello World', -5, -1 ) ); -// => 'Worl' - -console.log( sliceGraphemeClusters( '👋👋👋', 0, 2 ) ); -// => '👋👋' - -console.log( sliceGraphemeClusters( '六书/六書', 1, 5 ) ); -// => '书/六書' - -console.log( sliceGraphemeClusters( '👨‍👩‍👧‍👦👨‍👩‍👧‍👦👨‍👩‍👧‍👦', 0, 2 ) ); -// => '👨‍👩‍👧‍👦👨‍👩‍👧‍👦' diff --git a/base/slice-grapheme-clusters/lib/index.js b/base/slice-grapheme-clusters/lib/index.js deleted file mode 100644 index d33d4274..00000000 --- a/base/slice-grapheme-clusters/lib/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Slice a string based on grapheme cluster (i.e., user-perceived character) indices. -* -* @module @stdlib/string/base/slice-grapheme-clusters -* -* @example -* var sliceGraphemeClusters = require( '@stdlib/string/base/slice-grapheme-clusters' ); -* -* var out = sliceGraphemeClusters( 'Hello World', 0, 5 ); -* // returns 'Hello' -* -* out = sliceGraphemeClusters( '👋👋👋', 0, 2 ); -* // returns '👋👋' -* -* out = sliceGraphemeClusters( 'अनुच्छेद', 1, 3 ); -* // returns 'नुच्' -* -* out = sliceGraphemeClusters( 'Hello World', -5, -1 ); -* // returns 'Worl' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/slice-grapheme-clusters/lib/main.js b/base/slice-grapheme-clusters/lib/main.js deleted file mode 100644 index 0d1afe93..00000000 --- a/base/slice-grapheme-clusters/lib/main.js +++ /dev/null @@ -1,97 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var nextGraphemeClusterBreak = require( './../../../next-grapheme-cluster-break' ); -var numGraphemeClusters = require( './../../../num-grapheme-clusters' ); -var max = require( '@stdlib/math/base/special/fast/max' ); - - -// MAIN // - -/** -* Slices a string based on grapheme cluster (i.e., user-perceived character) indices. -* -* @param {string} str - input string -* @param {integer} start - the `ith` grapheme cluster to start a slice (inclusive) -* @param {integer} end - the `jth` grapheme cluster to end a slice (exclusive) -* @returns {string} output string -* -* @example -* var out = sliceGraphemeClusters( 'Hello World', 0, 5 ); -* // returns 'Hello' -* -* out = sliceGraphemeClusters( '👋👋👋', 0, 2 ); -* // returns '👋👋' -* -* out = sliceGraphemeClusters( 'अनुच्छेद', 1, 3 ); -* // returns 'नुच्' -* -* out = sliceGraphemeClusters( 'Hello World', -5, -1 ); -* // returns 'Worl' -*/ -function sliceGraphemeClusters( str, start, end ) { - var numClusters; - var result; - var idx; - var brk; - var i; - - if ( str === '' ) { - return ''; - } - numClusters = numGraphemeClusters( str ); - if ( start < 0 ) { - start = max( start + numClusters, 0 ); - } - if ( end < 0 ) { - end = max( end + numClusters, 0 ); - } - if ( start >= numClusters || start >= end ) { - return ''; - } - if ( end > numClusters ) { - end = numClusters; - } - result = ''; - idx = 0; - i = 0; - while ( idx < str.length ) { - brk = nextGraphemeClusterBreak( str, idx ); - if ( brk === -1 ) { - brk = str.length; - } - if ( i >= start && i < end ) { - result += str.substring( idx, brk ); - } - idx = brk; - i += 1; - if ( i >= end ) { - break; - } - } - return result; -} - - -// EXPORTS // - -module.exports = sliceGraphemeClusters; diff --git a/base/slice-grapheme-clusters/package.json b/base/slice-grapheme-clusters/package.json deleted file mode 100644 index d24fd3e5..00000000 --- a/base/slice-grapheme-clusters/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/slice-grapheme-clusters", - "version": "0.0.0", - "description": "Slice a string based on grapheme cluster (i.e., user-perceived character) indices.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "slice", - "substring", - "substr", - "unicode", - "grapheme", - "emojis" - ] -} diff --git a/base/slice-grapheme-clusters/test/test.js b/base/slice-grapheme-clusters/test/test.js deleted file mode 100644 index f93167a0..00000000 --- a/base/slice-grapheme-clusters/test/test.js +++ /dev/null @@ -1,157 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var sliceGraphemeClusters = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof sliceGraphemeClusters, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 3', function test( t ) { - t.strictEqual( sliceGraphemeClusters.length, 3, 'the function has an arity of 3' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty input string', function test( t ) { - var out; - - out = sliceGraphemeClusters( '', 0, 1 ); - t.strictEqual( out, '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an empty string if the starting index is greater than or equal to the ending index', function test( t ) { - var out; - - out = sliceGraphemeClusters( 'hello', 2, 2 ); - t.strictEqual( out, '', 'returns expected value' ); - - out = sliceGraphemeClusters( 'hello', 3, 2 ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty string if the starting index is greater than or equal to the string length', function test( t ) { - var out; - - out = sliceGraphemeClusters( 'hello', 5, 6 ); - t.strictEqual( out, '', 'returns expected value' ); - - out = sliceGraphemeClusters( 'hello', 10, 12 ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function slices an input string based on grapheme cluster indices', function test( t ) { - var out; - - out = sliceGraphemeClusters( 'hello', 0, 3 ); - t.strictEqual( out, 'hel', 'returns expected value' ); - - out = sliceGraphemeClusters( '🌷🍕👉🏿', 1, 2 ); - t.strictEqual( out, '🍕', 'returns expected value' ); - - out = sliceGraphemeClusters( 'अनुच्छेद', 1, 5 ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - out = sliceGraphemeClusters( '六书/六書', 1, 5 ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - out = sliceGraphemeClusters( '🏝️🌷', 1, 2 ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function slices an input string based on grapheme cluster indices (skin-tone emojis)', function test( t ) { - var out; - - out = sliceGraphemeClusters( '🌷👨‍👩‍👧‍👦👉🏿', 1, 2 ); - t.strictEqual( out, '👨‍👩‍👧‍👦', 'returns expected value' ); - - out = sliceGraphemeClusters( '🏝️👨‍👩‍👧‍👦', 1, 2 ); - t.strictEqual( out, '👨‍👩‍👧‍👦', 'returns expected value' ); - - out = sliceGraphemeClusters( '👋🏾🤦🏽‍♀️🧑🏿', 1, 2 ); - t.strictEqual( out, '🤦🏽‍♀️', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing negative indices', function test( t ) { - var out; - - out = sliceGraphemeClusters( 'hello', -5, -2 ); - t.strictEqual( out, 'hel', 'returns expected value' ); - - out = sliceGraphemeClusters( '🌷🍕👉🏿', -2, -1 ); - t.strictEqual( out, '🍕', 'returns expected value' ); - - out = sliceGraphemeClusters( 'अनुच्छेद', -4, -1 ); - t.strictEqual( out, 'नुच्छे', 'returns expected value' ); - - out = sliceGraphemeClusters( '六书/六書', -3, 5 ); - t.strictEqual( out, '/六書', 'returns expected value' ); - - out = sliceGraphemeClusters( '🏝️🌷', -1, 2 ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing negative indices (skin-tone emojis)', function test( t ) { - var out; - - out = sliceGraphemeClusters( '🌷👨‍👩‍👧‍👦👉🏿', -2, -1 ); - t.strictEqual( out, '👨‍👩‍👧‍👦', 'returns expected value' ); - - out = sliceGraphemeClusters( '🏝️👨‍👩‍👧‍👦', -1, 4 ); - t.strictEqual( out, '👨‍👩‍👧‍👦', 'returns expected value' ); - - out = sliceGraphemeClusters( '👋🏾🤦🏽‍♀️🧑🏿‍🦱', -2, -1 ); - t.strictEqual( out, '🤦🏽‍♀️', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function truncates the end index to the string length', function test( t ) { - var out; - - out = sliceGraphemeClusters( 'hello', 0, 10 ); - t.strictEqual( out, 'hello', 'returns expected value' ); - - out = sliceGraphemeClusters( '六书/六書', 1, 10 ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - out = sliceGraphemeClusters( '🏝️🌷', 0, 5 ); - t.strictEqual( out, '🏝️🌷', 'returns expected value' ); - - t.end(); -}); diff --git a/base/slice/README.md b/base/slice/README.md deleted file mode 100644 index df26d556..00000000 --- a/base/slice/README.md +++ /dev/null @@ -1,102 +0,0 @@ - - -# slice - -> Slice UTF-16 code units from a string. - -
- -## Usage - -```javascript -var slice = require( '@stdlib/string/base/slice' ); -``` - -#### slice( str, start, end ) - -Slices UTF-16 code units from a string. - -```javascript -var out = slice( 'last man standing', 1, 17 ); -// returns 'ast man standing' - -out = slice( 'Hidden Treasures', 0, 6 ); -// returns 'Hidden' - -out = slice( 'foo bar', 2, 7 ); -// returns 'o bar' - -out = slice( 'foo bar', -1, 7 ); -// returns 'r' -``` - -The function accepts the following arguments: - -- **str**: input string. -- **start**: slice start index (inclusive). -- **end**: slice end index (exclusive). - -
- - - -
- -## Examples - - - -```javascript -var slice = require( '@stdlib/string/base/slice' ); - -var str = slice( 'presidential election', 1, 21 ); -// returns 'residential election' - -str = slice( 'JavaScript', 4, 10 ); -// returns 'Script' - -str = slice( 'The Last of the Mohicans', 5, 24 ); -// returns 'ast of the Mohicans' -``` - -
- - - - - - - - - - - - - - diff --git a/base/slice/benchmark/benchmark.js b/base/slice/benchmark/benchmark.js deleted file mode 100644 index 4bb6202d..00000000 --- a/base/slice/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var slice = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = slice( values[ i%values.length ], 1, 6 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/slice/docs/repl.txt b/base/slice/docs/repl.txt deleted file mode 100644 index 926d5437..00000000 --- a/base/slice/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( str, start, end ) - Slices UTF-16 code units from a string. - - Parameters - ---------- - str: string - Input string. - - start: integer - Slice start index (inclusive). - - end: integer - Slice end index (exclusive). - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep', 1, 4 ) - 'eep' - > out = {{alias}}( 'Boop', 1, 4 ) - 'oop' - > out = {{alias}}( 'foo bar', 5, 7 ) - 'ar' - - See Also - -------- diff --git a/base/slice/docs/types/index.d.ts b/base/slice/docs/types/index.d.ts deleted file mode 100644 index 32a09472..00000000 --- a/base/slice/docs/types/index.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Slices UTF-16 code units from a string. -* -* @param str - input string -* @param start - slice start index (inclusive) -* @param end - slice end index (exclusive) -* @returns output string -* -* @example -* var out = slice( 'last man standing', 1, 17 ); -* // returns 'ast man standing' -* -* @example -* var out = slice( 'presidential election', 1, 21 ); -* // returns 'residential election' -* -* @example -* var out = slice( 'JavaScript', 4, 10 ); -* // returns 'Script' -* -* @example -* var out = slice( 'Hidden Treasures', 0, 6 ); -* // returns 'Hidden' -* -* @example -* var out = slice( 'foo bar', 2, 7 ); -* // returns 'o bar' -* -* @example -* var out = slice( 'foo bar', -1, 7 ); -* // returns 'r' -*/ -declare function slice( str: string, start: number, end: number ): string; - - -// EXPORTS // - -export = slice; diff --git a/base/slice/docs/types/test.ts b/base/slice/docs/types/test.ts deleted file mode 100644 index 14ed8c81..00000000 --- a/base/slice/docs/types/test.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import slice = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - slice( 'abc', 1, 4 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument that is not a string... -{ - slice( true, 1, 3 ); // $ExpectError - slice( false, 1, 3 ); // $ExpectError - slice( null, 1, 3 ); // $ExpectError - slice( undefined, 1, 3 ); // $ExpectError - slice( 5, 1, 3 ); // $ExpectError - slice( [], 1, 3 ); // $ExpectError - slice( {}, 1, 3 ); // $ExpectError - slice( ( x: number ): number => x, 1, 3 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument that is not a number... -{ - slice( 'abc', true, 3 ); // $ExpectError - slice( 'abc', false, 3 ); // $ExpectError - slice( 'abc', null, 3 ); // $ExpectError - slice( 'abc', 'abc', 3 ); // $ExpectError - slice( 'abc', [], 3 ); // $ExpectError - slice( 'abc', {}, 3 ); // $ExpectError - slice( 'abc', ( x: number ): number => x, 3 ); // $ExpectError -} - -// The compiler throws an error if the function is provided a third argument that is not a number... -{ - slice( 'abc', 1, true ); // $ExpectError - slice( 'abc', 1, false ); // $ExpectError - slice( 'abc', 1, null ); // $ExpectError - slice( 'abc', 1, 'abc' ); // $ExpectError - slice( 'abc', 1, [] ); // $ExpectError - slice( 'abc', 1, {} ); // $ExpectError - slice( 'abc', 1, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - slice(); // $ExpectError - slice( 'abc' ); // $ExpectError - slice( 'abc', 1, 2, {} ); // $ExpectError -} diff --git a/base/slice/examples/index.js b/base/slice/examples/index.js deleted file mode 100644 index 2709acdb..00000000 --- a/base/slice/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var slice = require( './../lib' ); - -console.log( slice( 'presidential election', 1, 21 ) ); -// => 'residential election' - -console.log( slice( 'JavaScript', 4, 10 ) ); -// => 'Script' - -console.log( slice( 'The Last of the Mohicans', 5, 24 ) ); -// => 'ast of the Mohicans' diff --git a/base/slice/lib/index.js b/base/slice/lib/index.js deleted file mode 100644 index cd1036f2..00000000 --- a/base/slice/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Slice UTF-16 code units from a string. -* -* @module @stdlib/string/base/slice -* -* @example -* var slice = require( '@stdlib/string/base/slice' ); -* -* var out = slice( 'last man standing', 1, 17 ); -* // returns 'ast man standing' -* -* out = slice( 'Hidden Treasures', 0, 6 ); -* // returns 'Hidden' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/slice/lib/main.js b/base/slice/lib/main.js deleted file mode 100644 index dfecb2c9..00000000 --- a/base/slice/lib/main.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// VARIABLES // - -// Cache a reference to the built-in to prevent prototype mutation shenanigans: -var sliceString = String.prototype.slice; - - -// MAIN // - -/** -* Slices UTF-16 code units from a string. -* -* @param {string} str - input string -* @param {integer} start - slice start index (inclusive) -* @param {integer} end - slice end index (exclusive) -* @returns {string} input string -* -* @example -* var out = slice( 'last man standing', 1, 17 ); -* // returns 'ast man standing' -* -* out = slice( 'Hidden Treasures', 0, 6 ); -* // returns 'Hidden' -*/ -function slice( str, start, end ) { - return sliceString.call( str, start, end ); -} - - -// EXPORTS // - -module.exports = slice; diff --git a/base/slice/package.json b/base/slice/package.json deleted file mode 100644 index 75e20ace..00000000 --- a/base/slice/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/slice", - "version": "0.0.0", - "description": "Slice UTF-16 code units from a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "slice", - "string.slice", - "codeunit", - "unicode" - ] -} diff --git a/base/slice/test/test.js b/base/slice/test/test.js deleted file mode 100644 index 16b1c3e7..00000000 --- a/base/slice/test/test.js +++ /dev/null @@ -1,98 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var slice = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof slice, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function has an arity of 3', function test( t ) { - t.strictEqual( slice.length, 3, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided a second argument greater or equal to string length', function test( t ) { - t.strictEqual( slice( 'hello world', 12, 4 ), '', 'returns expected value' ); - t.strictEqual( slice( 'hello world', 11, 4 ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function slices the UTF-16 code units of a provided string (positive indices)', function test( t ) { - var out; - - out = slice( 'hello world', 1, 11 ); - t.strictEqual( out, 'ello world', 'returns expected value' ); - - out = slice( 'hello world', 7, 11 ); - t.strictEqual( out, 'orld', 'returns expected value' ); - - out = slice( '!!!', 1, 3 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = slice( '!!!', 2, 3 ); - t.strictEqual( out, '!', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function slices the UTF-16 code units of a provided string (negative start index)', function test( t ) { - var out; - - out = slice( 'hello world', -4, 11 ); - t.strictEqual( out, 'orld', 'returns expected value' ); - - out = slice( 'hello world', -7, 11 ); - t.strictEqual( out, 'o world', 'returns expected value' ); - - out = slice( '!!!', -1, 3 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = slice( '!!!', -2, 3 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function slices the UTF-16 code units of a provided string (negative end index)', function test( t ) { - var out; - - out = slice( 'hello world', 0, -8 ); - t.strictEqual( out, 'hel', 'returns expected value' ); - - out = slice( 'hello world', 4, -2 ); - t.strictEqual( out, 'o wor', 'returns expected value' ); - - out = slice( '!!!', 0, -1 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = slice( '!!!', 1, -1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - t.end(); -}); diff --git a/base/snakecase/README.md b/base/snakecase/README.md deleted file mode 100644 index 6b0381eb..00000000 --- a/base/snakecase/README.md +++ /dev/null @@ -1,127 +0,0 @@ - - -# snakecase - -> Convert a string to snake case. - - - -
- -## Usage - -```javascript -var snakecase = require( '@stdlib/string/base/snakecase' ); -``` - -#### snakecase( str ) - -Converts a string to snake case. - -```javascript -var str = snakecase( 'Foo Bar' ); -// returns 'foo_bar' - -str = snakecase( 'I am a tiny little house' ); -// returns 'i_am_a_tiny_little_house' - -str = snakecase( 'Hello World!' ); -// returns 'hello_world' -``` - -
- - - - - -
- -## Examples - -```javascript -var snakecase = require( '@stdlib/string/base/snakecase' ); - -var str = 'foo bar baz'; -var out = snakecase( str ); -// returns 'foo_bar_baz' - -str = 'foo_baz'; -out = snakecase( str ); -// returns 'foo_baz' - -str = 'foo_bar_baz!'; -out = snakecase( str ); -// returns 'foo_bar_baz' - -str = 'beep boop!'; -out = snakecase( str ); -// returns 'beep_boop' - -str = 'foo-baz'; -out = snakecase( str ); -// returns 'foo_baz' - -str = 'Welcome! 😀'; -out = snakecase( str ); -// returns 'welcome_😀' -``` - -
- - - - - - - - - - - - - - diff --git a/base/snakecase/benchmark/benchmark.js b/base/snakecase/benchmark/benchmark.js deleted file mode 100644 index 069b56f3..00000000 --- a/base/snakecase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var snakecase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = snakecase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/snakecase/docs/repl.txt b/base/snakecase/docs/repl.txt deleted file mode 100644 index 39cc133c..00000000 --- a/base/snakecase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to snake case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Snake-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'hello_world' - > out = {{alias}}( 'I am a tiny little teapot' ) - 'i_am_a_tiny_little_teapot' - - See Also - -------- diff --git a/base/snakecase/docs/types/index.d.ts b/base/snakecase/docs/types/index.d.ts deleted file mode 100644 index baa183dd..00000000 --- a/base/snakecase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to snake case. -* -* @param str - string to convert -* @returns snake-cased string -* -* @example -* var str = snakecase( 'fooBar' ); -* // returns 'foo_bar' -* -* @example -* var str = snakecase( 'foo-bar' ); -* // returns 'foo_bar' -* -* @example -* var str = snakecase( 'foo_bar' ); -* // returns 'foo_bar' -*/ -declare function snakecase( str: string ): string; - - -// EXPORTS // - -export = snakecase; diff --git a/base/snakecase/docs/types/test.ts b/base/snakecase/docs/types/test.ts deleted file mode 100644 index e8cd9e39..00000000 --- a/base/snakecase/docs/types/test.ts +++ /dev/null @@ -1,44 +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. -*/ - -import snakecase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - snakecase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - snakecase( true ); // $ExpectError - snakecase( false ); // $ExpectError - snakecase( null ); // $ExpectError - snakecase( undefined ); // $ExpectError - snakecase( 5 ); // $ExpectError - snakecase( [] ); // $ExpectError - snakecase( {} ); // $ExpectError - snakecase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - snakecase(); // $ExpectError -} diff --git a/base/snakecase/examples/index.js b/base/snakecase/examples/index.js deleted file mode 100644 index 2d96ca13..00000000 --- a/base/snakecase/examples/index.js +++ /dev/null @@ -1,51 +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. -*/ - -'use strict'; - -var snakecase = require( './../lib' ); - -var str = 'foo bar baz'; -var out = snakecase( str ); -console.log( out ); -// => 'foo_bar_baz' - -str = 'foo_baz'; -out = snakecase( str ); -console.log( out ); -// => 'foo_baz' - -str = 'foo_bar_baz!'; -out = snakecase( str ); -console.log( out ); -// => 'foo_bar_baz' - -str = 'beep boop!'; -out = snakecase( str ); -console.log( out ); -// => 'beep_boop' - -str = 'foo_baz'; -out = snakecase( str ); -console.log( out ); -// => 'foo_baz' - -str = 'Welcome! 😀'; -out = snakecase( str ); -console.log( out ); -// => 'welcome_😀' diff --git a/base/snakecase/lib/index.js b/base/snakecase/lib/index.js deleted file mode 100644 index bff9c9da..00000000 --- a/base/snakecase/lib/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -/** -* Convert a string to snake case. -* -* @module @stdlib/string/base/snakecase -* -* @example -* var snakecase = require( '@stdlib/string/base/snakecase' ); -* -* var str = snakecase( 'Foo Bar' ); -* // returns 'foo_bar' -* -* str = snakecase( 'I am a tiny little house' ); -* // returns 'i_am_a_tiny_little_house' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/snakecase/lib/main.js b/base/snakecase/lib/main.js deleted file mode 100644 index 13911b75..00000000 --- a/base/snakecase/lib/main.js +++ /dev/null @@ -1,74 +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. -*/ - -'use strict'; - -// MODULES // - -var lowercase = require( './../../../base/lowercase' ); -var replace = require( './../../../base/replace' ); -var trim = require( './../../../base/trim' ); - - -// VARIABLES // - -var RE_WHITESPACE = /\s+/g; -var RE_SPECIAL = /[\-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape -var RE_CAMEL = /([a-z0-9])([A-Z])/g; - - -// MAIN // - -/** -* Converts a string to snake case. -* -* @param {string} str - string to convert -* @returns {string} snake-cased string -* -* @example -* var str = snakecase( 'Hello World!' ); -* // returns 'hello_world' -* -* @example -* var str = snakecase( 'foo bar' ); -* // returns 'foo_bar' -* -* @example -* var str = snakecase( 'I am a tiny little teapot' ); -* // returns 'i_am_a_tiny_little_teapot' -* -* @example -* var str = snakecase( 'BEEP boop' ); -* // returns 'beep_boop' -* -* @example -* var str = snakecase( 'isMobile' ); -* // returns 'is_mobile' -*/ -function snakecase( str ) { - str = replace( str, RE_SPECIAL, ' ' ); - str = replace( str, RE_CAMEL, '$1 $2' ); - str = trim( str ); - str = replace( str, RE_WHITESPACE, '_' ); - return lowercase( str ); -} - - -// EXPORTS // - -module.exports = snakecase; diff --git a/base/snakecase/package.json b/base/snakecase/package.json deleted file mode 100644 index b8732e55..00000000 --- a/base/snakecase/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/snakecase", - "version": "0.0.0", - "description": "Convert a string to snake case.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "case", - "convert", - "snake" - ], - "__stdlib__": {} -} diff --git a/base/snakecase/test/test.js b/base/snakecase/test/test.js deleted file mode 100644 index e94c1da1..00000000 --- a/base/snakecase/test/test.js +++ /dev/null @@ -1,196 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var snakecase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof snakecase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a string to snake case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo', - 'foo-bar', - 'fooBar', - 'foo_bar', - 'foo-bar-baz', - 'foo_bar_baz', - 'foo bar baz', - 'foo bar baz qux', - 'foo_bar_baz_qux', - 'foo_bar baz qux' - ]; - - expected = [ - 'foo', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar_baz', - 'foo_bar_baz', - 'foo_bar_baz', - 'foo_bar_baz_qux', - 'foo_bar_baz_qux', - 'foo_bar_baz_qux' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( snakecase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function converts a camel case string to snake case', function test( t ) { - var expected; - var actual; - var str; - - str = 'helloWorld'; - expected = 'hello_world'; - actual = snakecase( str ); - - str = 'isMobile'; - expected = 'is_mobile'; - actual = snakecase( str ); - - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to snake case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'fóoBár', - 'ру́сский язык', - '😀😀 😀', - 'ру́сский язы́к', - 'Привет мир', - '안녕하세요', - '你好世界', - '신규 서비스' - ]; - expected = [ - 'fóo_bár', - 'ру́сский_язык', - '😀😀_😀', - 'ру́сский_язы́к', - 'привет_мир', - '안녕하세요', - '你好世界', - '신규_서비스' - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( snakecase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function converts a string with special characters to snake case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo!bar', - 'foo@bar', - 'foo#bar', - 'foo$bar', - 'foo%bar', - 'foo^bar', - 'foo&bar', - 'foo*bar', - 'foo(bar', - 'foo)bar', - 'foo[bar', - 'foo]bar', - 'foo{bar', - 'foo}bar', - 'foo|bar', - 'foo~bar', - 'foo:"bar', - 'foo\'bar', - 'foobar', - 'foo?bar', - 'foo/bar' - ]; - - expected = [ - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( snakecase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function returns a string unchanged if already in snake case', function test( t ) { - var expected; - var actual; - - expected = 'foo_bar'; - actual = snakecase( expected ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'client_side_rendering'; - actual = snakecase( expected ); - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); diff --git a/base/startcase/README.md b/base/startcase/README.md deleted file mode 100644 index 4bbaacc1..00000000 --- a/base/startcase/README.md +++ /dev/null @@ -1,113 +0,0 @@ - - -# startcase - -> Capitalize the first letter of each word in a string. - -
- -
- - - -
- -## Usage - -```javascript -var startcase = require( '@stdlib/string/base/startcase' ); -``` - -#### startcase( str ) - -Capitalizes the first letter of each word in a string. - -```javascript -var str = startcase( 'beep boop a foo bar' ); -// returns 'Beep Boop A Foo Bar' -``` - -
- - - -
- -## Examples - - - -```javascript -var startcase = require( '@stdlib/string/base/startcase' ); - -var str = startcase( 'beep boop foo bar' ); -// returns 'Beep Boop Foo Bar' - -str = startcase( 'Beep' ); -// returns 'Beep' - -str = startcase( 'BeEp' ); -// returns 'BeEp' - -str = startcase( '$**_beep_BoOp_**$' ); -// returns '$**_beep_BoOp_**$' - -str = startcase( '' ); -// returns '' -``` - -
- - - - - - - - - - - - - - diff --git a/base/startcase/benchmark/benchmark.js b/base/startcase/benchmark/benchmark.js deleted file mode 100644 index 8fd5a4bf..00000000 --- a/base/startcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var startcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = startcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/startcase/docs/repl.txt b/base/startcase/docs/repl.txt deleted file mode 100644 index 666e4151..00000000 --- a/base/startcase/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( str ) - Capitalizes the first letter of each word in an input string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - String containing words where each first letter is capitalized. - - Examples - -------- - > var out = {{alias}}( 'beep boop' ) - 'Beep Boop' - - See Also - -------- - diff --git a/base/startcase/docs/types/index.d.ts b/base/startcase/docs/types/index.d.ts deleted file mode 100644 index cab628f3..00000000 --- a/base/startcase/docs/types/index.d.ts +++ /dev/null @@ -1,36 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Capitalizes the first letter of each word in an input string. -* -* @param str - string to convert -* @returns start-cased string -* -* @example -* var str = startcase( 'beep boop foo bar' ); -* // returns 'Beep Boop Foo Bar' -*/ -declare function startcase( str: string ): string; - - -// EXPORTS // - -export = startcase; diff --git a/base/startcase/docs/types/test.ts b/base/startcase/docs/types/test.ts deleted file mode 100644 index cb4bc8ab..00000000 --- a/base/startcase/docs/types/test.ts +++ /dev/null @@ -1,44 +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. -*/ - -import startcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - startcase( 'Last man standing' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - startcase( true ); // $ExpectError - startcase( false ); // $ExpectError - startcase( null ); // $ExpectError - startcase( undefined ); // $ExpectError - startcase( 5 ); // $ExpectError - startcase( [] ); // $ExpectError - startcase( {} ); // $ExpectError - startcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - startcase(); // $ExpectError -} diff --git a/base/startcase/examples/index.js b/base/startcase/examples/index.js deleted file mode 100644 index 9ae217a8..00000000 --- a/base/startcase/examples/index.js +++ /dev/null @@ -1,41 +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. -*/ - -'use strict'; - -var startcase = require( './../lib' ); - -var str = startcase( 'beep boop foo bar' ); -console.log( str ); -// => 'Beep Boop Foo Bar' - -str = startcase( 'Beep' ); -console.log( str ); -// => 'Beep' - -str = startcase( 'BeEp' ); -console.log( str ); -// => 'BeEp' - -str = startcase( '$**_beep_BoOp_**$' ); -console.log( str ); -// => '$**_beep_BoOp_**$' - -str = startcase( '' ); -console.log( str ); -// => '' diff --git a/base/startcase/lib/index.js b/base/startcase/lib/index.js deleted file mode 100644 index ccf32b84..00000000 --- a/base/startcase/lib/index.js +++ /dev/null @@ -1,40 +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. -*/ - -'use strict'; - -/** -* Capitalize the first letter of each word in an input string. -* -* @module @stdlib/string/base/startcase -* -* @example -* var startcase = require( '@stdlib/string/base/startcase' ); -* -* var str = startcase( 'beep boop foo bar' ); -* // returns 'Beep Boop Foo Bar' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/startcase/lib/main.js b/base/startcase/lib/main.js deleted file mode 100644 index ac5c5ee2..00000000 --- a/base/startcase/lib/main.js +++ /dev/null @@ -1,62 +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. -*/ - -'use strict'; - -// MODULES // - -var reWhitespace = require( '@stdlib/regexp/whitespace' ).REGEXP; - - -// MAIN // - -/** -* Capitalizes the first letter of each word in an input string. -* -* @param {string} str - string to convert -* @returns {string} start case string -* -* @example -* var str = startcase( 'beep boop foo bar' ); -* // returns 'Beep Boop Foo Bar' -*/ -function startcase( str ) { - var cap; - var out; - var ch; - var i; - - cap = true; - out = ''; - for ( i = 0; i < str.length; i++ ) { - ch = str.charAt( i ); - if ( reWhitespace.test( ch ) ) { - cap = true; - } else if ( cap ) { - ch = ch.toUpperCase(); - cap = false; - } - out += ch; - } - return out; -} - - -// EXPORTS // - -module.exports = startcase; diff --git a/base/startcase/package.json b/base/startcase/package.json deleted file mode 100644 index ee71bc8c..00000000 --- a/base/startcase/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/base/startcase", - "version": "0.0.0", - "description": "Capitalize the first letter of each word in a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "upper", - "case", - "start", - "title", - "startcase", - "uppercase", - "capitalize", - "convert", - "string", - "str" - ] -} diff --git a/base/startcase/test/test.js b/base/startcase/test/test.js deleted file mode 100644 index a2718d6e..00000000 --- a/base/startcase/test/test.js +++ /dev/null @@ -1,66 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var startcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof startcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a string to start case', function test( t ) { - var expected; - var values; - var actual; - var i; - - values = [ - 'beep boop a foo bar', - 'beep\nboop', - 'beep', - 'Beep', - 'BeEp', - 'Beep BOOP', - '$**_Beep_BoOp_**$', - '' - ]; - expected = [ - 'Beep Boop A Foo Bar', - 'Beep\nBoop', - 'Beep', - 'Beep', - 'BeEp', - 'Beep BOOP', - '$**_Beep_BoOp_**$', - '' - ]; - for ( i = 0; i < values.length; i++ ) { - actual = startcase( values[i] ); - t.strictEqual( actual, expected[i], 'converts string to '+expected[i] ); - } - t.end(); -}); diff --git a/base/starts-with/README.md b/base/starts-with/README.md deleted file mode 100644 index 47aad076..00000000 --- a/base/starts-with/README.md +++ /dev/null @@ -1,151 +0,0 @@ - - -# startsWith - -> Test if a string starts with the characters of another string. - -
- -
- - - -
- -## Usage - -```javascript -var startsWith = require( '@stdlib/string/base/starts-with' ); -``` - -#### startsWith( str, search, position ) - -Tests if a string starts with the characters of another string. - -```javascript -var str = 'To be, or not to be, that is the question.'; - -var bool = startsWith( str, 'To be', 0 ); -// returns true - -bool = startsWith( str, 'to be', 0 ); -// returns false -``` - -To search from a specific character index, provide a `position` value (zero-based). If provided a negative `position`, the start index is determined relative to the string end (i.e., `pos = str.length + position`). - -```javascript -var str = 'Remember the story I used to tell you when you were a boy?'; - -var bool = startsWith( str, 'the story', 0 ); -// returns false - -bool = startsWith( str, 'the story', 9 ); -// returns true - -bool = startsWith( str, 'you', -15 ); -// returns true -``` - -If provided an empty `search` string, the function **always** returns `true`. - -```javascript -var str = 'beep boop'; - -var bool = startsWith( str, '', 0 ); -// returns true -``` - -
- - - -
- -## Notes - -- This function differs from [`String.prototype.startsWith`][mdn-string-startswith] in the following ways: - - - The function assumes string values for the first and second arguments and assumes that the `position` argument is an integer value. - - The function does **not** clamp negative `position` values. Instead, when provided a negative `position`, the function resolves the starting search position relative to the end of the string. - - Except when provided an empty `search` string, the function **always** returns `false` if a `position` resolves to a starting search position which exceeds the bounds of the input string. - -
- - - -
- -## Examples - - - -```javascript -var startsWith = require( '@stdlib/string/base/starts-with' ); - -var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; - -var bool = startsWith( str, 'Fair', 0 ); -// returns true - -bool = startsWith( str, 'fair', 0 ); -// returns false - -bool = startsWith( str, 'foul', 8 ); -// returns true - -bool = startsWith( str, 'filthy', -10 ); -// returns true -``` - -
- - - - - - - - - - - - - - diff --git a/base/starts-with/benchmark/benchmark.js b/base/starts-with/benchmark/benchmark.js deleted file mode 100644 index e12df55d..00000000 --- a/base/starts-with/benchmark/benchmark.js +++ /dev/null @@ -1,149 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var startsWith = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': typeof String.prototype.startsWith !== 'function' -}; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'To be', - 'To ba', - 'To bi' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = startsWith( str, values[ i%values.length ], 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(); -}); - -bench( format( '%s::substring', pkg ), function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'to be', - 'to ba', - 'to bi' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = startsWith( str, values[ i%values.length ], 14 ); - 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(); -}); - -bench( format( '%s::builtin', pkg ), opts, function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'To be', - 'To ba', - 'To bi' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = str.startsWith( values[ i%values.length ], 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(); -}); - -bench( format( '%s::builtin,substring', pkg ), opts, function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'to be', - 'to ba', - 'to bi' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = str.startsWith( values[ i%values.length ], 14 ); - 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/base/starts-with/benchmark/benchmark.polyfill.js b/base/starts-with/benchmark/benchmark.polyfill.js deleted file mode 100644 index ef4018f7..00000000 --- a/base/starts-with/benchmark/benchmark.polyfill.js +++ /dev/null @@ -1,86 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var startsWith = require( './../lib/polyfill.js' ); - - -// MAIN // - -bench( format( '%s::polyfill', pkg ), function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'To be', - 'To ba', - 'To bi' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = startsWith( str, values[ i%values.length ], 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(); -}); - -bench( format( '%s::polyfill,substring', pkg ), function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'to be', - 'to ba', - 'to bi' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = startsWith( str, values[ i%values.length ], 14 ); - 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/base/starts-with/docs/repl.txt b/base/starts-with/docs/repl.txt deleted file mode 100644 index fcc5649d..00000000 --- a/base/starts-with/docs/repl.txt +++ /dev/null @@ -1,40 +0,0 @@ - -{{alias}}( str, search, position ) - Tests if a string starts with the characters of another string. - - If provided an empty search string, the function always returns `true`. - - Parameters - ---------- - str: string - Input string. - - search: string - Search string. - - position: integer - Position at which to start searching for `search`. If less than `0`, the - start position is determined relative to the end of the input string. - - Returns - ------- - bool: boolean - Boolean indicating whether a string starts with the characters of - another string. - - Examples - -------- - > var bool = {{alias}}( 'Beep', 'Be', 0 ) - true - > bool = {{alias}}( 'Beep', 'ep', 0 ) - false - > bool = {{alias}}( 'Beep', 'ee', 1 ) - true - > bool = {{alias}}( 'Beep', 'ee', -3 ) - true - > bool = {{alias}}( 'Beep', '', 0 ) - true - - See Also - -------- - diff --git a/base/starts-with/docs/types/index.d.ts b/base/starts-with/docs/types/index.d.ts deleted file mode 100644 index b022ba70..00000000 --- a/base/starts-with/docs/types/index.d.ts +++ /dev/null @@ -1,62 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Tests if a string starts with the characters of another string. -* -* ## Notes -* -* - If provided a negative `position`, the search starting position is resolved relative to the end of the string. For example, if provided the input string `'beep boop'` and a `position` equal to `-2`, the starting position resolves to `7`. -* -* @param str - input string -* @param search - search string -* @param position - position at which to start searching -* @returns boolean indicating if the input string starts with the search string -* -* @example -* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember', 0 ); -* // returns true -* -* @example -* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember', 0 ); -* // returns false -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be', 0 ); -* // returns true -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 0 ); -* // returns false -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 ); -* // returns true -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 ); -* // returns true -*/ -declare function startsWith( str: string, search: string, position: number ): boolean; - - -// EXPORTS // - -export = startsWith; diff --git a/base/starts-with/docs/types/test.ts b/base/starts-with/docs/types/test.ts deleted file mode 100644 index 5c9cd186..00000000 --- a/base/starts-with/docs/types/test.ts +++ /dev/null @@ -1,59 +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. -*/ - -import startsWith = require( './index' ); - - -// TESTS // - -// The function returns a boolean... -{ - startsWith( 'abd', 'b', 1 ); // $ExpectType boolean - startsWith( 'abd', 'ab', 1 ); // $ExpectType boolean -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - startsWith( true, 'd', 0 ); // $ExpectError - startsWith( false, 'd', 0 ); // $ExpectError - startsWith( 3, 'd', 0 ); // $ExpectError - startsWith( [], 'd', 0 ); // $ExpectError - startsWith( {}, 'd', 0 ); // $ExpectError - startsWith( ( x: number ): number => x, 'd', 0 ); // $ExpectError - - startsWith( 'abd', true, 0 ); // $ExpectError - startsWith( 'abd', false, 0 ); // $ExpectError - startsWith( 'abd', 5, 0 ); // $ExpectError - startsWith( 'abd', [], 0 ); // $ExpectError - startsWith( 'abd', {}, 0 ); // $ExpectError - startsWith( 'abd', ( x: number ): number => x, 0 ); // $ExpectError - - startsWith( 'abd', 'a', true ); // $ExpectError - startsWith( 'abd', 'a', false ); // $ExpectError - startsWith( 'abd', 'a', '5' ); // $ExpectError - startsWith( 'abd', 'b', [] ); // $ExpectError - startsWith( 'abd', 'b', {} ); // $ExpectError - startsWith( 'abd', 'b', /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - startsWith(); // $ExpectError - startsWith( 'abc' ); // $ExpectError - startsWith( 'abc', 'a' ); // $ExpectError -} diff --git a/base/starts-with/examples/index.js b/base/starts-with/examples/index.js deleted file mode 100644 index 1e130b00..00000000 --- a/base/starts-with/examples/index.js +++ /dev/null @@ -1,35 +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. -*/ - -'use strict'; - -var startsWith = require( './../lib' ); - -var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; - -console.log( startsWith( str, 'Fair', 0 ) ); -// => true - -console.log( startsWith( str, 'fair', 0 ) ); -// => false - -console.log( startsWith( str, 'foul', 8 ) ); -// => true - -console.log( startsWith( str, 'filthy', -10 ) ); -// => true diff --git a/base/starts-with/lib/builtin.js b/base/starts-with/lib/builtin.js deleted file mode 100644 index 55ec2c47..00000000 --- a/base/starts-with/lib/builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var startsWith = String.prototype.startsWith; - - -// EXPORTS // - -module.exports = startsWith; diff --git a/base/starts-with/lib/has_builtin.js b/base/starts-with/lib/has_builtin.js deleted file mode 100644 index 953e6523..00000000 --- a/base/starts-with/lib/has_builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var bool = ( typeof String.prototype.startsWith !== 'undefined' ); - - -// EXPORTS // - -module.exports = bool; diff --git a/base/starts-with/lib/index.js b/base/starts-with/lib/index.js deleted file mode 100644 index 92c9cd44..00000000 --- a/base/starts-with/lib/index.js +++ /dev/null @@ -1,62 +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. -*/ - -'use strict'; - -/** -* Test if a string starts with the characters of another string. -* -* @module @stdlib/string/base/starts-with -* -* @example -* var startsWith = require( '@stdlib/string/base/starts-with' ); -* -* var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; -* var bool = startsWith( str, 'Fair', 0 ); -* // returns true -* -* bool = startsWith( str, 'fair', 0 ); -* // returns false -* -* bool = startsWith( str, 'foul', 8 ); -* // returns true -* -* bool = startsWith( str, 'filthy', -10 ); -* // returns true -*/ - -// MODULES // - -var HAS_BUILTIN = require( './has_builtin.js' ); -var polyfill = require( './polyfill.js' ); -var main = require( './main.js' ); - - -// MAIN // - -var startsWith; -if ( HAS_BUILTIN ) { - startsWith = main; -} else { - startsWith = polyfill; -} - - -// EXPORTS // - -module.exports = startsWith; diff --git a/base/starts-with/lib/main.js b/base/starts-with/lib/main.js deleted file mode 100644 index aa184478..00000000 --- a/base/starts-with/lib/main.js +++ /dev/null @@ -1,82 +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. -*/ - -'use strict'; - -// MODULES // - -var builtin = require( './builtin.js' ); - - -// MAIN // - -/** -* Tests if a string starts with the characters of another string. -* -* @param {string} str - input string -* @param {string} search - search string -* @param {integer} position - position at which to start searching -* @returns {boolean} boolean indicating if the input string starts with the search string -* -* @example -* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember', 0 ); -* // returns true -* -* @example -* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember', 0 ); -* // returns false -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be', 0 ); -* // returns true -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 0 ); -* // returns false -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 ); -* // returns true -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 ); -* // returns true -*/ -function startsWith( str, search, position ) { - var pos; - if ( position < 0 ) { - pos = str.length + position; - } else { - pos = position; - } - if ( search.length === 0 ) { - return true; - } - if ( - pos < 0 || - pos + search.length > str.length - ) { - return false; - } - return builtin.call( str, search, pos ); -} - - -// EXPORTS // - -module.exports = startsWith; diff --git a/base/starts-with/lib/polyfill.js b/base/starts-with/lib/polyfill.js deleted file mode 100644 index d4157036..00000000 --- a/base/starts-with/lib/polyfill.js +++ /dev/null @@ -1,84 +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. -*/ - -'use strict'; - -// MAIN // - -/** -* Tests if a string starts with the characters of another string. -* -* @private -* @param {string} str - input string -* @param {string} search - search string -* @param {integer} position - position at which to start searching -* @returns {boolean} boolean indicating if the input string starts with the search string -* -* @example -* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember', 0 ); -* // returns true -* -* @example -* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember', 0 ); -* // returns false -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be', 0 ); -* // returns true -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 0 ); -* // returns false -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 ); -* // returns true -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 ); -* // returns true -*/ -function startsWith( str, search, position ) { - var pos; - var i; - if ( position < 0 ) { - pos = str.length + position; - } else { - pos = position; - } - if ( search.length === 0 ) { - return true; - } - if ( - pos < 0 || - pos + search.length > str.length - ) { - return false; - } - for ( i = 0; i < search.length; i++ ) { - if ( str.charCodeAt( pos + i ) !== search.charCodeAt( i ) ) { - return false; - } - } - return true; -} - - -// EXPORTS // - -module.exports = startsWith; diff --git a/base/starts-with/package.json b/base/starts-with/package.json deleted file mode 100644 index 77f0da47..00000000 --- a/base/starts-with/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/base/starts-with", - "version": "0.0.0", - "description": "Test if a string starts with the characters of another string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "check", - "begins", - "begin", - "starts", - "start", - "test", - "search", - "match" - ] -} diff --git a/base/starts-with/test/test.js b/base/starts-with/test/test.js deleted file mode 100644 index d5b9e465..00000000 --- a/base/starts-with/test/test.js +++ /dev/null @@ -1,175 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var polyfill = require( './../lib/polyfill.js' ); -var main = require( './../lib/main.js' ); -var startsWith = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof startsWith, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the main export is a polyfill if an environment does not support String.prototype.startsWith', function test( t ) { - var startsWith = proxyquire( './../lib', { - './has_builtin.js': false - }); - t.strictEqual( startsWith, polyfill, 'returns expected value' ); - t.end(); -}); - -tape( 'the main export is a wrapper around a builtin if an environment supports String.prototype.startsWith', function test( t ) { - var startsWith = proxyquire( './../lib', { - './has_builtin.js': true - }); - t.strictEqual( startsWith, main, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `true` if the input string starts with the search value', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'Too', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Not too late, I\'m afraid', 'Not', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome home', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome home!', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if the input string does not start with the search value', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'too', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Not too late, I\'m afraid', 'Never', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome at home', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing a starting search position relative to the beginning of an input string (positive)', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'late', 3 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'late', 4 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'late', 5 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afraid', 14 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing a starting search position relative to the end of an input string (negative)', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'i', -2 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -7 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -6 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -5 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afraid', -6 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input string length', function test( t ) { - var bool = startsWith( 'abc', 'abcde', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length', function test( t ) { - var bool; - - bool = startsWith( 'abc', 'bcd', 1 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'abc', 'bcd', -2 ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `true` if provided an empty search string', function test( t ) { - var bool; - - bool = startsWith( '', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', 10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', -10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a position exceeding the input string length (positive)', function test( t ) { - var bool = startsWith( 'abc', 'c', 99999 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a position exceeding the input string length (negative)', function test( t ) { - var bool = startsWith( 'abc', 'a', -5 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); diff --git a/base/starts-with/test/test.main.js b/base/starts-with/test/test.main.js deleted file mode 100644 index 16a1b440..00000000 --- a/base/starts-with/test/test.main.js +++ /dev/null @@ -1,164 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var HAS_BUILTIN = require( './../lib/has_builtin.js' ); -var startsWith = require( './../lib/main.js' ); - - -// VARIABLES // - -var opts = { - 'skip': !HAS_BUILTIN -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof startsWith, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns `true` if the input string starts with the search value', opts, function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'Too', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Not too late, I\'m afraid', 'Not', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome home', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome home!', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if the input string does not start with the search value', opts, function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'too', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Not too late, I\'m afraid', 'Never', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome at home', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing a starting search position relative to the beginning of an input string (positive)', opts, function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'late', 3 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'late', 4 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'late', 5 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afraid', 14 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing a starting search position relative to the end of an input string (negative)', opts, function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'i', -2 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -7 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -6 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -5 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afraid', -6 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input string length', opts, function test( t ) { - var bool = startsWith( 'abc', 'abcde', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length', opts, function test( t ) { - var bool; - - bool = startsWith( 'abc', 'bcd', 1 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'abc', 'bcd', -2 ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `true` if provided an empty search string', opts, function test( t ) { - var bool; - - bool = startsWith( '', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', 10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', -10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a position exceeding the input string length (positive)', opts, function test( t ) { - var bool = startsWith( 'abc', 'c', 99999 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a position exceeding the input string length (negative)', opts, function test( t ) { - var bool = startsWith( 'abc', 'a', -5 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); diff --git a/base/starts-with/test/test.polyfill.js b/base/starts-with/test/test.polyfill.js deleted file mode 100644 index 2e1b2595..00000000 --- a/base/starts-with/test/test.polyfill.js +++ /dev/null @@ -1,156 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var startsWith = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof startsWith, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns `true` if the input string starts with the search value', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'Too', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Not too late, I\'m afraid', 'Not', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome home', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome home!', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if the input string does not start with the search value', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'too', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Not too late, I\'m afraid', 'Never', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome at home', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing a starting search position relative to the beginning of an input string (positive)', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'late', 3 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'late', 4 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'late', 5 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afraid', 14 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing a starting search position relative to the end of an input string (negative)', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'i', -2 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -7 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -6 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -5 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afraid', -6 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input string length', function test( t ) { - var bool = startsWith( 'abc', 'abcde', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length', function test( t ) { - var bool; - - bool = startsWith( 'abc', 'bcd', 1 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'abc', 'bcd', -2 ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `true` if provided an empty search string', function test( t ) { - var bool; - - bool = startsWith( '', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', 10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', -10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a position exceeding the input string length (positive)', function test( t ) { - var bool = startsWith( 'abc', 'c', 99999 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a position exceeding the input string length (negative)', function test( t ) { - var bool = startsWith( 'abc', 'a', -5 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); diff --git a/base/stickycase/README.md b/base/stickycase/README.md deleted file mode 100644 index a3894272..00000000 --- a/base/stickycase/README.md +++ /dev/null @@ -1,131 +0,0 @@ - - -# stickycase - -> Convert a string to sticky case. - - - -
- -## Usage - -```javascript -var stickycase = require( '@stdlib/string/base/stickycase' ); -``` - -#### stickycase( str\[, p] ) - -Converts a string to sticky case, where each character in the input string is randomly converted to either uppercase or lowercase. - -```javascript -var str = 'hello world'; -var out = stickycase( 'hello world' ); -// returns -``` - -By default, the probability for any character to be capitalized is `0.5`. To set a different probability, provide a `p` argument. - -```javascript -var str = 'welcome!'; -var out = stickycase( 'welcome!', 0.2 ); -// returns - -str = 'good morning'; -out = stickycase( 'good morning', 0.8 ); -// returns -``` - -
- - - - - -
- -## Examples - -```javascript -var stickycase = require( '@stdlib/string/base/stickycase' ); - -var str = 'Hello World!'; -var out = stickycase( str ); -// returns -// returns - -str = 'I am a tiny little teapot'; -out = stickycase( str ); -// returns - -str = 'with big problems'; -out = stickycase( str, 0.1 ); -// returns - -str = 'To be, or not to be: that is the question.'; -out = stickycase( str, 0.9 ); -// returns - -str = 'isMobile'; -out = stickycase( str ); -// returns -``` - -
- - - - - - - - - - - - - - diff --git a/base/stickycase/benchmark/benchmark.js b/base/stickycase/benchmark/benchmark.js deleted file mode 100644 index 1d5377b4..00000000 --- a/base/stickycase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var stickycase = require( './../lib' ); -var pkg = require( './../package.json' ).name; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'hello world', - 'lorem ipsum dolor sit amet', - 'quick brown fox jumps over the lazy dog' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = stickycase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/stickycase/docs/repl.txt b/base/stickycase/docs/repl.txt deleted file mode 100644 index 285e7d40..00000000 --- a/base/stickycase/docs/repl.txt +++ /dev/null @@ -1,27 +0,0 @@ - -{{alias}}( str[, p] ) - Converts a string to sticky case. - - Parameters - ---------- - str: string - Input string. - - p: number - Probability of capitalization. - - Returns - ------- - out: string - Sticky-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - - - > out = {{alias}}( 'I am a tiny little teapot' ) - - See Also - -------- - diff --git a/base/stickycase/docs/types/index.d.ts b/base/stickycase/docs/types/index.d.ts deleted file mode 100644 index 7034da63..00000000 --- a/base/stickycase/docs/types/index.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Converts a string to "sticky caps" case. -* -* @param str - input string -* @param p - probability of capitalization (default: 0.5) -* @returns sticky case string -* -* @example -* var str = stickycase( 'hello world' ); -* // returns -* -* @example -* var str = stickycase( 'hello world', 0.2 ); -* // returns -* -* @example -* var str = stickycase( 'hello world', 0.8 ); -* // returns -*/ -declare function stickycase( str: string, p?: number ): string; - - -// EXPORTS // - -export = stickycase; diff --git a/base/stickycase/docs/types/test.ts b/base/stickycase/docs/types/test.ts deleted file mode 100644 index eb1fa8c1..00000000 --- a/base/stickycase/docs/types/test.ts +++ /dev/null @@ -1,54 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import stickycase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - stickycase( 'hello world' ); // $ExpectType string - stickycase( 'hello world', 0.3 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - stickycase( true ); // $ExpectError - stickycase( false ); // $ExpectError - stickycase( undefined ); // $ExpectError - stickycase( 5 ); // $ExpectError - stickycase( [] ); // $ExpectError - stickycase( {} ); // $ExpectError - stickycase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the second parameter is not a number... -{ - stickycase( 'hello world', true ); // $ExpectError - stickycase( 'hello world', false ); // $ExpectError - stickycase( 'hello world', 'test' ); // $ExpectError - stickycase( 'hello world', [] ); // $ExpectError - stickycase( 'hello world', {} ); // $ExpectError - stickycase( 'hello world', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - stickycase(); // $ExpectError -} diff --git a/base/stickycase/examples/index.js b/base/stickycase/examples/index.js deleted file mode 100644 index 2feff8be..00000000 --- a/base/stickycase/examples/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 stickycase = require( './../lib' ); - -var str = 'Hello World!'; -var out = stickycase( str ); -console.log( out ); -// => - -str = 'I am a tiny little teapot'; -out = stickycase( str ); -console.log( out ); -// => - -str = 'with big problems'; -out = stickycase( str, 0.1 ); -console.log( out ); -// => - -str = 'To be, or not to be: that is the question.'; -out = stickycase( str, 0.9 ); -console.log( out ); -// => - -str = 'isMobile'; -out = stickycase( str, 0.5 ); -console.log( out ); -// => diff --git a/base/stickycase/lib/index.js b/base/stickycase/lib/index.js deleted file mode 100644 index e387ae72..00000000 --- a/base/stickycase/lib/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to "sticky caps" case. -* -* @module @stdlib/string/base/stickycase -* -* @example -* var stickycase = require( '@stdlib/string/base/stickycase' ); -* var str = stickycase( 'hello world' ); -* // returns -* -* @example -* var stickycase = require( '@stdlib/string/base/stickycase' ); -* var str = stickycase( 'hello world', 0.2 ); -* // returns -* -* @example -* var stickycase = require( '@stdlib/string/base/stickycase' ); -* var str = stickycase( 'hello world', 0.8 ); -* // returns -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/stickycase/lib/main.js b/base/stickycase/lib/main.js deleted file mode 100644 index fe5c0483..00000000 --- a/base/stickycase/lib/main.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bernoulli = require( '@stdlib/random/base/bernoulli' ); - - -// MAIN // - -/** -* Converts a string to "sticky caps" case. -* -* @param {string} str - input string -* @param {number} [p=0.5] - probability of capitalization (between 0 and 1) -* @returns {string} converted string -* -* @example -* var str = stickycase( 'hello world' ); -* // returns -* -* @example -* var str = stickycase( 'hello world', 0.2 ); -* // returns -* -* @example -* var str = stickycase( 'hello world', 0.8 ); -* // returns -* -* @example -* var str = stickycase( 'hello world', '0.5' ); -* // returns -*/ -function stickycase( str, p ) { - var result = ''; - var char; - var i; - p = ( typeof p === 'number' && p >= 0 && p <= 1 ) ? p : 0.5; - - for ( i = 0; i < str.length; i++ ) { - char = str.charAt( i ); - if ( bernoulli( p ) ) { - char = char.toUpperCase(); - } else { - char = char.toLowerCase(); - } - result += char; - } - return result; -} - - -// EXPORTS // - -module.exports = stickycase; diff --git a/base/stickycase/package.json b/base/stickycase/package.json deleted file mode 100644 index dfe4cc96..00000000 --- a/base/stickycase/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/stickycase", - "version": "0.0.0", - "description": "Convert a string to sticky case.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "case", - "sticky", - "convert" - ], - "__stdlib__": {} -} diff --git a/base/stickycase/test/test.js b/base/stickycase/test/test.js deleted file mode 100644 index 805700cc..00000000 --- a/base/stickycase/test/test.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 tape = require( 'tape' ); -var stickycase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof stickycase, 'function', 'main export is a function' ); - t.end(); -}); - -tape('the function converts a string to sticky caps case', function test( t ) { - var actual; - - // Test with default probability (p=0.5) - actual = stickycase( 'hello world' ); - t.strictEqual( typeof actual, 'string', 'returns expected value' ); - - // Test with lower probability (p=0.2): - actual = stickycase( 'hello world', 0.2 ); - t.strictEqual( typeof actual, 'string', 'returns expected value' ); - - // Test with higher probability (p=0.8): - actual = stickycase( 'hello world', 0.8 ); - t.strictEqual( typeof actual, 'string', 'returns expected value' ); - - t.end(); -}); diff --git a/base/test/test.js b/base/test/test.js deleted file mode 100644 index 893b0402..00000000 --- a/base/test/test.js +++ /dev/null @@ -1,40 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var objectKeys = require( '@stdlib/utils/keys' ); -var ns = require( './../lib' ); - - -// TESTS // - -tape( 'main export is an object', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ns, 'object', 'main export is an object' ); - t.end(); -}); - -tape( 'the exported object contains base (i.e., lower-level) string functions', function test( t ) { - var keys = objectKeys( ns ); - t.strictEqual( keys.length > 0, true, 'has keys' ); - t.end(); -}); diff --git a/base/trim/README.md b/base/trim/README.md deleted file mode 100644 index 1854a42c..00000000 --- a/base/trim/README.md +++ /dev/null @@ -1,126 +0,0 @@ - - -# trim - -> Trim whitespace characters from the beginning and end of a string. - -
- -## Usage - -```javascript -var trim = require( '@stdlib/string/base/trim' ); -``` - -#### trim( str ) - -Trims whitespace characters from the beginning and end of a string. - -```javascript -var out = trim( ' \t\t\n Beep \r\n\t ' ); -// returns 'Beep' -``` - -
- - - -
- -## Notes - -- Following [Unicode 6.3.0][unicode] and later, "whitespace" is defined as the following characters: - - - `\f` - - `\n` - - `\r` - - `\t` - - `\v` - - `\u0020` - - `\u00a0` - - `\u1680` - - `\u2000-\u200a` - - `\u2028` - - `\u2029` - - `\u202f` - - `\u205f` - - `\u3000` - - `\ufeff` - -
- - - -
- -## Examples - - - -```javascript -var trim = require( '@stdlib/string/base/trim' ); - -var out = trim( ' Whitespace ' ); -// returns 'Whitespace' - -out = trim( '\t\t\tTabs\t\t\t' ); -// returns 'Tabs' - -out = trim( '\n\n\nNew Lines\n\n\n' ); -// returns 'New Lines' -``` - -
- - - - - - - - - - - - - - diff --git a/base/trim/benchmark/benchmark.js b/base/trim/benchmark/benchmark.js deleted file mode 100644 index 26d053a5..00000000 --- a/base/trim/benchmark/benchmark.js +++ /dev/null @@ -1,88 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var trim = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( typeof String.prototype.trim !== 'function' ) -}; -var whitespace = '\\f\\n\\r\\t\\v\\u0020\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff'; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - whitespace + 'beep boop' + whitespace, - whitespace + 'boop beep' + whitespace - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = trim( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::built-in', pkg ), opts, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - whitespace + 'beep boop' + whitespace, - whitespace + 'boop beep' + whitespace - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = values[ i%values.length ].trim(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/trim/benchmark/benchmark.polyfill.js b/base/trim/benchmark/benchmark.polyfill.js deleted file mode 100644 index 9af77a0f..00000000 --- a/base/trim/benchmark/benchmark.polyfill.js +++ /dev/null @@ -1,60 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var trim = require( './../lib/polyfill.js' ); - - -// VARIABLES // - -var whitespace = '\\f\\n\\r\\t\\v\\u0020\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff'; - - -// MAIN // - -bench( format( '%s::polyfill', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - whitespace + 'beep boop' + whitespace, - whitespace + 'boop beep' + whitespace - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = trim( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/trim/docs/repl.txt b/base/trim/docs/repl.txt deleted file mode 100644 index 3928f708..00000000 --- a/base/trim/docs/repl.txt +++ /dev/null @@ -1,40 +0,0 @@ - -{{alias}}( str ) - Trims whitespace from the beginning and end of a `string`. - - "Whitespace" is defined as the following characters: - - - \f - - \n - - \r - - \t - - \v - - \u0020 - - \u00a0 - - \u1680 - - \u2000-\u200a - - \u2028 - - \u2029 - - \u202f - - \u205f - - \u3000 - - \ufeff - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Trimmed string. - - Examples - -------- - > var out = {{alias}}( ' \t\t\n Beep \r\n\t ' ) - 'Beep' - - See Also - -------- - diff --git a/base/trim/docs/types/index.d.ts b/base/trim/docs/types/index.d.ts deleted file mode 100644 index bae6cac0..00000000 --- a/base/trim/docs/types/index.d.ts +++ /dev/null @@ -1,44 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Trims whitespace characters from the beginning and end of a string. -* -* @param str - input string -* @returns trimmed string -* -* @example -* var out = trim( ' Whitespace ' ); -* // returns 'Whitespace' -* -* @example -* var out = trim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs' -* -* @example -* var out = trim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines' -*/ -declare function trim( str: string ): string; - - -// EXPORTS // - -export = trim; diff --git a/base/trim/docs/types/test.ts b/base/trim/docs/types/test.ts deleted file mode 100644 index 387f474c..00000000 --- a/base/trim/docs/types/test.ts +++ /dev/null @@ -1,44 +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. -*/ - -import trim = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - trim( ' Whitespace ' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - trim( true ); // $ExpectError - trim( false ); // $ExpectError - trim( null ); // $ExpectError - trim( undefined ); // $ExpectError - trim( 5 ); // $ExpectError - trim( [] ); // $ExpectError - trim( {} ); // $ExpectError - trim( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - trim(); // $ExpectError -} diff --git a/base/trim/examples/index.js b/base/trim/examples/index.js deleted file mode 100644 index 13a0ab47..00000000 --- a/base/trim/examples/index.js +++ /dev/null @@ -1,30 +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. -*/ - -'use strict'; - -var trim = require( './../lib' ); - -console.log( trim( ' Whitespace ' ) ); -// => 'Whitespace' - -console.log( trim( '\t\t\tTabs\t\t\t' ) ); -// => 'Tabs' - -console.log( trim( '\n\n\nNew Lines\n\n\n' ) ); -// => 'New Lines' diff --git a/base/trim/lib/builtin.js b/base/trim/lib/builtin.js deleted file mode 100644 index f7af18a2..00000000 --- a/base/trim/lib/builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var trim = String.prototype.trim; - - -// EXPORTS // - -module.exports = trim; diff --git a/base/trim/lib/check.js b/base/trim/lib/check.js deleted file mode 100644 index ebce4143..00000000 --- a/base/trim/lib/check.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MODULES // - -var trim = require( './builtin.js' ); - - -// VARIABLES // - -var str1 = ' \n\t\r\n\f\v\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u2028\u2029\u202f\u205f\u3000\ufeff'; -var str2 = '\u180e'; - - -// MAIN // - -/** -* Tests the built-in `String.prototype.trim()` implementation when provided whitespace. -* -* ## Notes -* -* - For context, see . In short, we can only rely on the built-in `trim` method when it does not consider the Mongolian space separator as whitespace. -* -* @private -* @returns {boolean} boolean indicating whether the built-in implementation returns the expected value -* -* @example -* var b = test(); -* // returns -*/ -function test() { - return ( trim.call( str1 ) === '' ) && ( trim.call( str2 ) === str2 ); -} - - -// EXPORTS // - -module.exports = test; diff --git a/base/trim/lib/has_builtin.js b/base/trim/lib/has_builtin.js deleted file mode 100644 index 31cee04b..00000000 --- a/base/trim/lib/has_builtin.js +++ /dev/null @@ -1,28 +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. -*/ - -'use strict'; - -// MAIN // - -var bool = ( typeof String.prototype.trim !== 'undefined' ); - - -// EXPORTS // - -module.exports = bool; diff --git a/base/trim/lib/index.js b/base/trim/lib/index.js deleted file mode 100644 index e325e3e6..00000000 --- a/base/trim/lib/index.js +++ /dev/null @@ -1,59 +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. -*/ - -'use strict'; - -/** -* Trim whitespace characters from the beginning and end of a string. -* -* @module @stdlib/string/base/trim -* -* @example -* var trim = require( '@stdlib/string/base/trim' ); -* -* var out = trim( ' Whitespace ' ); -* // returns 'Whitespace' -* -* out = trim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs' -* -* out = trim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines' -*/ - -// MODULES // - -var HAS_BUILTIN = require( './has_builtin.js' ); -var check = require( './check.js' ); -var polyfill = require( './polyfill.js' ); -var main = require( './main.js' ); - - -// MAIN // - -var trim; -if ( HAS_BUILTIN && check() ) { - trim = main; -} else { - trim = polyfill; -} - - -// EXPORTS // - -module.exports = trim; diff --git a/base/trim/lib/main.js b/base/trim/lib/main.js deleted file mode 100644 index 2ac3c387..00000000 --- a/base/trim/lib/main.js +++ /dev/null @@ -1,53 +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. -*/ - -'use strict'; - -// MODULES // - -var builtin = require( './builtin.js' ); - - -// MAIN // - -/** -* Trims whitespace characters from the beginning and end of a string. -* -* @param {string} str - input string -* @returns {string} trimmed string -* -* @example -* var out = trim( ' Whitespace ' ); -* // returns 'Whitespace' -* -* @example -* var out = trim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs' -* -* @example -* var out = trim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines' -*/ -function trim( str ) { - return builtin.call( str ); -} - - -// EXPORTS // - -module.exports = trim; diff --git a/base/trim/lib/polyfill.js b/base/trim/lib/polyfill.js deleted file mode 100644 index 633f86fd..00000000 --- a/base/trim/lib/polyfill.js +++ /dev/null @@ -1,60 +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. -*/ - -'use strict'; - -// MODULES // - -var replace = require( './../../../base/replace' ); - - -// VARIABLES // - -// The following regular expression should suffice to polyfill (most?) all environments. -var RE = /^[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]*([\S\s]*?)[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]*$/; - - -// MAIN // - -/** -* Trims whitespace characters from the beginning and end of a string. -* -* @private -* @param {string} str - input string -* @returns {string} trimmed string -* -* @example -* var out = trim( ' Whitespace ' ); -* // returns 'Whitespace' -* -* @example -* var out = trim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs' -* -* @example -* var out = trim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines' -*/ -function trim( str ) { - return replace( str, RE, '$1' ); -} - - -// EXPORTS // - -module.exports = trim; diff --git a/base/trim/package.json b/base/trim/package.json deleted file mode 100644 index 43cf32f6..00000000 --- a/base/trim/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/base/trim", - "version": "0.0.0", - "description": "Trim whitespace characters from the beginning and end of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "whitespace", - "remove", - "trim", - "trimming", - "replace" - ] -} diff --git a/base/trim/test/test.js b/base/trim/test/test.js deleted file mode 100644 index 04893756..00000000 --- a/base/trim/test/test.js +++ /dev/null @@ -1,216 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var polyfill = require( './../lib/polyfill.js' ); -var main = require( './../lib/main.js' ); -var trim = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof trim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the main export is a polyfill if an environment does not support String.prototype.trim', function test( t ) { - var trim = proxyquire( './../lib', { - './has_builtin.js': false - }); - t.strictEqual( trim, polyfill, 'returns expected value' ); - t.end(); -}); - -tape( 'the main export is a polyfill if an environment has deprecated String.prototype.trim behavior', function test( t ) { - var trim = proxyquire( './../lib', { - './has_builtin.js': true, - './check.js': mock - }); - t.strictEqual( trim, polyfill, 'returns expected value' ); - t.end(); - - function mock() { - return false; - } -}); - -tape( 'the main export is a wrapper around a builtin if an environment supports String.prototype.trim and has expected behavior', function test( t ) { - var trim = proxyquire( './../lib', { - './has_builtin.js': true, - './check.js': mock - }); - t.strictEqual( trim, main, 'returns expected value' ); - t.end(); - - function mock() { - return true; - } -}); - -tape( 'the function removes all whitespace characters at the beginning and end of a string', function test( t ) { - var expected; - var actual; - - expected = 'Whitespace'; - actual = trim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'beep'; - actual = trim( ' beep' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'boop'; - actual = trim( 'boop ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'foo foo'; - actual = trim( ' foo foo ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '# bar bar bar'; - actual = trim( '# bar bar bar ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '# beep boop'; - actual = trim( ' # beep boop' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'foo \n\n\n\n foo'; - actual = trim( ' foo \n\n\n\n foo ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'Tabs'; - actual = trim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = 'New Lines'; - actual = trim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = 'Beep'; - actual = trim( ' \r\n\tBeep \r\n\t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = trim( '\fbeep\f' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = trim( '\nbeep\n' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = trim( '\tbeep\t' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = trim( '\vbeep\v' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = trim( '\u1680beep\u1680' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = trim( '\u2000beep\u2000' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = trim( '\u2001beep\u2001' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = trim( '\u2002beep\u2002' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = trim( '\u2003beep\u2003' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = trim( '\u2004beep\u2004' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = trim( '\u2005beep\u2005' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = trim( '\u2006beep\u2006' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = trim( '\u2007beep\u2007' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = trim( '\u2008beep\u2008' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = trim( '\u2009beep\u2009' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = trim( '\u200abeep\u200a' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = trim( '\u2028beep\u2028' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = trim( '\u2029beep\u2029' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = trim( '\u202fbeep\u202f' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = trim( '\u205fbeep\u205f' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = trim( '\u3000beep\u3000' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = trim( '\ufeffbeep\ufeff' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); - -tape( 'the function does not remove the Mongolian space separator in accordance with Unicode 6.3.0 and later', function test( t ) { - var expected; - var actual; - - expected = '\u180ebeep\u180e'; - actual = trim( '\u180ebeep\u180e' ); - t.strictEqual( actual, expected, 'does not remove \\u180e' ); - - t.end(); -}); diff --git a/base/trim/test/test.main.js b/base/trim/test/test.main.js deleted file mode 100644 index 8c8155d0..00000000 --- a/base/trim/test/test.main.js +++ /dev/null @@ -1,176 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var HAS_BUILTIN = require( './../lib/has_builtin.js' ); -var trim = require( './../lib/main.js' ); - - -// VARIABLES // - -var opts = { - 'skip': !HAS_BUILTIN -}; - - -// TESTS // - -tape( 'main export is a function', opts, function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof trim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function removes all whitespace characters at the beginning and end of a string', opts, function test( t ) { - var expected; - var actual; - - expected = 'Whitespace'; - actual = trim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'beep'; - actual = trim( ' beep' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'boop'; - actual = trim( 'boop ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'foo foo'; - actual = trim( ' foo foo ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '# bar bar bar'; - actual = trim( '# bar bar bar ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '# beep boop'; - actual = trim( ' # beep boop' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'foo \n\n\n\n foo'; - actual = trim( ' foo \n\n\n\n foo ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'Tabs'; - actual = trim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = 'New Lines'; - actual = trim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = 'Beep'; - actual = trim( ' \r\n\tBeep \r\n\t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = trim( '\fbeep\f' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = trim( '\nbeep\n' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = trim( '\tbeep\t' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = trim( '\vbeep\v' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = trim( '\u1680beep\u1680' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = trim( '\u2000beep\u2000' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = trim( '\u2001beep\u2001' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = trim( '\u2002beep\u2002' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = trim( '\u2003beep\u2003' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = trim( '\u2004beep\u2004' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = trim( '\u2005beep\u2005' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = trim( '\u2006beep\u2006' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = trim( '\u2007beep\u2007' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = trim( '\u2008beep\u2008' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = trim( '\u2009beep\u2009' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = trim( '\u200abeep\u200a' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = trim( '\u2028beep\u2028' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = trim( '\u2029beep\u2029' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = trim( '\u202fbeep\u202f' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = trim( '\u205fbeep\u205f' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = trim( '\u3000beep\u3000' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = trim( '\ufeffbeep\ufeff' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); diff --git a/base/trim/test/test.polyfill.js b/base/trim/test/test.polyfill.js deleted file mode 100644 index 5e240cf7..00000000 --- a/base/trim/test/test.polyfill.js +++ /dev/null @@ -1,179 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var trim = require( './../lib/polyfill.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof trim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function removes all whitespace characters at the beginning and end of a string', function test( t ) { - var expected; - var actual; - - expected = 'Whitespace'; - actual = trim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'beep'; - actual = trim( ' beep' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'boop'; - actual = trim( 'boop ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'foo foo'; - actual = trim( ' foo foo ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '# bar bar bar'; - actual = trim( '# bar bar bar ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '# beep boop'; - actual = trim( ' # beep boop' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'foo \n\n\n\n foo'; - actual = trim( ' foo \n\n\n\n foo ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'Tabs'; - actual = trim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = 'New Lines'; - actual = trim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = 'Beep'; - actual = trim( ' \r\n\tBeep \r\n\t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = trim( '\fbeep\f' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = trim( '\nbeep\n' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = trim( '\tbeep\t' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = trim( '\vbeep\v' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = trim( '\u1680beep\u1680' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = trim( '\u2000beep\u2000' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = trim( '\u2001beep\u2001' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = trim( '\u2002beep\u2002' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = trim( '\u2003beep\u2003' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = trim( '\u2004beep\u2004' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = trim( '\u2005beep\u2005' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = trim( '\u2006beep\u2006' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = trim( '\u2007beep\u2007' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = trim( '\u2008beep\u2008' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = trim( '\u2009beep\u2009' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = trim( '\u200abeep\u200a' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = trim( '\u2028beep\u2028' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = trim( '\u2029beep\u2029' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = trim( '\u202fbeep\u202f' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = trim( '\u205fbeep\u205f' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = trim( '\u3000beep\u3000' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = trim( '\ufeffbeep\ufeff' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); - -tape( 'the function does not remove the Mongolian space separator in accordance with Unicode 6.3.0 and later', function test( t ) { - var expected; - var actual; - - expected = '\u180ebeep\u180e'; - actual = trim( '\u180ebeep\u180e' ); - t.strictEqual( actual, expected, 'does not remove \\u180e' ); - - t.end(); -}); diff --git a/base/truncate-middle/README.md b/base/truncate-middle/README.md deleted file mode 100644 index 3f50acde..00000000 --- a/base/truncate-middle/README.md +++ /dev/null @@ -1,92 +0,0 @@ - - -# truncateMiddle - -> Truncate the middle UTF-16 code units of a string to return a string having a specified length. - -
- -## Usage - -```javascript -var truncateMiddle = require( '@stdlib/string/base/truncate-middle' ); -``` - -#### truncateMiddle( str, len, seq ) - -Truncates the middle UTF-16 code units of a string to return a string having a specified length. - -```javascript -var out = truncateMiddle( 'beep boop', 7, '...' ); -// returns 'be...op' - -out = truncateMiddle( 'beep boop', 7, '!' ); -// returns 'bee!oop' - -out = truncateMiddle( 'beep boop', 7, '!!!' ); -// returns 'be!!!op' -``` - -
- - - -
- -## Examples - - - -```javascript -var truncateMiddle = require( '@stdlib/string/base/truncate-middle' ); - -var str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; -var out = truncateMiddle( str, 15, '...' ); -// returns 'Lorem ... elit.' - -str = 'To be or not to be, that is the question'; -out = truncateMiddle( str, 19, '|' ); -// returns 'To be or | question' - -str = 'The quick fox jumps over the lazy dog.'; -out = truncateMiddle( str, 28, '...' ); -// returns 'The quick fox...he lazy dog.' -``` - -
- - - - - - - - - - - - - - diff --git a/base/truncate-middle/benchmark/benchmark.js b/base/truncate-middle/benchmark/benchmark.js deleted file mode 100644 index 6da36d6b..00000000 --- a/base/truncate-middle/benchmark/benchmark.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var truncateMiddle = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc', - '🐶🐮🐷🐰🐸' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = truncateMiddle( values[ i%values.length ], 7, '...' ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/truncate-middle/docs/repl.txt b/base/truncate-middle/docs/repl.txt deleted file mode 100644 index 39ca0eb4..00000000 --- a/base/truncate-middle/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( str, len, seq ) - Truncates the middle UTF-16 code units of a string to return a string - having a specified length. - - Parameters - ---------- - str: string - Input string. - - len: integer - Output string length. - - seq: string - Custom replacement sequence. - - Returns - ------- - out: string - Truncated string. - - Examples - -------- - > var str = 'beep boop'; - > var out = {{alias}}( str, 5, '...' ) - 'b...p' - > out = {{alias}}( str, 5, '|' ) - 'be|op' - - See Also - -------- diff --git a/base/truncate-middle/docs/types/index.d.ts b/base/truncate-middle/docs/types/index.d.ts deleted file mode 100644 index 712847d9..00000000 --- a/base/truncate-middle/docs/types/index.d.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Truncates the middle UTF-16 code units of a string to return a string having a specified length. -* -* @param str - input string -* @param len - output string length (including sequence) -* @param seq - custom replacement sequence -* @returns truncated string -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 5, '...' ); -* // returns 'b...p' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 5, '>>>' ); -* // returns 'b>>>p' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 10, '...' ); -* // returns 'beep boop' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 0, '...' ); -* // returns '' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 2, '...' ); -* // returns '..' -*/ -declare function truncateMiddle( str: string, len: number, seq: string ): string; - - -// EXPORTS // - -export = truncateMiddle; diff --git a/base/truncate-middle/docs/types/test.ts b/base/truncate-middle/docs/types/test.ts deleted file mode 100644 index f7c6020e..00000000 --- a/base/truncate-middle/docs/types/test.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import truncateMiddle = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - truncateMiddle( 'abcdefghi', 3, '...' ); // $ExpectType string -} - -// The compiler throws an error if the function is not provided a string as its first argument... -{ - truncateMiddle( true, 6, '...' ); // $ExpectError - truncateMiddle( false, 6, '...' ); // $ExpectError - truncateMiddle( 3, 6, '...' ); // $ExpectError - truncateMiddle( [], 6, '...' ); // $ExpectError - truncateMiddle( {}, 6, '...' ); // $ExpectError - truncateMiddle( ( x: number ): number => x, 6, '...' ); // $ExpectError -} - -// The compiler throws an error if the function is not provided a number as its second argument... -{ - truncateMiddle( 'abd', true, '...' ); // $ExpectError - truncateMiddle( 'abd', false, '...' ); // $ExpectError - truncateMiddle( 'abd', 'abc', '...' ); // $ExpectError - truncateMiddle( 'abd', [], '...' ); // $ExpectError - truncateMiddle( 'abd', {}, '...' ); // $ExpectError - truncateMiddle( 'abd', ( x: number ): number => x, '...' ); // $ExpectError -} - -// The compiler throws an error if the function is not provided a string as its third argument... -{ - truncateMiddle( 'beep boop', 4, true ); // $ExpectError - truncateMiddle( 'beep boop', 4, false ); // $ExpectError - truncateMiddle( 'beep boop', 4, 123 ); // $ExpectError - truncateMiddle( 'beep boop', 4, [], 0 ); // $ExpectError - truncateMiddle( 'beep boop', 4, {}, 0 ); // $ExpectError - truncateMiddle( 'beep boop', 4, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - truncateMiddle(); // $ExpectError - truncateMiddle( 'abc', 4, '|', true ); // $ExpectError -} diff --git a/base/truncate-middle/examples/index.js b/base/truncate-middle/examples/index.js deleted file mode 100644 index 50d16125..00000000 --- a/base/truncate-middle/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var truncateMiddle = require( './../lib' ); - -var str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; -var out = truncateMiddle( str, 15, '...' ); -console.log( out ); -// => 'Lorem ... elit.' - -str = 'To be or not to be, that is the question'; -out = truncateMiddle( str, 19, '|' ); -console.log( out ); -// => 'To be or | question' - -str = 'The quick fox jumps over the lazy dog.'; -out = truncateMiddle( str, 28, '...' ); -console.log( out ); -// => 'The quick fox...he lazy dog.' diff --git a/base/truncate-middle/lib/index.js b/base/truncate-middle/lib/index.js deleted file mode 100644 index 4690cc0c..00000000 --- a/base/truncate-middle/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Truncate the middle UTF-16 code units of a string to return a string having a specified length. -* -* @module @stdlib/string/base/truncate-middle -* -* @example -* var truncateMiddle = require( '@stdlib/string/base/truncate-middle' ); -* -* var out = truncateMiddle( 'beep boop', 7, '...' ); -* // returns 'be...op' -* -* out = truncateMiddle( 'beep boop', 7, '|' ); -* // returns 'bee|oop' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/truncate-middle/lib/main.js b/base/truncate-middle/lib/main.js deleted file mode 100644 index 19525c71..00000000 --- a/base/truncate-middle/lib/main.js +++ /dev/null @@ -1,89 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isOdd = require( '@stdlib/math/base/assert/is-odd' ); -var round = require( '@stdlib/math/base/special/round' ); - - -// MAIN // - -/** -* Truncates the middle UTF-16 code units of a string to return a string having a specified length. -* -* @param {string} str - input string -* @param {integer} len - output string length (including sequence) -* @param {string} seq - custom replacement sequence -* @returns {string} truncated string -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 5, '...' ); -* // returns 'b...p' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 5, '>>>' ); -* // returns 'b>>>p' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 10, '...' ); -* // returns 'beep boop' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 0, '...' ); -* // returns '' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 2, '...' ); -* // returns '..' -*/ -function truncateMiddle( str, len, seq ) { - var finalLength; - var seqLength; - var strLength; - var seqStart; - var seqEnd; - - seqLength = seq.length; - strLength = str.length; - if ( len > strLength ) { - return str; - } - finalLength = len - seqLength; - if ( finalLength < 0 ) { - return seq.slice( 0, len ); - } - - seqStart = round( finalLength / 2 ); - seqEnd = ( isOdd( finalLength ) ) ? seqStart-1 : seqStart; - seqEnd = strLength - seqEnd; - - return str.substring( 0, seqStart ) + seq + str.substring( seqEnd ); -} - - -// EXPORTS // - -module.exports = truncateMiddle; diff --git a/base/truncate-middle/package.json b/base/truncate-middle/package.json deleted file mode 100644 index 490b3e3a..00000000 --- a/base/truncate-middle/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/truncate-middle", - "version": "0.0.0", - "description": "Truncate the middle UTF-16 code units of a string to return a string having a specified length.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "base", - "truncate", - "middle", - "character", - "char", - "codeunit", - "unicode" - ] -} diff --git a/base/truncate-middle/test/test.js b/base/truncate-middle/test/test.js deleted file mode 100644 index 0ba15ad1..00000000 --- a/base/truncate-middle/test/test.js +++ /dev/null @@ -1,93 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var truncateMiddle = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof truncateMiddle, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function truncates a string to the specified length', function test( t ) { - var expected; - var actual; - var str; - var len; - - str = 'beep boop'; - len = 5; - expected = 'b...p'; - actual = truncateMiddle( str, len, '...' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 10; - expected = 'beep boop'; - actual = truncateMiddle( str, len, '...' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 0; - expected = ''; - actual = truncateMiddle( str, len, '...' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 1; - expected = '.'; - actual = truncateMiddle( str, len, '...' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function truncates a string to the specified length (custom replacement sequence)', function test( t ) { - var expected; - var actual; - var str; - var len; - - str = 'beep boop'; - len = 5; - expected = 'be|op'; - actual = truncateMiddle( str, len, '|' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 7; - expected = 'bee!oop'; - actual = truncateMiddle( str, len, '!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 3; - expected = 'b!p'; - actual = truncateMiddle( str, len, '!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/base/uncapitalize/README.md b/base/uncapitalize/README.md deleted file mode 100644 index 5fda99b3..00000000 --- a/base/uncapitalize/README.md +++ /dev/null @@ -1,101 +0,0 @@ - - -# uncapitalize - -> Uncapitalize the first character of a string. - -
- -## Usage - -```javascript -var uncapitalize = require( '@stdlib/string/base/uncapitalize' ); -``` - -#### uncapitalize( str ) - -Uncapitalizes the first character of a string. - -```javascript -var out = uncapitalize( 'Last man standing' ); -// returns 'last man standing' - -out = uncapitalize( 'Hidden Treasures' ); -// returns 'hidden Treasures' -``` - -
- - - -
- -## Examples - - - -```javascript -var uncapitalize = require( '@stdlib/string/base/uncapitalize' ); - -var out = uncapitalize( 'Last man standing' ); -// returns 'last man standing' - -out = uncapitalize( 'Presidential election' ); -// returns 'presidential election' - -out = uncapitalize( 'JavaScript' ); -// returns 'javaScript' - -out = uncapitalize( 'Hidden Treasures' ); -// returns 'hidden Treasures' -``` - -
- - - - - - - - - - - - - - diff --git a/base/uncapitalize/benchmark/benchmark.js b/base/uncapitalize/benchmark/benchmark.js deleted file mode 100644 index 6ef701b1..00000000 --- a/base/uncapitalize/benchmark/benchmark.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var uncapitalize = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = uncapitalize( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/uncapitalize/docs/repl.txt b/base/uncapitalize/docs/repl.txt deleted file mode 100644 index dc092c13..00000000 --- a/base/uncapitalize/docs/repl.txt +++ /dev/null @@ -1,24 +0,0 @@ - -{{alias}}( str ) - Lowercases the first character of a string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Uncapitalized string. - - Examples - -------- - > var out = {{alias}}( 'Beep' ) - 'beep' - > out = {{alias}}( 'bOOp' ) - 'bOOp' - - See Also - -------- - diff --git a/base/uncapitalize/docs/types/index.d.ts b/base/uncapitalize/docs/types/index.d.ts deleted file mode 100644 index a7860f7e..00000000 --- a/base/uncapitalize/docs/types/index.d.ts +++ /dev/null @@ -1,50 +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. -*/ - -// TypeScript Version: 4.1 - -type Uncapitalize = S extends `${infer F}${infer R}` ? `${Lowercase}${R}` : S; - -/** -* Uncapitalizes the first character of a string. -* -* @param str - input string -* @returns input string with first character converted to lowercase -* -* @example -* var out = uncapitalize( 'Last man standing' ); -* // returns 'last man standing' -* -* @example -* var out = uncapitalize( 'Presidential election' ); -* // returns 'presidential election' -* -* @example -* var out = uncapitalize( 'JavaScript' ); -* // returns 'javaScript' -* -* @example -* var out = uncapitalize( 'Hidden Treasures' ); -* // returns 'hidden Treasures' -*/ -declare function uncapitalize( str: S ): Uncapitalize; - - -// EXPORTS // - -export = uncapitalize; diff --git a/base/uncapitalize/docs/types/test.ts b/base/uncapitalize/docs/types/test.ts deleted file mode 100644 index 197c29a2..00000000 --- a/base/uncapitalize/docs/types/test.ts +++ /dev/null @@ -1,48 +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. -*/ - -import uncapitalize = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - uncapitalize( 'Last man standing' ); // $ExpectType "last man standing" - uncapitalize( 'Hello World!' ); // $ExpectType "hello World!" - uncapitalize( 'BeepBoop' ); // $ExpectType "beepBoop" - uncapitalize( 'A' ); // $ExpectType "a" - uncapitalize( 'foo' as string ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - uncapitalize( true ); // $ExpectError - uncapitalize( false ); // $ExpectError - uncapitalize( null ); // $ExpectError - uncapitalize( undefined ); // $ExpectError - uncapitalize( 5 ); // $ExpectError - uncapitalize( [] ); // $ExpectError - uncapitalize( {} ); // $ExpectError - uncapitalize( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - uncapitalize(); // $ExpectError -} diff --git a/base/uncapitalize/examples/index.js b/base/uncapitalize/examples/index.js deleted file mode 100644 index 53a94e7e..00000000 --- a/base/uncapitalize/examples/index.js +++ /dev/null @@ -1,33 +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. -*/ - -'use strict'; - -var uncapitalize = require( './../lib' ); - -console.log( uncapitalize( 'Last man standing' ) ); -// => 'last man standing' - -console.log( uncapitalize( 'Presidential election' ) ); -// => 'presidential election' - -console.log( uncapitalize( 'JavaScript' ) ); -// => 'javaScript' - -console.log( uncapitalize( 'Hidden Treasures' ) ); -// => 'hidden Treasures' diff --git a/base/uncapitalize/lib/index.js b/base/uncapitalize/lib/index.js deleted file mode 100644 index f3bc24ec..00000000 --- a/base/uncapitalize/lib/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -/** -* Uncapitalize the first character of a string. -* -* @module @stdlib/string/base/uncapitalize -* -* @example -* var uncapitalize = require( '@stdlib/string/base/uncapitalize' ); -* -* var out = uncapitalize( 'Last man standing' ); -* // returns 'last man standing' -* -* out = uncapitalize( 'Hidden Treasures' ); -* // returns 'hidden Treasures' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/uncapitalize/lib/main.js b/base/uncapitalize/lib/main.js deleted file mode 100644 index eee45283..00000000 --- a/base/uncapitalize/lib/main.js +++ /dev/null @@ -1,55 +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. -*/ - -'use strict'; - -// MAIN // - -/** -* Uncapitalizes the first character of a string. -* -* @param {string} str - input string -* @returns {string} input string with first character converted to lowercase -* -* @example -* var out = uncapitalize( 'Last man standing' ); -* // returns 'last man standing' -* -* @example -* var out = uncapitalize( 'Presidential election' ); -* // returns 'presidential election' -* -* @example -* var out = uncapitalize( 'JavaScript' ); -* // returns 'javaScript' -* -* @example -* var out = uncapitalize( 'Hidden Treasures' ); -* // returns 'hidden Treasures' -*/ -function uncapitalize( str ) { - if ( str === '' ) { - return ''; - } - return str.charAt( 0 ).toLowerCase() + str.slice( 1 ); -} - - -// EXPORTS // - -module.exports = uncapitalize; diff --git a/base/uncapitalize/package.json b/base/uncapitalize/package.json deleted file mode 100644 index a5e85d57..00000000 --- a/base/uncapitalize/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/base/uncapitalize", - "version": "0.0.0", - "description": "Uncapitalize the first character of a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "string", - "str", - "capitalize", - "decapitalize", - "uncapitalize", - "lowercase", - "lower", - "case" - ] -} diff --git a/base/uncapitalize/test/test.js b/base/uncapitalize/test/test.js deleted file mode 100644 index dcd43583..00000000 --- a/base/uncapitalize/test/test.js +++ /dev/null @@ -1,53 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var uncapitalize = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof uncapitalize, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( uncapitalize( '' ), '', 'returns empty string' ); - t.end(); -}); - -tape( 'the function converts the first character of an input string to lowercase', function test( t ) { - var out; - - out = uncapitalize( 'Hello world' ); - t.strictEqual( out, 'hello world', 'uncapitalizes first character' ); - - out = uncapitalize( '!!!' ); - t.strictEqual( out, '!!!', 'does not change non-alphabetical characters' ); - - out = uncapitalize( 'hello World' ); - t.strictEqual( out, 'hello World', 'leaves lowercase letters in lowercase' ); - - t.end(); -}); diff --git a/base/uppercase/README.md b/base/uppercase/README.md deleted file mode 100644 index d523add1..00000000 --- a/base/uppercase/README.md +++ /dev/null @@ -1,107 +0,0 @@ - - -# uppercase - -> Convert a string to uppercase. - -
- -
- - - -
- -## Usage - -```javascript -var uppercase = require( '@stdlib/string/base/uppercase' ); -``` - -#### uppercase( str ) - -Converts a string to uppercase. - -```javascript -var str = uppercase( 'bEEp' ); -// returns 'BEEP' -``` - -
- - - -
- -## Examples - - - -```javascript -var uppercase = require( '@stdlib/string/base/uppercase' ); - -var str = uppercase( 'Beep' ); -// returns 'BEEP' - -str = uppercase( 'BeEp' ); -// returns 'BEEP' - -str = uppercase( 'Beep BOOP' ); -// returns 'BEEP BOOP' - -str = uppercase( '$**_beep_BoOp_**$' ); -// returns '$**_BEEP_BOOP_**$' - -str = uppercase( '' ); -// returns '' -``` - -
- - - - - - - - - - - - - - diff --git a/base/uppercase/benchmark/benchmark.js b/base/uppercase/benchmark/benchmark.js deleted file mode 100644 index 7b0ca08f..00000000 --- a/base/uppercase/benchmark/benchmark.js +++ /dev/null @@ -1,82 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../../format' ); -var pkg = require( './../package.json' ).name; -var uppercase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = uppercase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::builtin', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = values[ i%values.length ].toUpperCase(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/base/uppercase/docs/repl.txt b/base/uppercase/docs/repl.txt deleted file mode 100644 index 36405910..00000000 --- a/base/uppercase/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( str ) - Converts a string to uppercase. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Uppercase string. - - Examples - -------- - > var out = {{alias}}( 'bEEp' ) - 'BEEP' - - See Also - -------- - diff --git a/base/uppercase/docs/types/index.d.ts b/base/uppercase/docs/types/index.d.ts deleted file mode 100644 index 4341559f..00000000 --- a/base/uppercase/docs/types/index.d.ts +++ /dev/null @@ -1,36 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to uppercase. -* -* @param str - string to convert -* @returns uppercase string -* -* @example -* var str = uppercase( 'bEEp' ); -* // returns 'BEEP' -*/ -declare function uppercase( str: S ): Uppercase; - - -// EXPORTS // - -export = uppercase; diff --git a/base/uppercase/docs/types/test.ts b/base/uppercase/docs/types/test.ts deleted file mode 100644 index beae3f0d..00000000 --- a/base/uppercase/docs/types/test.ts +++ /dev/null @@ -1,48 +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. -*/ - -import uppercase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - uppercase( 'Last man standing' ); // $ExpectType "LAST MAN STANDING" - uppercase( 'Hello World!' ); // $ExpectType "HELLO WORLD!" - uppercase( 'beep' ); // $ExpectType "BEEP" - uppercase( 'BOOP' ); // $ExpectType "BOOP" - uppercase( 'foo' as string ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - uppercase( true ); // $ExpectError - uppercase( false ); // $ExpectError - uppercase( null ); // $ExpectError - uppercase( undefined ); // $ExpectError - uppercase( 5 ); // $ExpectError - uppercase( [] ); // $ExpectError - uppercase( {} ); // $ExpectError - uppercase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - uppercase(); // $ExpectError -} diff --git a/base/uppercase/examples/index.js b/base/uppercase/examples/index.js deleted file mode 100644 index e7ed3048..00000000 --- a/base/uppercase/examples/index.js +++ /dev/null @@ -1,41 +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. -*/ - -'use strict'; - -var uppercase = require( './../lib' ); - -var str = uppercase( 'Beep' ); -console.log( str ); -// => 'BEEP' - -str = uppercase( 'BeEp' ); -console.log( str ); -// => 'BEEP' - -str = uppercase( 'Beep BOOP' ); -console.log( str ); -// => 'BEEP BOOP' - -str = uppercase( '$**_beep_BoOp_**$' ); -console.log( str ); -// => '$**_BEEP_BOOP_**$' - -str = uppercase( '' ); -console.log( str ); -// => '' diff --git a/base/uppercase/lib/index.js b/base/uppercase/lib/index.js deleted file mode 100644 index acfaa6ce..00000000 --- a/base/uppercase/lib/index.js +++ /dev/null @@ -1,40 +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. -*/ - -'use strict'; - -/** -* Convert a string to uppercase. -* -* @module @stdlib/string/base/uppercase -* -* @example -* var uppercase = require( '@stdlib/string/base/uppercase' ); -* -* var str = uppercase( 'bEEp' ); -* // returns 'BEEP' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/base/uppercase/lib/main.js b/base/uppercase/lib/main.js deleted file mode 100644 index 44bdcd21..00000000 --- a/base/uppercase/lib/main.js +++ /dev/null @@ -1,40 +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. -*/ - -'use strict'; - -// MAIN // - -/** -* Converts a string to uppercase. -* -* @param {string} str - string to convert -* @returns {string} uppercase string -* -* @example -* var str = uppercase( 'bEEp' ); -* // returns 'BEEP' -*/ -function uppercase( str ) { - return str.toUpperCase(); -} - - -// EXPORTS // - -module.exports = uppercase; diff --git a/base/uppercase/package.json b/base/uppercase/package.json deleted file mode 100644 index ad5d7563..00000000 --- a/base/uppercase/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/base/uppercase", - "version": "0.0.0", - "description": "Convert a string to uppercase.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "base", - "upper", - "case", - "uppercase", - "convert", - "string", - "str" - ] -} diff --git a/base/uppercase/test/test.js b/base/uppercase/test/test.js deleted file mode 100644 index 35246eea..00000000 --- a/base/uppercase/test/test.js +++ /dev/null @@ -1,64 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var uppercase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof uppercase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function converts a string to uppercase', function test( t ) { - var expected; - var values; - var actual; - var i; - - values = [ - 'BEEP', - 'beep', - 'Beep', - 'BeEp', - 'Beep BOOP', - '$**_Beep_BoOp_**$', - 'König' - ]; - expected = [ - 'BEEP', - 'BEEP', - 'BEEP', - 'BEEP', - 'BEEP BOOP', - '$**_BEEP_BOOP_**$', - 'KÖNIG' - ]; - for ( i = 0; i < values.length; i++ ) { - actual = uppercase( values[i] ); - t.strictEqual( actual, expected[i], 'converts string to '+expected[i] ); - } - t.end(); -}); diff --git a/branches.md b/branches.md deleted file mode 100644 index d9af69dc..00000000 --- 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/string" -%% click B href "https://github.com/stdlib-js/string/tree/main" -%% click C href "https://github.com/stdlib-js/string/tree/production" -%% click D href "https://github.com/stdlib-js/string/tree/esm" -%% click E href "https://github.com/stdlib-js/string/tree/deno" -%% click F href "https://github.com/stdlib-js/string/tree/umd" -``` - -[stdlib-url]: https://github.com/stdlib-js/stdlib/tree/develop/lib/node_modules/%40stdlib/string -[production-url]: https://github.com/stdlib-js/string/tree/production -[deno-url]: https://github.com/stdlib-js/string/tree/deno -[deno-readme]: https://github.com/stdlib-js/string/blob/deno/README.md -[umd-url]: https://github.com/stdlib-js/string/tree/umd -[umd-readme]: https://github.com/stdlib-js/string/blob/umd/README.md -[esm-url]: https://github.com/stdlib-js/string/tree/esm -[esm-readme]: https://github.com/stdlib-js/string/blob/esm/README.md \ No newline at end of file diff --git a/browser.js b/browser.js new file mode 100644 index 00000000..6ec6a092 --- /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 e,r;e=this,r=function(){"use strict";var e="function"==typeof Object.defineProperty?Object.defineProperty:null,r=Object.defineProperty;function t(e){return"number"==typeof e}function n(e){var r,t="";for(r=0;r0&&(t-=1),n=e.toExponential(t)):n=e.toPrecision(r.precision),r.alternate||(n=h.call(n,y,"$1e"),n=h.call(n,d,"e"),n=h.call(n,v,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return n=h.call(n,c,"e+0$1"),n=h.call(n,g,"e-0$1"),r.alternate&&(n=h.call(n,p,"$1."),n=h.call(n,m,"$1.e")),e>=0&&r.sign&&(n=r.sign+n),n=r.specifier===f.call(r.specifier)?f.call(n):l.call(n)}function b(e){var r,t="";for(r=0;r127)throw new Error("invalid character code. Value: "+o.arg);o.arg=V(s)?String(o.arg):T(s)}break;case"e":case"E":case"f":case"F":case"g":case"G":if(r||(o.precision=6),h=parseFloat(o.arg),!isFinite(h)){if(!t(o.arg))throw new Error("invalid floating-point number. Value: "+l);h=o.arg,o.padZeros=!1}o.arg=w(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=E(o.arg,o.width,o.padRight)),l+=o.arg||"",f+=1}return l}var F=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function S(e){var r={mapping:e[1]?parseInt(e[1],10):void 0,flags:e[2],width:e[3],precision:e[5],specifier:e[6]};return"."===e[4]&&void 0===e[5]&&(r.precision="1"),r}function L(e){var r,t,n,i;for(t=[],i=0,n=F.exec(e);n;)(r=e.slice(i,F.lastIndex-n[0].length)).length&&t.push(r),"%"===n[6]?t.push("%"):t.push(S(n)),i=F.lastIndex,n=F.exec(e);return(r=e.slice(i)).length&&t.push(r),t}function O(e){var r,t;if("string"!=typeof e)throw new TypeError(O("invalid argument. First argument must be a string. Value: `%s`.",e));for(r=[L(e)],t=1;t=0&&"/"!==e[t];t--);return void 0===t||t<=0?e.replace(re,"\\$&"):(r=(r=e.substring(1,t)).replace(re,"\\$&"),e=e[0]+r+e.substring(t))}var ne=/./;function ie(e){return"boolean"==typeof e}var oe=Boolean,ae=Boolean.prototype.toString,ue=W();function se(e){return"object"==typeof e&&(e instanceof oe||(ue?function(e){try{return ae.call(e),!0}catch(e){return!1}}(e):"[object Boolean]"===Q(e)))}function le(e){return ie(e)||se(e)}P(le,"isPrimitive",ie),P(le,"isObject",se);var fe="object"==typeof self?self:null,he="object"==typeof window?window:null,ce="object"==typeof globalThis?globalThis:null,ge=function(e){if(arguments.length){if(!ie(e))throw new TypeError(O("invalid argument. Must provide a boolean. Value: `%s`.",e));if(e)return new Function("return this;")()}if(ce)return ce;if(fe)return fe;if(he)return he;throw new Error("unexpected error. Unable to resolve global object.")}(),pe=ge.document&&ge.document.childNodes,me=Int8Array;function ve(){return/^\s*function\s*([^(]*)/i}var de=/^\s*function\s*([^(]*)/i;P(ve,"REGEXP",de);var ye=Array.isArray?Array.isArray:function(e){return"[object Array]"===Q(e)};function we(e){if("function"!=typeof e)throw new TypeError(O("invalid argument. Must provide a function. Value: `%s`.",e));return function(r){var t,n;if(!ye(r))return!1;if(0===(t=r.length))return!1;for(n=0;n0&&(t-=1),n=e.toExponential(t)):n=e.toPrecision(r.precision),r.alternate||(n=Ie.call(n,$e,"$1e"),n=Ie.call(n,We,"e"),n=Ie.call(n,Ue,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return n=Ie.call(n,De,"e+0$1"),n=Ie.call(n,Be,"e-0$1"),r.alternate&&(n=Ie.call(n,Pe,"$1."),n=Ie.call(n,Ye,"$1.e")),e>=0&&r.sign&&(n=r.sign+n),n=r.specifier===Ce.call(r.specifier)?Ce.call(n):je.call(n)}function Ge(e){var r,t="";for(r=0;r127)throw new Error("invalid character code. Value: "+n.arg);n.arg=Qe(o)?String(n.arg):Je(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":if(r||(n.precision=6),s=parseFloat(n.arg),!isFinite(s)){if(!Se(n.arg))throw new Error("invalid floating-point number. Value: "+a);s=n.arg,n.padZeros=!1}n.arg=ze(s,n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=Oe(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=qe(n.arg,n.width,n.padRight)),a+=n.arg||"",u+=1}return a}var Ke=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function er(e){var r={mapping:e[1]?parseInt(e[1],10):void 0,flags:e[2],width:e[3],precision:e[5],specifier:e[6]};return"."===e[4]&&void 0===e[5]&&(r.precision="1"),r}function rr(e){var r,t,n,i;for(t=[],i=0,n=Ke.exec(e);n;)(r=e.slice(i,Ke.lastIndex-n[0].length)).length&&t.push(r),"%"===n[6]?t.push("%"):t.push(er(n)),i=Ke.lastIndex,n=Ke.exec(e);return(r=e.slice(i)).length&&t.push(r),t}function tr(e){var r,t;if("string"!=typeof e)throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));for(r=[rr(e)],t=1;t?`{}|~\/\\\[\]]/g;function ar(e){if(!Y(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));return ir(e,or,"")}var ur={"i.e.":["i.e."],"I.e.":["I.e."],"I.E.":["I.E."],"e.g.":["e.g."],"E.g.":["E.g."],"E.G.":["E.G."],"et al.":["et al."],"etc.":["etc."],"vs.":["vs."],"A.S.A.P":["A.S.A.P"],"E.T.A.":["E.T.A."],"D.I.Y":["D.I.Y"],"R.S.V.P":["R.S.V.P"],"P.S.":["P.S."],"B.Y.O.B":["B.Y.O.B"],"Ms.":["Ms."],"Mr.":["Mr."],"Dr.":["Dr."],"Prof.":["Prof."],"Mrs.":["Mrs."],"Messrs.":["Messrs."],"Gov.":["Gov."],"Gen.":["Gen."],"Lt.":["Lt."],"Col.":["Col."],"Mt.":["Mt."],"Bros.":["Bros."],"Corp.":["Corp."],"Co.":["Co."],"co.":["co."],"Inc.":["Inc."],"Ltd.":["Ltd."],"Rep.":["Rep."],"Sen.":["Sen."],"Jr.":["Jr."],"Sr.":["Sr."],"Ph.D.":["Ph.D."],"J.D.":["J.D."],"M.D.":["M.D."],"Rev.":["Rev."],"Adm.":["Adm."],"St.":["St."],"a.m.":["a.m."],"p.m.":["p.m."],"b.c.":["b.c."],"B.C.":["B.C."],"a.d.":["a.d."],"A.D.":["A.D."],"b.c.e.":["b.c.e."],"B.C.E.":["B.C.E."],"Jan.":["Jan."],"Feb.":["Feb."],"Mar.":["Mar."],"Apr.":["Apr."],"May.":["May."],"Jun.":["Jun."],"Jul.":["Jul."],"Aug.":["Aug."],"Sep.":["Sep."],"Sept.":["Sept."],"Oct.":["Oct."],"Nov.":["Nov."],"Dec.":["Dec."],"Ala.":["Ala."],"Ariz.":["Ariz."],"Ark.":["Ark."],"Calif.":["Calif."],"Colo.":["Colo."],"Conn.":["Conn."],"Del.":["Del."],"D.C.":["D.C."],"Fla.":["Fla."],"Ga.":["Ga."],"Ill.":["Ill."],"Ind.":["Ind."],"Kans.":["Kans."],"Kan.":["Kan."],"Ky.":["Ky."],"La.":["La."],"Md.":["Md."],"Mass.":["Mass."],"Mich.":["Mich."],"Minn.":["Minn."],"Miss.":["Miss."],"Mo.":["Mo."],"Mont.":["Mont."],"Nebr.":["Nebr."],"Neb.":["Neb."],"Nev.":["Nev."],"N.H.":["N.H."],"N.J.":["N.J."],"N.M.":["N.M."],"N.Y.":["N.Y."],"N.C.":["N.C."],"N.D.":["N.D."],"Okla.":["Okla."],"Ore.":["Ore."],"Pa.":["Pa."],"Tenn.":["Tenn."],"Va.":["Va."],"Wash.":["Wash."],"Wis.":["Wis."]},sr={"^_^":["^_^"],"=D":["=D"],";-p":[";-p"],":O":[":O"],":-/":[":-/"],xD:["xD"],V_V:["V_V"],";(":[";("],"(:":["(:"],'")':['")'],":Y":[":Y"],":]":[":]"],":3":[":3"],":(":[":("],":-)":[":-)"],"=3":["=3"],":))":[":))"],":>":[":>"],";p":[";p"],":p":[":p"],"=[[":["=[["],xDD:["xDD"],"<333":["<333"],"<33":["<33"],":P":[":P"],"o.O":["o.O"],"<3":["<3"],";-)":[";-)"],":)":[":)"],"-_-":["-_-"],":')":[":')"],o_O:["o_O"],";)":[";)"],"=]":["=]"],"(=":["(="],"-__-":["-__-"],":/":[":/"],":0":[":0"],"(^_^)":["(^_^)"],";D":[";D"],o_o:["o_o"],":((":[":(("],"=)":["=)"]},lr={"'s":["'s"],"'S":["'S"],"ain't":["ai","n't"],aint:["ai","nt"],"Ain't":["Ai","n't"],"aren't":["are","n't"],arent:["are","nt"],"Aren't":["Are","n't"],"can't":["ca","n't"],cant:["ca","nt"],"Can't":["Ca","n't"],"can't've":["ca","n't","'ve"],"'cause":["'cause'"],cannot:["can","not"],Cannot:["Can","not"],"could've":["could","'ve"],couldve:["could","ve"],"Could've":["Could","'ve"],"couldn't":["could","n't"],couldnt:["could","nt"],"Couldn't":["Could","n't"],"couldn't've":["could","n't","'ve"],couldntve:["could","nt","ve"],"Couldn't've":["Could","n't","'ve"],"didn't":["did","n't"],didnt:["did","nt"],"Didn't":["Did","n't"],"doesn't":["does","n't"],doesnt:["does","nt"],"Doesn't":["Does","n't"],"don't":["do","n't"],dont:["do","nt"],"Don't":["Do","n't"],"hadn't":["had","n't"],hadnt:["had","nt"],"Hadn't":["Had","n't"],"hadn't've":["had","n't","'ve"],"hasn't":["has","n't"],hasnt:["has","nt"],"haven't":["have","n't"],havent:["have","nt"],"he'd":["he","'d"],hed:["he","d"],"he'd've":["he","'d","'ve"],hedve:["he","d","ve"],"he'll":["he","'ll"],"he'll've":["he","'ll","'ve"],"he's":["he","'s"],hes:["he","s"],"how'd":["how","'d"],howd:["how","d"],"how'd'y":["how","'d","'y"],"how'll":["how","'ll"],howll:["how","ll"],"how's":["how","'s"],hows:["how","s"],"I'd":["I","'d"],"I'd've":["I","'d","'ve"],"I'll":["I","'ll"],"i'll":["i","'ll"],"I'll've":["I","'ll","'ve"],"i'll've":["i","'ll","'ve"],"I'm":["I","'m"],"i'm":["i","'m"],Im:["I","m"],im:["i","m"],"I'ma":["I","'ma"],"i'ma":["i","'ma"],"I've":["I","'ve"],"i've":["i","'ve"],"isn't":["is","n't"],isnt:["is","nt"],"Isn't":["Is","n't"],"It'd":["It","'d"],"it'd":["it","'d"],"it'd've":["it","'d","'ve"],"it'll've":["it","'ll","'ve"],"it'll":["it","'ll"],itll:["it","ll"],"it's":["it","'s"],"let's":["let","'s"],lets:["let","s"],"ma'am":["ma'am"],"mayn't":["may","n't"],"mightn't":["might","n't"],"mightn't've":["might","n't","'ve"],"might've":["might","'ve"],"mustn't":["must","n't"],"mustn't've":["must","n't","'ve"],"must've":["must","'ve"],"needn't":["need","n't"],"needn't've":["need","n't","'ve"],"not've":["not","'ve"],"o'clock":["o'clock"],"oughtn't":["ought","n't"],"oughtn't've":["ought","n't","'ve"],"so've":["so","'ve"],"so's":["so","'s"],"shan't":["sha","n't"],"sha'n't":["sha'","n't"],"shan't've":["sha","n't","'ve"],"she'd":["she","'d"],"she'd've":["she","'d","'ve"],"she'll":["she","'ll"],"she'll've":["she","'ll","'ve"],"she's":["she","'s"],"should've":["should","'ve"],"shouldn't":["should","n't"],"shouldn't've":["should","n't","'ve"],"that'd":["that","'d"],"that'd've":["that","'d","'ve"],"that's":["that","'s"],thats:["that","s"],"there'd":["there","'d"],"there'd've":["there","'d","'ve"],"there's":["there","'s"],"they'd":["they","'d"],"They'd":["They","'d"],"they'd've":["they","'d","'ve"],"They'd've":["They","'d","'ve"],"they'll":["they","'ll"],"They'll":["They","'ll"],"they'll've":["they","'ll","'ve"],"They'll've":["They","'ll","'ve"],"they're":["they","'re"],"They're":["They","'re"],"they've":["they","'ve"],"They've":["They","'ve"],"to've":["to","'ve"],"wasn't":["was","n't"],"we'd":["we","'d"],"We'd":["We","'d"],"we'd've":["we","'d","'ve"],"we'll":["we","'ll"],"We'll":["We","'ll"],"we'll've":["we","'ll","'ve"],"We'll've":["We","'ll","'ve"],"we're":["we","'re"],"We're":["We","'re"],"we've":["we","'ve"],"We've":["We","'ve"],"weren't":["were","n't"],"what'll":["what","'ll"],"what'll've":["what","'ll","'ve"],"what're":["what","'re"],"what's":["what","'s"],"what've":["what","'ve"],"when's":["when","'s"],"when've":["when","'ve"],"where'd":["where","'d"],"where's":["where","'s"],"where've":["where","'ve"],"who'd":["who","'d"],"who'll":["who","'ll"],"who'll've":["who","'ll'","'ve'"],"who're":["who","'re"],"who's":["who","'s"],"who've":["who","'ve"],"why've":["why","'ve"],"why'll":["why","'ll"],"why're":["why","'re"],"why's":["why","'s"],"will've":["will","'ve"],"won't":["wo","n't"],wont:["wo","nt"],"won't've":["wo","n't","'ve"],"would've":["would","'ve"],"wouldn't":["would","n't"],"wouldn't've":["would","n't","'ve"],"y'all":["y'","all"],"y'all'd":["y'","all","'d"],"y'all'd've":["y'","all","'d","'ve"],"y'all're":["y'","all","'re'"],"y'all've":["y'","all","ve"],"you'd":["you","'d"],"You'd":["You","'d"],"you'd've":["you","'d","'ve"],"You'd've":["You","'d","'ve"],"you'll":["you","'ll"],"You'll":["You","'ll"],"you'll've":["you","'ll","'ve"],"You'll've":["You","'ll","'ve"],"you're":["you","'re"],"You're":["You","'re"],"you've":["you","'ve"],"You've":["You","'ve"]},fr=/^([,([{*<"“'`‘]|\.{1,3})/gi,hr=/([,.!?%*>:;"'”`)\]}]|\.\.\.)$/gi;function cr(e,r){var t;for(t=0;t1?(i.push(r[1]),e=r[2]):(r=e.split(hr)).length>1?(e=r[0],o.unshift(r[1])):t=!0}while(!t);return n=i,e&&n.push(e),"..."===o[o.length-1]&&(o.pop(),o.unshift("...")),cr(n,o),n}function pr(e,r){var t,n,i,o,a,u;if(!Y(e))throw new TypeError(O("invalid argument. First argument must be a string. Value: `%s`.",e));if(arguments.length>1&&!ie(r))throw new TypeError(O("invalid argument. Second argument must be a boolean. Value: `%s`.",r));if(!e)return[];for(n=r?e.split(/(\s+)/):e.split(/\s+/),a={},i=[],u=0;uVt&&xt(e)}function St(e){return yt(e)&&Ft(e)}function Lt(e){return Tt(e)&&Ft(e.valueOf())}function Ot(e){return St(e)||Lt(e)}function Rt(e){return St(e)&&e>=0}function Nt(e){return Lt(e)&&e.valueOf()>=0}function Mt(e){return Rt(e)||Nt(e)}P(Ot,"isPrimitive",St),P(Ot,"isObject",Lt),P(Mt,"isPrimitive",Rt),P(Mt,"isObject",Nt);var kt=4294967295;function jt(e){return"object"==typeof e&&null!==e&&"number"==typeof e.length&&xt(e.length)&&e.length>=0&&e.length<=kt}var Ct=9007199254740991;function It(e){return"object"==typeof e&&null!==e&&"number"==typeof e.length&&xt(e.length)&&e.length>=0&&e.length<=Ct}var Dt="function"==typeof ArrayBuffer;function Bt(e){return Dt&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Q(e)}function Pt(e){return"object"==typeof e&&null!==e&&!ye(e)}var Yt=we(ee.isPrimitive),Ut=we(ee.isObject),Wt=we(ee);function $t(e,r){if(!(this instanceof $t))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!yt(e))throw new TypeError(O("invalid argument. Real component must be a number. Value: `%s`.",e));if(!yt(r))throw new TypeError(O("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return B(this,"re",e),B(this,"im",r),this}P(Wt,"primitives",Yt),P(Wt,"objects",Ut),P($t,"name","Complex128"),P($t,"BYTES_PER_ELEMENT",8),P($t.prototype,"BYTES_PER_ELEMENT",8),P($t.prototype,"byteLength",16),P($t.prototype,"toString",(function(){var e=""+this.re;return this.im<0?e+=" - "+-this.im:e+=" + "+this.im,e+="i"})),P($t.prototype,"toJSON",(function(){var e={type:"Complex128"};return e.re=this.re,e.im=this.im,e}));var zt="function"==typeof Math.fround?Math.fround:null,Gt=new kr(1),qt="function"==typeof zt?zt:function(e){return Gt[0]=e,Gt[0]};function Jt(e,r){if(!(this instanceof Jt))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!yt(e))throw new TypeError(O("invalid argument. Real component must be a number. Value: `%s`.",e));if(!yt(r))throw new TypeError(O("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return B(this,"re",qt(e)),B(this,"im",qt(r)),this}function Zt(e){return e instanceof $t||e instanceof Jt||"object"==typeof e&&null!==e&&"number"==typeof e.re&&"number"==typeof e.im}function Qt(e){return xt(e/2)}P(Jt,"name","Complex64"),P(Jt,"BYTES_PER_ELEMENT",4),P(Jt.prototype,"BYTES_PER_ELEMENT",4),P(Jt.prototype,"byteLength",8),P(Jt.prototype,"toString",(function(){var e=""+this.re;return this.im<0?e+=" - "+-this.im:e+=" + "+this.im,e+="i"})),P(Jt.prototype,"toJSON",(function(){var e={type:"Complex64"};return e.re=this.re,e.im=this.im,e}));var Ht=8;function Xt(e){return"object"==typeof e&&null!==e&&"Complex64Array"===e.constructor.name&&e.BYTES_PER_ELEMENT===Ht}var Kt=16;function en(e){return"object"==typeof e&&null!==e&&"Complex128Array"===e.constructor.name&&e.BYTES_PER_ELEMENT===Kt}function rn(){return"function"==typeof J&&"symbol"==typeof J("foo")&&G(J,"iterator")&&"symbol"==typeof J.iterator}var tn=rn()?Symbol.iterator:null;function nn(e,r,t){D(e,r,{configurable:!1,enumerable:!1,get:t})}function on(e){return e.re}function an(e){return e.im}function un(e,r){return new kr(e.buffer,e.byteOffset+e.BYTES_PER_ELEMENT*r,2*(e.length-r))}function sn(e,r){return new Lr(e.buffer,e.byteOffset+e.BYTES_PER_ELEMENT*r,2*(e.length-r))}function ln(e){var r,t,n;for(r=[];!(t=e.next()).done;)if(jt(n=t.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!Zt(n))return new TypeError(O("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));r.push(on(n),an(n))}return r}var fn=2*kr.BYTES_PER_ELEMENT,hn=rn();function cn(e){return e instanceof mn||"object"==typeof e&&null!==e&&("Complex64Array"===e.constructor.name||"Complex128Array"===e.constructor.name)&&"number"==typeof e._length&&"object"==typeof e._buffer}function gn(e){return e===mn||"Complex128Array"===e.name}function pn(e,r){return new Jt(e[r*=2],e[r+1])}function mn(){var e,r,t,n;if(r=arguments.length,!(this instanceof mn))return 0===r?new mn:1===r?new mn(arguments[0]):2===r?new mn(arguments[0],arguments[1]):new mn(arguments[0],arguments[1],arguments[2]);if(0===r)t=new kr(0);else if(1===r)if(Rt(arguments[0]))t=new kr(2*arguments[0]);else if(It(arguments[0]))if((n=(t=arguments[0]).length)&&ye(t)&&Zt(t[0])){if(t=function(e,r){var t,n,i,o;for(t=r.length,o=0,i=0;it.byteLength-e)throw new RangeError(O("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*fn));t=new kr(t,e,2*n)}}return P(this,"_buffer",t),P(this,"_length",t.length/2),this}function vn(e){return e.re}function dn(e){return e.im}function yn(e){var r,t,n;for(r=[];!(t=e.next()).done;)if(jt(n=t.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!Zt(n))return new TypeError(O("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));r.push(vn(n),dn(n))}return r}P(mn,"BYTES_PER_ELEMENT",fn),P(mn,"name","Complex64Array"),P(mn,"from",(function(e){var r,t,n,i,o,a,u,s,l,f,h,c;if(!Ve(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!gn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!Ve(n=arguments[1]))throw new TypeError(O("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(r=arguments[2])}if(cn(e)){if(s=e.length,n){for(o=(i=new this(s))._buffer,c=0,h=0;h=2))throw new TypeError(O("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",f));o[c]=f[0],o[c+1]=f[1]}c+=2}return i}return new this(e)}if(It(e)){if(n){for(s=e.length,u=e.get&&e.set?br("default"):Tr("default"),h=0;h=2))throw new TypeError(O("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",f));o[c]=f[0],o[c+1]=f[1]}c+=2}return i}return new this(e)}if(Pt(e)&&hn&&Ve(e[tn])){if(!Ve((o=e[tn]()).next))throw new TypeError(O("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",e));if(a=n?function(e,r,t){var n,i,o,a;for(n=[],a=-1;!(i=e.next()).done;)if(a+=1,jt(o=r.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Zt(o))return new TypeError(O("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(on(o),an(o))}return n}(o,n,r):ln(o),a instanceof Error)throw a;for(o=(i=new this(s=a.length/2))._buffer,h=0;h=this._length))return pn(this._buffer,e)})),nn(mn.prototype,"buffer",(function(){return this._buffer.buffer})),nn(mn.prototype,"byteLength",(function(){return this._buffer.byteLength})),nn(mn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),P(mn.prototype,"BYTES_PER_ELEMENT",mn.BYTES_PER_ELEMENT),P(mn.prototype,"copyWithin",(function(e,r){if(!cn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*e,2*r):this._buffer.copyWithin(2*e,2*r,2*arguments[2]),this})),P(mn.prototype,"entries",(function(){var e,r,t,n,i,o;if(!cn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,n=this._buffer,t=this._length,o=-1,P(r={},"next",(function(){return o+=1,i||o>=t?{done:!0}:{value:[o,pn(n,o)],done:!1}})),P(r,"return",(function(e){return i=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(r,tn,(function(){return e.entries()})),r})),P(mn.prototype,"every",(function(e,r){var t,n;if(!cn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n1){if(!xt(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!xt(t))throw new TypeError(O("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else r=0,t=i;for(a=on(e),u=an(e),s=r;s=0;n--)if(i=pn(t,n),e.call(r,i,n,this))return i})),P(mn.prototype,"findLastIndex",(function(e,r){var t,n,i;if(!cn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=pn(t,n),e.call(r,i,n,this))return n;return-1})),P(mn.prototype,"forEach",(function(e,r){var t,n,i;if(!cn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n=this._length))return pn(this._buffer,e)})),P(mn.prototype,"includes",(function(e,r){var t,n,i,o,a;if(!cn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Zt(e))throw new TypeError(O("invalid argument. First argument must be a complex number. Value: `%s`.",e));if(arguments.length>1){if(!xt(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=on(e),o=an(e),t=this._buffer,a=r;a1){if(!xt(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=on(e),o=an(e),t=this._buffer,a=r;a=t?{done:!0}:{value:i,done:!1}})),P(r,"return",(function(e){return n=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(r,tn,(function(){return e.keys()})),r})),P(mn.prototype,"lastIndexOf",(function(e,r){var t,n,i,o,a;if(!cn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Zt(e))throw new TypeError(O("invalid argument. First argument must be a complex number. Value: `%s`.",e));if(arguments.length>1){if(!xt(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(i=on(e),o=an(e),t=this._buffer,a=r;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),nn(mn.prototype,"length",(function(){return this._length})),P(mn.prototype,"map",(function(e,r){var t,n,i,o,a;if(!cn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(n=this._buffer,t=(i=new this.constructor(this._length))._buffer,o=0;o1)n=r,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=pn(t,0),o=1}for(;o1)n=r,o=i-1;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=pn(t,i-1),o=i-2}for(;o>=0;o--)n=e(n,pn(t,o),o,this);return n})),P(mn.prototype,"reverse",(function(){var e,r,t,n,i,o;if(!cn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,e=this._buffer,n=At(t/2),i=0;i1){if(!Rt(t=arguments[1]))throw new TypeError(O("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(Zt(e)){if(t>=this._length)throw new RangeError(O("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=on(e),void(n[t+1]=an(e))}if(cn(e)){if(t+(a=e._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=e._buffer,l=n.byteOffset+t*fn,r.buffer===n.buffer&&r.byteOffsetl){for(i=new kr(r.length),s=0;sthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=e,l=n.byteOffset+t*fn,r.buffer===n.buffer&&r.byteOffsetl){for(i=new kr(a),s=0;sthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,s=0;su&&(r=u)}}for(t=ei&&(r=i)}}return e>=i?(i=0,t=n.byteLength):e>=r?(i=0,t=n.byteOffset+e*fn):(i=r-e,t=n.byteOffset+e*fn),new this.constructor(n.buffer,t,i<0?0:i)})),P(mn.prototype,"toLocaleString",(function(e,r){var t,n,i,o,a;if(!cn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=[];else{if(!Y(e)&&!Yt(e))throw new TypeError(O("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",e));n=e}if(arguments.length<2)t={};else{if(!Pt(r))throw new TypeError(O("invalid argument. Options argument must be an object. Value: `%s`.",r));t=r}for(o=this._buffer,i=[],a=0;a=t?{done:!0}:{value:pn(i,o),done:!1}})),P(e,"return",(function(e){return n=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(e,tn,(function(){return r.values()})),e})),P(mn.prototype,"with",(function(e,r){var t,n,i;if(!cn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!xt(e))throw new TypeError(O("invalid argument. First argument must be an integer. Value: `%s`.",e));if(i=this._length,e<0&&(e+=i),e<0||e>=i)throw new RangeError(O("invalid argument. Index argument is out-of-bounds. Value: `%s`.",e));if(!Zt(r))throw new TypeError(O("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(t=(n=new this.constructor(this._buffer))._buffer)[2*e]=on(r),t[2*e+1]=an(r),n}));var wn=2*Lr.BYTES_PER_ELEMENT,bn=rn();function En(e){return e instanceof Vn||"object"==typeof e&&null!==e&&("Complex64Array"===e.constructor.name||"Complex128Array"===e.constructor.name)&&"number"==typeof e._length&&"object"==typeof e._buffer}function Tn(e){return e===Vn||"Complex64Array"===e.name}function _n(e,r){return new $t(e[r*=2],e[r+1])}function Vn(){var e,r,t,n;if(r=arguments.length,!(this instanceof Vn))return 0===r?new Vn:1===r?new Vn(arguments[0]):2===r?new Vn(arguments[0],arguments[1]):new Vn(arguments[0],arguments[1],arguments[2]);if(0===r)t=new Lr(0);else if(1===r)if(Rt(arguments[0]))t=new Lr(2*arguments[0]);else if(It(arguments[0]))if((n=(t=arguments[0]).length)&&ye(t)&&Zt(t[0])){if(t=function(e,r){var t,n,i,o;for(t=r.length,o=0,i=0;it.byteLength-e)throw new RangeError(O("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*wn));t=new Lr(t,e,2*n)}}return P(this,"_buffer",t),P(this,"_length",t.length/2),this}function An(e){var r,t;for(r=[];!(t=e.next()).done;)r.push(oe(t.value));return r}P(Vn,"BYTES_PER_ELEMENT",wn),P(Vn,"name","Complex128Array"),P(Vn,"from",(function(e){var r,t,n,i,o,a,u,s,l,f,h,c;if(!Ve(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Tn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!Ve(n=arguments[1]))throw new TypeError(O("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(r=arguments[2])}if(En(e)){if(s=e.length,n){for(o=(i=new this(s))._buffer,c=0,h=0;h=2))throw new TypeError(O("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",f));o[c]=f[0],o[c+1]=f[1]}c+=2}return i}return new this(e)}if(It(e)){if(n){for(s=e.length,u=e.get&&e.set?br("default"):Tr("default"),h=0;h=2))throw new TypeError(O("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",f));o[c]=f[0],o[c+1]=f[1]}c+=2}return i}return new this(e)}if(Pt(e)&&bn&&Ve(e[tn])){if(!Ve((o=e[tn]()).next))throw new TypeError(O("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",e));if(a=n?function(e,r,t){var n,i,o,a;for(n=[],a=-1;!(i=e.next()).done;)if(a+=1,jt(o=r.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Zt(o))return new TypeError(O("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(vn(o),dn(o))}return n}(o,n,r):yn(o),a instanceof Error)throw a;for(o=(i=new this(s=a.length/2))._buffer,h=0;h=this._length))return _n(this._buffer,e)})),nn(Vn.prototype,"buffer",(function(){return this._buffer.buffer})),nn(Vn.prototype,"byteLength",(function(){return this._buffer.byteLength})),nn(Vn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),P(Vn.prototype,"BYTES_PER_ELEMENT",Vn.BYTES_PER_ELEMENT),P(Vn.prototype,"copyWithin",(function(e,r){if(!En(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*e,2*r):this._buffer.copyWithin(2*e,2*r,2*arguments[2]),this})),P(Vn.prototype,"entries",(function(){var e,r,t,n,i,o,a;if(!En(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return r=this,e=this._buffer,n=this._length,o=-1,a=-2,P(t={},"next",(function(){var r;return o+=1,i||o>=n?{done:!0}:(r=new $t(e[a+=2],e[a+1]),{value:[o,r],done:!1})})),P(t,"return",(function(e){return i=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(t,tn,(function(){return r.entries()})),t})),P(Vn.prototype,"every",(function(e,r){var t,n;if(!En(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n1){if(!xt(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!xt(t))throw new TypeError(O("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else r=0,t=i;for(a=vn(e),u=dn(e),s=r;s=0;n--)if(i=_n(t,n),e.call(r,i,n,this))return i})),P(Vn.prototype,"findLastIndex",(function(e,r){var t,n,i;if(!En(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=_n(t,n),e.call(r,i,n,this))return n;return-1})),P(Vn.prototype,"forEach",(function(e,r){var t,n,i;if(!En(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n=this._length))return _n(this._buffer,e)})),nn(Vn.prototype,"length",(function(){return this._length})),P(Vn.prototype,"includes",(function(e,r){var t,n,i,o,a;if(!En(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Zt(e))throw new TypeError(O("invalid argument. First argument must be a complex number. Value: `%s`.",e));if(arguments.length>1){if(!xt(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=vn(e),o=dn(e),t=this._buffer,a=r;a1){if(!xt(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=vn(e),o=dn(e),t=this._buffer,a=r;a=t?{done:!0}:{value:i,done:!1}})),P(r,"return",(function(e){return n=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(r,tn,(function(){return e.keys()})),r})),P(Vn.prototype,"lastIndexOf",(function(e,r){var t,n,i,o,a;if(!En(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Zt(e))throw new TypeError(O("invalid argument. First argument must be a complex number. Value: `%s`.",e));if(arguments.length>1){if(!xt(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(i=vn(e),o=dn(e),t=this._buffer,a=r;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),P(Vn.prototype,"map",(function(e,r){var t,n,i,o,a;if(!En(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(n=this._buffer,t=(i=new this.constructor(this._length))._buffer,o=0;o1)n=r,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=_n(t,0),o=1}for(;o1)n=r,o=i-1;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=_n(t,i-1),o=i-2}for(;o>=0;o--)n=e(n,_n(t,o),o,this);return n})),P(Vn.prototype,"reverse",(function(){var e,r,t,n,i,o;if(!En(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,e=this._buffer,n=At(t/2),i=0;i1){if(!Rt(t=arguments[1]))throw new TypeError(O("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(Zt(e)){if(t>=this._length)throw new RangeError(O("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=vn(e),void(n[t+1]=dn(e))}if(En(e)){if(t+(a=e._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=e._buffer,l=n.byteOffset+t*wn,r.buffer===n.buffer&&r.byteOffsetl){for(i=new Lr(r.length),s=0;sthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=e,l=n.byteOffset+t*wn,r.buffer===n.buffer&&r.byteOffsetl){for(i=new Lr(a),s=0;sthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,s=0;su&&(r=u)}}for(t=ei&&(r=i)}}return e>=i?(i=0,t=n.byteLength):e>=r?(i=0,t=n.byteOffset+e*wn):(i=r-e,t=n.byteOffset+e*wn),new this.constructor(n.buffer,t,i<0?0:i)})),P(Vn.prototype,"toLocaleString",(function(e,r){var t,n,i,o,a;if(!En(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=[];else{if(!ee(e)&&!Yt(e))throw new TypeError(O("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",e));n=e}if(arguments.length<2)t={};else{if(!Pt(r))throw new TypeError(O("invalid argument. Options argument must be an object. Value: `%s`.",r));t=r}for(o=this._buffer,i=[],a=0;a=t?{done:!0}:{value:_n(i,o),done:!1}})),P(e,"return",(function(e){return n=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(e,tn,(function(){return r.values()})),e})),P(Vn.prototype,"with",(function(e,r){var t,n,i;if(!En(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!xt(e))throw new TypeError(O("invalid argument. First argument must be an integer. Value: `%s`.",e));if(i=this._length,e<0&&(e+=i),e<0||e>=i)throw new RangeError(O("invalid argument. Index argument is out-of-bounds. Value: `%s`.",e));if(!Zt(r))throw new TypeError(O("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(t=(n=new this.constructor(this._buffer))._buffer)[2*e]=vn(r),t[2*e+1]=dn(r),n}));var xn=st.BYTES_PER_ELEMENT,Fn=rn();function Sn(e){return"object"==typeof e&&null!==e&&"BooleanArray"===e.constructor.name&&e.BYTES_PER_ELEMENT===xn}function Ln(e){return e===On}function On(){var e,r,t,n,i;if(r=arguments.length,!(this instanceof On))return 0===r?new On:1===r?new On(arguments[0]):2===r?new On(arguments[0],arguments[1]):new On(arguments[0],arguments[1],arguments[2]);if(0===r)t=new st(0);else if(1===r)if(Rt(i=arguments[0]))t=new st(i);else if(It(i))t=function(e,r){var t,n;for(t=r.length,n=0;nt.byteLength-e)throw new RangeError(O("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*xn));t=new st(t,e,n)}}return P(this,"_buffer",t),P(this,"_length",t.length),this}P(On,"BYTES_PER_ELEMENT",xn),P(On,"name","BooleanArray"),P(On,"from",(function(e){var r,t,n,i,o,a,u,s,l;if(!Ve(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Ln(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if((t=arguments.length)>1){if(!Ve(n=arguments[1]))throw new TypeError(O("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(r=arguments[2])}if(It(e)){if(n){for(s=e.length,u=e.get&&e.set?br("default"):Tr("default"),o=(i=new this(s))._buffer,l=0;l=t))return oe(r[e])})),nn(On.prototype,"buffer",(function(){return this._buffer.buffer})),nn(On.prototype,"byteLength",(function(){return this._buffer.byteLength})),nn(On.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),P(On.prototype,"BYTES_PER_ELEMENT",On.BYTES_PER_ELEMENT),P(On.prototype,"copyWithin",(function(e,r){if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return 2===arguments.length?this._buffer.copyWithin(e,r):this._buffer.copyWithin(e,r,arguments[2]),this})),P(On.prototype,"entries",(function(){var e,r,t,n,i,o;if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return e=this,n=this._buffer,t=this._length,o=-1,P(r={},"next",(function(){return o+=1,i||o>=t?{done:!0}:{value:[o,oe(n[o])],done:!1}})),P(r,"return",(function(e){return i=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(r,tn,(function(){return e.entries()})),r})),P(On.prototype,"every",(function(e,r){var t,n;if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n1){if(!St(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!St(t))throw new TypeError(O("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else r=0,t=i;for(o=e?1:0,a=r;a=0;i--)if(n=oe(t[i]),e.call(r,n,i,this))return n})),P(On.prototype,"findLastIndex",(function(e,r){var t,n,i;if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,i=this._length-1;i>=0;i--)if(n=oe(t[i]),e.call(r,n,i,this))return i;return-1})),P(On.prototype,"forEach",(function(e,r){var t,n;if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n=this._length))return oe(this._buffer[e])})),P(On.prototype,"includes",(function(e,r){var t,n;if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!ie(e))throw new TypeError(O("invalid argument. First argument must be a boolean. Value: `%s`.",e));if(arguments.length>1){if(!St(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(t=this._buffer,n=r;n1){if(!St(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(t=this._buffer,n=r;n0){if(!Y(e))throw new TypeError(O("invalid argument. First argument must be a string. Value: `%s`.",e))}else e=",";for(r=this._buffer,t=[],n=0;n=t?{done:!0}:{value:i,done:!1}})),P(r,"return",(function(e){return n=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(r,tn,(function(){return e.keys()})),r})),P(On.prototype,"lastIndexOf",(function(e,r){var t,n;if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!ie(e))throw new TypeError(O("invalid argument. First argument must be a boolean. Value: `%s`.",e));if(arguments.length>1){if(!St(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(t=this._buffer,n=r;n>=0;n--)if(e===oe(t[n]))return n;return-1})),nn(On.prototype,"length",(function(){return this._length})),P(On.prototype,"map",(function(e,r){var t,n,i,o;if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Ve(e))throw new TypeError("invalid argument. First argument must be a function. Value: `%s`.",e);for(i=this._buffer,t=(n=new this.constructor(this._length))._buffer,o=0;o1)i=r,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=oe(t[0]),o=1}for(;o1)i=r,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=oe(t[n-1]),o=n-2}for(;o>=0;o--)i=e(i,oe(t[o]),o,this);return i})),P(On.prototype,"reverse",(function(){var e,r,t,n,i,o;if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");for(e=this._buffer,t=this._length,n=At(t/2),i=0;i1){if(!Rt(t=arguments[1]))throw new TypeError(O("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(It(e)){if(t+(o=e.length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=Sn(e)?e._buffer:e,u=n.byteOffset+t*xn,r.buffer===n.buffer&&r.byteOffsetu){for(i=new st(r.length),a=0;a=this._length)throw new RangeError(O("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));n[t]=e?1:0}})),P(On.prototype,"slice",(function(e,r){var t,n,i,o,a,u;if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(o=this._buffer,a=this._length,0===arguments.length)e=0,r=a;else{if(!St(e))throw new TypeError(O("invalid argument. First argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=a)<0&&(e=0),1===arguments.length)r=a;else{if(!St(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0?(r+=a)<0&&(r=0):r>a&&(r=a)}}for(t=ei&&(r=i)}}return e>=i?(i=0,t=n.byteLength):e>=r?(i=0,t=n.byteOffset+e*xn):(i=r-e,t=n.byteOffset+e*xn),new this.constructor(n.buffer,t,i<0?0:i)})),P(On.prototype,"toLocaleString",(function(e,r){var t,n,i,o,a;if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(0===arguments.length)n=[];else{if(!Y(e)&&!Yt(e))throw new TypeError(O("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",e));n=e}if(arguments.length<2)t={};else{if(!Pt(r))throw new TypeError(O("invalid argument. Options argument must be an object. Value: `%s`.",r));t=r}for(o=this._buffer,i=[],a=0;a=t?{done:!0}:{value:oe(i[o]),done:!1}})),P(e,"return",(function(e){return n=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(e,tn,(function(){return r.values()})),e})),P(On.prototype,"with",(function(e,r){var t,n;if(!Sn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!St(e))throw new TypeError(O("invalid argument. First argument must be an integer. Value: `%s`.",e));if(n=this._length,e<0&&(e+=n),e<0||e>=n)throw new RangeError(O("invalid argument. Index argument is out-of-bounds. Value: `%s`.",e));if(!ie(r))throw new TypeError(O("invalid argument. Second argument must be a boolean. Value: `%s`.",r));return(t=new this.constructor(this._buffer))._buffer[e]=r?1:0,t}));var Rn=[Lr,kr,qr,Ur,nt,Xr,dt,st,gt,mn,Vn,On],Nn=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128","bool"],Mn=Nn.length;function kn(e){var r;if(ye(e))return"generic";if(Ee(e))return null;for(r=0;r?`{}|~\/\\\[\]_#$*&^@%]+/g,ri=/(?:\s|^)([^\s]+)(?=\s|$)/g,ti=/([a-z0-9])([A-Z])/g;function ni(e,r,t){return r=vr(r),0===t?r:Jn(r)}function ii(e){return e=nr(e,ei," "),e=nr(e,Kn," "),e=nr(e,ti,"$1 $2"),nr(e=Xn(e),ri,ni)}var oi=65536,ai=1024,ui=55296,si=56319,li=56320,fi=57343;function hi(e,r,t){var n,i,o;return r<0&&(r+=e.length),(n=e.charCodeAt(r))>=ui&&n<=si&&r=li&&n<=fi&&r>=1?(o=e.charCodeAt(r-1),i=n,ui<=o&&o<=si?(o-ui)*ai+(i-li)+oi:i):n}var ci=/\s+/g,gi=/[\-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g,pi=/([a-z0-9])([A-Z])/g;function mi(e){return e=nr(e,gi," "),e=nr(e,pi,"$1 $2"),mr(e=nr(e=Xn(e),ci,"_"))}function vi(e){return e!=e}function di(e,r){return vi(e)||vi(r)?NaN:e===Vt||r===Vt?Vt:e===r&&0===e?function(e){return 0===e&&1/e===Vt}(e)?e:r:e?`{}|~\/\\\[\]_#$*&^@%]+/g,Ei=/([a-z0-9])([A-Z])/g;function Ti(e){return e=nr(e,bi," "),e=nr(e,Ei,"$1 $2"),vr(e=nr(e=Xn(e),wi,"."))}var _i,Vi=void 0!==String.prototype.endsWith,Ai=String.prototype.endsWith;_i=Vi?function(e,r,t){var n,i;return i=r.length,0===t?0===i:(n=t<0?e.length+t:t,0===i||!(n-i<0||n>e.length)&&Ai.call(e,r,n))}:function(e,r,t){var n,i,o;if(i=r.length,0===t)return 0===i;if(n=t<0?e.length+t:t,0===i)return!0;if((n-=i)<0)return!1;for(o=0;o=e.length)throw new RangeError(tr("invalid argument. Second argument must be a valid position (i.e., be within string bounds). Value: `%d`.",r));if(arguments.length>2){if(!ie(t))throw new TypeError(tr("invalid argument. Third argument must be a boolean. Value: `%s`.",t));n=t}else n=!1;return hi(e,r,n)}var ki=55296,ji=56319,Ci=56320,Ii=57343;function Di(e,r){var t,n;if(!Y(e))throw new TypeError(O("invalid argument. Must provide a string. Value: `%s`.",e));if(!Rt(r))throw new TypeError(O("invalid argument. Must provide a valid position (i.e., a nonnegative integer). Value: `%s`.",r));if(r>=e.length)throw new RangeError(O("invalid argument. Must provide a valid position (i.e., within string bounds). Value: `%u`.",r));return t=e.charCodeAt(r),n=e.charCodeAt(r+1),t>=ki&&t<=ji&&n>=Ci&&n<=Ii}var Bi={CR:0,LF:1,Control:2,Extend:3,RegionalIndicator:4,SpacingMark:5,L:6,V:7,T:8,LV:9,LVT:10,Other:11,Prepend:12,ZWJ:13,NotBreak:0,BreakStart:1,Break:2,BreakLastRegional:3,BreakPenultimateRegional:4,ExtendedPictographic:101};function Pi(e,r,t,n){var i;for(t>=e.length&&(t=e.length-1),i=r;i<=t;i++)if(e[i]!==n)return!1;return!0}function Yi(e,r,t,n){var i;for(r>=e.length-1&&(r=e.length-1),i=r;i>=t;i--)if(e[i]===n)return i;return-1}var Ui={};P(Ui,"constants",Bi),P(Ui,"breakType",(function(e,r){var t,n,i,o,a;return i=e[(a=e.length-1)-1],n=e[a],t=r[a],(o=Yi(e,a,0,Bi.RegionalIndicator))>0&&i!==Bi.Prepend&&i!==Bi.RegionalIndicator&&Pi(e,1,o-1,Bi.RegionalIndicator)?function(e,r,t,n){var i,o;for(t>=e.length&&(t=e.length-1),i=0,o=r;o<=t;o++)e[o]===n&&(i+=1);return i}(e,0,a,Bi.RegionalIndicator)%2==1?Bi.BreakLastRegional:Bi.BreakPenultimateRegional:i===Bi.CR&&n===Bi.LF?Bi.NotBreak:i===Bi.Control||i===Bi.CR||i===Bi.LF||n===Bi.Control||n===Bi.CR||n===Bi.LF?Bi.BreakStart:(i!==Bi.L||n!==Bi.L&&n!==Bi.V&&n!==Bi.LV&&n!==Bi.LVT)&&(i!==Bi.LV&&i!==Bi.V||n!==Bi.V&&n!==Bi.T)&&(i!==Bi.LVT&&i!==Bi.T||n!==Bi.T)?n===Bi.Extend||n===Bi.ZWJ||n===Bi.SpacingMark||i===Bi.Prepend||(o=Yi(r,a-1,0,Bi.ExtendedPictographic))>=0&&i===Bi.ZWJ&&t===Bi.ExtendedPictographic&&r[o]===Bi.ExtendedPictographic&&Pi(e,o+1,a-2,Bi.Extend)?Bi.NotBreak:function(e,r,t,n){var i;for(t>=e.length&&(t=e.length-1),i=r;i<=t;i++)if(e[i]===n)return i;return-1}(e,1,a-1,Bi.RegionalIndicator)>=0?Bi.Break:i===Bi.RegionalIndicator&&n===Bi.RegionalIndicator?Bi.NotBreak:Bi.BreakStart:Bi.NotBreak})),P(Ui,"emojiProperty",(function(e){return 169===e||174===e||8252===e||8265===e||8482===e||8505===e||8596<=e&&e<=8601||8617<=e&&e<=8618||8986<=e&&e<=8987||9e3===e||9096===e||9167===e||9193<=e&&e<=9196||9197<=e&&e<=9198||9199===e||9200===e||9201<=e&&e<=9202||9203===e||9208<=e&&e<=9210||9410===e||9642<=e&&e<=9643||9654===e||9664===e||9723<=e&&e<=9726||9728<=e&&e<=9729||9730<=e&&e<=9731||9732===e||9733===e||9735<=e&&e<=9741||9742===e||9743<=e&&e<=9744||9745===e||9746===e||9748<=e&&e<=9749||9750<=e&&e<=9751||9752===e||9753<=e&&e<=9756||9757===e||9758<=e&&e<=9759||9760===e||9761===e||9762<=e&&e<=9763||9764<=e&&e<=9765||9766===e||9767<=e&&e<=9769||9770===e||9771<=e&&e<=9773||9774===e||9775===e||9776<=e&&e<=9783||9784<=e&&e<=9785||9786===e||9787<=e&&e<=9791||9792===e||9793===e||9794===e||9795<=e&&e<=9799||9800<=e&&e<=9811||9812<=e&&e<=9822||9823===e||9824===e||9825<=e&&e<=9826||9827===e||9828===e||9829<=e&&e<=9830||9831===e||9832===e||9833<=e&&e<=9850||9851===e||9852<=e&&e<=9853||9854===e||9855===e||9856<=e&&e<=9861||9872<=e&&e<=9873||9874===e||9875===e||9876===e||9877===e||9878<=e&&e<=9879||9880===e||9881===e||9882===e||9883<=e&&e<=9884||9885<=e&&e<=9887||9888<=e&&e<=9889||9890<=e&&e<=9894||9895===e||9896<=e&&e<=9897||9898<=e&&e<=9899||9900<=e&&e<=9903||9904<=e&&e<=9905||9906<=e&&e<=9916||9917<=e&&e<=9918||9919<=e&&e<=9923||9924<=e&&e<=9925||9926<=e&&e<=9927||9928===e||9929<=e&&e<=9933||9934===e||9935===e||9936===e||9937===e||9938===e||9939===e||9940===e||9941<=e&&e<=9960||9961===e||9962===e||9963<=e&&e<=9967||9968<=e&&e<=9969||9970<=e&&e<=9971||9972===e||9973===e||9974===e||9975<=e&&e<=9977||9978===e||9979<=e&&e<=9980||9981===e||9982<=e&&e<=9985||9986===e||9987<=e&&e<=9988||9989===e||9992<=e&&e<=9996||9997===e||9998===e||9999===e||1e4<=e&&e<=10001||10002===e||10004===e||10006===e||10013===e||10017===e||10024===e||10035<=e&&e<=10036||10052===e||10055===e||10060===e||10062===e||10067<=e&&e<=10069||10071===e||10083===e||10084===e||10085<=e&&e<=10087||10133<=e&&e<=10135||10145===e||10160===e||10175===e||10548<=e&&e<=10549||11013<=e&&e<=11015||11035<=e&&e<=11036||11088===e||11093===e||12336===e||12349===e||12951===e||12953===e||126976<=e&&e<=126979||126980===e||126981<=e&&e<=127182||127183===e||127184<=e&&e<=127231||127245<=e&&e<=127247||127279===e||127340<=e&&e<=127343||127344<=e&&e<=127345||127358<=e&&e<=127359||127374===e||127377<=e&&e<=127386||127405<=e&&e<=127461||127489<=e&&e<=127490||127491<=e&&e<=127503||127514===e||127535===e||127538<=e&&e<=127546||127548<=e&&e<=127551||127561<=e&&e<=127567||127568<=e&&e<=127569||127570<=e&&e<=127743||127744<=e&&e<=127756||127757<=e&&e<=127758||127759===e||127760===e||127761===e||127762===e||127763<=e&&e<=127765||127766<=e&&e<=127768||127769===e||127770===e||127771===e||127772===e||127773<=e&&e<=127774||127775<=e&&e<=127776||127777===e||127778<=e&&e<=127779||127780<=e&&e<=127788||127789<=e&&e<=127791||127792<=e&&e<=127793||127794<=e&&e<=127795||127796<=e&&e<=127797||127798===e||127799<=e&&e<=127818||127819===e||127820<=e&&e<=127823||127824===e||127825<=e&&e<=127867||127868===e||127869===e||127870<=e&&e<=127871||127872<=e&&e<=127891||127892<=e&&e<=127893||127894<=e&&e<=127895||127896===e||127897<=e&&e<=127899||127900<=e&&e<=127901||127902<=e&&e<=127903||127904<=e&&e<=127940||127941===e||127942===e||127943===e||127944===e||127945===e||127946===e||127947<=e&&e<=127950||127951<=e&&e<=127955||127956<=e&&e<=127967||127968<=e&&e<=127971||127972===e||127973<=e&&e<=127984||127985<=e&&e<=127986||127987===e||127988===e||127989===e||127990===e||127991===e||127992<=e&&e<=127994||128e3<=e&&e<=128007||128008===e||128009<=e&&e<=128011||128012<=e&&e<=128014||128015<=e&&e<=128016||128017<=e&&e<=128018||128019===e||128020===e||128021===e||128022===e||128023<=e&&e<=128041||128042===e||128043<=e&&e<=128062||128063===e||128064===e||128065===e||128066<=e&&e<=128100||128101===e||128102<=e&&e<=128107||128108<=e&&e<=128109||128110<=e&&e<=128172||128173===e||128174<=e&&e<=128181||128182<=e&&e<=128183||128184<=e&&e<=128235||128236<=e&&e<=128237||128238===e||128239===e||128240<=e&&e<=128244||128245===e||128246<=e&&e<=128247||128248===e||128249<=e&&e<=128252||128253===e||128254===e||128255<=e&&e<=128258||128259===e||128260<=e&&e<=128263||128264===e||128265===e||128266<=e&&e<=128276||128277===e||128278<=e&&e<=128299||128300<=e&&e<=128301||128302<=e&&e<=128317||128326<=e&&e<=128328||128329<=e&&e<=128330||128331<=e&&e<=128334||128335===e||128336<=e&&e<=128347||128348<=e&&e<=128359||128360<=e&&e<=128366||128367<=e&&e<=128368||128369<=e&&e<=128370||128371<=e&&e<=128377||128378===e||128379<=e&&e<=128390||128391===e||128392<=e&&e<=128393||128394<=e&&e<=128397||128398<=e&&e<=128399||128400===e||128401<=e&&e<=128404||128405<=e&&e<=128406||128407<=e&&e<=128419||128420===e||128421===e||128422<=e&&e<=128423||128424===e||128425<=e&&e<=128432||128433<=e&&e<=128434||128435<=e&&e<=128443||128444===e||128445<=e&&e<=128449||128450<=e&&e<=128452||128453<=e&&e<=128464||128465<=e&&e<=128467||128468<=e&&e<=128475||128476<=e&&e<=128478||128479<=e&&e<=128480||128481===e||128482===e||128483===e||128484<=e&&e<=128487||128488===e||128489<=e&&e<=128494||128495===e||128496<=e&&e<=128498||128499===e||128500<=e&&e<=128505||128506===e||128507<=e&&e<=128511||128512===e||128513<=e&&e<=128518||128519<=e&&e<=128520||128521<=e&&e<=128525||128526===e||128527===e||128528===e||128529===e||128530<=e&&e<=128532||128533===e||128534===e||128535===e||128536===e||128537===e||128538===e||128539===e||128540<=e&&e<=128542||128543===e||128544<=e&&e<=128549||128550<=e&&e<=128551||128552<=e&&e<=128555||128556===e||128557===e||128558<=e&&e<=128559||128560<=e&&e<=128563||128564===e||128565===e||128566===e||128567<=e&&e<=128576||128577<=e&&e<=128580||128581<=e&&e<=128591||128640===e||128641<=e&&e<=128642||128643<=e&&e<=128645||128646===e||128647===e||128648===e||128649===e||128650<=e&&e<=128651||128652===e||128653===e||128654===e||128655===e||128656===e||128657<=e&&e<=128659||128660===e||128661===e||128662===e||128663===e||128664===e||128665<=e&&e<=128666||128667<=e&&e<=128673||128674===e||128675===e||128676<=e&&e<=128677||128678===e||128679<=e&&e<=128685||128686<=e&&e<=128689||128690===e||128691<=e&&e<=128693||128694===e||128695<=e&&e<=128696||128697<=e&&e<=128702||128703===e||128704===e||128705<=e&&e<=128709||128710<=e&&e<=128714||128715===e||128716===e||128717<=e&&e<=128719||128720===e||128721<=e&&e<=128722||128723<=e&&e<=128724||128725===e||128726<=e&&e<=128727||128728<=e&&e<=128735||128736<=e&&e<=128741||128742<=e&&e<=128744||128745===e||128746===e||128747<=e&&e<=128748||128749<=e&&e<=128751||128752===e||128753<=e&&e<=128754||128755===e||128756<=e&&e<=128758||128759<=e&&e<=128760||128761===e||128762===e||128763<=e&&e<=128764||128765<=e&&e<=128767||128884<=e&&e<=128895||128981<=e&&e<=128991||128992<=e&&e<=129003||129004<=e&&e<=129023||129036<=e&&e<=129039||129096<=e&&e<=129103||129114<=e&&e<=129119||129160<=e&&e<=129167||129198<=e&&e<=129279||129292===e||129293<=e&&e<=129295||129296<=e&&e<=129304||129305<=e&&e<=129310||129311===e||129312<=e&&e<=129319||129320<=e&&e<=129327||129328===e||129329<=e&&e<=129330||129331<=e&&e<=129338||129340<=e&&e<=129342||129343===e||129344<=e&&e<=129349||129351<=e&&e<=129355||129356===e||129357<=e&&e<=129359||129360<=e&&e<=129374||129375<=e&&e<=129387||129388<=e&&e<=129392||129393===e||129394===e||129395<=e&&e<=129398||129399<=e&&e<=129400||129401===e||129402===e||129403===e||129404<=e&&e<=129407||129408<=e&&e<=129412||129413<=e&&e<=129425||129426<=e&&e<=129431||129432<=e&&e<=129442||129443<=e&&e<=129444||129445<=e&&e<=129450||129451<=e&&e<=129453||129454<=e&&e<=129455||129456<=e&&e<=129465||129466<=e&&e<=129471||129472===e||129473<=e&&e<=129474||129475<=e&&e<=129482||129483===e||129484===e||129485<=e&&e<=129487||129488<=e&&e<=129510||129511<=e&&e<=129535||129536<=e&&e<=129647||129648<=e&&e<=129651||129652===e||129653<=e&&e<=129655||129656<=e&&e<=129658||129659<=e&&e<=129663||129664<=e&&e<=129666||129667<=e&&e<=129670||129671<=e&&e<=129679||129680<=e&&e<=129685||129686<=e&&e<=129704||129705<=e&&e<=129711||129712<=e&&e<=129718||129719<=e&&e<=129727||129728<=e&&e<=129730||129731<=e&&e<=129743||129744<=e&&e<=129750||129751<=e&&e<=129791||130048<=e&&e<=131069?Bi.ExtendedPictographic:Bi.Other})),P(Ui,"breakProperty",(function(e){return 1536<=e&&e<=1541||1757===e||1807===e||2274===e||3406===e||69821===e||69837===e||70082<=e&&e<=70083||71999===e||72001===e||72250===e||72324<=e&&e<=72329||73030===e?Bi.Prepend:13===e?Bi.CR:10===e?Bi.LF:0<=e&&e<=9||11<=e&&e<=12||14<=e&&e<=31||127<=e&&e<=159||173===e||1564===e||6158===e||8203===e||8206<=e&&e<=8207||8232===e||8233===e||8234<=e&&e<=8238||8288<=e&&e<=8292||8293===e||8294<=e&&e<=8303||65279===e||65520<=e&&e<=65528||65529<=e&&e<=65531||78896<=e&&e<=78904||113824<=e&&e<=113827||119155<=e&&e<=119162||917504===e||917505===e||917506<=e&&e<=917535||917632<=e&&e<=917759||918e3<=e&&e<=921599?Bi.Control:768<=e&&e<=879||1155<=e&&e<=1159||1160<=e&&e<=1161||1425<=e&&e<=1469||1471===e||1473<=e&&e<=1474||1476<=e&&e<=1477||1479===e||1552<=e&&e<=1562||1611<=e&&e<=1631||1648===e||1750<=e&&e<=1756||1759<=e&&e<=1764||1767<=e&&e<=1768||1770<=e&&e<=1773||1809===e||1840<=e&&e<=1866||1958<=e&&e<=1968||2027<=e&&e<=2035||2045===e||2070<=e&&e<=2073||2075<=e&&e<=2083||2085<=e&&e<=2087||2089<=e&&e<=2093||2137<=e&&e<=2139||2259<=e&&e<=2273||2275<=e&&e<=2306||2362===e||2364===e||2369<=e&&e<=2376||2381===e||2385<=e&&e<=2391||2402<=e&&e<=2403||2433===e||2492===e||2494===e||2497<=e&&e<=2500||2509===e||2519===e||2530<=e&&e<=2531||2558===e||2561<=e&&e<=2562||2620===e||2625<=e&&e<=2626||2631<=e&&e<=2632||2635<=e&&e<=2637||2641===e||2672<=e&&e<=2673||2677===e||2689<=e&&e<=2690||2748===e||2753<=e&&e<=2757||2759<=e&&e<=2760||2765===e||2786<=e&&e<=2787||2810<=e&&e<=2815||2817===e||2876===e||2878===e||2879===e||2881<=e&&e<=2884||2893===e||2901<=e&&e<=2902||2903===e||2914<=e&&e<=2915||2946===e||3006===e||3008===e||3021===e||3031===e||3072===e||3076===e||3134<=e&&e<=3136||3142<=e&&e<=3144||3146<=e&&e<=3149||3157<=e&&e<=3158||3170<=e&&e<=3171||3201===e||3260===e||3263===e||3266===e||3270===e||3276<=e&&e<=3277||3285<=e&&e<=3286||3298<=e&&e<=3299||3328<=e&&e<=3329||3387<=e&&e<=3388||3390===e||3393<=e&&e<=3396||3405===e||3415===e||3426<=e&&e<=3427||3457===e||3530===e||3535===e||3538<=e&&e<=3540||3542===e||3551===e||3633===e||3636<=e&&e<=3642||3655<=e&&e<=3662||3761===e||3764<=e&&e<=3772||3784<=e&&e<=3789||3864<=e&&e<=3865||3893===e||3895===e||3897===e||3953<=e&&e<=3966||3968<=e&&e<=3972||3974<=e&&e<=3975||3981<=e&&e<=3991||3993<=e&&e<=4028||4038===e||4141<=e&&e<=4144||4146<=e&&e<=4151||4153<=e&&e<=4154||4157<=e&&e<=4158||4184<=e&&e<=4185||4190<=e&&e<=4192||4209<=e&&e<=4212||4226===e||4229<=e&&e<=4230||4237===e||4253===e||4957<=e&&e<=4959||5906<=e&&e<=5908||5938<=e&&e<=5940||5970<=e&&e<=5971||6002<=e&&e<=6003||6068<=e&&e<=6069||6071<=e&&e<=6077||6086===e||6089<=e&&e<=6099||6109===e||6155<=e&&e<=6157||6277<=e&&e<=6278||6313===e||6432<=e&&e<=6434||6439<=e&&e<=6440||6450===e||6457<=e&&e<=6459||6679<=e&&e<=6680||6683===e||6742===e||6744<=e&&e<=6750||6752===e||6754===e||6757<=e&&e<=6764||6771<=e&&e<=6780||6783===e||6832<=e&&e<=6845||6846===e||6847<=e&&e<=6848||6912<=e&&e<=6915||6964===e||6965===e||6966<=e&&e<=6970||6972===e||6978===e||7019<=e&&e<=7027||7040<=e&&e<=7041||7074<=e&&e<=7077||7080<=e&&e<=7081||7083<=e&&e<=7085||7142===e||7144<=e&&e<=7145||7149===e||7151<=e&&e<=7153||7212<=e&&e<=7219||7222<=e&&e<=7223||7376<=e&&e<=7378||7380<=e&&e<=7392||7394<=e&&e<=7400||7405===e||7412===e||7416<=e&&e<=7417||7616<=e&&e<=7673||7675<=e&&e<=7679||8204===e||8400<=e&&e<=8412||8413<=e&&e<=8416||8417===e||8418<=e&&e<=8420||8421<=e&&e<=8432||11503<=e&&e<=11505||11647===e||11744<=e&&e<=11775||12330<=e&&e<=12333||12334<=e&&e<=12335||12441<=e&&e<=12442||42607===e||42608<=e&&e<=42610||42612<=e&&e<=42621||42654<=e&&e<=42655||42736<=e&&e<=42737||43010===e||43014===e||43019===e||43045<=e&&e<=43046||43052===e||43204<=e&&e<=43205||43232<=e&&e<=43249||43263===e||43302<=e&&e<=43309||43335<=e&&e<=43345||43392<=e&&e<=43394||43443===e||43446<=e&&e<=43449||43452<=e&&e<=43453||43493===e||43561<=e&&e<=43566||43569<=e&&e<=43570||43573<=e&&e<=43574||43587===e||43596===e||43644===e||43696===e||43698<=e&&e<=43700||43703<=e&&e<=43704||43710<=e&&e<=43711||43713===e||43756<=e&&e<=43757||43766===e||44005===e||44008===e||44013===e||64286===e||65024<=e&&e<=65039||65056<=e&&e<=65071||65438<=e&&e<=65439||66045===e||66272===e||66422<=e&&e<=66426||68097<=e&&e<=68099||68101<=e&&e<=68102||68108<=e&&e<=68111||68152<=e&&e<=68154||68159===e||68325<=e&&e<=68326||68900<=e&&e<=68903||69291<=e&&e<=69292||69446<=e&&e<=69456||69633===e||69688<=e&&e<=69702||69759<=e&&e<=69761||69811<=e&&e<=69814||69817<=e&&e<=69818||69888<=e&&e<=69890||69927<=e&&e<=69931||69933<=e&&e<=69940||70003===e||70016<=e&&e<=70017||70070<=e&&e<=70078||70089<=e&&e<=70092||70095===e||70191<=e&&e<=70193||70196===e||70198<=e&&e<=70199||70206===e||70367===e||70371<=e&&e<=70378||70400<=e&&e<=70401||70459<=e&&e<=70460||70462===e||70464===e||70487===e||70502<=e&&e<=70508||70512<=e&&e<=70516||70712<=e&&e<=70719||70722<=e&&e<=70724||70726===e||70750===e||70832===e||70835<=e&&e<=70840||70842===e||70845===e||70847<=e&&e<=70848||70850<=e&&e<=70851||71087===e||71090<=e&&e<=71093||71100<=e&&e<=71101||71103<=e&&e<=71104||71132<=e&&e<=71133||71219<=e&&e<=71226||71229===e||71231<=e&&e<=71232||71339===e||71341===e||71344<=e&&e<=71349||71351===e||71453<=e&&e<=71455||71458<=e&&e<=71461||71463<=e&&e<=71467||71727<=e&&e<=71735||71737<=e&&e<=71738||71984===e||71995<=e&&e<=71996||71998===e||72003===e||72148<=e&&e<=72151||72154<=e&&e<=72155||72160===e||72193<=e&&e<=72202||72243<=e&&e<=72248||72251<=e&&e<=72254||72263===e||72273<=e&&e<=72278||72281<=e&&e<=72283||72330<=e&&e<=72342||72344<=e&&e<=72345||72752<=e&&e<=72758||72760<=e&&e<=72765||72767===e||72850<=e&&e<=72871||72874<=e&&e<=72880||72882<=e&&e<=72883||72885<=e&&e<=72886||73009<=e&&e<=73014||73018===e||73020<=e&&e<=73021||73023<=e&&e<=73029||73031===e||73104<=e&&e<=73105||73109===e||73111===e||73459<=e&&e<=73460||92912<=e&&e<=92916||92976<=e&&e<=92982||94031===e||94095<=e&&e<=94098||94180===e||113821<=e&&e<=113822||119141===e||119143<=e&&e<=119145||119150<=e&&e<=119154||119163<=e&&e<=119170||119173<=e&&e<=119179||119210<=e&&e<=119213||119362<=e&&e<=119364||121344<=e&&e<=121398||121403<=e&&e<=121452||121461===e||121476===e||121499<=e&&e<=121503||121505<=e&&e<=121519||122880<=e&&e<=122886||122888<=e&&e<=122904||122907<=e&&e<=122913||122915<=e&&e<=122916||122918<=e&&e<=122922||123184<=e&&e<=123190||123628<=e&&e<=123631||125136<=e&&e<=125142||125252<=e&&e<=125258||127995<=e&&e<=127999||917536<=e&&e<=917631||917760<=e&&e<=917999?Bi.Extend:127462<=e&&e<=127487?Bi.RegionalIndicator:2307===e||2363===e||2366<=e&&e<=2368||2377<=e&&e<=2380||2382<=e&&e<=2383||2434<=e&&e<=2435||2495<=e&&e<=2496||2503<=e&&e<=2504||2507<=e&&e<=2508||2563===e||2622<=e&&e<=2624||2691===e||2750<=e&&e<=2752||2761===e||2763<=e&&e<=2764||2818<=e&&e<=2819||2880===e||2887<=e&&e<=2888||2891<=e&&e<=2892||3007===e||3009<=e&&e<=3010||3014<=e&&e<=3016||3018<=e&&e<=3020||3073<=e&&e<=3075||3137<=e&&e<=3140||3202<=e&&e<=3203||3262===e||3264<=e&&e<=3265||3267<=e&&e<=3268||3271<=e&&e<=3272||3274<=e&&e<=3275||3330<=e&&e<=3331||3391<=e&&e<=3392||3398<=e&&e<=3400||3402<=e&&e<=3404||3458<=e&&e<=3459||3536<=e&&e<=3537||3544<=e&&e<=3550||3570<=e&&e<=3571||3635===e||3763===e||3902<=e&&e<=3903||3967===e||4145===e||4155<=e&&e<=4156||4182<=e&&e<=4183||4228===e||6070===e||6078<=e&&e<=6085||6087<=e&&e<=6088||6435<=e&&e<=6438||6441<=e&&e<=6443||6448<=e&&e<=6449||6451<=e&&e<=6456||6681<=e&&e<=6682||6741===e||6743===e||6765<=e&&e<=6770||6916===e||6971===e||6973<=e&&e<=6977||6979<=e&&e<=6980||7042===e||7073===e||7078<=e&&e<=7079||7082===e||7143===e||7146<=e&&e<=7148||7150===e||7154<=e&&e<=7155||7204<=e&&e<=7211||7220<=e&&e<=7221||7393===e||7415===e||43043<=e&&e<=43044||43047===e||43136<=e&&e<=43137||43188<=e&&e<=43203||43346<=e&&e<=43347||43395===e||43444<=e&&e<=43445||43450<=e&&e<=43451||43454<=e&&e<=43456||43567<=e&&e<=43568||43571<=e&&e<=43572||43597===e||43755===e||43758<=e&&e<=43759||43765===e||44003<=e&&e<=44004||44006<=e&&e<=44007||44009<=e&&e<=44010||44012===e||69632===e||69634===e||69762===e||69808<=e&&e<=69810||69815<=e&&e<=69816||69932===e||69957<=e&&e<=69958||70018===e||70067<=e&&e<=70069||70079<=e&&e<=70080||70094===e||70188<=e&&e<=70190||70194<=e&&e<=70195||70197===e||70368<=e&&e<=70370||70402<=e&&e<=70403||70463===e||70465<=e&&e<=70468||70471<=e&&e<=70472||70475<=e&&e<=70477||70498<=e&&e<=70499||70709<=e&&e<=70711||70720<=e&&e<=70721||70725===e||70833<=e&&e<=70834||70841===e||70843<=e&&e<=70844||70846===e||70849===e||71088<=e&&e<=71089||71096<=e&&e<=71099||71102===e||71216<=e&&e<=71218||71227<=e&&e<=71228||71230===e||71340===e||71342<=e&&e<=71343||71350===e||71456<=e&&e<=71457||71462===e||71724<=e&&e<=71726||71736===e||71985<=e&&e<=71989||71991<=e&&e<=71992||71997===e||72e3===e||72002===e||72145<=e&&e<=72147||72156<=e&&e<=72159||72164===e||72249===e||72279<=e&&e<=72280||72343===e||72751===e||72766===e||72873===e||72881===e||72884===e||73098<=e&&e<=73102||73107<=e&&e<=73108||73110===e||73461<=e&&e<=73462||94033<=e&&e<=94087||94192<=e&&e<=94193||119142===e||119149===e?Bi.SpacingMark:4352<=e&&e<=4447||43360<=e&&e<=43388?Bi.L:4448<=e&&e<=4519||55216<=e&&e<=55238?Bi.V:4520<=e&&e<=4607||55243<=e&&e<=55291?Bi.T:44032===e||44060===e||44088===e||44116===e||44144===e||44172===e||44200===e||44228===e||44256===e||44284===e||44312===e||44340===e||44368===e||44396===e||44424===e||44452===e||44480===e||44508===e||44536===e||44564===e||44592===e||44620===e||44648===e||44676===e||44704===e||44732===e||44760===e||44788===e||44816===e||44844===e||44872===e||44900===e||44928===e||44956===e||44984===e||45012===e||45040===e||45068===e||45096===e||45124===e||45152===e||45180===e||45208===e||45236===e||45264===e||45292===e||45320===e||45348===e||45376===e||45404===e||45432===e||45460===e||45488===e||45516===e||45544===e||45572===e||45600===e||45628===e||45656===e||45684===e||45712===e||45740===e||45768===e||45796===e||45824===e||45852===e||45880===e||45908===e||45936===e||45964===e||45992===e||46020===e||46048===e||46076===e||46104===e||46132===e||46160===e||46188===e||46216===e||46244===e||46272===e||46300===e||46328===e||46356===e||46384===e||46412===e||46440===e||46468===e||46496===e||46524===e||46552===e||46580===e||46608===e||46636===e||46664===e||46692===e||46720===e||46748===e||46776===e||46804===e||46832===e||46860===e||46888===e||46916===e||46944===e||46972===e||47e3===e||47028===e||47056===e||47084===e||47112===e||47140===e||47168===e||47196===e||47224===e||47252===e||47280===e||47308===e||47336===e||47364===e||47392===e||47420===e||47448===e||47476===e||47504===e||47532===e||47560===e||47588===e||47616===e||47644===e||47672===e||47700===e||47728===e||47756===e||47784===e||47812===e||47840===e||47868===e||47896===e||47924===e||47952===e||47980===e||48008===e||48036===e||48064===e||48092===e||48120===e||48148===e||48176===e||48204===e||48232===e||48260===e||48288===e||48316===e||48344===e||48372===e||48400===e||48428===e||48456===e||48484===e||48512===e||48540===e||48568===e||48596===e||48624===e||48652===e||48680===e||48708===e||48736===e||48764===e||48792===e||48820===e||48848===e||48876===e||48904===e||48932===e||48960===e||48988===e||49016===e||49044===e||49072===e||49100===e||49128===e||49156===e||49184===e||49212===e||49240===e||49268===e||49296===e||49324===e||49352===e||49380===e||49408===e||49436===e||49464===e||49492===e||49520===e||49548===e||49576===e||49604===e||49632===e||49660===e||49688===e||49716===e||49744===e||49772===e||49800===e||49828===e||49856===e||49884===e||49912===e||49940===e||49968===e||49996===e||50024===e||50052===e||50080===e||50108===e||50136===e||50164===e||50192===e||50220===e||50248===e||50276===e||50304===e||50332===e||50360===e||50388===e||50416===e||50444===e||50472===e||50500===e||50528===e||50556===e||50584===e||50612===e||50640===e||50668===e||50696===e||50724===e||50752===e||50780===e||50808===e||50836===e||50864===e||50892===e||50920===e||50948===e||50976===e||51004===e||51032===e||51060===e||51088===e||51116===e||51144===e||51172===e||51200===e||51228===e||51256===e||51284===e||51312===e||51340===e||51368===e||51396===e||51424===e||51452===e||51480===e||51508===e||51536===e||51564===e||51592===e||51620===e||51648===e||51676===e||51704===e||51732===e||51760===e||51788===e||51816===e||51844===e||51872===e||51900===e||51928===e||51956===e||51984===e||52012===e||52040===e||52068===e||52096===e||52124===e||52152===e||52180===e||52208===e||52236===e||52264===e||52292===e||52320===e||52348===e||52376===e||52404===e||52432===e||52460===e||52488===e||52516===e||52544===e||52572===e||52600===e||52628===e||52656===e||52684===e||52712===e||52740===e||52768===e||52796===e||52824===e||52852===e||52880===e||52908===e||52936===e||52964===e||52992===e||53020===e||53048===e||53076===e||53104===e||53132===e||53160===e||53188===e||53216===e||53244===e||53272===e||53300===e||53328===e||53356===e||53384===e||53412===e||53440===e||53468===e||53496===e||53524===e||53552===e||53580===e||53608===e||53636===e||53664===e||53692===e||53720===e||53748===e||53776===e||53804===e||53832===e||53860===e||53888===e||53916===e||53944===e||53972===e||54e3===e||54028===e||54056===e||54084===e||54112===e||54140===e||54168===e||54196===e||54224===e||54252===e||54280===e||54308===e||54336===e||54364===e||54392===e||54420===e||54448===e||54476===e||54504===e||54532===e||54560===e||54588===e||54616===e||54644===e||54672===e||54700===e||54728===e||54756===e||54784===e||54812===e||54840===e||54868===e||54896===e||54924===e||54952===e||54980===e||55008===e||55036===e||55064===e||55092===e||55120===e||55148===e||55176===e?Bi.LV:44033<=e&&e<=44059||44061<=e&&e<=44087||44089<=e&&e<=44115||44117<=e&&e<=44143||44145<=e&&e<=44171||44173<=e&&e<=44199||44201<=e&&e<=44227||44229<=e&&e<=44255||44257<=e&&e<=44283||44285<=e&&e<=44311||44313<=e&&e<=44339||44341<=e&&e<=44367||44369<=e&&e<=44395||44397<=e&&e<=44423||44425<=e&&e<=44451||44453<=e&&e<=44479||44481<=e&&e<=44507||44509<=e&&e<=44535||44537<=e&&e<=44563||44565<=e&&e<=44591||44593<=e&&e<=44619||44621<=e&&e<=44647||44649<=e&&e<=44675||44677<=e&&e<=44703||44705<=e&&e<=44731||44733<=e&&e<=44759||44761<=e&&e<=44787||44789<=e&&e<=44815||44817<=e&&e<=44843||44845<=e&&e<=44871||44873<=e&&e<=44899||44901<=e&&e<=44927||44929<=e&&e<=44955||44957<=e&&e<=44983||44985<=e&&e<=45011||45013<=e&&e<=45039||45041<=e&&e<=45067||45069<=e&&e<=45095||45097<=e&&e<=45123||45125<=e&&e<=45151||45153<=e&&e<=45179||45181<=e&&e<=45207||45209<=e&&e<=45235||45237<=e&&e<=45263||45265<=e&&e<=45291||45293<=e&&e<=45319||45321<=e&&e<=45347||45349<=e&&e<=45375||45377<=e&&e<=45403||45405<=e&&e<=45431||45433<=e&&e<=45459||45461<=e&&e<=45487||45489<=e&&e<=45515||45517<=e&&e<=45543||45545<=e&&e<=45571||45573<=e&&e<=45599||45601<=e&&e<=45627||45629<=e&&e<=45655||45657<=e&&e<=45683||45685<=e&&e<=45711||45713<=e&&e<=45739||45741<=e&&e<=45767||45769<=e&&e<=45795||45797<=e&&e<=45823||45825<=e&&e<=45851||45853<=e&&e<=45879||45881<=e&&e<=45907||45909<=e&&e<=45935||45937<=e&&e<=45963||45965<=e&&e<=45991||45993<=e&&e<=46019||46021<=e&&e<=46047||46049<=e&&e<=46075||46077<=e&&e<=46103||46105<=e&&e<=46131||46133<=e&&e<=46159||46161<=e&&e<=46187||46189<=e&&e<=46215||46217<=e&&e<=46243||46245<=e&&e<=46271||46273<=e&&e<=46299||46301<=e&&e<=46327||46329<=e&&e<=46355||46357<=e&&e<=46383||46385<=e&&e<=46411||46413<=e&&e<=46439||46441<=e&&e<=46467||46469<=e&&e<=46495||46497<=e&&e<=46523||46525<=e&&e<=46551||46553<=e&&e<=46579||46581<=e&&e<=46607||46609<=e&&e<=46635||46637<=e&&e<=46663||46665<=e&&e<=46691||46693<=e&&e<=46719||46721<=e&&e<=46747||46749<=e&&e<=46775||46777<=e&&e<=46803||46805<=e&&e<=46831||46833<=e&&e<=46859||46861<=e&&e<=46887||46889<=e&&e<=46915||46917<=e&&e<=46943||46945<=e&&e<=46971||46973<=e&&e<=46999||47001<=e&&e<=47027||47029<=e&&e<=47055||47057<=e&&e<=47083||47085<=e&&e<=47111||47113<=e&&e<=47139||47141<=e&&e<=47167||47169<=e&&e<=47195||47197<=e&&e<=47223||47225<=e&&e<=47251||47253<=e&&e<=47279||47281<=e&&e<=47307||47309<=e&&e<=47335||47337<=e&&e<=47363||47365<=e&&e<=47391||47393<=e&&e<=47419||47421<=e&&e<=47447||47449<=e&&e<=47475||47477<=e&&e<=47503||47505<=e&&e<=47531||47533<=e&&e<=47559||47561<=e&&e<=47587||47589<=e&&e<=47615||47617<=e&&e<=47643||47645<=e&&e<=47671||47673<=e&&e<=47699||47701<=e&&e<=47727||47729<=e&&e<=47755||47757<=e&&e<=47783||47785<=e&&e<=47811||47813<=e&&e<=47839||47841<=e&&e<=47867||47869<=e&&e<=47895||47897<=e&&e<=47923||47925<=e&&e<=47951||47953<=e&&e<=47979||47981<=e&&e<=48007||48009<=e&&e<=48035||48037<=e&&e<=48063||48065<=e&&e<=48091||48093<=e&&e<=48119||48121<=e&&e<=48147||48149<=e&&e<=48175||48177<=e&&e<=48203||48205<=e&&e<=48231||48233<=e&&e<=48259||48261<=e&&e<=48287||48289<=e&&e<=48315||48317<=e&&e<=48343||48345<=e&&e<=48371||48373<=e&&e<=48399||48401<=e&&e<=48427||48429<=e&&e<=48455||48457<=e&&e<=48483||48485<=e&&e<=48511||48513<=e&&e<=48539||48541<=e&&e<=48567||48569<=e&&e<=48595||48597<=e&&e<=48623||48625<=e&&e<=48651||48653<=e&&e<=48679||48681<=e&&e<=48707||48709<=e&&e<=48735||48737<=e&&e<=48763||48765<=e&&e<=48791||48793<=e&&e<=48819||48821<=e&&e<=48847||48849<=e&&e<=48875||48877<=e&&e<=48903||48905<=e&&e<=48931||48933<=e&&e<=48959||48961<=e&&e<=48987||48989<=e&&e<=49015||49017<=e&&e<=49043||49045<=e&&e<=49071||49073<=e&&e<=49099||49101<=e&&e<=49127||49129<=e&&e<=49155||49157<=e&&e<=49183||49185<=e&&e<=49211||49213<=e&&e<=49239||49241<=e&&e<=49267||49269<=e&&e<=49295||49297<=e&&e<=49323||49325<=e&&e<=49351||49353<=e&&e<=49379||49381<=e&&e<=49407||49409<=e&&e<=49435||49437<=e&&e<=49463||49465<=e&&e<=49491||49493<=e&&e<=49519||49521<=e&&e<=49547||49549<=e&&e<=49575||49577<=e&&e<=49603||49605<=e&&e<=49631||49633<=e&&e<=49659||49661<=e&&e<=49687||49689<=e&&e<=49715||49717<=e&&e<=49743||49745<=e&&e<=49771||49773<=e&&e<=49799||49801<=e&&e<=49827||49829<=e&&e<=49855||49857<=e&&e<=49883||49885<=e&&e<=49911||49913<=e&&e<=49939||49941<=e&&e<=49967||49969<=e&&e<=49995||49997<=e&&e<=50023||50025<=e&&e<=50051||50053<=e&&e<=50079||50081<=e&&e<=50107||50109<=e&&e<=50135||50137<=e&&e<=50163||50165<=e&&e<=50191||50193<=e&&e<=50219||50221<=e&&e<=50247||50249<=e&&e<=50275||50277<=e&&e<=50303||50305<=e&&e<=50331||50333<=e&&e<=50359||50361<=e&&e<=50387||50389<=e&&e<=50415||50417<=e&&e<=50443||50445<=e&&e<=50471||50473<=e&&e<=50499||50501<=e&&e<=50527||50529<=e&&e<=50555||50557<=e&&e<=50583||50585<=e&&e<=50611||50613<=e&&e<=50639||50641<=e&&e<=50667||50669<=e&&e<=50695||50697<=e&&e<=50723||50725<=e&&e<=50751||50753<=e&&e<=50779||50781<=e&&e<=50807||50809<=e&&e<=50835||50837<=e&&e<=50863||50865<=e&&e<=50891||50893<=e&&e<=50919||50921<=e&&e<=50947||50949<=e&&e<=50975||50977<=e&&e<=51003||51005<=e&&e<=51031||51033<=e&&e<=51059||51061<=e&&e<=51087||51089<=e&&e<=51115||51117<=e&&e<=51143||51145<=e&&e<=51171||51173<=e&&e<=51199||51201<=e&&e<=51227||51229<=e&&e<=51255||51257<=e&&e<=51283||51285<=e&&e<=51311||51313<=e&&e<=51339||51341<=e&&e<=51367||51369<=e&&e<=51395||51397<=e&&e<=51423||51425<=e&&e<=51451||51453<=e&&e<=51479||51481<=e&&e<=51507||51509<=e&&e<=51535||51537<=e&&e<=51563||51565<=e&&e<=51591||51593<=e&&e<=51619||51621<=e&&e<=51647||51649<=e&&e<=51675||51677<=e&&e<=51703||51705<=e&&e<=51731||51733<=e&&e<=51759||51761<=e&&e<=51787||51789<=e&&e<=51815||51817<=e&&e<=51843||51845<=e&&e<=51871||51873<=e&&e<=51899||51901<=e&&e<=51927||51929<=e&&e<=51955||51957<=e&&e<=51983||51985<=e&&e<=52011||52013<=e&&e<=52039||52041<=e&&e<=52067||52069<=e&&e<=52095||52097<=e&&e<=52123||52125<=e&&e<=52151||52153<=e&&e<=52179||52181<=e&&e<=52207||52209<=e&&e<=52235||52237<=e&&e<=52263||52265<=e&&e<=52291||52293<=e&&e<=52319||52321<=e&&e<=52347||52349<=e&&e<=52375||52377<=e&&e<=52403||52405<=e&&e<=52431||52433<=e&&e<=52459||52461<=e&&e<=52487||52489<=e&&e<=52515||52517<=e&&e<=52543||52545<=e&&e<=52571||52573<=e&&e<=52599||52601<=e&&e<=52627||52629<=e&&e<=52655||52657<=e&&e<=52683||52685<=e&&e<=52711||52713<=e&&e<=52739||52741<=e&&e<=52767||52769<=e&&e<=52795||52797<=e&&e<=52823||52825<=e&&e<=52851||52853<=e&&e<=52879||52881<=e&&e<=52907||52909<=e&&e<=52935||52937<=e&&e<=52963||52965<=e&&e<=52991||52993<=e&&e<=53019||53021<=e&&e<=53047||53049<=e&&e<=53075||53077<=e&&e<=53103||53105<=e&&e<=53131||53133<=e&&e<=53159||53161<=e&&e<=53187||53189<=e&&e<=53215||53217<=e&&e<=53243||53245<=e&&e<=53271||53273<=e&&e<=53299||53301<=e&&e<=53327||53329<=e&&e<=53355||53357<=e&&e<=53383||53385<=e&&e<=53411||53413<=e&&e<=53439||53441<=e&&e<=53467||53469<=e&&e<=53495||53497<=e&&e<=53523||53525<=e&&e<=53551||53553<=e&&e<=53579||53581<=e&&e<=53607||53609<=e&&e<=53635||53637<=e&&e<=53663||53665<=e&&e<=53691||53693<=e&&e<=53719||53721<=e&&e<=53747||53749<=e&&e<=53775||53777<=e&&e<=53803||53805<=e&&e<=53831||53833<=e&&e<=53859||53861<=e&&e<=53887||53889<=e&&e<=53915||53917<=e&&e<=53943||53945<=e&&e<=53971||53973<=e&&e<=53999||54001<=e&&e<=54027||54029<=e&&e<=54055||54057<=e&&e<=54083||54085<=e&&e<=54111||54113<=e&&e<=54139||54141<=e&&e<=54167||54169<=e&&e<=54195||54197<=e&&e<=54223||54225<=e&&e<=54251||54253<=e&&e<=54279||54281<=e&&e<=54307||54309<=e&&e<=54335||54337<=e&&e<=54363||54365<=e&&e<=54391||54393<=e&&e<=54419||54421<=e&&e<=54447||54449<=e&&e<=54475||54477<=e&&e<=54503||54505<=e&&e<=54531||54533<=e&&e<=54559||54561<=e&&e<=54587||54589<=e&&e<=54615||54617<=e&&e<=54643||54645<=e&&e<=54671||54673<=e&&e<=54699||54701<=e&&e<=54727||54729<=e&&e<=54755||54757<=e&&e<=54783||54785<=e&&e<=54811||54813<=e&&e<=54839||54841<=e&&e<=54867||54869<=e&&e<=54895||54897<=e&&e<=54923||54925<=e&&e<=54951||54953<=e&&e<=54979||54981<=e&&e<=55007||55009<=e&&e<=55035||55037<=e&&e<=55063||55065<=e&&e<=55091||55093<=e&&e<=55119||55121<=e&&e<=55147||55149<=e&&e<=55175||55177<=e&&e<=55203?Bi.LVT:8205===e?Bi.ZWJ:Bi.Other}));var Wi=Ui.breakType,$i=Ui.breakProperty,zi=Ui.emojiProperty;function Gi(e,r){var t,n,i,o,a,u;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(arguments.length>1){if(!St(r))throw new TypeError(tr("invalid argument. Second argument must be an integer. Value: `%s`.",r));o=r}else o=0;if(i=e.length,o<0&&(o+=i)<0&&(o=0),0===i||o>=i)return-1;for(t=[],n=[],a=Mi(e,o),t.push($i(a)),n.push(zi(a)),u=o+1;u0))return u;return-1}function qi(e,r){for(var t=0;r>0;)t=Gi(e,t),r-=1;return""===e||-1===t?e:e.substring(0,t)}function Ji(e,r,t){var n;for(n=0;n0){if(t=function(e,r){return Un(r)?G(r,"flags")&&(e.flags=r.flags,!Y(e.flags))?new TypeError(O("invalid option. `%s` option must be a string. Option: `%s`.","flags",e.flags)):G(r,"capture")&&(e.capture=r.capture,!ie(e.capture))?new TypeError(O("invalid option. `%s` option must be a boolean. Option: `%s`.","capture",e.capture)):null:new TypeError(O("invalid argument. Options argument must be an object. Value: `%s`.",r))}(r={},e),t)throw t;return r.capture?new RegExp("("+ro+")",r.flags):new RegExp(ro,r.flags)}return/[\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/}var no=to({capture:!0}),io=to();function oo(e){var r,t,n,i;for(r=!0,t="",i=0;i?`{}|~\/\\\[\]_#$*&^@%]+/g,so=/([a-z0-9])([A-Z])/g;function lo(e){return e=nr(e,uo," "),e=nr(e,so,"$1 $2"),nr(e=oo(e=vr(e=Xn(e))),ao,"-")}var fo=/\s+/g,ho=/[!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g,co=/([a-z0-9])([A-Z])/g;function go(e){return e=nr(e,ho," "),e=nr(e,co,"$1 $2"),vr(e=nr(e=Xn(e),fo,"-"))}function po(e,r){var t=e.length;return e.substring(t-r,t)}var mo=/[\uDC00-\uDFFF]/,vo=/[\uD800-\uDBFF]/;function yo(e,r){var t,n,i,o,a,u;if(t=e.length,n="",a=0,""===e||0===r)return"";if(1===r)return e=e.substring(t-2,t),Li.test(e)?e:e[1];for(u=t-1;u>=0;u--){if(n=(i=e[u])+n,a+=1,mo.test(i)){if(0===u)break;o=e[u-1],vo.test(o)&&(n=o+n,u-=1)}if(a===r)break}return n}function wo(e){return St(e)&&e>0}function bo(e){return Lt(e)&&e.valueOf()>0}function Eo(e){return wo(e)||bo(e)}P(Eo,"isPrimitive",wo),P(Eo,"isObject",bo);var To={float64:function(e,r,t){e[r]=t},float32:function(e,r,t){e[r]=t},int32:function(e,r,t){e[r]=t},int16:function(e,r,t){e[r]=t},int8:function(e,r,t){e[r]=t},uint32:function(e,r,t){e[r]=t},uint16:function(e,r,t){e[r]=t},uint8:function(e,r,t){e[r]=t},uint8c:function(e,r,t){e[r]=t},generic:function(e,r,t){e[r]=t},default:function(e,r,t){e[r]=t}};function _o(e){var r=To[e];return"function"==typeof r?r:To.default}var Vo={complex128:function(e,r,t){e.set(t,r)},complex64:function(e,r,t){e.set(t,r)},default:function(e,r,t){e.set(t,r)}};function Ao(e){var r=Vo[e];return"function"==typeof r?r:Vo.default}function xo(e){var r=kn(e);return yr(e)?{data:e,dtype:r,accessorProtocol:!0,accessors:[br(r),Ao(r)]}:{data:e,dtype:r,accessorProtocol:!1,accessors:[Tr(r),_o(r)]}}function Fo(e){var r,t;if(!(this instanceof Fo))return new Fo(e);if(wo(e))for(r=[],t=0;ti?{done:!0}:t._count!==t._length?(n=!0,{done:!0}):(a=(a+1)%t._length,{value:t._buffer.accessors[0](t._buffer.data,a),done:!1})})),P(r,"return",(function(e){return n=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(r,tn,(function(){return t.iterator(i)})),r})),nn(Fo.prototype,"length",(function(){return this._length})),P(Fo.prototype,"push",(function(e){var r,t,n,i;return n=this._buffer.data,t=this._buffer.accessors[0],r=this._buffer.accessors[1],this._i=(this._i+1)%this._length,this._count>>=1);)e+=e;return t},No=Math.ceil;function Mo(e,r,t){var n=(r-e.length)/t.length;return n<=0?e:(n=No(n),Ro(t,n)+e)}var ko=void 0!==String.prototype.trimLeft,jo=/^[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/,Co=String.prototype.trimLeft,Io=ko?function(e){return Co.call(e)}:function(e){return nr(e,jo,"")},Do=/\s+/g,Bo=/[-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g,Po=/(?:\s|^)([^\s]+)(?=\s|$)/g,Yo=/([a-z0-9])([A-Z])/g;function Uo(e,r){return Jn(vr(r))}function Wo(e){return e=nr(e,Bo," "),e=nr(e,Do," "),e=nr(e,Yo,"$1 $2"),nr(e=Xn(e),Po,Uo)}var $o=63,zo=128,Go=192,qo=224,Jo=240,Zo=1023,Qo=2048,Ho=55296,Xo=57344,Ko=65536;function ea(e){var r,t,n,i;if(!Y(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));for(n=e.length,t=[],i=0;i>6),t.push(zo|r&$o)):r=Xo?(t.push(qo|r>>12),t.push(zo|r>>6&$o),t.push(zo|r&$o)):(i+=1,r=Ko+((r&Zo)<<10|e.charCodeAt(i)&Zo),t.push(Jo|r>>18),t.push(zo|r>>12&$o),t.push(zo|r>>6&$o),t.push(zo|r&$o));return t}var ra=95,ta=46,na=45,ia=126,oa=48,aa=57,ua=65,sa=90,la=97,fa=122;function ha(e){var r,t,n,i,o;for(n=(i=ea(e)).length,t="",o=0;o=oa&&r<=aa||r>=ua&&r<=sa||r>=la&&r<=fa||r===na||r===ta||r===ra||r===ia?e.charAt(o):"%"+r.toString(16).toUpperCase();return t}function ca(e,r){return e.substring(r,e.length)}var ga=/[\uDC00-\uDFFF]/,pa=/[\uD800-\uDBFF]/;function ma(e,r){var t,n,i,o,a;if(0===r)return e;for(t=e.length,o=0,a=0;a0;)t=Gi(e,t),r-=1;return""===e||-1===t?"":e.substring(t,e.length)}function da(e,r){return e.substring(0,e.length-r)}var ya=/[\uDC00-\uDFFF]/,wa=/[\uD800-\uDBFF]/;function ba(e,r){var t,n,i,o;if(0===r)return e;for(i=0,o=e.length-1;o>=0;o--){if(t=e[o],i+=1,ya.test(t)){if(0===o)break;n=e[o-1],wa.test(n)&&(o-=1)}if(i===r)break}return e.substring(0,o)}function Ea(e){var r,t,n;if(!Y(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));for(r=0,n=Gi(e,t=0);-1!==n;)r+=1,n=Gi(e,t=n);return t=e.length)return e;return i=e.indexOf(r,n),""===e||""===r||""===t||i<0?e:t+e.substring(i)}function Va(e){var r,t;for(r="",t=e.length-1;t>=0;t--)r+=e[t];return r}var Aa=/[\uDC00-\uDFFF]/,xa=/[\uD800-\uDBFF]/;function Fa(e){var r,t,n,i,o;for(r=e.length,t="",o=0;or?e:r}var Ba=/[\uDC00-\uDFFF]/,Pa=/[\uD800-\uDBFF]/,Ya=/\s+/g,Ua=/[\-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g,Wa=/([a-z0-9])([A-Z])/g;function $a(e){return e=nr(e,Ua," "),e=nr(e,Wa,"$1 $2"),vr(e=nr(e=Xn(e),Ya,"_"))}var za=void 0!==String.prototype.startsWith,Ga=String.prototype.startsWith,qa=za?function(e,r,t){var n;return n=t<0?e.length+t:t,0===r.length||!(n<0||n+r.length>e.length)&&Ga.call(e,r,n)}:function(e,r,t){var n,i;if(n=t<0?e.length+t:t,0===r.length)return!0;if(n<0||n+r.length>e.length)return!1;for(i=0;i=0&&e<=1}function Qa(e){return Tt(e)&&e.valueOf()>=0&&e.valueOf()<=1}function Ha(e){return Za(e)||Qa(e)}function Xa(e){return function(){return e}}function Ka(){}P(Ha,"isPrimitive",Za),P(Ha,"isObject",Qa);var eu=9007199254740991;function ru(e,r){return vi(e)||vi(r)?NaN:e===Rr||r===Rr?Rr:e===r&&0===e?function(e){return 0===e&&1/e===Rr}(e)?e:r:e>r?e:r}var tu,nu="function"==typeof Math.imul?Math.imul:null;tu="function"==typeof nu?nu:function(e,r){var t,n;return((t=(65535&(e|=0))>>>0)*(n=(65535&(r|=0))>>>0)>>>0)+((e>>>16>>>0)*n+t*(r>>>16>>>0)<<16>>>0)|0};var iu=tu;function ou(e,r){return iu(e,r)>>>0}function au(e,r,t,n,i,o,a){var u,s,l,f,h,c,g;for(u=r.data,s=i.data,f=r.accessors[0],l=i.accessors[1],h=n,c=a,g=0;g0)for(f=0;f0)for(c=0;cVt&&e65504||isNaN(r)?i*Rr:i*r)};var Eu=wu,Tu=wt.NEGATIVE_INFINITY,_u=new kr(1),Vu=new Ur(_u.buffer);function Au(e){return _u[0]=e,Vu[0]}var xu=127,Fu=2139095040,Su=new kr(1);new Ur(Su.buffer)[0]=4286578688;var Lu=Su[0],Ou=8388607,Ru=32256,Nu=31744,Mu=64512,ku=0,ju=32768,Cu=8388608,Iu=8191,Du=4095,Bu=1023;function Pu(e){var r,t,n,i,o,a,u,s;return function(e){return e!=e}(e)?Ru:e===hu?Nu:e===Tu?Mu:0===e?function(e){return 0===e&&1/e===Lu}(e)?ju:ku:(s=e<0?1:0,u=Au(e=function(e){return Math.abs(e)}(e))&Ou,r=function(e){var r=Au(e);return(r=(r&Fu)>>>23)-xu}(e),(t=r+15)>=31?s?Mu:Nu:t<=0?t<-10?s<<15:(i=(Cu|u)>>>13,(a=1-t)<11?(o=i>>>a-1&1,(n=0!=(i&(1<>>13-(a-11)-1&1,n=0!=(u&(1<<13-(a-11)-1)-1)),i>>>=a,o&&(n||1&i)&&(i+=1),s<<15|i):(i=u>>>13,n=0!=(u&Du),(o=u>>>12&1)&&(n||1&i)&&(i+=1)>Bu&&(i=0,(t+=1)>=31)?s?Mu:Nu:s<<15|t<<10|i))}var Yu=1023,Uu=-1022,Wu=Math.round,$u=1023,zu=-1023,Gu=-1074;function qu(e){return e===Rr||e===Vt}var Ju,Zu,Qu,Hu=2147483648,Xu=2147483647,Ku={uint16:Xr,uint8:st},es=((Ju=new Ku.uint16(1))[0]=4660,52===new Ku.uint8(Ju.buffer)[0]);!0===es?(Zu=1,Qu=0):(Zu=0,Qu=1);var rs={HIGH:Zu,LOW:Qu},ts=new Lr(1),ns=new Ur(ts.buffer),is=rs.HIGH,os=rs.LOW;function as(e,r,t,n){return ts[0]=e,r[n]=ns[is],r[n+t]=ns[os],r}function us(e){return as(e,[0,0],1,0)}P(us,"assign",as);var ss,ls,fs=!0===es?1:0,hs=new Lr(1),cs=new Ur(hs.buffer);function gs(e){return hs[0]=e,cs[fs]}!0===es?(ss=1,ls=0):(ss=0,ls=1);var ps={HIGH:ss,LOW:ls},ms=new Lr(1),vs=new Ur(ms.buffer),ds=ps.HIGH,ys=ps.LOW;function ws(e,r){return vs[ds]=e,vs[ys]=r,ms[0]}var bs=[0,0],Es=22250738585072014e-324,Ts=4503599627370496;function _s(e,r,t,n){return vi(e)||qu(e)?(r[n]=e,r[n+t]=0,r):0!==e&&yu(e)>>20)-$u|0}(e),rYu?e<0?Vt:Rr:(r<=zu?(r+=52,n=As):n=1,us.assign(e,Ss,1,0),t=Ss[0],t&=xs,n*ws(t|=r+$u<<20,Ss[1])))}function Os(e){var r,t,n;return vi(e)?e:e>Yu?Rr:e>>15,r=1023&e,(t=(31744&e)>>>10)===Rs?0===r?1===n?Tu:hu:NaN:0===t?0===r?1===n?-0:0:(i=Os(-14)*(r/1024),n?-i:i):(i=Os(t-15)*(1+r/1024),n?-i:i)}function Ms(e){var r,t;for(r=[];!(t=e.next()).done;)r.push(Pu(Eu(t.value)));return r}var ks=Xr.BYTES_PER_ELEMENT,js=rn();function Cs(e){return"object"==typeof e&&null!==e&&"Float16Array"===e.constructor.name&&e.BYTES_PER_ELEMENT===ks}function Is(e){return e===Ps}function Ds(e,r){return function(){return e._get(r)}}function Bs(e,r){return function(t){e.set([t],r)}}function Ps(){var e,r,t,n,i,o;if(r=arguments.length,!(this instanceof Ps))return 0===r?new Ps:1===r?new Ps(arguments[0]):2===r?new Ps(arguments[0],arguments[1]):new Ps(arguments[0],arguments[1],arguments[2]);if(0===r)t=new Xr(0);else if(1===r)if(Rt(i=arguments[0]))t=new Xr(i);else if(It(i))Cs(i)?(t=new Xr(i.length),su.ndarray(i.length,new Xr(i.buffer,i.byteOffset,i.length),1,0,t,1,0)):t=function(e,r){var t,n;for(t=r.length,n=0;nt.byteLength-e)throw new RangeError(O("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*ks));t=new Xr(t,e,n)}}for(P(this,"_buffer",t),P(this,"_length",t.length),o=0;o1){if(!Ve(n=arguments[1]))throw new TypeError(O("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(r=arguments[2])}if(It(e)){if(n){for(o=(i=new this(u=e.length))._buffer,s=0;s=this._length))return Ns(this._buffer[e])})),nn(Ps.prototype,"buffer",(function(){return this._buffer.buffer})),nn(Ps.prototype,"byteLength",(function(){return this._buffer.byteLength})),nn(Ps.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),P(Ps.prototype,"BYTES_PER_ELEMENT",Ps.BYTES_PER_ELEMENT),P(Ps.prototype,"copyWithin",(function(e,r){if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");return 2===arguments.length?this._buffer.copyWithin(e,r):this._buffer.copyWithin(e,r,arguments[2]),this})),P(Ps.prototype,"entries",(function(){var e,r,t,n,i,o;if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");return e=this,n=this._buffer,t=this._length,o=-1,P(r={},"next",(function(){return o+=1,i||o>=t?{done:!0}:{value:[o,Ns(n[o])],done:!1}})),P(r,"return",(function(e){return i=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(r,tn,(function(){return e.entries()})),r})),P(Ps.prototype,"every",(function(e,r){var t,n;if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n1){if(!St(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!St(t))throw new TypeError(O("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else r=0,t=i;for(a=Pu(e),o=r;o=0;i--)if(n=Ns(t[i]),e.call(r,n,i,this))return n})),P(Ps.prototype,"findLastIndex",(function(e,r){var t,n,i;if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,i=this._length-1;i>=0;i--)if(n=Ns(t[i]),e.call(r,n,i,this))return i;return-1})),P(Ps.prototype,"forEach",(function(e,r){var t,n;if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n=this._length))return Ns(this._buffer[e])})),P(Ps.prototype,"includes",(function(e,r){var t,n,i;if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!yt(e))throw new TypeError(O("invalid argument. First argument must be a number. Value: `%s`.",e));if(arguments.length>1){if(!St(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(t=this._buffer,i=Pu(e),n=r;n1){if(!St(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(t=this._buffer,i=Pu(e),n=r;n0){if(!Y(e))throw new TypeError(O("invalid argument. First argument must be a string. Value: `%s`.",e))}else e=",";for(r=this._buffer,t=[],n=0;n=t?{done:!0}:{value:i,done:!1}})),P(r,"return",(function(e){return n=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(r,tn,(function(){return e.keys()})),r})),P(Ps.prototype,"lastIndexOf",(function(e,r){var t,n,i;if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!yt(e))throw new TypeError(O("invalid argument. First argument must be a number. Value: `%s`.",e));if(arguments.length>1){if(!St(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(t=this._buffer,i=Pu(e),n=r;n>=0;n--)if(i===t[n])return n;return-1})),nn(Ps.prototype,"length",(function(){return this._length})),P(Ps.prototype,"map",(function(e,r){var t,n,i,o;if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!Ve(e))throw new TypeError("invalid argument. First argument must be a function. Value: `%s`.",e);for(i=this._buffer,t=(n=new this.constructor(this._length))._buffer,o=0;o1)i=r,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=Ns(t[0]),o=1}for(;o1)i=r,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=Ns(t[n-1]),o=n-2}for(;o>=0;o--)i=e(i,Ns(t[o]),o,this);return i})),P(Ps.prototype,"reverse",(function(){var e,r,t,n,i,o;if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");for(e=this._buffer,t=this._length,n=At(t/2),i=0;i1){if(!Rt(t=arguments[1]))throw new TypeError(O("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(t+(a=e.length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(Cs(e)?(r=e._buffer,o=!0):(r=e,o=!1),s=n.byteOffset+t*ks,r.buffer===n.buffer&&r.byteOffsets){for(i=new Xr(r.length),u=0;ua&&(r=a)}}for(t=en?1:0})),this;if(!Ve(e))throw new TypeError(O("invalid argument. First argument must be a function. Value: `%s`.",e));return r.sort((function(r,t){return e(Ns(r),Ns(t))})),this})),P(Ps.prototype,"subarray",(function(e,r){var t,n,i;if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(n=this._buffer,i=this._length,0===arguments.length)e=0,r=i;else{if(!St(e))throw new TypeError(O("invalid argument. First argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),1===arguments.length)r=i;else{if(!St(r))throw new TypeError(O("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0?(r+=i)<0&&(r=0):r>i&&(r=i)}}return e>=i?(i=0,t=n.byteLength):e>=r?(i=0,t=n.byteOffset+e*ks):(i=r-e,t=n.byteOffset+e*ks),new this.constructor(n.buffer,t,i<0?0:i)})),P(Ps.prototype,"toLocaleString",(function(e,r){var t,n,i,o,a;if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(0===arguments.length)n=[];else{if(!Y(e)&&!Yt(e))throw new TypeError(O("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",e));n=e}if(arguments.length<2)t={};else{if(!Pt(r))throw new TypeError(O("invalid argument. Options argument must be an object. Value: `%s`.",r));t=r}for(o=this._buffer,i=[],a=0;a=t?{done:!0}:{value:Ns(i[o]),done:!1}})),P(e,"return",(function(e){return n=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(e,tn,(function(){return r.values()})),e})),P(Ps.prototype,"with",(function(e,r){var t,n;if(!Cs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!St(e))throw new TypeError(O("invalid argument. First argument must be an integer. Value: `%s`.",e));if(n=this._length,e<0&&(e+=n),e<0||e>=n)throw new RangeError(O("invalid argument. Index argument is out-of-bounds. Value: `%s`.",e));if(!yt(r))throw new TypeError(O("invalid argument. Second argument must be a number. Value: `%s`.",r));return(t=new this.constructor(this))[e]=r,t}));var Ys,Us="function"==typeof Float16Array?Float16Array:void 0;Ys=function(){var e,r;if("function"!=typeof cu)return!1;try{e="object"==typeof(r=new cu([1,3.14,-3.14,5e40]))&&null!==r&&"Float16Array"===r.constructor.name&&2===r.BYTES_PER_ELEMENT&&1===r[0]&&3.14!==r[1]&&-3.14!==r[2]&&r[3]===hu&&4===r.length}catch(r){e=!1}return e}()?Us:Ps;var Ws=[Lr,kr,Ys,qr,Ur,nt,Xr,dt,st,gt],$s=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float16Array","Float32Array","Float64Array"],zs=xr()?Pn(Lr):Gs;function Gs(){}zs="TypedArray"===function(e){if(!1===Ve(e))throw new TypeError(O("invalid argument. Must provide a function. Value: `%s`.",e));return fu?e.name:de.exec(e.toString())[1]}(zs)?zs:Gs;var qs=[Vn,mn],Js=["Complex64Array","Complex128Array"];function Zs(){return"function"==typeof J&&"symbol"==typeof J("foo")&&G(J,"hasInstance")&&"symbol"==typeof J.hasInstance}var Qs=Zs()?Symbol.hasInstance:null,Hs=Zs();function Xs(e,r){if("function"!=typeof r&&(!Hs||"object"!=typeof r||"function"!=typeof r[Qs]))throw new TypeError(O("invalid argument. Second argument must be callable. Value: `%s`.",r));return e instanceof r}var Ks=[[Lr,"Float64Array"],[kr,"Float32Array"],[qr,"Int32Array"],[Ur,"Uint32Array"],[nt,"Int16Array"],[Xr,"Uint16Array"],[dt,"Int8Array"],[st,"Uint8Array"],[gt,"Uint8ClampedArray"],[mn,"Complex64Array"],[Vn,"Complex128Array"],[On,"BooleanArray"]];function el(e){var r,t;for(t=0;t>>0}var il=624,ol=397,al=Dr>>>0,ul=19650218,sl=2147483648,ll=2147483647,fl=1812433253,hl=1664525,cl=1566083941,gl=2636928640,pl=4022730752,ml=[0,2567483615],vl=1/(eu+1),dl=67108864,yl=2147483648,wl=1,bl=eu*vl,El=1,Tl=3,_l=2,Vl=il+3,Al=il+5,xl=il+6;function Fl(e,r){var t;return t=r?"option":"argument",e.length>>0,n=1;n>>0)^t>>>30)>>>0,e[n]=ou(t,fl)+n>>>0;return e}function Ll(e){var r,t,n,i,o,a;if(n={},arguments.length){if(!Un(e))throw new TypeError(O("invalid argument. Options argument must be an object. Value: `%s`.",e));if(G(e,"copy")&&(n.copy=e.copy,!ie(e.copy)))throw new TypeError(O("invalid option. `%s` option must be a boolean. Option: `%s`.","copy",e.copy));if(G(e,"state")){if(t=e.state,n.state=!0,!Cr(t))throw new TypeError(O("invalid option. `%s` option must be a Uint32Array. Option: `%s`.","state",t));if(a=Fl(t,!0))throw a;!1===n.copy?r=t:(r=new Ur(t.length),su(t.length,t,1,r,1)),t=new Ur(r.buffer,r.byteOffset+(_l+1)*r.BYTES_PER_ELEMENT,il),i=new Ur(r.buffer,r.byteOffset+(Al+1)*r.BYTES_PER_ELEMENT,t[Al])}if(void 0===i)if(G(e,"seed"))if(i=e.seed,n.seed=!0,wo(i)){if(i>al)throw new RangeError(O("invalid option. `%s` option must be a positive integer less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.","seed",i));i>>>=0}else{if(!1===It(i)||i.length<1)throw new TypeError(O("invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.","seed",i));if(1===i.length){if(!wo(i=i[0]))throw new TypeError(O("invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.","seed",i));if(i>al)throw new RangeError(O("invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.","seed",i));i>>>=0}else o=i.length,(r=new Ur(xl+o))[0]=El,r[1]=Tl,r[_l]=il,r[Vl]=1,r[Vl+1]=il,r[Al]=o,su.ndarray(o,i,1,0,r,1,Al+1),t=new Ur(r.buffer,r.byteOffset+(_l+1)*r.BYTES_PER_ELEMENT,il),i=new Ur(r.buffer,r.byteOffset+(Al+1)*r.BYTES_PER_ELEMENT,o),t=function(e,r,t,n){var i,o,a,u;for(o=1,a=0,u=ru(r,n);u>0;u--)i=ou(i=((i=e[o-1]>>>0)^i>>>30)>>>0,hl)>>>0,e[o]=(e[o]>>>0^i)+t[a]+a>>>0,a+=1,(o+=1)>=r&&(e[0]=e[r-1],o=1),a>=n&&(a=0);for(u=r-1;u>0;u--)i=ou(i=((i=e[o-1]>>>0)^i>>>30)>>>0,cl)>>>0,e[o]=(e[o]>>>0^i)-o>>>0,(o+=1)>=r&&(e[0]=e[r-1],o=1);return e[0]=yl,e}(t=Sl(t,il,ul),il,i,o)}else i=nl()>>>0}else i=nl()>>>0;return void 0===t&&((r=new Ur(xl+1))[0]=El,r[1]=Tl,r[_l]=il,r[Vl]=1,r[Vl+1]=il,r[Al]=1,r[Al+1]=i,t=new Ur(r.buffer,r.byteOffset+(_l+1)*r.BYTES_PER_ELEMENT,il),i=new Ur(r.buffer,r.byteOffset+(Al+1)*r.BYTES_PER_ELEMENT,1),t=Sl(t,il,i)),P(p,"NAME","mt19937"),nn(p,"seed",u),nn(p,"seedLength",s),Ja(p,"state",h,c),nn(p,"stateLength",l),nn(p,"byteLength",f),P(p,"toJSON",g),P(p,"MIN",0),P(p,"MAX",Dr),P(p,"normalized",m),P(m,"NAME",p.NAME),nn(m,"seed",u),nn(m,"seedLength",s),Ja(m,"state",h,c),nn(m,"stateLength",l),nn(m,"byteLength",f),P(m,"toJSON",g),P(m,"MIN",0),P(m,"MAX",bl),p;function u(){var e=r[Al];return su(e,i,1,new Ur(e),1)}function s(){return r[Al]}function l(){return r.length}function f(){return r.byteLength}function h(){var e=r.length;return su(e,r,1,new Ur(e),1)}function c(e){var o;if(!Cr(e))throw new TypeError(O("invalid argument. Must provide a Uint32Array. Value: `%s`.",e));if(o=Fl(e,!1))throw o;!1===n.copy?n.state&&e.length===r.length?su(e.length,e,1,r,1):(r=e,n.state=!0):(e.length!==r.length&&(r=new Ur(e.length)),su(e.length,e,1,r,1)),t=new Ur(r.buffer,r.byteOffset+(_l+1)*r.BYTES_PER_ELEMENT,il),i=new Ur(r.buffer,r.byteOffset+(Al+1)*r.BYTES_PER_ELEMENT,r[Al])}function g(){var e={type:"PRNG"};return e.name=p.NAME,e.state=rl(r),e.params=[],e}function p(){var e,n;return(n=r[Vl+1])>=il&&(t=function(e){var r,t,n,i;for(i=il-ol,t=0;t>>1^ml[r&wl];for(n=il-1;t>>1^ml[r&wl];return r=e[n]&sl|e[0]&ll,e[n]=e[ol-1]^r>>>1^ml[r&wl],e}(t),n=0),e=t[n],r[Vl+1]=n+1,e^=e>>>11,e^=e<<7&gl,e^=e<<15&pl,(e^=e>>>18)>>>0}function m(){var e=p()>>>5,r=p()>>>6;return(e*dl+r)*vl}}function Ol(){var e,r,t,n;if(0===arguments.length)r=Ll();else if(1===arguments.length&&Un(arguments[0]))if(G(e=arguments[0],"prng")){if(!Ve(e.prng))throw new TypeError(O("invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.","prng",e.prng));r=e.prng}else r=Ll(e);else{if(!Za(n=arguments[0]))throw new TypeError(O("invalid argument. First argument must be a probability. Value: `%s`.",n));if(arguments.length>1){if(!Un(e=arguments[1]))throw new TypeError(O("invalid argument. Options argument must be an object. Value: `%s`.",e));if(G(e,"prng")){if(!Ve(e.prng))throw new TypeError(O("invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.","prng",e.prng));r=e.prng}else r=Ll(e)}else r=Ll()}return P(t=void 0===n?function(e){return vi(e)||e<0||e>1?NaN:r()<=e?1:0}:function(){return r()<=n?1:0},"NAME","bernoulli"),e&&e.prng?(P(t,"seed",null),P(t,"seedLength",null),Ja(t,"state",Xa(null),Ka),P(t,"stateLength",null),P(t,"byteLength",null),P(t,"toJSON",Xa(null)),P(t,"PRNG",r)):(nn(t,"seed",(function(){return r.seed})),nn(t,"seedLength",(function(){return r.seedLength})),Ja(t,"state",(function(){return r.state}),(function(e){r.state=e})),nn(t,"stateLength",(function(){return r.stateLength})),nn(t,"byteLength",(function(){return r.byteLength})),P(t,"toJSON",(function(){var e={type:"PRNG"};return e.name=t.NAME,e.state=rl(r.state),e.params=void 0===n?[]:[n],e})),P(t,"PRNG",r),r=r.normalized),t}P(Ll({seed:nl()}),"factory",Ll);var Rl=Ol();function Nl(e){return""===e?"":e.charAt(0).toLowerCase()+e.slice(1)}P(Rl,"factory",Ol);var Ml={};B(Ml,"altcase",(function(e){var r,t="";for(r=0;r=0;u--)o=u,a=n=e[u],u>0&&Xi.test(n)&&(i=e[u-1],Ki.test(i)&&(a=i+n,u-=1)),r.call(t,a,o,e);return e})),B(Ml,"forEachGraphemeCluster",eo),B(Ml,"forEachRight",(function(e,r,t){var n;for(n=e.length-1;n>=0;n--)r.call(t,e[n],n,e);return e})),B(Ml,"formatInterpolate",Xe),B(Ml,"formatTokenize",rr),B(Ml,"headercase",lo),B(Ml,"invcase",(function(e){var r,t,n,i;for(r=[],i=0;i=e.length)return e;return i=e.indexOf(r,n),""===e||""===r||""===t||i<0?e:e.substring(0,i+r.length)+t})),B(Ml,"replaceAfterLast",(function(e,r,t,n){var i;return n<0&&(n+=e.length)<0?e:(i=e.lastIndexOf(r,n),""===e||""===r||""===t||i<0?e:e.substring(0,i+r.length)+t)})),B(Ml,"replaceBefore",_a),B(Ml,"replaceBeforeLast",(function(e,r,t,n){var i;return n<0&&(n+=e.length)<0?e:(i=e.lastIndexOf(r,n),""===e||""===r||""===t||i<0?e:t+e.substring(i))})),B(Ml,"reverse",Va),B(Ml,"reverseCodePoints",Fa),B(Ml,"reverseGraphemeClusters",Sa),B(Ml,"rpad",La),B(Ml,"rtrim",Ma),B(Ml,"slice",(function(e,r,t){return ka.call(e,r,t)})),B(Ml,"sliceCodePoints",(function(e,r,t){var n,i,o,a,u,s,l,f;if(0===(o=e.length))return"";if(n=Ia(e),r<0&&(r=Da(n+r,0)),t<0?t=Da(n+t,0):t>n&&(t=n),r>=n||t<=r)return"";for(i="",s=0,f=0;f=r&&s=n||r>=t)return"";for(t>n&&(t=n),i="",o=0,u=0;o=r&&u=t)););return i})),B(Ml,"snakecase",$a),B(Ml,"startcase",oo),B(Ml,"startsWith",qa),B(Ml,"stickycase",(function(e,r){var t,n,i="";for(r="number"==typeof r&&r>=0&&r<=1?r:.5,n=0;n(o=e.length)?e:(n=r-i)<0?t.slice(0,r):(a=Wu(n/2),u=o-(u=Qt((s=n)>0?s-1:s+1)?a-1:a),e.substring(0,a)+t+e.substring(u))})),B(Ml,"uncapitalize",Nl),B(Ml,"uppercase",mr);var kl=["grapheme","code_point","code_unit"],jl={grapheme:qi,code_point:Ni,code_unit:Fi},Cl=jn(kl),Il=["grapheme","code_point","code_unit"],Dl={grapheme:eo,code_point:Hi,code_unit:Ji},Bl=jn(Il),Pl=1114111,Yl=String.fromCharCode,Ul=["grapheme","code_point","code_unit"],Wl={grapheme:So,code_point:yo,code_unit:po},$l=jn(Ul);function zl(e,r,t){var n;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(!Rt(r))throw new TypeError(tr("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",r));if(arguments.length>2){if(!Y(n=t))throw new TypeError(tr("invalid argument. Third argument must be a string. Value: `%s`.",n));if(0===n.length)throw new RangeError("invalid argument. Third argument must not be an empty string.")}else n=" ";if(r>eu)throw new RangeError(tr("invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.",r));return Mo(e,r,n)}function Gl(e){var r,t,n;if(!Y(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));if(r=0,n=[],0===e.length)return n;for(t=Gi(e,r);-1!==t;)n.push(e.substring(r,t)),t=Gi(e,r=t);return n.push(e.substring(r)),n}var ql=/[\uDC00-\uDFFF]/,Jl=/[\uD800-\uDBFF]/,Zl=[{VAL:1,EN:"zero",DE:"null"},{VAL:10,EN:"ten",DE:"zehn"},{VAL:100,EN:"hundred",DE:"hundert"},{VAL:1e3,EN:"thousand",DE:"tausend"},{VAL:1e6,EN:"million",DE:"Million"},{VAL:1e9,EN:"billion",DE:"Milliarde"},{VAL:1e12,EN:"trillion",DE:"Billion"},{VAL:1e15,EN:"quadrillion",DE:"Billiarde"},{VAL:1e18,EN:"quintillion",DE:"Trillion"},{VAL:1e21,EN:"sextillion",DE:"Trilliarde"},{VAL:1e24,EN:"septillion",DE:"Quadrillion"},{VAL:1e27,EN:"octillion",DE:"Quadrilliarde"},{VAL:1e30,EN:"nonillion",DE:"Quintillion"},{VAL:1e33,EN:"decillion",DE:"Quintilliarde"},{VAL:1e36,EN:"undecillion",DE:"Sextillion"},{VAL:1e39,EN:"duodecillion",DE:"Sextilliarde"},{VAL:1e42,EN:"tredecillion",DE:"Septillion"},{VAL:1e45,EN:"quattuordecillion",DE:"Septilliarde"},{VAL:1e48,EN:"quindecillion",DE:"Octillion"},{VAL:1e51,EN:"sedecillion",DE:"Octilliarde"},{VAL:1e54,EN:"septendecillion",DE:"Nonillion"},{VAL:1e57,EN:"octodecillion",DE:"Nonilliarde"},{VAL:1e60,EN:"novendecillion",DE:"Decillion"},{VAL:1e63,EN:"vigintillion",DE:"Decilliarde"},{VAL:1e66,EN:"unvigintillion",DE:"Undecillion"},{VAL:1e69,EN:"duovigintillion",DE:"Undecilliarde"},{VAL:1e72,EN:"tresvigintillion",DE:"Duodecillion"},{VAL:1e75,EN:"quattuorvigintillion",DE:"Duodecilliarde"},{VAL:1e78,EN:"quinquavigintillion",DE:"Tredecillion"},{VAL:1e81,EN:"sesvigintillion",DE:"Tredecilliarde"},{VAL:1e84,EN:"septemvigintillion",DE:"Quattuordecillion"},{VAL:1e87,EN:"octovigintillion",DE:"Quattuordecilliarde"},{VAL:1e90,EN:"novemvigintillion",DE:"Quindecillion"},{VAL:1e93,EN:"trigintillion",DE:"Quindecilliarde"},{VAL:1e96,EN:"untrigintillion",DE:"Sedecillion"},{VAL:1e99,EN:"duotrigintillion",DE:"Sedecilliarde"},{VAL:1e102,EN:"trestrigintillion",DE:"Septendecillion"},{VAL:1e105,EN:"quattuortrigintillion",DE:"Septendecilliarde"},{VAL:1e108,EN:"quinquatrigintillion",DE:"Octodecillion"},{VAL:1e111,EN:"sestrigintillion",DE:"Octodecilliarde"},{VAL:1e114,EN:"septentrigintillion",DE:"Novendecillion"},{VAL:1e117,EN:"octotrigintillion",DE:"Novendecilliarde"},{VAL:1e120,EN:"noventrigintillion",DE:"Vigintillion"},{VAL:1e123,EN:"quadragintillion",DE:"Vigintilliarde"},{VAL:1e153,EN:"quinquagintillion",DE:"Quinvigintilliarde"},{VAL:1e183,EN:"sexagintillion",DE:"Trigintilliarde"},{VAL:1e213,EN:"septuagintillion",DE:"Quintrigintilliarde"},{VAL:1e243,EN:"octogintillion",DE:"Quadragintilliarde"},{VAL:1e273,EN:"nonagintillion",DE:"Quin­quadra­gint­illiarde"},{VAL:1e303,EN:"centillion",DE:"Quinquagintilliarde"},{VAL:1e306,EN:"uncentillion",DE:"Unquinquagintillione"}],Ql=["null","eins","zwei","drei","vier","fünf","sechs","sieben","acht","neun","zehn","elf","zwölf","dreizehn","vierzehn","fünfzehn","sechzehn","siebzehn","achtzehn","neunzehn"],Hl=["null","zehn","zwanzig","dreißig","vierzig","fünfzig","sechzig","siebzig","achtzig","neunzig"];function Xl(e){return xi(e,"e")?e+"n":e+"en"}function Kl(e,r){var t,n,i;if(0===e)return r||"null";if(e<0&&(r+="minus ",e*=-1),e<20)n=0,t=1===e&&0===r.length?"ein":Ql[e];else if(e<100)n=e%10,t=Hl[At(e/10)],n&&(t=(1===n?"ein":Ql[n])+"und"+t,n=0);else if(e<1e3)n=e%100,t=Kl(At(e/100),"")+"hundert";else if(e<1e6)n=e%1e3,t=Kl(At(e/1e3),"")+"tausend";else for(i=5;i0&&(t+="-"+ef[n],n=0);else{for(i=3;i0&&(r+=" "),tf(n,r+=t)}function nf(e){return yt(e)&&vi(e)}function of(e){return Tt(e)&&vi(e.valueOf())}function af(e){return nf(e)||of(e)}P(af,"isPrimitive",nf),P(af,"isObject",of);var uf=["en","de"];function sf(e,r){return Un(r)?G(r,"lang")&&(e.lang=r.lang,-1===function(e,r,t){var n,i;if(!It(e)&&!Y(e))throw new TypeError(O("invalid argument. First argument must be an array-like object. Value: `%s`.",e));if(0===(n=e.length))return-1;if(3===arguments.length){if(!St(t))throw new TypeError(O("invalid argument. Third argument must be an integer. Value: `%s`.",t));if(t>=0){if(t>=n)return-1;i=t}else(i=n+t)<0&&(i=0)}else i=0;if(af(r)){for(;i2){if(!Y(n=t))throw new TypeError(tr("invalid argument. Third argument must be a string. Value: `%s`.",n));if(0===n.length)throw new RangeError("invalid argument. Pad string must not be an empty string.")}else n=" ";if(r>eu)throw new RangeError(tr("invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.",r));return La(e,r,n)}var cf=Ui.breakType,gf=Ui.breakProperty,pf=Ui.emojiProperty;function mf(e,r){var t,n,i,o,a,u,s;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(o=e.length,arguments.length>1){if(!Ot(r))throw new TypeError(tr("invalid argument. Second argument must be an integer. Value: `%s`.",r));a=r}else a=o-1;if(0===o||a<=0)return-1;for(a>=o&&(a=o-1),t=[],n=[],u=Mi(e,0),t.push(gf(u)),n.push(pf(u)),i=-1,s=1;s<=a;s++)Di(e,s-1)?(i=s-2,t.length=0,n.length=0):(u=Mi(e,s),t.push(gf(u)),n.push(pf(u)),cf(t,n)>0&&(i=s-1,t.length=0,n.length=0));return i}var vf=["grapheme","code_point","code_unit"],df={grapheme:va,code_point:ma,code_unit:ca},yf=jn(vf),wf=["grapheme","code_point","code_unit"],bf={grapheme:Ta,code_point:ba,code_unit:da},Ef=jn(wf);function Tf(e){if(!Y(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));return e.toUpperCase()}var _f=["grapheme","code_point","code_unit"],Vf={grapheme:Sa,code_point:Fa,code_unit:Va},Af=jn(_f),xf=/[\uDC00-\uDFFF]/,Ff=/[\uD800-\uDBFF]/;function Sf(e){var r;for(r=0;r0&&xf.test(e[r])&&!Ff.test(e[r-1]))return!1}return!0}function Lf(e){return"string"==typeof e&&Sf(e)}function Of(e){return ee.isObject(e)&&Sf(e.valueOf())}function Rf(e){return Lf(e)||Of(e)}P(Rf,"isPrimitive",Lf),P(Rf,"isObject",Of);var Nf=/[\uDC00-\uDFFF]/,Mf=/[\uD800-\uDBFF]/,kf={};return B(kf,"acronym",(function(e,r){var t,n,i,o,a,u;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(i={},arguments.length>1&&(o=Wn(i,r)))throw o;for(t=jn(i.stopwords||$n),n=pr(e=nr(e=ar(e),zn," ")),a="",u=0;u2){if(!St(t))throw new TypeError(tr("invalid argument. Third argument must be an integer. Value: `%s`.",t))}else t=e.length;return xi(e,r,t)})),B(kf,"first",(function(e){var r,t,n,i;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(n={mode:"grapheme"},1===(t=arguments.length))i=1;else if(2===t){if(Un(i=arguments[1]))r=i,i=1;else if(!Rt(i))throw new TypeError(tr("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i))}else{if(!Rt(i=arguments[1]))throw new TypeError(tr("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i));if(!Un(r=arguments[2]))throw new TypeError(tr("invalid argument. Options argument must be an object. Value: `%s`.",r))}if(r&&G(r,"mode")&&(n.mode=r.mode,!Cl(n.mode)))throw new TypeError(tr('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",kl.join('", "'),n.mode));return jl[n.mode](e,i)})),B(kf,"forEach",(function(e,r,t){var n,i,o,a;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(o={mode:"grapheme"},2===(i=arguments.length))a=r,r=null;else if(3===i)Un(r)?a=t:(a=r,r=null,n=t);else{if(!Un(r))throw new TypeError(tr("invalid argument. Options argument must be an object. Value: `%s`.",r));a=t,n=arguments[3]}if(!Ve(a))throw new TypeError(tr("invalid argument. Callback argument must be a function. Value: `%s`.",a));if(r&&G(r,"mode")&&(o.mode=r.mode,!Bl(o.mode)))throw new TypeError(tr('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",Il.join('", "'),o.mode));return Dl[o.mode](e,a,n),e})),B(kf,"format",tr),B(kf,"fromCodePoint",(function(e){var r,t,n,i,o;if(1===(r=arguments.length)&&It(e))r=(n=arguments[0]).length;else for(n=[],o=0;oPl)throw new RangeError(tr("invalid argument. Must provide a valid code point (i.e., cannot exceed %u). Value: `%s`.",Pl,i));t+=i<=65535?Yl(i):Yl(55296+((i-=65536)>>10),56320+(1023&i))}return t})),B(kf,"headercase",(function(e){if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));return lo(e)})),B(kf,"kebabcase",(function(e){if(!Y(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));return go(e)})),B(kf,"last",(function(e){var r,t,n,i;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(n={mode:"grapheme"},1===(t=arguments.length))i=1;else if(2===t){if(Un(i=arguments[1]))r=i,i=1;else if(!Rt(i))throw new TypeError(tr("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i))}else{if(!Rt(i=arguments[1]))throw new TypeError(tr("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i));if(!Un(r=arguments[2]))throw new TypeError(tr("invalid argument. Options argument must be an object. Value: `%s`.",r))}if(r&&G(r,"mode")&&(n.mode=r.mode,!$l(n.mode)))throw new TypeError(tr('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",Ul.join('", "'),n.mode));return Wl[n.mode](e,i)})),B(kf,"lpad",zl),B(kf,"ltrim",(function(e){if(!Y(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));return Io(e)})),B(kf,"ltrimN",(function(e,r,t){var n,i,o,a,u;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(!Rt(r))throw new TypeError(tr("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",r));if(arguments.length>2){if(!(o=Y(t))&&!Yt(t))throw new TypeError(tr("invalid argument. Third argument must be a string or an array of strings. Value: `%s`.",t));for(o&&(t=Gl(t)),n=t.length-1,i="",u=0;u1){if(!St(r))throw new TypeError(tr("invalid argument. Second argument must be an integer. Value: `%s`.",r));i=r}else i=0;return n=e.length,i<0&&(i+=n)<0&&(i=0),i>=(t=n-1)?-1:(a=(o=i+1)+1,Jl.test(e[i])&&ql.test(e[o])?a>=t?-1:a:o)})),B(kf,"nextGraphemeClusterBreak",Gi),B(kf,"numCodePoints",Ia),B(kf,"numGraphemeClusters",Ea),B(kf,"num2words",(function(e,r){var t,n,i;if(!yt(e))throw new TypeError(tr("invalid argument. First argument must be a number. Value: `%s`.",e));if(n={},arguments.length>1&&(i=sf(n,r)))throw i;return St(e)?"de"===n.lang?Kl(e,""):tf(e,""):mu(e)?(t=e.toString().split("."),"de"===n.lang?Kl(t[0],"")+" Komma "+lf(t[1],Kl):tf(t[0],"")+" point "+lf(t[1],tf)):"de"===n.lang?e<0?"minus unendlich":"unendlich":e<0?"negative infinity":"infinity"})),B(kf,"pad",(function(e,r,t){var n,i,o,a,u,s,l,f,h;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(!Rt(r))throw new TypeError(tr("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",r));if(r>eu)throw new RangeError(tr("invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.",r));if(s={},arguments.length>2&&(l=function(e,r){return Un(r)?G(r,"lpad")&&(e.lpad=r.lpad,!Y(e.lpad))?new TypeError(tr("invalid option. `%s` option must be a string. Option: `%s`.","lpad",e.lpad)):G(r,"rpad")&&(e.rpad=r.rpad,!Y(e.rpad))?new TypeError(tr("invalid option. `%s` option must be a string. Option: `%s`.","rpad",e.rpad)):G(r,"centerRight")&&(e.centerRight=r.centerRight,!ie(e.centerRight))?new TypeError(tr("invalid option. `%s` option must be a boolean. Option: `%s`.","centerRight",e.centerRight)):null:new TypeError(tr("invalid argument. Options argument must be an object. Value: `%s`.",r))}(s,t)))throw l;if(s.lpad&&s.rpad)return 0==(h=(r-e.length)/2)?e:((f=At(h))!==h&&(o=!0),h<0?(i=h=At(yu(h)),n=e.length-h,o&&(s.centerRight?n-=1:i+=1),e.substring(i,n)):(i=No(h/s.lpad.length),u=ff(s.lpad,i),n=No(h/s.rpad.length),a=ff(s.rpad,n),i=h=f,n=h,o&&(s.centerRight?i+=1:n+=1),(u=u.substring(0,i))+e+(a=a.substring(0,n))));if(s.lpad)return(f=zl(e,r,s.lpad)).substring(f.length-r);if(s.rpad)return hf(e,r,s.rpad).substring(0,r);if(void 0===s.rpad)return hf(e,r," ").substring(0,r);throw new RangeError(tr("invalid argument. At least one padding option must have a length greater than 0. Left padding: `%s`. Right padding: `%s`.",s.lpad,s.rpad))})),B(kf,"pascalcase",(function(e){if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));return Wo(e)})),B(kf,"percentEncode",(function(e){if(!Y(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));return ha(e)})),B(kf,"prevGraphemeClusterBreak",mf),B(kf,"removeFirst",(function(e){var r,t,n,i;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(n={mode:"grapheme"},1===(t=arguments.length))i=1;else if(2===t){if(Un(i=arguments[1]))r=i,i=1;else if(!Rt(i))throw new TypeError(tr("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i))}else{if(!Rt(i=arguments[1]))throw new TypeError(tr("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i));if(!Un(r=arguments[2]))throw new TypeError(tr("invalid argument. Options argument must be an object. Value: `%s`.",r))}if(r&&G(r,"mode")&&(n.mode=r.mode,!yf(n.mode)))throw new TypeError(tr('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",vf.join('", "'),n.mode));return df[n.mode](e,i)})),B(kf,"removeLast",(function(e){var r,t,n,i;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(n={mode:"grapheme"},1===(t=arguments.length))i=1;else if(2===t){if(Un(i=arguments[1]))r=i,i=1;else if(!Rt(i))throw new TypeError(tr("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i))}else{if(!Rt(i=arguments[1]))throw new TypeError(tr("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i));if(!Un(r=arguments[2]))throw new TypeError(tr("invalid argument. Options argument must be an object. Value: `%s`.",r))}if(r&&G(r,"mode")&&(n.mode=r.mode,!Ef(n.mode)))throw new TypeError(tr('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",wf.join('", "'),n.mode));return bf[n.mode](e,i)})),B(kf,"removePunctuation",ar),B(kf,"removeUTF8BOM",(function(e){if(!Y(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));return 65279===e.charCodeAt(0)?e.slice(1):e})),B(kf,"removeWords",(function(e,r,t){var n,i,o,a,u,s,l,f;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(!Wt(r))throw new TypeError(tr("invalid argument. Second argument must be an array of strings. Value: `%s`.",r));if(arguments.length>2&&!ie(t))throw new TypeError(tr("invalid argument. Third argument must be a boolean. Value: `%s`.",t));if(n=pr(e,!0),s=r.length,u=[],t){for(o=r.slice(),l=0;l1&&!Un(r=arguments[1]))throw new TypeError(tr("invalid argument. Options argument must be an object. Value: `%s`.",r));if(r&&G(r,"mode")&&(t.mode=r.mode,!Af(t.mode)))throw new TypeError(tr('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",_f.join('", "'),t.mode));return Vf[t.mode](e)})),B(kf,"rpad",hf),B(kf,"rtrim",(function(e){if(!Y(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));return Ma(e)})),B(kf,"rtrimN",(function(e,r,t){var n,i,o,a,u;if(!Y(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));if(!Rt(r))throw new TypeError(tr("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(arguments.length>2){if(!(o=Y(t))&&!Yt(t))throw new TypeError(tr("invalid argument. Must provide a string or an array of strings. Value: `%s`.",t));for(o&&(t=Gl(t)),n=t.length-1,i="",u=0;u2){if(!St(t))throw new TypeError(tr("invalid argument. Third argument must be an integer. Value: `%s`.",t));n=t}else n=0;return qa(e,r,n)})),B(kf,"substringAfter",(function(e,r,t){var n;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(!Y(r))throw new TypeError(tr("invalid argument. Second argument must be a string. Value: `%s`.",r));if(arguments.length>2){if(!St(t))throw new TypeError(tr("invalid argument. Third argument must be an integer. Value: `%s`.",t));n=e.indexOf(r,t)}else n=e.indexOf(r);return-1===n?"":e.substring(n+r.length)})),B(kf,"substringAfterLast",(function(e,r,t){var n;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(!Y(r))throw new TypeError(tr("invalid argument. Second argument must be a string. Value: `%s`.",r));if(arguments.length>2){if(!St(t))throw new TypeError(tr("invalid argument. Third argument must be a nonnegative integer. Value: `%s`.",t));n=e.lastIndexOf(r,t)}else n=e.lastIndexOf(r);return-1===n?"":e.substring(n+r.length)})),B(kf,"substringBefore",(function(e,r){var t;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(!Y(r))throw new TypeError(tr("invalid argument. Second argument must be a string. Value: `%s`.",r));return-1===(t=e.indexOf(r))?e:e.substring(0,t)})),B(kf,"substringBeforeLast",(function(e,r){var t;if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));if(!Y(r))throw new TypeError(tr("invalid argument. Second argument must be a string. Value: `%s`.",r));return-1===(t=e.lastIndexOf(r))?e:e.substring(0,t)})),B(kf,"graphemeClusters2iterator",(function e(r){var t,n,i,o,a;if(!Y(r))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",r));if(arguments.length>1){if(!Ve(o=arguments[1]))throw new TypeError(tr("invalid argument. Second argument must be a function. Value: `%s`.",o));t=arguments[2]}return a=0,P(n={},"next",o?function(){var e,n;return i?{done:!0}:-1===(n=Gi(r,a))?(i=!0,r.length?{value:o.call(t,r.substring(a),a,r),done:!1}:{done:!0}):(e=o.call(t,r.substring(a,n),a,r),a=n,{value:e,done:!1})}:function(){var e,t;return i?{done:!0}:-1===(t=Gi(r,a))?(i=!0,r.length?{value:r.substring(a),done:!1}:{done:!0}):(e=r.substring(a,t),a=t,{value:e,done:!1})}),P(n,"return",(function(e){return i=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(n,tn,(function(){return o?e(r,o,t):e(r)})),n})),B(kf,"graphemeClusters2iteratorRight",(function e(r){var t,n,i,o,a;if(!Y(r))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",r));if(arguments.length>1){if(!Ve(o=arguments[1]))throw new TypeError(tr("invalid argument. Second argument must be a function. Value: `%s`.",o));t=arguments[2]}return a=r.length-1,P(n={},"next",o?function(){var e,n;return i?{done:!0}:-1===(n=mf(r,a))?(i=!0,r.length?{value:o.call(t,r.substring(n+1,a+1),n+1,r),done:!1}:{done:!0}):(e=o.call(t,r.substring(n+1,a+1),n+1,r),a=n,{value:e,done:!1})}:function(){var e,t;return i?{done:!0}:-1===(t=mf(r,a))?(i=!0,r.length?{value:r.substring(t+1,a+1),done:!1}:{done:!0}):(e=r.substring(t+1,a+1),a=t,{value:e,done:!1})}),P(n,"return",(function(e){return i=!0,arguments.length?{value:e,done:!0}:{done:!0}})),tn&&P(n,tn,(function(){return o?e(r,o,t):e(r)})),n})),B(kf,"toWellFormed",(function(e){var r,t;if(r="",!ee(e))throw new TypeError(tr("invalid argument. Must provide a string. Value: `%s`.",e));if(Rf(e)){for(t=0;t2&&!Y(t))throw new TypeError(tr("invalid argument. Third argument must be a string. Value: `%s`.",t));if(n=Ea(t=t||"..."),i=0,r>=Ea(e))return e;if(r-n<=0)return t.slice(0,r);for(o=0;o2&&!Y(t))throw new TypeError(tr("invalid argument. Third argument must be a string. Value: `%s`.",t));if(n=Ea(t=t||"..."),i=0,r>(o=Ea(e)))return e;if(r-n<0)return t.slice(0,r);for(a=Wu((r-n)/2),s=o-At((r-n)/2),u=0;u0&&!((l=Gi(e,i))>=s+i-u);)i=l,u+=1;return e.substring(0,f)+t+e.substring(l)})),B(kf,"uncapitalize",(function(e){if(!Y(e))throw new TypeError(tr("invalid argument. First argument must be a string. Value: `%s`.",e));return Nl(e)})),B(kf,"uppercase",Tf),B(kf,"utf16ToUTF8Array",ea),kf},"object"==typeof exports&&"undefined"!=typeof module?module.exports=r():"function"==typeof define&&define.amd?define(r):(e="undefined"!=typeof globalThis?globalThis:e||self).string=r(); +//# sourceMappingURL=browser.js.map diff --git a/browser.js.map b/browser.js.map new file mode 100644 index 00000000..86b68efb --- /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-read-only-property/lib/main.js","../node_modules/@stdlib/utils/define-nonenumerable-read-only-property/lib/main.js","../node_modules/@stdlib/assert/is-string/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/index.js","../node_modules/@stdlib/utils/native-class/lib/tostringtag.js","../node_modules/@stdlib/utils/native-class/lib/polyfill.js","../node_modules/@stdlib/utils/native-class/lib/main.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/utils/escape-regexp-string/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/regexp/function-name/lib/index.js","../node_modules/@stdlib/assert/is-array/lib/main.js","../node_modules/@stdlib/assert/tools/array-function/lib/main.js","../node_modules/@stdlib/assert/is-object-like/lib/main.js","../node_modules/@stdlib/assert/is-buffer/lib/main.js","../node_modules/@stdlib/utils/constructor-name/lib/main.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-regexp/lib/exec.js","../node_modules/@stdlib/assert/is-regexp/lib/main.js","../node_modules/@stdlib/assert/is-regexp/lib/try2exec.js","../base/format-interpolate/lib/is_number.js","../base/format-interpolate/lib/zero_pad.js","../base/format-interpolate/lib/format_integer.js","../base/format-interpolate/lib/format_double.js","../base/format-interpolate/lib/space_pad.js","../base/format-interpolate/lib/main.js","../base/format-interpolate/lib/is_string.js","../base/format-tokenize/lib/main.js","../format/lib/main.js","../format/lib/is_string.js","../base/replace/lib/main.js","../replace/lib/main.js","../remove-punctuation/lib/main.js","../node_modules/@stdlib/nlp/tokenize/lib/main.js","../base/uppercase/lib/main.js","../base/lowercase/lib/main.js","../node_modules/@stdlib/array/base/assert/is-accessor-array/lib/main.js","../node_modules/@stdlib/array/base/accessor-getter/lib/main.js","../node_modules/@stdlib/array/base/getter/lib/main.js","../node_modules/@stdlib/array/dtype/lib/ctor2dtype.js","../node_modules/@stdlib/assert/is-float64array/lib/main.js","../node_modules/@stdlib/assert/has-float64array-support/lib/float64array.js","../node_modules/@stdlib/assert/has-float64array-support/lib/main.js","../node_modules/@stdlib/array/float64/lib/main.js","../node_modules/@stdlib/array/float32/lib/index.js","../node_modules/@stdlib/array/float64/lib/index.js","../node_modules/@stdlib/array/float64/lib/polyfill.js","../node_modules/@stdlib/assert/is-float32array/lib/main.js","../node_modules/@stdlib/constants/float64/pinf/lib/index.js","../node_modules/@stdlib/assert/has-float32array-support/lib/float32array.js","../node_modules/@stdlib/array/float32/lib/main.js","../node_modules/@stdlib/assert/has-float32array-support/lib/main.js","../node_modules/@stdlib/array/float32/lib/polyfill.js","../node_modules/@stdlib/assert/is-uint32array/lib/main.js","../node_modules/@stdlib/constants/uint32/max/lib/index.js","../node_modules/@stdlib/array/uint32/lib/index.js","../node_modules/@stdlib/assert/has-uint32array-support/lib/uint32array.js","../node_modules/@stdlib/array/uint32/lib/main.js","../node_modules/@stdlib/assert/has-uint32array-support/lib/main.js","../node_modules/@stdlib/array/uint32/lib/polyfill.js","../node_modules/@stdlib/array/int32/lib/index.js","../node_modules/@stdlib/assert/is-int32array/lib/main.js","../node_modules/@stdlib/assert/has-int32array-support/lib/int32array.js","../node_modules/@stdlib/array/int32/lib/main.js","../node_modules/@stdlib/assert/has-int32array-support/lib/main.js","../node_modules/@stdlib/constants/int32/min/lib/index.js","../node_modules/@stdlib/array/int32/lib/polyfill.js","../node_modules/@stdlib/array/uint16/lib/index.js","../node_modules/@stdlib/assert/is-uint16array/lib/main.js","../node_modules/@stdlib/assert/has-uint16array-support/lib/uint16array.js","../node_modules/@stdlib/array/uint16/lib/main.js","../node_modules/@stdlib/assert/has-uint16array-support/lib/main.js","../node_modules/@stdlib/array/uint16/lib/polyfill.js","../node_modules/@stdlib/array/int16/lib/index.js","../node_modules/@stdlib/assert/is-int16array/lib/main.js","../node_modules/@stdlib/assert/has-int16array-support/lib/int16array.js","../node_modules/@stdlib/array/int16/lib/main.js","../node_modules/@stdlib/assert/has-int16array-support/lib/main.js","../node_modules/@stdlib/constants/int16/min/lib/index.js","../node_modules/@stdlib/array/int16/lib/polyfill.js","../node_modules/@stdlib/array/uint8/lib/index.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/assert/has-uint8array-support/lib/main.js","../node_modules/@stdlib/array/uint8/lib/polyfill.js","../node_modules/@stdlib/array/uint8c/lib/index.js","../node_modules/@stdlib/assert/is-uint8clampedarray/lib/main.js","../node_modules/@stdlib/assert/has-uint8clampedarray-support/lib/uint8clampedarray.js","../node_modules/@stdlib/array/uint8c/lib/main.js","../node_modules/@stdlib/assert/has-uint8clampedarray-support/lib/main.js","../node_modules/@stdlib/array/uint8c/lib/polyfill.js","../node_modules/@stdlib/array/int8/lib/index.js","../node_modules/@stdlib/assert/is-int8array/lib/main.js","../node_modules/@stdlib/assert/has-int8array-support/lib/int8array.js","../node_modules/@stdlib/array/int8/lib/main.js","../node_modules/@stdlib/assert/has-int8array-support/lib/main.js","../node_modules/@stdlib/constants/int8/min/lib/index.js","../node_modules/@stdlib/array/int8/lib/polyfill.js","../node_modules/@stdlib/assert/is-number/lib/primitive.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/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-array-length/lib/index.js","../node_modules/@stdlib/assert/is-array-like-object/lib/main.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-object/lib/main.js","../node_modules/@stdlib/assert/is-string-array/lib/index.js","../node_modules/@stdlib/complex/float64/ctor/lib/main.js","../node_modules/@stdlib/complex/float64/ctor/lib/tostring.js","../node_modules/@stdlib/complex/float64/ctor/lib/tojson.js","../node_modules/@stdlib/number/float64/base/to-float32/lib/main.js","../node_modules/@stdlib/number/float64/base/to-float32/lib/polyfill.js","../node_modules/@stdlib/number/float64/base/to-float32/lib/index.js","../node_modules/@stdlib/complex/float32/ctor/lib/main.js","../node_modules/@stdlib/assert/is-complex-like/lib/main.js","../node_modules/@stdlib/math/base/assert/is-even/lib/main.js","../node_modules/@stdlib/complex/float32/ctor/lib/tostring.js","../node_modules/@stdlib/complex/float32/ctor/lib/tojson.js","../node_modules/@stdlib/array/base/assert/is-complex64array/lib/main.js","../node_modules/@stdlib/array/base/assert/is-complex128array/lib/main.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/complex/float32/real/lib/main.js","../node_modules/@stdlib/complex/float32/imag/lib/main.js","../node_modules/@stdlib/strided/base/reinterpret-complex64/lib/main.js","../node_modules/@stdlib/strided/base/reinterpret-complex128/lib/main.js","../node_modules/@stdlib/array/complex64/lib/from_iterator.js","../node_modules/@stdlib/array/complex64/lib/main.js","../node_modules/@stdlib/array/complex64/lib/from_array.js","../node_modules/@stdlib/complex/float64/real/lib/main.js","../node_modules/@stdlib/complex/float64/imag/lib/main.js","../node_modules/@stdlib/array/complex128/lib/from_iterator.js","../node_modules/@stdlib/array/complex64/lib/from_iterator_map.js","../node_modules/@stdlib/array/complex128/lib/main.js","../node_modules/@stdlib/array/complex128/lib/from_array.js","../node_modules/@stdlib/array/bool/lib/from_iterator.js","../node_modules/@stdlib/array/complex128/lib/from_iterator_map.js","../node_modules/@stdlib/array/bool/lib/main.js","../node_modules/@stdlib/array/bool/lib/from_array.js","../node_modules/@stdlib/array/bool/lib/from_iterator_map.js","../node_modules/@stdlib/array/dtype/lib/ctors.js","../node_modules/@stdlib/array/dtype/lib/dtypes.js","../node_modules/@stdlib/array/dtype/lib/main.js","../node_modules/@stdlib/array/base/assert/contains/lib/factory.js","../node_modules/@stdlib/array/base/assert/contains/lib/index.js","../node_modules/@stdlib/array/base/assert/contains/lib/main.js","../node_modules/@stdlib/object/ctor/lib/main.js","../node_modules/@stdlib/utils/get-prototype-of/lib/detect.js","../node_modules/@stdlib/utils/get-prototype-of/lib/native.js","../node_modules/@stdlib/utils/get-prototype-of/lib/polyfill.js","../node_modules/@stdlib/utils/get-prototype-of/lib/proto.js","../node_modules/@stdlib/utils/get-prototype-of/lib/main.js","../node_modules/@stdlib/assert/is-plain-object/lib/main.js","../acronym/lib/validate.js","../node_modules/@stdlib/assert/is-empty-array/lib/main.js","../acronym/lib/main.js","../base/atob/lib/global.js","../base/atob/lib/main.js","../base/capitalize/lib/main.js","../base/trim/lib/has_builtin.js","../base/trim/lib/builtin.js","../base/trim/lib/polyfill.js","../base/trim/lib/index.js","../base/trim/lib/check.js","../base/trim/lib/main.js","../base/camelcase/lib/main.js","../base/code-point-at/lib/main.js","../base/constantcase/lib/main.js","../node_modules/@stdlib/math/base/assert/is-nan/lib/main.js","../node_modules/@stdlib/math/base/special/min/lib/main.js","../node_modules/@stdlib/math/base/assert/is-negative-zero/lib/main.js","../base/distances/lib/index.js","../base/distances/hamming/lib/main.js","../base/distances/levenshtein/lib/main.js","../base/dotcase/lib/main.js","../base/ends-with/lib/has_builtin.js","../base/ends-with/lib/index.js","../base/ends-with/lib/builtin.js","../base/ends-with/lib/main.js","../base/ends-with/lib/polyfill.js","../base/first/lib/main.js","../node_modules/@stdlib/regexp/utf16-surrogate-pair/lib/main.js","../node_modules/@stdlib/regexp/utf16-surrogate-pair/lib/regexp.js","../node_modules/@stdlib/regexp/utf16-surrogate-pair/lib/index.js","../base/first-code-point/lib/main.js","../code-point-at/lib/main.js","../node_modules/@stdlib/assert/has-utf16-surrogate-pair-at/lib/main.js","../tools/grapheme-cluster-break/lib/constants.js","../tools/grapheme-cluster-break/lib/break_type.js","../tools/grapheme-cluster-break/lib/index.js","../tools/grapheme-cluster-break/lib/emoji_property.js","../tools/grapheme-cluster-break/lib/break_property.js","../next-grapheme-cluster-break/lib/main.js","../base/first-grapheme-cluster/lib/main.js","../base/for-each/lib/main.js","../base/for-each-code-point/lib/main.js","../base/for-each-code-point-right/lib/main.js","../base/for-each-grapheme-cluster/lib/main.js","../node_modules/@stdlib/regexp/whitespace/lib/main.js","../node_modules/@stdlib/regexp/whitespace/lib/validate.js","../node_modules/@stdlib/regexp/whitespace/lib/regexp_capture.js","../node_modules/@stdlib/regexp/whitespace/lib/regexp.js","../base/startcase/lib/main.js","../node_modules/@stdlib/regexp/whitespace/lib/index.js","../base/headercase/lib/main.js","../base/kebabcase/lib/main.js","../base/last/lib/main.js","../base/last-code-point/lib/main.js","../node_modules/@stdlib/assert/is-positive-integer/lib/primitive.js","../node_modules/@stdlib/assert/is-positive-integer/lib/object.js","../node_modules/@stdlib/assert/is-positive-integer/lib/main.js","../node_modules/@stdlib/assert/is-positive-integer/lib/index.js","../node_modules/@stdlib/constants/float64/max/lib/index.js","../node_modules/@stdlib/array/base/setter/lib/main.js","../node_modules/@stdlib/array/base/accessor-setter/lib/main.js","../node_modules/@stdlib/array/base/arraylike2object/lib/main.js","../node_modules/@stdlib/dstructs/circular-buffer/lib/main.js","../base/last-grapheme-cluster/lib/main.js","../node_modules/@stdlib/array/base/filled/lib/main.js","../node_modules/@stdlib/array/base/zeros/lib/main.js","../base/repeat/lib/has_builtin.js","../base/repeat/lib/builtin.js","../base/repeat/lib/index.js","../base/repeat/lib/main.js","../base/repeat/lib/polyfill.js","../node_modules/@stdlib/math/base/special/ceil/lib/main.js","../base/left-pad/lib/main.js","../base/left-trim/lib/has_builtin.js","../base/left-trim/lib/polyfill.js","../base/left-trim/lib/builtin.js","../base/left-trim/lib/index.js","../base/left-trim/lib/main.js","../base/pascalcase/lib/main.js","../utf16-to-utf8-array/lib/main.js","../base/percent-encode/lib/main.js","../base/remove-first/lib/main.js","../base/remove-first-code-point/lib/main.js","../base/remove-first-grapheme-cluster/lib/main.js","../base/remove-last/lib/main.js","../base/remove-last-code-point/lib/main.js","../num-grapheme-clusters/lib/main.js","../base/remove-last-grapheme-cluster/lib/main.js","../base/replace-before/lib/main.js","../base/reverse/lib/main.js","../base/reverse-code-points/lib/main.js","../base/reverse-grapheme-clusters/lib/main.js","../base/right-pad/lib/main.js","../base/right-trim/lib/has_builtin.js","../base/right-trim/lib/polyfill.js","../base/right-trim/lib/builtin.js","../base/right-trim/lib/index.js","../base/right-trim/lib/main.js","../base/slice/lib/main.js","../num-code-points/lib/main.js","../node_modules/@stdlib/math/base/special/fast/max/lib/main.js","../base/slice-code-points/lib/main.js","../base/snakecase/lib/main.js","../base/starts-with/lib/has_builtin.js","../base/starts-with/lib/builtin.js","../base/starts-with/lib/index.js","../base/starts-with/lib/main.js","../base/starts-with/lib/polyfill.js","../node_modules/@stdlib/utils/define-nonenumerable-read-write-accessor/lib/main.js","../node_modules/@stdlib/assert/is-probability/lib/primitive.js","../node_modules/@stdlib/assert/is-probability/lib/object.js","../node_modules/@stdlib/assert/is-probability/lib/main.js","../node_modules/@stdlib/utils/constant-function/lib/main.js","../node_modules/@stdlib/utils/noop/lib/main.js","../node_modules/@stdlib/assert/is-probability/lib/index.js","../node_modules/@stdlib/constants/float64/max-safe-integer/lib/index.js","../node_modules/@stdlib/math/base/special/max/lib/main.js","../node_modules/@stdlib/math/base/assert/is-positive-zero/lib/main.js","../node_modules/@stdlib/number/int32/base/mul/lib/main.js","../node_modules/@stdlib/number/int32/base/mul/lib/index.js","../node_modules/@stdlib/number/int32/base/mul/lib/polyfill.js","../node_modules/@stdlib/number/uint32/base/mul/lib/main.js","../node_modules/@stdlib/blas/base/gcopy/lib/accessors.js","../node_modules/@stdlib/blas/base/gcopy/lib/main.js","../node_modules/@stdlib/assert/has-function-name-support/lib/foo.js","../node_modules/@stdlib/blas/base/gcopy/lib/index.js","../node_modules/@stdlib/blas/base/gcopy/lib/ndarray.js","../node_modules/@stdlib/utils/function-name/lib/main.js","../node_modules/@stdlib/assert/has-function-name-support/lib/main.js","../node_modules/@stdlib/constants/float16/pinf/lib/index.js","../node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js","../node_modules/@stdlib/utils/define-read-write-accessor/lib/main.js","../node_modules/@stdlib/number/float64/base/to-float16/lib/main.js","../node_modules/@stdlib/math/base/assert/is-finite/lib/main.js","../node_modules/@stdlib/constants/float16/eps/lib/index.js","../node_modules/@stdlib/constants/float16/smallest-normal/lib/index.js","../node_modules/@stdlib/math/base/special/abs/lib/main.js","../node_modules/@stdlib/number/float64/base/to-float16/lib/polyfill.js","../node_modules/@stdlib/number/float64/base/to-float16/lib/index.js","../node_modules/@stdlib/constants/float16/max/lib/index.js","../node_modules/@stdlib/constants/float16/ninf/lib/index.js","../node_modules/@stdlib/number/float32/base/to-word/lib/main.js","../node_modules/@stdlib/constants/float32/exponent-bias/lib/index.js","../node_modules/@stdlib/number/float32/base/exponent/lib/main.js","../node_modules/@stdlib/constants/float32/ninf/lib/index.js","../node_modules/@stdlib/constants/float32/significand-mask/lib/index.js","../node_modules/@stdlib/number/float16/base/to-word/lib/main.js","../node_modules/@stdlib/math/base/assert/is-nanf/lib/main.js","../node_modules/@stdlib/math/base/assert/is-negative-zerof/lib/main.js","../node_modules/@stdlib/math/base/special/absf/lib/main.js","../node_modules/@stdlib/constants/float64/max-base2-exponent/lib/index.js","../node_modules/@stdlib/constants/float64/min-base2-exponent/lib/index.js","../node_modules/@stdlib/math/base/special/round/lib/main.js","../node_modules/@stdlib/constants/float64/exponent-bias/lib/index.js","../node_modules/@stdlib/constants/float64/max-base2-exponent-subnormal/lib/index.js","../node_modules/@stdlib/constants/float64/min-base2-exponent-subnormal/lib/index.js","../node_modules/@stdlib/math/base/assert/is-infinite/lib/main.js","../node_modules/@stdlib/constants/float64/high-word-sign-mask/lib/index.js","../node_modules/@stdlib/assert/is-little-endian/lib/main.js","../node_modules/@stdlib/number/float64/base/to-words/lib/indices.js","../node_modules/@stdlib/constants/float64/high-word-abs-mask/lib/index.js","../node_modules/@stdlib/assert/is-little-endian/lib/ctors.js","../node_modules/@stdlib/number/float64/base/to-words/lib/assign.js","../node_modules/@stdlib/number/float64/base/to-words/lib/main.js","../node_modules/@stdlib/number/float64/base/to-words/lib/index.js","../node_modules/@stdlib/number/float64/base/get-high-word/lib/high.js","../node_modules/@stdlib/number/float64/base/from-words/lib/indices.js","../node_modules/@stdlib/number/float64/base/get-high-word/lib/main.js","../node_modules/@stdlib/number/float64/base/from-words/lib/main.js","../node_modules/@stdlib/math/base/special/copysign/lib/main.js","../node_modules/@stdlib/constants/float64/smallest-normal/lib/index.js","../node_modules/@stdlib/number/float64/base/normalize/lib/assign.js","../node_modules/@stdlib/number/float64/base/normalize/lib/index.js","../node_modules/@stdlib/number/float64/base/normalize/lib/main.js","../node_modules/@stdlib/constants/float64/high-word-exponent-mask/lib/index.js","../node_modules/@stdlib/math/base/special/ldexp/lib/main.js","../node_modules/@stdlib/number/float64/base/exponent/lib/main.js","../node_modules/@stdlib/math/base/special/exp2/lib/main.js","../node_modules/@stdlib/math/base/special/exp2/lib/polyval_p.js","../node_modules/@stdlib/math/base/special/exp2/lib/polyval_q.js","../node_modules/@stdlib/constants/float16/exponent-bias/lib/index.js","../node_modules/@stdlib/number/float16/base/from-word/lib/main.js","../node_modules/@stdlib/constants/float16/num-exponent-bits/lib/index.js","../node_modules/@stdlib/constants/float16/sign-mask/lib/index.js","../node_modules/@stdlib/constants/float16/significand-mask/lib/index.js","../node_modules/@stdlib/constants/float16/exponent-mask/lib/index.js","../node_modules/@stdlib/constants/float16/num-significand-bits/lib/index.js","../node_modules/@stdlib/array/float16/lib/polyfill/from_iterator.js","../node_modules/@stdlib/array/float16/lib/polyfill/index.js","../node_modules/@stdlib/array/float16/lib/polyfill/from_array.js","../node_modules/@stdlib/array/float16/lib/polyfill/from_iterator_map.js","../node_modules/@stdlib/array/float16/lib/main.js","../node_modules/@stdlib/array/float16/lib/index.js","../node_modules/@stdlib/assert/has-float16array-support/lib/main.js","../node_modules/@stdlib/assert/is-typed-array/lib/ctors.js","../node_modules/@stdlib/assert/is-typed-array/lib/main.js","../node_modules/@stdlib/assert/is-complex-typed-array/lib/ctors.js","../node_modules/@stdlib/assert/has-has-instance-symbol-support/lib/main.js","../node_modules/@stdlib/symbol/has-instance/lib/main.js","../node_modules/@stdlib/assert/instance-of/lib/main.js","../node_modules/@stdlib/array/to-json/lib/ctors.js","../node_modules/@stdlib/array/to-json/lib/type.js","../node_modules/@stdlib/array/to-json/lib/main.js","../node_modules/@stdlib/strided/base/reinterpret-boolean/lib/main.js","../node_modules/@stdlib/assert/is-booleanarray/lib/main.js","../node_modules/@stdlib/assert/is-complex-typed-array/lib/main.js","../node_modules/@stdlib/random/base/mt19937/lib/rand_uint32.js","../node_modules/@stdlib/random/base/mt19937/lib/factory.js","../node_modules/@stdlib/random/base/bernoulli/lib/factory.js","../node_modules/@stdlib/random/base/mt19937/lib/index.js","../node_modules/@stdlib/random/base/mt19937/lib/main.js","../node_modules/@stdlib/random/base/bernoulli/lib/main.js","../base/uncapitalize/lib/main.js","../node_modules/@stdlib/random/base/bernoulli/lib/index.js","../base/lib/index.js","../base/altcase/lib/main.js","../base/base64-to-uint8array/lib/main.js","../base/for-each-right/lib/main.js","../base/invcase/lib/main.js","../base/replace-after/lib/main.js","../base/replace-after-last/lib/main.js","../base/replace-before-last/lib/main.js","../base/slice-grapheme-clusters/lib/main.js","../base/stickycase/lib/main.js","../base/truncate-middle/lib/main.js","../node_modules/@stdlib/math/base/assert/is-odd/lib/main.js","../first/lib/main.js","../for-each/lib/main.js","../node_modules/@stdlib/constants/unicode/max/lib/index.js","../from-code-point/lib/main.js","../last/lib/main.js","../left-pad/lib/main.js","../split-grapheme-clusters/lib/main.js","../next-code-point-index/lib/main.js","../num2words/lib/int2words_de.js","../num2words/lib/int2words_en.js","../node_modules/@stdlib/assert/is-nan/lib/primitive.js","../node_modules/@stdlib/assert/is-nan/lib/object.js","../node_modules/@stdlib/assert/is-nan/lib/main.js","../node_modules/@stdlib/assert/is-nan/lib/index.js","../num2words/lib/validate.js","../node_modules/@stdlib/utils/index-of/lib/main.js","../num2words/lib/decimals.js","../repeat/lib/main.js","../right-pad/lib/main.js","../prev-grapheme-cluster-break/lib/main.js","../remove-first/lib/main.js","../remove-last/lib/main.js","../uppercase/lib/main.js","../reverse/lib/main.js","../node_modules/@stdlib/assert/is-well-formed-string/lib/iswellformed.js","../node_modules/@stdlib/assert/is-well-formed-string/lib/primitive.js","../node_modules/@stdlib/assert/is-well-formed-string/lib/object.js","../node_modules/@stdlib/assert/is-well-formed-string/lib/main.js","../node_modules/@stdlib/assert/is-well-formed-string/lib/index.js","../to-well-formed/lib/main.js","../lib/index.js","../camelcase/lib/main.js","../capitalize/lib/main.js","../constantcase/lib/main.js","../dotcase/lib/main.js","../ends-with/lib/main.js","../node_modules/@stdlib/constants/unicode/max-bmp/lib/index.js","../headercase/lib/main.js","../kebabcase/lib/main.js","../left-trim/lib/main.js","../left-trim-n/lib/main.js","../lowercase/lib/main.js","../num2words/lib/main.js","../pad/lib/main.js","../pad/lib/validate.js","../pascalcase/lib/main.js","../percent-encode/lib/main.js","../remove-utf8-bom/lib/main.js","../remove-words/lib/main.js","../replace-before/lib/main.js","../right-trim/lib/main.js","../right-trim-n/lib/main.js","../snakecase/lib/main.js","../startcase/lib/main.js","../starts-with/lib/main.js","../substring-after/lib/main.js","../substring-after-last/lib/main.js","../substring-before/lib/main.js","../substring-before-last/lib/main.js","../to-grapheme-cluster-iterator/lib/main.js","../to-grapheme-cluster-iterator-right/lib/main.js","../trim/lib/main.js","../truncate/lib/main.js","../truncate-middle/lib/main.js","../uncapitalize/lib/main.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 './../../base/format-interpolate';\nimport tokenize from './../../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 './../../define-property';\n\n\n// MAIN //\n\n/**\n* Defines a 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* setReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setReadOnly;\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 './../../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 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// MODULES //\n\nimport hasSymbols from './../../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/**\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 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// 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// 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 './../../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// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar RE_CHARS = /[-\\/\\\\^$*+?.()|[\\]{}]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Escapes a regular expression string.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} first argument must be a string\n* @returns {string} escaped string\n*\n* @example\n* var str = rescape( '[A-Z]*' );\n* // returns '\\[A\\-Z\\]\\*'\n*/\nfunction rescape( str ) {\n\tvar len;\n\tvar s;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a regular expression string. Value: `%s`.', str ) );\n\t}\n\t// Check if the string starts with a forward slash...\n\tif ( str[ 0 ] === '/' ) {\n\t\t// Find the last forward slash...\n\t\tlen = str.length;\n\t\tfor ( i = len-1; i >= 0; i-- ) {\n\t\t\tif ( str[ i ] === '/' ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// If we searched the string to no avail or if the first letter is not `/`, assume that the string is not of the form `/[...]/[guimy]`:\n\tif ( i === void 0 || i <= 0 ) {\n\t\treturn str.replace( RE_CHARS, '\\\\$&' );\n\t}\n\t// We need to de-construct the string...\n\ts = str.substring( 1, i );\n\n\t// Only escape the characters between the `/`:\n\ts = s.replace( RE_CHARS, '\\\\$&' );\n\n\t// Reassemble:\n\tstr = str[ 0 ] + s + str.substring( i );\n\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default rescape;\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 './../../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 './../../../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) 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// 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 './../../../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 isObjectLike from './../../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) 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 './../../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/**\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 './../../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 './../../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 './../../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\nvar exec = RegExp.prototype.exec; // non-generic\n\n\n// EXPORTS //\n\nexport default exec;\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 './../../has-tostringtag-support';\nimport nativeClass from '@stdlib/utils/native-class';\nimport test from './try2exec.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a regular expression.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a regular expression\n*\n* @example\n* var bool = isRegExp( /\\.+/ );\n* // returns true\n*\n* @example\n* var bool = isRegExp( {} );\n* // returns false\n*/\nfunction isRegExp( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof RegExp ) {\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 RegExp]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isRegExp;\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 exec from './exec.js';\n\n\n// MAIN //\n\n/**\n* Attempts to call a `RegExp` method.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if able to call a `RegExp` method\n*/\nfunction test( value ) {\n\ttry {\n\t\texec.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) 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 './../../base/format-interpolate';\nimport tokenize from './../../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) 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* Replaces search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {RegExp} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* import capitalize from '@stdlib/string/base/capitalize';\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer );\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\treturn str.replace( search, newval );\n}\n\n\n// EXPORTS //\n\nexport default replace;\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 rescape from '@stdlib/utils/escape-regexp-string';\nimport isFunction from '@stdlib/assert/is-function';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isRegExp from '@stdlib/assert/is-regexp';\nimport format from './../../format';\nimport base from './../../base/replace';\n\n\n// MAIN //\n\n/**\n* Replaces search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {(string|RegExp)} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string or regular expression\n* @throws {TypeError} third argument must be a string or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* import capitalize from '@stdlib/string/capitalize';\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer );\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( isString( search ) ) {\n\t\tsearch = new RegExp( rescape( search ), 'g' );\n\t} else if ( !isRegExp( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string or regular expression. Value: `%s`.', search ) );\n\t}\n\tif ( !isString( newval ) && !isFunction( newval ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string or replacement function. Value: `%s`.', newval ) );\n\t}\n\treturn base( str, search, newval );\n}\n\n\n// EXPORTS //\n\nexport default replace;\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 isString } from '@stdlib/assert/is-string';\nimport replace from './../../replace';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar RE = /[!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Removes punctuation characters from a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string primitive\n* @returns {string} output string\n*\n* @example\n* var str = 'Sun Tzu said: \"A leader leads by example not by force.\"';\n* var out = removePunctuation( str );\n* // returns 'Sun Tzu said A leader leads by example not by force'\n*\n* @example\n* var str = 'Double, double, toil and trouble; Fire burn, and cauldron bubble!';\n* var out = removePunctuation( str );\n* // returns 'Double double toil and trouble Fire burn and cauldron bubble'\n*\n* @example\n* var str = 'This module removes these characters: `{}[]:,!/<>().;~|?\\'\"';\n* var out = removePunctuation( str );\n* // returns 'This module removes these characters '\n*/\nfunction removePunctuation( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn replace( str, RE, '' );\n}\n\n\n// EXPORTS //\n\nexport default removePunctuation;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport format from '@stdlib/string/format';\nimport ABBRS from './abbreviations.json';\nimport EMOJIS from './emojis.json';\nimport CONTRACT from './contractions.json';\n\n\n// VARIABLES //\n\nvar REGEXP_PREFIXES = /^([,([{*<\"“'`‘]|\\.{1,3})/gi;\nvar REGEXP_SUFFIXES = /([,.!?%*>:;\"'”`)\\]}]|\\.\\.\\.)$/gi;\n\n\n// FUNCTIONS //\n\n/**\n* Extends an array by the elements of another array.\n*\n* @private\n* @param {Array} arr - input array\n* @param {Array} ext - array to extend `arr` with\n* @returns {Array} mutated input array\n*\n* @example\n* var arr = [ 1, 2, 3 ];\n* var out = extend( arr, [ 4, 5 ] );\n* // returns [ 1, 2, 3, 4, 5 ]\n*/\nfunction extend( arr, ext ) {\n\tvar i;\n\tfor ( i = 0; i < ext.length; i++ ) {\n\t\tarr.push( ext[ i ] );\n\t}\n\treturn arr;\n}\n\n/**\n* Tokenizes a substring.\n*\n* @private\n* @param {string} substr - input string\n* @returns {Array} token array\n*\n* @example\n* var str = '(never)';\n* var out = tokenizeSubstring( str );\n* // returns [ '(', 'never', ')' ]\n*/\nfunction tokenizeSubstring( substr ) {\n\tvar prefixes = [];\n\tvar suffixes = [];\n\tvar match;\n\tvar done;\n\tvar res;\n\n\tdo {\n\t\tif (\n\t\t\t!EMOJIS[ substr ] &&\n\t\t\t!ABBRS[ substr ] &&\n\t\t\t!CONTRACT[ substr ]\n\t\t) {\n\t\t\tmatch = substr.split( REGEXP_PREFIXES );\n\t\t\tif ( match.length > 1 ) {\n\t\t\t\tprefixes.push( match[ 1 ] );\n\t\t\t\tsubstr = match[ 2 ];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmatch = substr.split( REGEXP_SUFFIXES );\n\t\t\t\tif ( match.length > 1 ) {\n\t\t\t\t\tsubstr = match[ 0 ];\n\t\t\t\t\tsuffixes.unshift( match[ 1 ] );\n\t\t\t\t} else {\n\t\t\t\t\tdone = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tdone = true;\n\t\t}\n\t} while ( !done );\n\n\tres = prefixes;\n\tif ( substr ) {\n\t\tres.push( substr );\n\t}\n\n\t// If the last suffix is an ellipsis, move it to the front of the suffix array:\n\tif ( suffixes[ suffixes.length-1 ] === '...' ) {\n\t\tsuffixes.pop();\n\t\tsuffixes.unshift( '...' );\n\t}\n\textend( res, suffixes );\n\treturn res;\n}\n\n\n// MAIN //\n\n/**\n* Tokenize a string.\n*\n* @param {string} str - input string\n* @param {boolean} [keepWhitespace=false] - boolean indicating whether whitespace characters should be returned as part of the token array\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a boolean\n* @returns {Array} array of tokens\n*\n* @example\n* var str = 'Hello World!';\n* var out = tokenize( str );\n* // returns [ 'Hello', 'World', '!' ]\n*\n* @example\n* var str = '';\n* var out = tokenize( str );\n* // returns []\n*\n* @example\n* var str = 'Hello Mrs. Maple, could you call me back?';\n* var out = tokenize( str );\n* // returns [ 'Hello', 'Mrs.', 'Maple', ',', 'could', 'you', 'call', 'me', 'back', '?' ]\n*/\nfunction tokenize( str, keepWhitespace ) {\n\tvar subtkns;\n\tvar substrs;\n\tvar tokens;\n\tvar substr;\n\tvar cache;\n\tvar i;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isBoolean( keepWhitespace ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a boolean. Value: `%s`.', keepWhitespace ) );\n\t\t}\n\t}\n\tif ( !str ) {\n\t\treturn [];\n\t}\n\n\t// Split on whitespace:\n\tif ( keepWhitespace ) {\n\t\tsubstrs = str.split( /(\\s+)/ );\n\t} else {\n\t\tsubstrs = str.split( /\\s+/ );\n\t}\n\n\t// Set up cache to hold tokens for substring matches:\n\tcache = {};\n\n\t// Initialize token array:\n\ttokens = [];\n\n\tfor ( i = 0; i < substrs.length; i++ ) {\n\t\tsubstr = substrs[ i ];\n\t\tif ( hasOwnProp( cache, substr ) ) {\n\t\t\textend( tokens, cache[ substr ] );\n\t\t}\n\t\telse {\n\t\t\tsubtkns = tokenizeSubstring( substr );\n\t\t\textend( tokens, subtkns );\n\t\t\tcache[ substr ] = subtkns;\n\t\t}\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default tokenize;\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* Converts a string to uppercase.\n*\n* @param {string} str - string to convert\n* @returns {string} uppercase string\n*\n* @example\n* var str = uppercase( 'bEEp' );\n* // returns 'BEEP'\n*/\nfunction uppercase( str ) {\n\treturn str.toUpperCase();\n}\n\n\n// EXPORTS //\n\nexport default uppercase;\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* Converts a string to lowercase.\n*\n* @param {string} str - string to convert\n* @returns {string} lowercase string\n*\n* @example\n* var str = lowercase( 'bEEp' );\n* // returns 'beep'\n*/\nfunction lowercase( str ) {\n\treturn str.toLowerCase();\n}\n\n\n// EXPORTS //\n\nexport default lowercase;\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 TYPE = 'function';\n\n\n// MAIN //\n\n/**\n* Tests if an array-like object supports the accessor (get/set) protocol.\n*\n* @param {Object} value - value to test\n* @returns {boolean} boolean indicating whether a value is an accessor array\n*\n* @example\n* import Complex128Array from '@stdlib/array/complex128';\n*\n* var bool = isAccessorArray( new Complex128Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isAccessorArray( [] );\n* // returns false\n*/\nfunction isAccessorArray( value ) {\n\treturn ( typeof value.get === TYPE && typeof value.set === TYPE ); // eslint-disable-line valid-typeof\n}\n\n\n// EXPORTS //\n\nexport default isAccessorArray;\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// 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) 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// MAIN //\n\n// Mapping from array constructors to data types...\nvar ctor2dtypes = {\n\t'Float32Array': 'float32',\n\t'Float64Array': 'float64',\n\t'Array': 'generic',\n\t'Int16Array': 'int16',\n\t'Int32Array': 'int32',\n\t'Int8Array': 'int8',\n\t'Uint16Array': 'uint16',\n\t'Uint32Array': 'uint32',\n\t'Uint8Array': 'uint8',\n\t'Uint8ClampedArray': 'uint8c',\n\t'Complex64Array': 'complex64',\n\t'Complex128Array': 'complex128',\n\t'BooleanArray': 'bool'\n};\n\n\n// EXPORTS //\n\nexport default ctor2dtypes;\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 hasFloat64Array = ( typeof Float64Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float64Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float64Array\n*\n* @example\n* import Float64Array from '@stdlib/array/float64';\n*\n* var bool = isFloat64Array( new Float64Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat64Array( [] );\n* // returns false\n*/\nfunction isFloat64Array( value ) {\n\treturn (\n\t\t( hasFloat64Array && value instanceof Float64Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float64Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isFloat64Array;\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 Float64Array === 'function' ) ? Float64Array : 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// MODULES //\n\nimport isFloat64Array from './../../is-float64array';\nimport GlobalFloat64Array from './float64array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Float64Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float64Array` support\n*\n* @example\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\nfunction hasFloat64ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat64Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat64Array( [ 1.0, 3.14, -3.14, NaN ] );\n\t\tbool = (\n\t\t\tisFloat64Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.14 &&\n\t\t\tarr[ 2 ] === -3.14 &&\n\t\t\tarr[ 3 ] !== arr[ 3 ]\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 hasFloat64ArraySupport;\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 Float64Array === 'function' ) ? Float64Array : 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 single-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array/float32\n*\n* @example\n* import ctor from '@stdlib/array/float32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasFloat32ArraySupport from '@stdlib/assert/has-float32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat32ArraySupport() ) {\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/**\n* Typed array constructor which returns a typed array representing an array of double-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array/float64\n*\n* @example\n* import ctor from '@stdlib/array/float64';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasFloat64ArraySupport from '@stdlib/assert/has-float64array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat64ArraySupport() ) {\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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of double-precision floating-point numbers 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) 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 hasFloat32Array = ( typeof Float32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float32Array\n*\n* @example\n* import Float32Array from '@stdlib/array/float32';\n*\n* var bool = isFloat32Array( new Float32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat32Array( [] );\n* // returns false\n*/\nfunction isFloat32Array( value ) {\n\treturn (\n\t\t( hasFloat32Array && value instanceof Float32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isFloat32Array;\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// MAIN //\n\nvar main = ( typeof Float32Array === 'function' ) ? Float32Array : 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 Float32Array === 'function' ) ? Float32Array : 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// MODULES //\n\nimport isFloat32Array from './../../is-float32array';\nimport PINF from '@stdlib/constants/float64/pinf';\nimport GlobalFloat32Array from './float32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Float32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float32Array` support\n*\n* @example\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\nfunction hasFloat32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat32Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\tisFloat32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.140000104904175 &&\n\t\t\tarr[ 2 ] === -3.140000104904175 &&\n\t\t\tarr[ 3 ] === PINF\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 hasFloat32ArraySupport;\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 single-precision floating-point numbers 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) 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 hasUint32Array = ( typeof Uint32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint32Array\n*\n* @example\n* import Uint32Array from '@stdlib/array/uint32';\n*\n* var bool = isUint32Array( new Uint32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint32Array( [] );\n* // returns false\n*/\nfunction isUint32Array( value ) {\n\treturn (\n\t\t( hasUint32Array && value instanceof Uint32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint32Array;\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 32-bit integer.\n*\n* @module @stdlib/constants/uint32/max\n* @type {uinteger32}\n*\n* @example\n* import UINT32_MAX from '@stdlib/constants/uint32/max';\n* // returns 4294967295\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{32} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 11111111111111111111111111111111\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 4294967295\n*/\nvar UINT32_MAX = 4294967295;\n\n\n// EXPORTS //\n\nexport default UINT32_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/**\n* Typed array constructor which returns a typed array representing an array of 32-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array/uint32\n*\n* @example\n* import ctor from '@stdlib/array/uint32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint32ArraySupport from '@stdlib/assert/has-uint32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint32ArraySupport() ) {\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// MAIN //\n\nvar main = ( typeof Uint32Array === 'function' ) ? Uint32Array : 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 Uint32Array === 'function' ) ? Uint32Array : 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// MODULES //\n\nimport isUint32Array from './../../is-uint32array';\nimport UINT32_MAX from '@stdlib/constants/uint32/max';\nimport GlobalUint32Array from './uint32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint32Array` support\n*\n* @example\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\nfunction hasUint32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT32_MAX+1, UINT32_MAX+2 ];\n\t\tarr = new GlobalUint32Array( arr );\n\t\tbool = (\n\t\t\tisUint32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT32_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 hasUint32ArraySupport;\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 32-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) 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 twos-complement 32-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array/int32\n*\n* @example\n* import ctor from '@stdlib/array/int32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt32ArraySupport from '@stdlib/assert/has-int32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt32ArraySupport() ) {\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 nativeClass from '@stdlib/utils/native-class';\n\n\n// VARIABLES //\n\nvar hasInt32Array = ( typeof Int32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int32Array\n*\n* @example\n* import Int32Array from '@stdlib/array/int32';\n*\n* var bool = isInt32Array( new Int32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt32Array( [] );\n* // returns false\n*/\nfunction isInt32Array( value ) {\n\treturn (\n\t\t( hasInt32Array && value instanceof Int32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt32Array;\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 Int32Array === 'function' ) ? Int32Array : 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 Int32Array === 'function' ) ? Int32Array : 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// MODULES //\n\nimport isInt32Array from './../../is-int32array';\nimport INT32_MAX from '@stdlib/constants/int32/max';\nimport INT32_MIN from '@stdlib/constants/int32/min';\nimport GlobalInt32Array from './int32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int32Array` support\n*\n* @example\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\nfunction hasInt32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt32Array( [ 1, 3.14, -3.14, INT32_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT32_MIN // 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 hasInt32ArraySupport;\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* Minimum signed 32-bit integer.\n*\n* @module @stdlib/constants/int32/min\n* @type {integer32}\n*\n* @example\n* import INT32_MIN from '@stdlib/constants/int32/min';\n* // returns -2147483648\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{31})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -2147483648\n*/\nvar INT32_MIN = -2147483648|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT32_MIN;\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 twos-complement 32-bit signed 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) 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 16-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array/uint16\n*\n* @example\n* import ctor from '@stdlib/array/uint16';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint16ArraySupport from '@stdlib/assert/has-uint16array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint16ArraySupport() ) {\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 nativeClass from '@stdlib/utils/native-class';\n\n\n// VARIABLES //\n\nvar hasUint16Array = ( typeof Uint16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint16Array\n*\n* @example\n* import Uint16Array from '@stdlib/array/uint16';\n*\n* var bool = isUint16Array( new Uint16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint16Array( [] );\n* // returns false\n*/\nfunction isUint16Array( value ) {\n\treturn (\n\t\t( hasUint16Array && value instanceof Uint16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint16Array;\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 Uint16Array === 'function' ) ? Uint16Array : 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 Uint16Array === 'function' ) ? Uint16Array : 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// MODULES //\n\nimport isUint16Array from './../../is-uint16array';\nimport UINT16_MAX from '@stdlib/constants/uint16/max';\nimport GlobalUint16Array from './uint16array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint16Array` support\n*\n* @example\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\nfunction hasUint16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT16_MAX+1, UINT16_MAX+2 ];\n\t\tarr = new GlobalUint16Array( arr );\n\t\tbool = (\n\t\t\tisUint16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT16_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 hasUint16ArraySupport;\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 16-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) 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 twos-complement 16-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array/int16\n*\n* @example\n* import ctor from '@stdlib/array/int16';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt16ArraySupport from '@stdlib/assert/has-int16array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt16ArraySupport() ) {\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 nativeClass from '@stdlib/utils/native-class';\n\n\n// VARIABLES //\n\nvar hasInt16Array = ( typeof Int16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int16Array\n*\n* @example\n* import Int16Array from '@stdlib/array/int16';\n*\n* var bool = isInt16Array( new Int16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt16Array( [] );\n* // returns false\n*/\nfunction isInt16Array( value ) {\n\treturn (\n\t\t( hasInt16Array && value instanceof Int16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt16Array;\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 Int16Array === 'function' ) ? Int16Array : 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 Int16Array === 'function' ) ? Int16Array : 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// MODULES //\n\nimport isInt16Array from './../../is-int16array';\nimport INT16_MAX from '@stdlib/constants/int16/max';\nimport INT16_MIN from '@stdlib/constants/int16/min';\nimport GlobalInt16Array from './int16array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int16Array` support\n*\n* @example\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\nfunction hasInt16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt16Array( [ 1, 3.14, -3.14, INT16_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT16_MIN // 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 hasInt16ArraySupport;\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* Minimum signed 16-bit integer.\n*\n* @module @stdlib/constants/int16/min\n* @type {integer32}\n*\n* @example\n* import INT16_MIN from '@stdlib/constants/int16/min';\n* // returns -32768\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{15})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 1000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -32768\n*/\nvar INT16_MIN = -32768|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT16_MIN;\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 twos-complement 16-bit signed 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) 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 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// MODULES //\n\nimport isUint8Array from './../../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) 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 clamped to 0-255.\n*\n* @module @stdlib/array/uint8c\n*\n* @example\n* import ctor from '@stdlib/array/uint8c';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint8ClampedArraySupport from '@stdlib/assert/has-uint8clampedarray-support'; // eslint-disable-line id-length\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ClampedArraySupport() ) {\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 nativeClass from '@stdlib/utils/native-class';\n\n\n// VARIABLES //\n\nvar hasUint8ClampedArray = ( typeof Uint8ClampedArray === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8ClampedArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8ClampedArray\n*\n* @example\n* import Uint8ClampedArray from '@stdlib/array/uint8c';\n*\n* var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8ClampedArray( [] );\n* // returns false\n*/\nfunction isUint8ClampedArray( value ) {\n\treturn (\n\t\t( hasUint8ClampedArray && value instanceof Uint8ClampedArray ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8ClampedArray]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint8ClampedArray;\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 Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : 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 Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : 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// MODULES //\n\nimport isUint8ClampedArray from './../../is-uint8clampedarray';\nimport GlobalUint8ClampedArray from './uint8clampedarray.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8ClampedArray` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8ClampedArray` support\n*\n* @example\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\nfunction hasUint8ClampedArraySupport() { // eslint-disable-line id-length\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8ClampedArray !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalUint8ClampedArray( [ -1, 0, 1, 3.14, 4.99, 255, 256 ] );\n\t\tbool = (\n\t\t\tisUint8ClampedArray( arr ) &&\n\t\t\tarr[ 0 ] === 0 && // clamped\n\t\t\tarr[ 1 ] === 0 &&\n\t\t\tarr[ 2 ] === 1 &&\n\t\t\tarr[ 3 ] === 3 && // round to nearest\n\t\t\tarr[ 4 ] === 5 && // round to nearest\n\t\t\tarr[ 5 ] === 255 &&\n\t\t\tarr[ 6 ] === 255 // clamped\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 hasUint8ClampedArraySupport;\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 clamped to 0-255.\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) 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 twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array/int8\n*\n* @example\n* import ctor from '@stdlib/array/int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert/has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\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 nativeClass from '@stdlib/utils/native-class';\n\n\n// VARIABLES //\n\nvar hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* import Int8Array from '@stdlib/array/int8';\n*\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\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 Int8Array === 'function' ) ? Int8Array : 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 Int8Array === 'function' ) ? Int8Array : 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// MODULES //\n\nimport isInt8Array from './../../is-int8array';\nimport INT8_MAX from '@stdlib/constants/int8/max';\nimport INT8_MIN from '@stdlib/constants/int8/min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // 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 hasInt8ArraySupport;\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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants/int8/min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants/int8/min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\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 twos-complement 8-bit signed 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) 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// 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 './../../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 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 './../../../../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 './../../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 './../../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 './../../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 './../../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 generic array.\n*\n* @module @stdlib/constants/array/max-array-length\n*\n* @example\n* import MAX_ARRAY_LENGTH from '@stdlib/constants/array/max-array-length';\n* // returns 4294967295\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a generic array.\n*\n* ```tex\n* 2^{32} - 1\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 4294967295\n*/\nvar MAX_ARRAY_LENGTH = 4294967295>>>0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default MAX_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-array-length';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an array-like object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is an array-like object\n*\n* @example\n* var bool = isArrayLikeObject( [] );\n* // returns true\n*\n* @example\n* var bool = isArrayLikeObject( { 'length': 10 } );\n* // returns true\n*\n* @example\n* var bool = isArrayLikeObject( 'beep' );\n* // returns false\n*/\nfunction isArrayLikeObject( 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 isArrayLikeObject;\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 isArray from './../../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\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 './../../tools/array-function';\nimport isString from './../../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 { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport setEnumerableReadOnly from '@stdlib/utils/define-read-only-property';\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport format from '@stdlib/string/format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 128-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex128} 128-bit complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex128( real, imag ) {\n\tif ( !( this instanceof Complex128 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tsetEnumerableReadOnly( this, 're', real );\n\tsetEnumerableReadOnly( this, 'im', imag );\n\treturn this;\n}\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex128\n* @readonly\n* @type {string}\n* @default 'Complex128'\n*\n* @example\n* var name = Complex128.name;\n* // returns 'Complex128'\n*/\nsetReadOnly( Complex128, 'name', 'Complex128' );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex128.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128.prototype, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 16\n*/\nsetReadOnly( Complex128.prototype, 'byteLength', 16 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex128.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex128` instance.\n*\n* @name toJSON\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex128', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex128.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex128;\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex128';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\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 fround = ( typeof Math.fround === 'function' ) ? Math.fround : null; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default fround;\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 Float32Array from '@stdlib/array/float32';\n\n\n// VARIABLES //\n\nvar FLOAT32_VIEW = new Float32Array( 1 );\n\n\n// MAIN //\n\n/**\n* Converts a double-precision floating-point number to the nearest single-precision floating-point number.\n*\n* @param {number} x - double-precision floating-point number\n* @returns {number} nearest single-precision floating-point number\n*\n* @example\n* var y = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*/\nfunction float64ToFloat32( x ) {\n\tFLOAT32_VIEW[ 0 ] = x;\n\treturn FLOAT32_VIEW[ 0 ];\n}\n\n\n// EXPORTS //\n\nexport default float64ToFloat32;\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* Convert a double-precision floating-point number to the nearest single-precision floating-point number.\n*\n* @module @stdlib/number/float64/base/to-float32\n*\n* @example\n* import float64ToFloat32 from '@stdlib/number/float64/base/to-float32';\n*\n* var y = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*/\n\n// MODULES //\n\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar float64ToFloat32;\nif ( typeof builtin === 'function' ) {\n\tfloat64ToFloat32 = builtin;\n} else {\n\tfloat64ToFloat32 = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default float64ToFloat32;\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 setEnumerableReadOnly from '@stdlib/utils/define-read-only-property';\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport float64ToFloat32 from '@stdlib/number/float64/base/to-float32';\nimport format from '@stdlib/string/format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 64-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex64} 64-bit complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex64( real, imag ) {\n\tif ( !( this instanceof Complex64 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tsetEnumerableReadOnly( this, 're', float64ToFloat32( real ) );\n\tsetEnumerableReadOnly( this, 'im', float64ToFloat32( imag ) );\n\treturn this;\n}\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex64\n* @readonly\n* @type {string}\n* @default 'Complex64'\n*\n* @example\n* var name = Complex64.name;\n* // returns 'Complex64'\n*/\nsetReadOnly( Complex64, 'name', 'Complex64' );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex64.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64.prototype, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 8\n*/\nsetReadOnly( Complex64.prototype, 'byteLength', 8 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex64.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex64` instance.\n*\n* @name toJSON\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex64', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex64.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex64;\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 Complex128 from '@stdlib/complex/float64/ctor';\nimport Complex64 from '@stdlib/complex/float32/ctor';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a complex number-like object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex number-like object.\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var x = new Complex128( 4.0, 2.0 );\n* var bool = isComplexLike( x );\n* // returns true\n*\n* x = new Complex64( 4.0, 2.0 );\n* bool = isComplexLike( x );\n* // returns true\n*/\nfunction isComplexLike( value ) {\n\tif ( value instanceof Complex128 || value instanceof Complex64 ) {\n\t\treturn true;\n\t}\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.re === 'number' &&\n\t\ttypeof value.im === 'number'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplexLike;\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 './../../../../base/assert/is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a finite numeric value is an even number.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an even number\n*\n* @example\n* var bool = isEven( 5.0 );\n* // returns false\n*\n* @example\n* var bool = isEven( -2.0 );\n* // returns true\n*\n* @example\n* var bool = isEven( 0.0 );\n* // returns true\n*\n* @example\n* var bool = isEven( NaN );\n* // returns false\n*/\nfunction isEven( x ) {\n\treturn isInteger( x/2.0 );\n}\n\n\n// EXPORTS //\n\nexport default isEven;\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex64';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\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// VARIABLES //\n\nvar BYTES_PER_ELEMENT = 8; // 4 bytes per float32 x (1 real + 1 imag component)\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a value is a `Complex64Array`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `Complex64Array`\n*\n* @example\n* import Complex64Array from '@stdlib/array/complex64';\n*\n* var bool = isComplex64Array( new Complex64Array( 10 ) );\n* // returns true\n*\n* bool = isComplex64Array( [] );\n* // returns false\n*/\nfunction isComplex64Array( value ) {\n\t// Note: the following is not robust and that is intentional. In this case, we are seeking a lower cost way to reasonably determine whether an input value is a `Complex64Array` in order to avoid walking the prototype chain and resolving constructors, which is necessary for robust identification of cross-realm instances. For more robust validation, see `@stdlib/assert/is-complex64array`.\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'Complex64Array' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplex64Array;\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// VARIABLES //\n\nvar BYTES_PER_ELEMENT = 16; // 8 bytes per float64 x (1 real + 1 imag component)\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a value is a `Complex128Array`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `Complex128Array`\n*\n* @example\n* import Complex128Array from '@stdlib/array/complex128';\n*\n* var bool = isComplex128Array( new Complex128Array( 10 ) );\n* // returns true\n*\n* bool = isComplex128Array( [] );\n* // returns false\n*/\nfunction isComplex128Array( value ) {\n\t// Note: the following is not robust and that is intentional. In this case, we are seeking a lower cost way to reasonably determine whether an input value is a `Complex128Array` in order to avoid walking the prototype chain and resolving constructors, which is necessary for robust identification of cross-realm instances. For more robust validation, see `@stdlib/assert/is-complex128array`.\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'Complex128Array' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplex128Array;\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 './../../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 './../../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) 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* Returns the real component of a single-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} real component\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var re = real( z );\n* // returns 5.0\n*/\nfunction real( z ) {\n\treturn z.re;\n}\n\n\n// EXPORTS //\n\nexport default real;\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* Returns the imaginary component of a single-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} imaginary component\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var im = imag( z );\n* // returns 3.0\n*/\nfunction imag( z ) {\n\treturn z.im;\n}\n\n\n// EXPORTS //\n\nexport default imag;\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 Float32Array from '@stdlib/array/float32';\n\n\n// MAIN //\n\n/**\n* Reinterprets a `Complex64Array` as a `Float32Array`.\n*\n* @param {Complex64Array} x - input array\n* @param {NonNegativeInteger} offset - starting index\n* @returns {Float32Array} `Float32Array` view\n*\n* @example\n* import Complex64Array from '@stdlib/array/complex64';\n*\n* var x = new Complex64Array( 10 );\n*\n* var out = reinterpret( x, 0 );\n* // returns \n*\n* var bool = ( out.buffer === x.buffer );\n* // returns true\n*/\nfunction reinterpret( x, offset ) {\n\treturn new Float32Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), 2*(x.length-offset) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default reinterpret;\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 Float64Array from '@stdlib/array/float64';\n\n\n// MAIN //\n\n/**\n* Reinterprets a `Complex128Array` as a `Float64Array`.\n*\n* @param {Complex128Array} x - input array\n* @param {NonNegativeInteger} offset - starting index\n* @returns {Float64Array} `Float64Array` view\n*\n* @example\n* import Complex128Array from '@stdlib/array/complex128';\n*\n* var x = new Complex128Array( 10 );\n*\n* var out = reinterpret( x, 0 );\n* // returns \n*\n* var bool = ( out.buffer === x.buffer );\n* // returns true\n*/\nfunction reinterpret( x, offset ) {\n\treturn new Float64Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), 2*(x.length-offset) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default reinterpret;\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 isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport realf from '@stdlib/complex/float32/real';\nimport imagf from '@stdlib/complex/float32/imag';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\tvar z;\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\tz = v.value;\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( realf( z ), imagf( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIterator;\n","/* eslint-disable no-restricted-syntax, max-lines, no-invalid-this */\n\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 isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isCollection from '@stdlib/assert/is-collection';\nimport isArrayBuffer from '@stdlib/assert/is-arraybuffer';\nimport isObject from '@stdlib/assert/is-object';\nimport isArray from '@stdlib/assert/is-array';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isFunction from '@stdlib/assert/is-function';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport isEven from '@stdlib/math/base/assert/is-even';\nimport isInteger from '@stdlib/math/base/assert/is-integer';\nimport isComplex64Array from './../../base/assert/is-complex64array';\nimport isComplex128Array from './../../base/assert/is-complex128array';\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 Float32Array from './../../float32';\nimport Complex64 from '@stdlib/complex/float32/ctor';\nimport format from '@stdlib/string/format';\nimport realf from '@stdlib/complex/float32/real';\nimport imagf from '@stdlib/complex/float32/imag';\nimport floor from '@stdlib/math/base/special/floor';\nimport reinterpret64 from '@stdlib/strided/base/reinterpret-complex64';\nimport reinterpret128 from '@stdlib/strided/base/reinterpret-complex128';\nimport getter from './../../base/getter';\nimport accessorGetter from './../../base/accessor-getter';\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 = Float32Array.BYTES_PER_ELEMENT * 2;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a complex typed array.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array\n*/\nfunction isComplexArray( value ) {\n\treturn (\n\t\tvalue instanceof Complex64Array ||\n\t\t(\n\t\t\ttypeof value === 'object' &&\n\t\t\tvalue !== null &&\n\t\t\t(\n\t\t\t\tvalue.constructor.name === 'Complex64Array' ||\n\t\t\t\tvalue.constructor.name === 'Complex128Array'\n\t\t\t) &&\n\t\t\ttypeof value._length === 'number' && // eslint-disable-line no-underscore-dangle\n\n\t\t\t// NOTE: we don't perform a more rigorous test here for a typed array for performance reasons, as robustly checking for a typed array instance could require walking the prototype tree and performing relatively expensive constructor checks...\n\t\t\ttypeof value._buffer === 'object' // eslint-disable-line no-underscore-dangle\n\t\t)\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a complex typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array constructor\n*/\nfunction isComplexArrayConstructor( value ) {\n\treturn (\n\t\tvalue === Complex64Array ||\n\n\t\t// NOTE: weaker test in order to avoid a circular dependency with Complex128Array...\n\t\tvalue.name === 'Complex128Array'\n\t);\n}\n\n/**\n* Retrieves a complex number from a complex number array buffer.\n*\n* @private\n* @param {Float32Array} buf - array buffer\n* @param {NonNegativeInteger} idx - element index\n* @returns {Complex64} complex number\n*/\nfunction getComplex64( buf, idx ) {\n\tidx *= 2;\n\treturn new Complex64( buf[ idx ], buf[ idx+1 ] );\n}\n\n\n// MAIN //\n\n/**\n* 64-bit complex number 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 {RangeError} ArrayBuffer byte length must be a multiple of `8`\n* @throws {RangeError} array-like object and typed array input arguments must have a length which is a multiple of two\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} byte offset must be a multiple of `8`\n* @throws {TypeError} view length must be a positive multiple of `8`\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex64Array} complex number array\n*\n* @example\n* var arr = new Complex64Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new Complex64Array( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var arr = new Complex64Array( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Complex64Array( buf );\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 Complex64Array( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Complex64Array( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction Complex64Array() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof Complex64Array) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new Complex64Array();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new Complex64Array( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new Complex64Array( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new Complex64Array( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Float32Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\tif ( isNonNegativeInteger( arguments[0] ) ) {\n\t\t\tbuf = new Float32Array( arguments[0]*2 );\n\t\t} else if ( isCollection( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tlen = buf.length;\n\n\t\t\t// If provided a \"generic\" array, peak at the first value, and, if the value is a complex number, try to process as an array of complex numbers, falling back to \"normal\" typed array initialization if we fail and ensuring consistency if the first value had not been a complex number...\n\t\t\tif ( len && isArray( buf ) && isComplexLike( buf[0] ) ) {\n\t\t\t\tbuf = fromArray( new Float32Array( len*2 ), buf );\n\t\t\t\tif ( buf === null ) {\n\t\t\t\t\t// We failed and we are now forced to allocate a new array :-(\n\t\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t\t}\n\t\t\t\t\t// We failed, so fall back to directly setting values...\n\t\t\t\t\tbuf = new Float32Array( arguments[0] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( isComplex64Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret64( buf, 0 );\n\t\t\t\t} else if ( isComplex128Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret128( buf, 0 );\n\t\t\t\t} else if ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tbuf = new Float32Array( buf );\n\t\t\t}\n\t\t} else if ( isArrayBuffer( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( !isInteger( buf.byteLength/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.', BYTES_PER_ELEMENT, buf.byteLength ) );\n\t\t\t}\n\t\t\tbuf = new Float32Array( buf );\n\t\t} else if ( isObject( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\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`.', buf ) );\n\t\t\t}\n\t\t\tif ( !isFunction( buf[ 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`.', buf ) );\n\t\t\t}\n\t\t\tbuf = buf[ 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`.', buf ) ); // FIXME: `buf` is what is returned from above, NOT the original value\n\t\t\t}\n\t\t\tbuf = fromIterator( buf );\n\t\t\tif ( buf instanceof Error ) {\n\t\t\t\tthrow buf;\n\t\t\t}\n\t\t\tbuf = new Float32Array( 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`.', arguments[0] ) );\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 ( !isInteger( byteOffset/BYTES_PER_ELEMENT ) ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Byte offset must be a multiple of %u. Value: `%u`.', BYTES_PER_ELEMENT, byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t\tif ( !isInteger( len/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.', BYTES_PER_ELEMENT, len ) );\n\t\t\t}\n\t\t\tbuf = new Float32Array( 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 Float32Array( buf, byteOffset, len*2 );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length/2 );\n\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64Array\n* @readonly\n* @type {PositiveInteger}\n* @default 8\n*\n* @example\n* var nbytes = Complex64Array.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex64Array, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex64Array\n* @readonly\n* @type {string}\n* @default 'Complex64Array'\n*\n* @example\n* var str = Complex64Array.name;\n* // returns 'Complex64Array'\n*/\nsetReadOnly( Complex64Array, 'name', 'Complex64Array' );\n\n/**\n* Creates a new 64-bit complex number array from an array-like object or an iterable.\n*\n* @name from\n* @memberof Complex64Array\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 complex number 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* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @throws {TypeError} when provided an iterator, a callback must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex64Array} 64-bit complex number array\n*\n* @example\n* var arr = Complex64Array.from( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = Complex64Array.from( [ new Complex64( 1.0, 1.0 ) ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function clbk( v ) {\n* return new Complex64( realf(v)*2.0, imagf(v)*2.0 );\n* }\n*\n* var arr = Complex64Array.from( [ new Complex64( 1.0, 1.0 ) ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*/\nsetReadOnly( Complex64Array, '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 flg;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( isComplexArray( src ) ) {\n\t\tlen = src.length;\n\t\tif ( clbk ) {\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, src.get( i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = realf( v );\n\t\t\t\t\tbuf[ j+1 ] = imagf( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isCollection( src ) ) {\n\t\tif ( clbk ) {\n\t\t\t// Note: array contents affect how we iterate over a provided data source. If only complex number objects, we can extract real and imaginary components. Otherwise, for non-complex number arrays (e.g., `Float64Array`, etc), we assume a strided array where real and imaginary components are interleaved. In the former case, we expect a callback to return real and imaginary components (possibly as a complex number). In the latter case, we expect a callback to return *either* a real or imaginary component.\n\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\t// Detect whether we've been provided an array which returns complex number objects...\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tif ( !isComplexLike( get( src, i ) ) ) {\n\t\t\t\t\tflg = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If an array does not contain only complex number objects, then we assume interleaved real and imaginary components...\n\t\t\tif ( flg ) {\n\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. First argument must have a length which is a multiple of %u. Length: `%u`.', 2, len ) );\n\t\t\t\t}\n\t\t\t\tout = new this( len/2 );\n\t\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tbuf[ i ] = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\t// If an array contains only complex number objects, then we need to extract real and imaginary components...\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = realf( v );\n\t\t\t\t\tbuf[ j+1 ] = imagf( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\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\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\n\t\t}\n\t\tlen = tmp.length / 2;\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 64-bit complex number array from a variable number of arguments.\n*\n* @name of\n* @memberof Complex64Array\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} 64-bit complex number array\n*\n* @example\n* var arr = Complex64Array.of( 1.0, 1.0, 1.0, 1.0 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( Complex64Array, '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 ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide an integer\n* @returns {(Complex64|void)} array element\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var z = arr.at( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 9.0, -9.0 ], 9 );\n*\n* z = arr.at( 0 );\n* // returns [ 1.0, -1.0 ]\n*\n* z = arr.at( -1 );\n* // returns [ 9.0, -9.0 ]\n*\n* z = arr.at( 100 );\n* // returns undefined\n*\n* z = arr.at( -100 );\n* // returns undefined\n*/\nsetReadOnly( Complex64Array.prototype, 'at', function at( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tif ( idx < 0 ) {\n\t\tidx += this._length;\n\t}\n\tif ( idx < 0 || idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex64( this._buffer, idx );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( Complex64Array.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 Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 80\n*/\nsetReadOnlyAccessor( Complex64Array.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 Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( Complex64Array.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 Complex64Array.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 8\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex64Array.prototype, 'BYTES_PER_ELEMENT', Complex64Array.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 Complex64Array.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 complex number array\n* @returns {Complex64Array} modified array\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( 4 );\n*\n* // Set the array elements:\n* arr.set( new Complex64( 1.0, 1.0 ), 0 );\n* arr.set( new Complex64( 2.0, 2.0 ), 1 );\n* arr.set( new Complex64( 3.0, 3.0 ), 2 );\n* arr.set( new Complex64( 4.0, 4.0 ), 3 );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n* // arr => [ 1.0, 1.0, 2.0, 2.0, 1.0, 1.0, 2.0, 2.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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*2, start*2 );\n\t} else {\n\t\tthis._buffer.copyWithin( target*2, start*2, arguments[2]*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 Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = [\n* new Complex64( 1.0, 1.0 ),\n* new Complex64( 2.0, 2.0 ),\n* new Complex64( 3.0, 3.0 )\n* ];\n* arr = new Complex64Array( arr );\n*\n* // Create an iterator:\n* var it = arr.entries();\n*\n* // Iterate over the key-value pairs...\n* var v = it.next().value;\n* // returns [ 0, ]\n*\n* v = it.next().value;\n* // returns [ 1, ]\n*\n* v = it.next().value;\n* // returns [ 2, ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'entries', function entries() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar buf;\n\tvar FLG;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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, getComplex64( 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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number 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* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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, getComplex64( 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 Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} 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 complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n* @returns {Complex64Array} modified array\n*\n* @example\n* var arr = new Complex64Array( 3 );\n*\n* arr.fill( new Complex64( 1.0, 1.0 ), 1 );\n*\n* var z = arr.get( 1 );\n* // returns [ 1.0, 1.0 ]\n*\n* z = arr.get( 2 );\n* // returns [ 1.0, 1.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = realf( value );\n\tim = imagf( value );\n\tfor ( i = start; i < end; i++ ) {\n\t\tidx = 2*i;\n\t\tbuf[ idx ] = re;\n\t\tbuf[ idx+1 ] = im;\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} complex number array\n*\n* @example\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.filter( predicate );\n* // returns [ 2.0, 2.0 ]\n*\n* var len = out.length;\n* // returns 1\n*/\nsetReadOnly( Complex64Array.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\tout.push( z );\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex64|void)} array element or undefined\n*\n* @example\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.find( predicate );\n* // returns [ 1.0, 1.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var idx = arr.findIndex( predicate );\n* // returns 2\n*/\nsetReadOnly( Complex64Array.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, 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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex64|void)} array element or undefined\n*\n* @example\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.findLast( predicate );\n* // returns [ 3.0, 3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var idx = arr.findLastIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Complex64Array.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, 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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* function log( v, i ) {\n* console.log( '%s: %s', i, v.toString() );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( Complex64Array.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tfcn.call( thisArg, z, i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @name get\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(Complex64|void)} array element\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns [ 1.0, -1.0 ]\n*\n* z = arr.get( 100 );\n* // returns undefined\n*/\nsetReadOnly( Complex64Array.prototype, 'get', function get( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 getComplex64( this._buffer, idx );\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {boolean} boolean indicating whether an array includes a provided value\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var bool = arr.includes( new Complex64( 3.0, -3.0 ) );\n* // returns true\n*\n* bool = arr.includes( new Complex64( 3.0, -3.0 ), 3 );\n* // returns false\n*\n* bool = arr.includes( new Complex64( 4.0, -4.0 ), -3 );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\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 Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( 10 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var idx = arr.indexOf( new Complex64( 3.0, -3.0 ) );\n* // returns 2\n*\n* idx = arr.indexOf( new Complex64( 3.0, -3.0 ), 3 );\n* // returns -1\n*\n* idx = arr.indexOf( new Complex64( 4.0, -4.0 ), -3 );\n* // returns -1\n*/\nsetReadOnly( Complex64Array.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\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 Complex64Array.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.join();\n* // returns '1 + 1i,2 + 2i'\n*\n* str = arr.join( '/' );\n* // returns '1 + 1i/2 + 2i'\n*/\nsetReadOnly( Complex64Array.prototype, 'join', function join( separator ) {\n\tvar out;\n\tvar buf;\n\tvar sep;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( arguments.length === 0 ) {\n\t\tsep = ',';\n\t} else if ( isString( separator ) ) {\n\t\tsep = separator;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', separator ) );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex64( buf, i ).toString() );\n\t}\n\treturn out.join( sep );\n});\n\n/**\n* Returns an iterator for iterating over each index key in a typed array.\n*\n* @name keys\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 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( Complex64Array.prototype, 'keys', function keys() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex] - index at which to start searching backward (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 3.0, -3.0 ], 4 );\n*\n* var idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ) );\n* // returns 4\n*\n* idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ), 3 );\n* // returns 2\n*\n* idx = arr.lastIndexOf( new Complex64( 5.0, -5.0 ), 3 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( new Complex64( 2.0, -2.0 ), -3 );\n* // returns 1\n*/\nsetReadOnly( Complex64Array.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\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 Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( Complex64Array.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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} complex number array\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function scale( v, i ) {\n* return new Complex64( 2.0*realf( v ), 2.0*imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.map( scale );\n* // returns [ 2.0, -2.0, 4.0, -4.0, 6.0, -6.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\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\tv = fcn.call( thisArg, getComplex64( buf, i ), i, this );\n\t\tif ( isComplexLike( v ) ) {\n\t\t\toutbuf[ 2*i ] = realf( v );\n\t\t\toutbuf[ (2*i)+1 ] = imagf( v );\n\t\t} else if ( isArrayLikeObject( v ) && v.length === 2 ) {\n\t\t\toutbuf[ 2*i ] = v[ 0 ];\n\t\t\toutbuf[ (2*i)+1 ] = v[ 1 ];\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t}\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\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* import caddf from '@stdlib/complex/float32/base/add';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduce( caddf );\n* // returns [ 6.0, 6.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 = getComplex64( buf, 0 );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tv = getComplex64( buf, i );\n\t\tacc = reducer( acc, v, 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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\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* import caddf from '@stdlib/complex/float32/base/add';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduceRight( caddf );\n* // returns [ 6.0, 6.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'reduceRight', function reduceRight( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 = getComplex64( buf, len-1 );\n\t\ti = len-2;\n\t}\n\tfor ( ; i >= 0; i-- ) {\n\t\tv = getComplex64( buf, i );\n\t\tacc = reducer( acc, v, i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} reversed array\n*\n* @example\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.reverse();\n* // returns [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'reverse', function reverse() {\n\tvar buf;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tbuf = this._buffer;\n\tN = floor( len / 2 );\n\tfor ( i = 0; i < N; i++ ) {\n\t\tj = len - i - 1;\n\t\ttmp = buf[ (2*i) ];\n\t\tbuf[ (2*i) ] = buf[ (2*j) ];\n\t\tbuf[ (2*j) ] = tmp;\n\t\ttmp = buf[ (2*i)+1 ];\n\t\tbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t\tbuf[ (2*j)+1 ] = tmp;\n\t}\n\treturn this;\n});\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - When provided a typed array, real or complex, 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 Complex64Array.prototype\n* @type {Function}\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be either a complex number, an array-like object, or a complex number array\n* @throws {TypeError} index argument must be a nonnegative integer\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\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 Complex64Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns [ 1.0, -1.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'set', function set( value ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar flg;\n\tvar N;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( isComplexLike( value ) ) {\n\t\tif ( idx >= this._length ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );\n\t\t}\n\t\tidx *= 2;\n\t\tbuf[ idx ] = realf( value );\n\t\tbuf[ idx+1 ] = imagf( value );\n\t\treturn;\n\t}\n\tif ( isComplexArray( 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\tsbuf = value._buffer;\n\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 Float32Array( sbuf.length );\n\t\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t}\n\t\t\tsbuf = tmp;\n\t\t}\n\t\tidx *= 2;\n\t\tj = 0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\tidx += 2; // stride\n\t\t\tj += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tif ( isCollection( value ) ) {\n\t\t// Detect whether we've been provided an array of complex numbers...\n\t\tN = value.length;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tif ( !isComplexLike( value[ i ] ) ) {\n\t\t\t\tflg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// If an array does not contain only complex numbers, then we assume interleaved real and imaginary components...\n\t\tif ( flg ) {\n\t\t\tif ( !isEven( N ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', N ) );\n\t\t\t}\n\t\t\tif ( idx+(N/2) > this._length ) {\n\t\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t\t}\n\t\t\tsbuf = value;\n\n\t\t\t// Check for overlapping memory...\n\t\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\t\tif (\n\t\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t\t(\n\t\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// We need to copy source values...\n\t\t\t\ttmp = new Float32Array( N );\n\t\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\t\ttmp[ i ] = sbuf[ i ]; // TODO: handle accessor arrays\n\t\t\t\t}\n\t\t\t\tsbuf = tmp;\n\t\t\t}\n\t\t\tidx *= 2;\n\t\t\tN /= 2;\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\t\tidx += 2; // stride\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t// If an array contains only complex numbers, then we need to extract real and imaginary components...\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\tidx *= 2;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tv = value[ i ];\n\t\t\tbuf[ idx ] = realf( v );\n\t\t\tbuf[ idx+1 ] = imagf( v );\n\t\t\tidx += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.', value ) );\n\n\t/* eslint-enable no-underscore-dangle */\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} complex number array\n*\n* @example\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var out = arr.slice();\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0, 4.0, -4.0, 5.0, -5.0 ]\n*\n* out = arr.slice( 1, -2 );\n* // returns [ 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'slice', function slice( start, end ) {\n\tvar outlen;\n\tvar outbuf;\n\tvar out;\n\tvar idx;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tstart = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First 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 === 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 ( start < end ) {\n\t\toutlen = end - start;\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\tidx = 2*(i+start);\n\t\toutbuf[ 2*i ] = buf[ idx ];\n\t\toutbuf[ (2*i)+1 ] = buf[ idx+1 ];\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number 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* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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, getComplex64( 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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} compareFcn - comparison function\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} sorted array\n*\n* @example\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function compare( a, b ) {\n* var re1;\n* var re2;\n* var im1;\n* var im2;\n* re1 = realf( a );\n* re2 = realf( b );\n* if ( re1 < re2 ) {\n* return -1;\n* }\n* if ( re1 > re2 ) {\n* return 1;\n* }\n* im1 = imagf( a );\n* im2 = imagf( b );\n* if ( im1 < im2 ) {\n* return -1;\n* }\n* if ( im1 > im2 ) {\n* return 1;\n* }\n* return 0;\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 3.0, -3.0 ], 0 );\n* arr.set( [ 1.0, -1.0 ], 1 );\n* arr.set( [ 2.0, -2.0 ], 2 );\n*\n* var out = arr.sort( compare );\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'sort', function sort( compareFcn ) {\n\tvar tmp;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\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 = this._buffer;\n\tlen = this._length;\n\ttmp = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\ttmp.push( getComplex64( buf, i ) );\n\t}\n\ttmp.sort( compareFcn );\n\tfor ( i = 0; i < len; i++ ) {\n\t\tj = 2 * i;\n\t\tbuf[ j ] = realf( tmp[i] );\n\t\tbuf[ j+1 ] = imagf( tmp[i] );\n\t}\n\treturn this;\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 Complex64Array.prototype\n* @type {Function}\n* @param {integer} [begin=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} subarray\n*\n* @example\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var subarr = arr.subarray();\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0, 4.0, -4.0, 5.0, -5.0 ]\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns [ 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 Complex64Array.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 complex number 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 Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toLocaleString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex64Array.prototype, 'toLocaleString', function toLocaleString( locales, options ) {\n\tvar opts;\n\tvar loc;\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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( getComplex64( 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 Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} reversed array\n*\n* @example\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.toReversed();\n* // returns [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tj = len - i - 1;\n\t\toutbuf[ (2*i) ] = buf[ (2*j) ];\n\t\toutbuf[ (2*i)+1 ] = buf[ (2*j)+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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} compareFcn - comparison function\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} sorted array\n*\n* @example\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function compare( a, b ) {\n* var re1;\n* var re2;\n* var im1;\n* var im2;\n* re1 = realf( a );\n* re2 = realf( b );\n* if ( re1 < re2 ) {\n* return -1;\n* }\n* if ( re1 > re2 ) {\n* return 1;\n* }\n* im1 = imagf( a );\n* im2 = imagf( b );\n* if ( im1 < im2 ) {\n* return -1;\n* }\n* if ( im1 > im2 ) {\n* return 1;\n* }\n* return 0;\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 3.0, -3.0 ], 0 );\n* arr.set( [ 1.0, -1.0 ], 1 );\n* arr.set( [ 2.0, -2.0 ], 2 );\n*\n* var out = arr.sort( compare );\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'toSorted', function toSorted( compareFcn ) {\n\tvar tmp;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\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 = this._buffer;\n\tlen = this._length;\n\ttmp = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\ttmp.push( getComplex64( buf, i ) );\n\t}\n\ttmp.sort( compareFcn );\n\treturn new Complex64Array( tmp );\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex64Array.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex64( buf, i ).toString() );\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 Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n*\n* var iter = arr.values();\n*\n* var v = iter.next().value;\n* // returns [ 1.0, -1.0 ]\n*\n* v = iter.next().value;\n* // returns [ 2.0, -2.0 ]\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'values', function values() {\n\tvar iter;\n\tvar self;\n\tvar len;\n\tvar FLG;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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': getComplex64( 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 Complex64Array.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {ComplexLike} value - new value\n* @throws {TypeError} `this` must be a complex number 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 complex number\n* @returns {Complex64Array} new typed array\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.with( 0, new Complex64( 4.0, 4.0 ) );\n* // returns [ 4.0, 4.0, 2.0, 2.0, 3.0, 3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'with', function copyWith( index, value ) {\n\tvar buf;\n\tvar out;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tout = new this.constructor( this._buffer );\n\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tbuf[ 2*index ] = realf( value );\n\tbuf[ (2*index)+1 ] = imagf( value );\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default Complex64Array;\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 isComplexLike from '@stdlib/assert/is-complex-like';\nimport realf from '@stdlib/complex/float32/real';\nimport imagf from '@stdlib/complex/float32/imag';\n\n\n// MAIN //\n\n/**\n* Returns a strided array of real and imaginary components.\n*\n* @private\n* @param {Float32Array} buf - output array\n* @param {Array} arr - array containing complex numbers\n* @returns {(Float32Array|null)} output array or null\n*/\nfunction fromArray( buf, arr ) {\n\tvar len;\n\tvar v;\n\tvar i;\n\tvar j;\n\n\tlen = arr.length;\n\tj = 0;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tv = arr[ i ];\n\t\tif ( !isComplexLike( v ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tbuf[ j ] = realf( v );\n\t\tbuf[ j+1 ] = imagf( v );\n\t\tj += 2; // stride\n\t}\n\treturn buf;\n}\n\n\n// EXPORTS //\n\nexport default fromArray;\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* Returns the real component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} real component\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var re = real( z );\n* // returns 5.0\n*/\nfunction real( z ) {\n\treturn z.re;\n}\n\n\n// EXPORTS //\n\nexport default real;\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* Returns the imaginary component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} imaginary component\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var im = imag( z );\n* // returns 3.0\n*/\nfunction imag( z ) {\n\treturn z.im;\n}\n\n\n// EXPORTS //\n\nexport default imag;\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 isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport format from '@stdlib/string/format';\nimport real from '@stdlib/complex/float64/real';\nimport imag from '@stdlib/complex/float64/imag';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\tvar z;\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\tz = v.value;\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( real( z ), imag( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIterator;\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 isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport realf from '@stdlib/complex/float32/real';\nimport imagf from '@stdlib/complex/float32/imag';\nimport format from '@stdlib/string/format';\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|TypeError)} array or an error\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar z;\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\tz = clbk.call( thisArg, v.value, i );\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( realf( z ), imagf( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIteratorMap;\n","/* eslint-disable no-restricted-syntax, max-lines, no-invalid-this */\n\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 { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isCollection from '@stdlib/assert/is-collection';\nimport isArrayBuffer from '@stdlib/assert/is-arraybuffer';\nimport isObject from '@stdlib/assert/is-object';\nimport isArray from '@stdlib/assert/is-array';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport isString from '@stdlib/assert/is-string';\nimport isFunction from '@stdlib/assert/is-function';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport isEven from '@stdlib/math/base/assert/is-even';\nimport isInteger from '@stdlib/math/base/assert/is-integer';\nimport isComplex64Array from './../../base/assert/is-complex64array';\nimport isComplex128Array from './../../base/assert/is-complex128array';\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 Float64Array from './../../float64';\nimport Complex128 from '@stdlib/complex/float64/ctor';\nimport real from '@stdlib/complex/float64/real';\nimport imag from '@stdlib/complex/float64/imag';\nimport floor from '@stdlib/math/base/special/floor';\nimport reinterpret64 from '@stdlib/strided/base/reinterpret-complex64';\nimport reinterpret128 from '@stdlib/strided/base/reinterpret-complex128';\nimport getter from './../../base/getter';\nimport accessorGetter from './../../base/accessor-getter';\nimport format from '@stdlib/string/format';\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 = Float64Array.BYTES_PER_ELEMENT * 2;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a complex typed array.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array\n*/\nfunction isComplexArray( value ) {\n\treturn (\n\t\tvalue instanceof Complex128Array ||\n\t\t(\n\t\t\ttypeof value === 'object' &&\n\t\t\tvalue !== null &&\n\t\t\t(\n\t\t\t\tvalue.constructor.name === 'Complex64Array' ||\n\t\t\t\tvalue.constructor.name === 'Complex128Array'\n\t\t\t) &&\n\t\t\ttypeof value._length === 'number' && // eslint-disable-line no-underscore-dangle\n\n\t\t\t// NOTE: we don't perform a more rigorous test here for a typed array for performance reasons, as robustly checking for a typed array instance could require walking the prototype tree and performing relatively expensive constructor checks...\n\t\t\ttypeof value._buffer === 'object' // eslint-disable-line no-underscore-dangle\n\t\t)\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a complex typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array constructor\n*/\nfunction isComplexArrayConstructor( value ) {\n\treturn (\n\t\tvalue === Complex128Array ||\n\n\t\t// NOTE: weaker test in order to avoid a circular dependency with Complex64Array...\n\t\tvalue.name === 'Complex64Array'\n\t);\n}\n\n/**\n* Retrieves a complex number from a complex number array buffer.\n*\n* @private\n* @param {Float64Array} buf - array buffer\n* @param {NonNegativeInteger} idx - element index\n* @returns {Complex128} complex number\n*/\nfunction getComplex128( buf, idx ) {\n\tidx *= 2;\n\treturn new Complex128( buf[ idx ], buf[ idx+1 ] );\n}\n\n\n// MAIN //\n\n/**\n* 128-bit complex number array constructor.\n*\n* @constructor\n* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @throws {RangeError} ArrayBuffer byte length must be a multiple of `16`\n* @throws {RangeError} array-like object and typed array input arguments must have a length which is a multiple of two\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} byte offset must be a multiple of `16`\n* @throws {TypeError} view length must be a positive multiple of `16`\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex128Array} complex number array\n*\n* @example\n* var arr = new Complex128Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new Complex128Array( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var arr = new Complex128Array( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Complex128Array( buf );\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( 32 );\n* var arr = new Complex128Array( buf, 16 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = new Complex128Array( buf, 16, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction Complex128Array() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof Complex128Array) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new Complex128Array();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new Complex128Array( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new Complex128Array( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new Complex128Array( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Float64Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\tif ( isNonNegativeInteger( arguments[0] ) ) {\n\t\t\tbuf = new Float64Array( arguments[0]*2 );\n\t\t} else if ( isCollection( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tlen = buf.length;\n\n\t\t\t// If provided a \"generic\" array, peak at the first value, and, if the value is a complex number, try to process as an array of complex numbers, falling back to \"normal\" typed array initialization if we fail and ensuring consistency if the first value had not been a complex number...\n\t\t\tif ( len && isArray( buf ) && isComplexLike( buf[0] ) ) {\n\t\t\t\tbuf = fromArray( new Float64Array( len*2 ), buf );\n\t\t\t\tif ( buf === null ) {\n\t\t\t\t\t// We failed and we are now forced to allocate a new array :-(\n\t\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t\t}\n\t\t\t\t\t// We failed, so fall back to directly setting values...\n\t\t\t\t\tbuf = new Float64Array( arguments[0] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( isComplex64Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret64( buf, 0 );\n\t\t\t\t} else if ( isComplex128Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret128( buf, 0 );\n\t\t\t\t} else if ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tbuf = new Float64Array( buf );\n\t\t\t}\n\t\t} else if ( isArrayBuffer( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( !isInteger( buf.byteLength/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.', BYTES_PER_ELEMENT, buf.byteLength ) );\n\t\t\t}\n\t\t\tbuf = new Float64Array( buf );\n\t\t} else if ( isObject( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\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`.', buf ) );\n\t\t\t}\n\t\t\tif ( !isFunction( buf[ 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`.', buf ) );\n\t\t\t}\n\t\t\tbuf = buf[ 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`.', buf ) );\n\t\t\t}\n\t\t\tbuf = fromIterator( buf );\n\t\t\tif ( buf instanceof Error ) {\n\t\t\t\tthrow buf;\n\t\t\t}\n\t\t\tbuf = new Float64Array( 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`.', arguments[0] ) );\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 ( !isInteger( byteOffset/BYTES_PER_ELEMENT ) ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Byte offset must be a multiple of %u. Value: `%u`.', BYTES_PER_ELEMENT, byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t\tif ( !isInteger( len/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.', BYTES_PER_ELEMENT, len ) );\n\t\t\t}\n\t\t\tbuf = new Float64Array( 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 Float64Array( buf, byteOffset, len*2 );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length/2 );\n\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128Array\n* @readonly\n* @type {PositiveInteger}\n* @default 16\n*\n* @example\n* var nbytes = Complex128Array.BYTES_PER_ELEMENT;\n* // returns 16\n*/\nsetReadOnly( Complex128Array, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex128Array\n* @readonly\n* @type {string}\n* @default 'Complex128Array'\n*\n* @example\n* var name = Complex128Array.name;\n* // returns 'Complex128Array'\n*/\nsetReadOnly( Complex128Array, 'name', 'Complex128Array' );\n\n/**\n* Creates a new 128-bit complex number array from an array-like object or an iterable.\n*\n* @name from\n* @memberof Complex128Array\n* @type {Function}\n* @param {(Collection|Object)} 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 complex number 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* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @throws {TypeError} when provided an iterator, a callback must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex128Array} 128-bit complex number array\n*\n* @example\n* var arr = Complex128Array.from( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = Complex128Array.from( [ new Complex128( 1.0, 1.0 ) ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function clbk( v ) {\n* return new Complex128( real(v)*2.0, imag(v)*2.0 );\n* }\n*\n* var arr = Complex128Array.from( [ new Complex128( 1.0, 1.0 ) ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*/\nsetReadOnly( Complex128Array, '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 flg;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( isComplexArray( src ) ) {\n\t\tlen = src.length;\n\t\tif ( clbk ) {\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, src.get( i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = real( v );\n\t\t\t\t\tbuf[ j+1 ] = imag( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isCollection( src ) ) {\n\t\tif ( clbk ) {\n\t\t\t// Note: array contents affect how we iterate over a provided data source. If only complex number objects, we can extract real and imaginary components. Otherwise, for non-complex number arrays (e.g., `Float64Array`, etc), we assume a strided array where real and imaginary components are interleaved. In the former case, we expect a callback to return real and imaginary components (possibly as a complex number). In the latter case, we expect a callback to return *either* a real or imaginary component.\n\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\t// Detect whether we've been provided an array which returns complex number objects...\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tif ( !isComplexLike( get( src, i ) ) ) {\n\t\t\t\t\tflg = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If an array does not contain only complex number objects, then we assume interleaved real and imaginary components...\n\t\t\tif ( flg ) {\n\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. First argument must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tout = new this( len/2 );\n\t\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tbuf[ i ] = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\t// If an array contains only complex number objects, then we need to extract real and imaginary components...\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = real( v );\n\t\t\t\t\tbuf[ j+1 ] = imag( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\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\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\n\t\t}\n\t\tlen = tmp.length / 2;\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 128-bit complex number array from a variable number of arguments.\n*\n* @name of\n* @memberof Complex128Array\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} 128-bit complex number array\n*\n* @example\n* var arr = Complex128Array.of( 1.0, 1.0, 1.0, 1.0 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( Complex128Array, '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 ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide an integer\n* @returns {(Complex128|void)} array element\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var z = arr.at( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 9.0, -9.0 ], 9 );\n*\n* z = arr.at( 0 );\n* // returns [ 1.0, -1.0 ]\n*\n* z = arr.at( -1 );\n* // returns [ 9.0, -9.0 ]\n*\n* z = arr.at( 100 );\n* // returns undefined\n*\n* z = arr.at( -100 );\n* // returns undefined\n*/\nsetReadOnly( Complex128Array.prototype, 'at', function at( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tif ( idx < 0 ) {\n\t\tidx += this._length;\n\t}\n\tif ( idx < 0 || idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex128( this._buffer, idx );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( Complex128Array.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 Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 160\n*/\nsetReadOnlyAccessor( Complex128Array.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 Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( Complex128Array.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 Complex128Array.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 16\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 16\n*/\nsetReadOnly( Complex128Array.prototype, 'BYTES_PER_ELEMENT', Complex128Array.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 Complex128Array.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 complex number array\n* @returns {Complex128Array} modified array\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( 4 );\n*\n* // Set the array elements:\n* arr.set( new Complex128( 1.0, 1.0 ), 0 );\n* arr.set( new Complex128( 2.0, 2.0 ), 1 );\n* arr.set( new Complex128( 3.0, 3.0 ), 2 );\n* arr.set( new Complex128( 4.0, 4.0 ), 3 );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n* // arr => [ 1.0, 1.0, 2.0, 2.0, 1.0, 1.0, 2.0, 2.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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*2, start*2 );\n\t} else {\n\t\tthis._buffer.copyWithin( target*2, start*2, arguments[2]*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 Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = [\n* new Complex128( 1.0, 1.0 ),\n* new Complex128( 2.0, 2.0 ),\n* new Complex128( 3.0, 3.0 )\n* ];\n* arr = new Complex128Array( arr );\n*\n* // Create an iterator:\n* var it = arr.entries();\n*\n* // Iterate over the key-value pairs...\n* var v = it.next().value;\n* // returns [ 0, ]\n*\n* v = it.next().value;\n* // returns [ 1, ]\n*\n* v = it.next().value;\n* // returns [ 2, ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'entries', function entries() {\n\tvar buffer;\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tself = this;\n\tbuffer = this._buffer;\n\tlen = this._length;\n\n\t// Initialize the iteration indices:\n\ti = -1;\n\tj = -2;\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\tvar z;\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\tj += 2;\n\t\tz = new Complex128( buffer[ j ], buffer[ j+1 ] );\n\t\treturn {\n\t\t\t'value': [ i, z ],\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number 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* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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, getComplex128( 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 Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} 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 complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n* @returns {Complex128Array} modified array\n*\n* @example\n* var arr = new Complex128Array( 3 );\n*\n* arr.fill( new Complex128( 1.0, 1.0 ), 1 );\n*\n* var z = arr.get( 1 );\n* // returns [ 1.0, 1.0 ]\n*\n* z = arr.get( 2 );\n* // returns [ 1.0, 1.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = real( value );\n\tim = imag( value );\n\tfor ( i = start; i < end; i++ ) {\n\t\tidx = 2*i;\n\t\tbuf[ idx ] = re;\n\t\tbuf[ idx+1 ] = im;\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} complex number array\n*\n* @example\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.filter( predicate );\n* // returns \n*\n* var len = out.length;\n* // returns 1\n*\n* var z = out.get( 0 );\n* // returns [ 2.0, 2.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\tout.push( z );\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex128|void)} array element or undefined\n*\n* @example\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.find( predicate );\n* // returns [ 1.0, 1.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var idx = arr.findIndex( predicate );\n* // returns 2\n*/\nsetReadOnly( Complex128Array.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, 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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex128|void)} array element or undefined\n*\n* @example\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.findLast( predicate );\n* // returns [ 3.0, 3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var idx = arr.findLastIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Complex128Array.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, 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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* function log( v, i ) {\n* console.log( '%s: %s', i, v.toString() );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( Complex128Array.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tfcn.call( thisArg, z, i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @name get\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(Complex128|void)} array element\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns [ 1.0, -1.0 ]\n*\n* z = arr.get( 100 );\n* // returns undefined\n*/\nsetReadOnly( Complex128Array.prototype, 'get', function get( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 getComplex128( this._buffer, idx );\n});\n\n/**\n* Number of array elements.\n*\n* @name length\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( Complex128Array.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {boolean} boolean indicating whether an array includes a provided value\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var bool = arr.includes( new Complex128( 3.0, -3.0 ) );\n* // returns true\n*\n* bool = arr.includes( new Complex128( 3.0, -3.0 ), 3 );\n* // returns false\n*\n* bool = arr.includes( new Complex128( 4.0, -4.0 ), -3 );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\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 Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var idx = arr.indexOf( new Complex128( 3.0, -3.0 ) );\n* // returns 2\n*\n* idx = arr.indexOf( new Complex128( 3.0, -3.0 ), 3 );\n* // returns -1\n*\n* idx = arr.indexOf( new Complex128( 4.0, -4.0 ), -3 );\n* // returns 3\n*/\nsetReadOnly( Complex128Array.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\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 Complex128Array.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.join();\n* // returns '1 + 1i,2 + 2i'\n*\n* str = arr.join( '/' );\n* // returns '1 + 1i/2 + 2i'\n*/\nsetReadOnly( Complex128Array.prototype, 'join', function join( separator ) {\n\tvar out;\n\tvar buf;\n\tvar sep;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( arguments.length === 0 ) {\n\t\tsep = ',';\n\t} else if ( isString( separator ) ) {\n\t\tsep = separator;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', separator ) );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex128( buf, i ).toString() );\n\t}\n\treturn out.join( sep );\n});\n\n/**\n* Returns an iterator for iterating over each index key in a typed array.\n*\n* @name keys\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 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( Complex128Array.prototype, 'keys', function keys() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex] - index at which to start searching backward (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 3.0, -3.0 ], 4 );\n*\n* var idx = arr.lastIndexOf( new Complex128( 3.0, -3.0 ) );\n* // returns 4\n*\n* idx = arr.lastIndexOf( new Complex128( 3.0, -3.0 ), 3 );\n* // returns 2\n*\n* idx = arr.lastIndexOf( new Complex128( 5.0, -5.0 ), 3 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( new Complex128( 2.0, -2.0 ), -3 );\n* // returns 1\n*/\nsetReadOnly( Complex128Array.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} complex number array\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function scale( v, i ) {\n* return new Complex128( 2.0*real( v ), 2.0*imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.map( scale );\n* // returns [ 2.0, -2.0, 4.0, -4.0, 6.0, -6.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\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\tv = fcn.call( thisArg, getComplex128( buf, i ), i, this );\n\t\tif ( isComplexLike( v ) ) {\n\t\t\toutbuf[ 2*i ] = real( v );\n\t\t\toutbuf[ (2*i)+1 ] = imag( v );\n\t\t} else if ( isArrayLikeObject( v ) && v.length === 2 ) {\n\t\t\toutbuf[ 2*i ] = v[ 0 ];\n\t\t\toutbuf[ (2*i)+1 ] = v[ 1 ];\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t}\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\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* import cadd from '@stdlib/complex/float64/base/add';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduce( cadd );\n* // returns [ 6.0, 6.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 = getComplex128( buf, 0 );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tv = getComplex128( buf, i );\n\t\tacc = reducer( acc, v, 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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\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* import cadd from '@stdlib/complex/float64/base/add';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduceRight( cadd );\n* // returns [ 6.0, 6.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'reduceRight', function reduceRight( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 = getComplex128( buf, len-1 );\n\t\ti = len-2;\n\t}\n\tfor ( ; i >= 0; i-- ) {\n\t\tv = getComplex128( buf, i );\n\t\tacc = reducer( acc, v, i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} reversed array\n*\n* @example\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.reverse();\n* // returns [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'reverse', function reverse() {\n\tvar buf;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tbuf = this._buffer;\n\tN = floor( len / 2 );\n\tfor ( i = 0; i < N; i++ ) {\n\t\tj = len - i - 1;\n\t\ttmp = buf[ (2*i) ];\n\t\tbuf[ (2*i) ] = buf[ (2*j) ];\n\t\tbuf[ (2*j) ] = tmp;\n\t\ttmp = buf[ (2*i)+1 ];\n\t\tbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t\tbuf[ (2*j)+1 ] = tmp;\n\t}\n\treturn this;\n});\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - When provided a typed array, real or complex, 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 Complex128Array.prototype\n* @type {Function}\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be either a complex number, an array-like object, or a complex number array\n* @throws {TypeError} index argument must be a nonnegative integer\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\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 Complex128Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns [ 1.0, -1.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'set', function set( value ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar flg;\n\tvar N;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( isComplexLike( value ) ) {\n\t\tif ( idx >= this._length ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );\n\t\t}\n\t\tidx *= 2;\n\t\tbuf[ idx ] = real( value );\n\t\tbuf[ idx+1 ] = imag( value );\n\t\treturn;\n\t}\n\tif ( isComplexArray( 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\tsbuf = value._buffer;\n\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 Float64Array( sbuf.length );\n\t\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t}\n\t\t\tsbuf = tmp;\n\t\t}\n\t\tidx *= 2;\n\t\tj = 0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\tidx += 2; // stride\n\t\t\tj += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tif ( isCollection( value ) ) {\n\t\t// Detect whether we've been provided an array of complex numbers...\n\t\tN = value.length;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tif ( !isComplexLike( value[ i ] ) ) {\n\t\t\t\tflg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// If an array does not contain only complex numbers, then we assume interleaved real and imaginary components...\n\t\tif ( flg ) {\n\t\t\tif ( !isEven( N ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', N ) );\n\t\t\t}\n\t\t\tif ( idx+(N/2) > this._length ) {\n\t\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t\t}\n\t\t\tsbuf = value;\n\n\t\t\t// Check for overlapping memory...\n\t\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\t\tif (\n\t\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t\t(\n\t\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// We need to copy source values...\n\t\t\t\ttmp = new Float64Array( N );\n\t\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t\t}\n\t\t\t\tsbuf = tmp;\n\t\t\t}\n\t\t\tidx *= 2;\n\t\t\tN /= 2;\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\t\tidx += 2; // stride\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t// If an array contains only complex numbers, then we need to extract real and imaginary components...\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\tidx *= 2;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tv = value[ i ];\n\t\t\tbuf[ idx ] = real( v );\n\t\t\tbuf[ idx+1 ] = imag( v );\n\t\t\tidx += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.', value ) );\n\n\t/* eslint-enable no-underscore-dangle */\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex128Array} complex number array\n*\n* @example\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var out = arr.slice();\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0, 4.0, -4.0, 5.0, -5.0 ]\n*\n* out = arr.slice( 1, -2 );\n* // returns [ 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'slice', function slice( start, end ) {\n\tvar outlen;\n\tvar outbuf;\n\tvar out;\n\tvar idx;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tstart = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First 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 === 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 ( start < end ) {\n\t\toutlen = end - start;\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\tidx = 2*(i+start);\n\t\toutbuf[ 2*i ] = buf[ idx ];\n\t\toutbuf[ (2*i)+1 ] = buf[ idx+1 ];\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number 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* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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, getComplex128( 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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} compareFcn - comparison function\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} sorted array\n*\n* @example\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function compare( a, b ) {\n* var re1;\n* var re2;\n* var im1;\n* var im2;\n* re1 = real( a );\n* re2 = real( b );\n* if ( re1 < re2 ) {\n* return -1;\n* }\n* if ( re1 > re2 ) {\n* return 1;\n* }\n* im1 = imag( a );\n* im2 = imag( b );\n* if ( im1 < im2 ) {\n* return -1;\n* }\n* if ( im1 > im2 ) {\n* return 1;\n* }\n* return 0;\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 3.0, -3.0 ], 0 );\n* arr.set( [ 1.0, -1.0 ], 1 );\n* arr.set( [ 2.0, -2.0 ], 2 );\n*\n* var out = arr.sort( compare );\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'sort', function sort( compareFcn ) {\n\tvar tmp;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\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 = this._buffer;\n\tlen = this._length;\n\ttmp = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\ttmp.push( getComplex128( buf, i ) );\n\t}\n\ttmp.sort( compareFcn );\n\tfor ( i = 0; i < len; i++ ) {\n\t\tj = 2 * i;\n\t\tbuf[ j ] = real( tmp[i] );\n\t\tbuf[ j+1 ] = imag( tmp[i] );\n\t}\n\treturn this;\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 Complex128Array.prototype\n* @type {Function}\n* @param {integer} [begin=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} subarray\n*\n* @example\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var subarr = arr.subarray();\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0, 4.0, -4.0, 5.0, -5.0 ]\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns [ 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 Complex128Array.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 complex number 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 Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toLocaleString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex128Array.prototype, 'toLocaleString', function toLocaleString( locales, options ) {\n\tvar opts;\n\tvar loc;\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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( getComplex128( 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 Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} reversed array\n*\n* @example\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.toReversed();\n* // returns [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tj = len - i - 1;\n\t\toutbuf[ (2*i) ] = buf[ (2*j) ];\n\t\toutbuf[ (2*i)+1 ] = buf[ (2*j)+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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} compareFcn - comparison function\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} sorted array\n*\n* @example\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function compare( a, b ) {\n* var re1;\n* var re2;\n* var im1;\n* var im2;\n* re1 = real( a );\n* re2 = real( b );\n* if ( re1 < re2 ) {\n* return -1;\n* }\n* if ( re1 > re2 ) {\n* return 1;\n* }\n* im1 = imag( a );\n* im2 = imag( b );\n* if ( im1 < im2 ) {\n* return -1;\n* }\n* if ( im1 > im2 ) {\n* return 1;\n* }\n* return 0;\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 3.0, -3.0 ], 0 );\n* arr.set( [ 1.0, -1.0 ], 1 );\n* arr.set( [ 2.0, -2.0 ], 2 );\n*\n* var out = arr.sort( compare );\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'toSorted', function toSorted( compareFcn ) {\n\tvar tmp;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\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 = this._buffer;\n\tlen = this._length;\n\ttmp = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\ttmp.push( getComplex128( buf, i ) );\n\t}\n\ttmp.sort( compareFcn );\n\treturn new Complex128Array( tmp );\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex128Array.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex128( buf, i ).toString() );\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 Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n*\n* var iter = arr.values();\n*\n* var v = iter.next().value;\n* // returns [ 1.0, -1.0 ]\n*\n* v = iter.next().value;\n* // returns [ 2.0, -2.0 ]\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'values', function values() {\n\tvar iter;\n\tvar self;\n\tvar len;\n\tvar FLG;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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': getComplex128( 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 Complex128Array.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {ComplexLike} value - new value\n* @throws {TypeError} `this` must be a complex number 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 complex number\n* @returns {Complex128Array} new typed array\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.with( 0, new Complex128( 4.0, 4.0 ) );\n* // returns [ 4.0, 4.0, 2.0, 2.0, 3.0, 3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'with', function copyWith( index, value ) {\n\tvar buf;\n\tvar out;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tout = new this.constructor( this._buffer );\n\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tbuf[ 2*index ] = real( value );\n\tbuf[ (2*index)+1 ] = imag( value );\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default Complex128Array;\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 isComplexLike from '@stdlib/assert/is-complex-like';\nimport real from '@stdlib/complex/float64/real';\nimport imag from '@stdlib/complex/float64/imag';\n\n\n// MAIN //\n\n/**\n* Returns a strided array of real and imaginary components.\n*\n* @private\n* @param {Float64Array} buf - output array\n* @param {Array} arr - array containing complex numbers\n* @returns {(Float64Array|null)} output array or null\n*/\nfunction fromArray( buf, arr ) {\n\tvar len;\n\tvar v;\n\tvar i;\n\tvar j;\n\n\tlen = arr.length;\n\tj = 0;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tv = arr[ i ];\n\t\tif ( !isComplexLike( v ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tbuf[ j ] = real( v );\n\t\tbuf[ j+1 ] = imag( v );\n\t\tj += 2; // stride\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* @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) 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 isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport format from '@stdlib/string/format';\nimport real from '@stdlib/complex/float64/real';\nimport imag from '@stdlib/complex/float64/imag';\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|TypeError)} array or an error\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar z;\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\tz = clbk.call( thisArg, v.value, i );\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( real( z ), imag( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default 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/* 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 './../../uint8';\nimport Boolean from '@stdlib/boolean/ctor';\nimport getter from './../../base/getter';\nimport floor from '@stdlib/math/base/special/floor';\nimport accessorGetter from './../../base/accessor-getter';\nimport format from '@stdlib/string/format';\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( '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\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","/**\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 Float64Array from './../../float64';\nimport Float32Array from './../../float32';\nimport Uint32Array from './../../uint32';\nimport Int32Array from './../../int32';\nimport Uint16Array from './../../uint16';\nimport Int16Array from './../../int16';\nimport Uint8Array from './../../uint8';\nimport Uint8ClampedArray from './../../uint8c';\nimport Int8Array from './../../int8';\nimport Complex64Array from './../../complex64';\nimport Complex128Array from './../../complex128';\nimport BooleanArray from './../../bool';\n\n\n// MAIN //\n\n// Note: order should match `dtypes` order\nvar CTORS = [\n\tFloat64Array,\n\tFloat32Array,\n\tInt32Array,\n\tUint32Array,\n\tInt16Array,\n\tUint16Array,\n\tInt8Array,\n\tUint8Array,\n\tUint8ClampedArray,\n\tComplex64Array,\n\tComplex128Array,\n\tBooleanArray\n];\n\n\n// EXPORTS //\n\nexport default CTORS;\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// MAIN //\n\n// Note: order should match `ctors` order\nvar DTYPES = [\n\t'float64',\n\t'float32',\n\t'int32',\n\t'uint32',\n\t'int16',\n\t'uint16',\n\t'int8',\n\t'uint8',\n\t'uint8c',\n\t'complex64',\n\t'complex128',\n\t'bool'\n];\n\n\n// EXPORTS //\n\nexport default DTYPES;\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 isBuffer from '@stdlib/assert/is-buffer';\nimport isArray from '@stdlib/assert/is-array';\nimport constructorName from '@stdlib/utils/constructor-name';\nimport ctor2dtype from './ctor2dtype.js';\nimport CTORS from './ctors.js';\nimport DTYPES from './dtypes.js';\n\n\n// VARIABLES //\n\nvar NTYPES = DTYPES.length;\n\n\n// MAIN //\n\n/**\n* Returns the data type of an array.\n*\n* @param {*} value - input value\n* @returns {(string|null)} data type\n*\n* @example\n* var dt = dtype( [ 1, 2, 3 ] );\n* // returns 'generic'\n*\n* var dt = dtype( 'beep' );\n* // returns null\n*/\nfunction dtype( value ) {\n\tvar i;\n\tif ( isArray( value ) ) {\n\t\treturn 'generic';\n\t}\n\tif ( isBuffer( value ) ) {\n\t\treturn null;\n\t}\n\tfor ( i = 0; i < NTYPES; i++ ) {\n\t\tif ( value instanceof CTORS[ i ] ) {\n\t\t\treturn DTYPES[ i ];\n\t\t}\n\t}\n\t// If the above failed, fall back to a more robust (and significantly slower) means for resolving underlying data types:\n\treturn ctor2dtype[ constructorName( value ) ] || null;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isCollection from '@stdlib/assert/is-collection';\nimport isAccessorArray from './../../../../base/assert/is-accessor-array';\nimport accessorGetter from './../../../../base/accessor-getter';\nimport dtype from './../../../../dtype';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Returns a function to tests if an array contains a provided search value.\n*\n* @param {Collection} x - input array\n* @throws {TypeError} must provide an array-like object\n* @returns {Function} function to test if an array contains a search value\n*\n* @example\n* var contains = factory( [ 1, 2, 3 ] );\n* // returns \n*\n* var bool = contains( 2 );\n* // returns true\n*/\nfunction factory( x ) {\n\tvar get;\n\tvar len;\n\tvar dt;\n\n\tif ( !isCollection( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', x ) );\n\t}\n\t// Resolve the input array data type:\n\tdt = dtype( x );\n\n\t// Resolve an accessor for retrieving input array elements:\n\tif ( isAccessorArray( x ) ) {\n\t\tget = accessorGetter( dt );\n\t}\n\t// Get the number of elements over which to iterate:\n\tlen = x.length;\n\n\treturn ( get === void 0 ) ? contains : accessors;\n\t/**\n\t* Tests if an array contains a provided search value.\n\t*\n\t* @private\n\t* @param {*} value - search value\n\t* @returns {boolean} boolean indicating if an array contains a search value\n\t*\n\t* @example\n\t* var out = contains( [ 1, 2, 3 ], 2 );\n\t* // returns true\n\t*/\n\tfunction contains( value ) {\n\t\tvar i;\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( x[ i ] === value ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t* Tests if an array contains a provided search value.\n\t*\n\t* @private\n\t* @param {*} value - search value\n\t* @returns {boolean} boolean indicating if an array contains a search value\n\t*/\n\tfunction accessors( value ) {\n\t\tvar i;\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( get( x, i ) === value ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default factory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if an array contains a provided search value.\n*\n* @module @stdlib/array/base/assert/contains\n*\n* @example\n* import contains from '@stdlib/array/base/assert/contains';\n*\n* var out = contains( [ 1, 2, 3 ], 2 );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"factory\": \"main.factory\" }\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isAccessorArray from './../../../../base/assert/is-accessor-array';\nimport accessorGetter from './../../../../base/accessor-getter';\nimport getter from './../../../../base/getter';\nimport dtype from './../../../../dtype';\n\n\n// MAIN //\n\n/**\n* Tests if an array contains a provided search value.\n*\n* @param {Collection} x - input array\n* @param {*} value - search value\n* @returns {boolean} boolean indicating if an array contains a search value\n*\n* @example\n* var out = contains( [ 1, 2, 3 ], 2 );\n* // returns true\n*/\nfunction contains( x, value ) {\n\tvar len;\n\tvar get;\n\tvar dt;\n\tvar i;\n\n\t// Resolve the input array data type:\n\tdt = dtype( x );\n\n\t// Resolve an accessor for retrieving input array elements:\n\tif ( isAccessorArray( x ) ) {\n\t\tget = accessorGetter( dt );\n\t} else {\n\t\tget = getter( dt );\n\t}\n\t// Get the number of elements over which to iterate:\n\tlen = x.length;\n\n\t// Loop over the elements...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tif ( get( x, i ) === value ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default contains;\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 an object.\n*\n* @name Object\n* @constructor\n* @type {Function}\n* @param {*} value - input value\n* @returns {Object} object\n*\n* @example\n* var o = new Object( null );\n* // returns {}\n*\n* @example\n* var o = new Object( 5.0 );\n* // returns \n*\n* @example\n* var o = new Object( 'beep' );\n* // returns \n*\n* @example\n* var o1 = {};\n*\n* var o2 = new Object( o1 );\n* // returns {}\n*\n* var bool = ( o1 === o2 );\n* // returns true\n*/\nvar Obj = Object; // eslint-disable-line stdlib/require-globals\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 isFunction from '@stdlib/assert/is-function';\nimport builtin from './native.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar getProto;\nif ( isFunction( Object.getPrototypeOf ) ) {\n\tgetProto = builtin;\n} else {\n\tgetProto = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default getProto;\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 getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nexport default getProto;\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 './../../native-class';\nimport Object from '@stdlib/object/ctor';\nimport getProto from './proto.js';\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {(Object|null)} prototype\n*/\nfunction getPrototypeOf( obj ) {\n\tvar proto = getProto( obj );\n\tif ( proto || proto === null ) {\n\t\treturn proto;\n\t}\n\tif ( nativeClass( obj.constructor ) === '[object Function]' ) {\n\t\t// May break if the constructor has been tampered with...\n\t\treturn obj.constructor.prototype;\n\t}\n\tif ( obj instanceof Object ) {\n\t\treturn Object.prototype;\n\t}\n\t// Return `null` for objects created via `Object.create( null )`. Also return `null` for cross-realm objects on browsers that lack `__proto__` support, such as IE < 11.\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default getPrototypeOf;\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* Returns the value of the `__proto__` property.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {*} value of `__proto__` property\n*/\nfunction getProto( obj ) {\n\t// eslint-disable-next-line no-proto\n\treturn obj.__proto__;\n}\n\n\n// EXPORTS //\n\nexport default getProto;\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 Object from '@stdlib/object/ctor';\nimport getProto from './detect.js';\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @param {*} value - input value\n* @returns {(Object|null)} prototype\n*\n* @example\n* var proto = getPrototypeOf( {} );\n* // returns {}\n*/\nfunction getPrototypeOf( value ) {\n\tif (\n\t\tvalue === null ||\n\t\tvalue === void 0\n\t) {\n\t\treturn null;\n\t}\n\t// In order to ensure consistent ES5/ES6 behavior, cast input value to an object (strings, numbers, booleans); ES5 `Object.getPrototypeOf` throws when provided primitives and ES6 `Object.getPrototypeOf` casts:\n\tvalue = Object( value );\n\n\treturn getProto( value );\n}\n\n\n// EXPORTS //\n\nexport default getPrototypeOf;\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 from './../../is-object';\nimport isFunction from './../../is-function';\nimport getPrototypeOf from '@stdlib/utils/get-prototype-of';\nimport hasOwnProp from './../../has-own-property';\nimport nativeClass from '@stdlib/utils/native-class';\n\n\n// VARIABLES //\n\nvar objectPrototype = Object.prototype;\n\n\n// FUNCTIONS //\n\n/**\n* Tests that an object only has own properties.\n*\n* @private\n* @param {Object} obj - value to test\n* @returns {boolean} boolean indicating if an object only has own properties\n*/\nfunction ownProps( obj ) {\n\tvar key;\n\n\t// NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing).\n\tfor ( key in obj ) {\n\t\tif ( !hasOwnProp( obj, key ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// MAIN //\n\n/**\n* Tests if a value is a plain object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a plain object\n*\n* @example\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* @example\n* var bool = isPlainObject( null );\n* // returns false\n*/\nfunction isPlainObject( value ) {\n\tvar proto;\n\n\t// Screen for obvious non-objects...\n\tif ( !isObject( value ) ) {\n\t\treturn false;\n\t}\n\t// Objects with no prototype (e.g., `Object.create( null )`) are plain...\n\tproto = getPrototypeOf( value );\n\tif ( !proto ) {\n\t\treturn true;\n\t}\n\t// Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object...\n\treturn (\n\t\t// Cannot have own `constructor` property:\n\t\t!hasOwnProp( value, 'constructor' ) &&\n\n\t\t// Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing):\n\t\thasOwnProp( proto, 'constructor' ) &&\n\t\tisFunction( proto.constructor ) &&\n\t\tnativeClass( proto.constructor ) === '[object Function]' &&\n\n\t\t// Test for object-specific method:\n\t\thasOwnProp( proto, 'isPrototypeOf' ) &&\n\t\tisFunction( proto.isPrototypeOf ) &&\n\n\t\t(\n\t\t\t// Test if the prototype matches the global `Object` prototype (same realm):\n\t\t\tproto === objectPrototype ||\n\n\t\t\t// Test that all properties are own properties (cross-realm; *most* likely a plain object):\n\t\t\townProps( value )\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPlainObject;\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 isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport isEmptyArray from '@stdlib/assert/is-empty-array';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {StringArray} [options.stopwords] - array of custom stop words\n* @returns {(null|Error)} error object or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'stopwords': [ 'of' ]\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isPlainObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'stopwords' ) ) {\n\t\topts.stopwords = options.stopwords;\n\t\tif (\n\t\t\t!isStringArray( opts.stopwords ) &&\n\t\t\t!isEmptyArray( opts.stopwords )\n\t\t) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be an array of strings. Option: `%s`.', 'stopwords', opts.stopwords ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\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 './../../is-array';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an empty array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an empty array\n*\n* @example\n* var bool = isEmptyArray( [] );\n* // returns true\n*\n* @example\n* var bool = isEmptyArray( [ 1, 2, 3 ] );\n* // returns false\n*\n* @example\n* var bool = isEmptyArray( {} );\n* // returns false\n*/\nfunction isEmptyArray( value ) {\n\treturn (\n\t\tisArray( value ) &&\n\t\tvalue.length === 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isEmptyArray;\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 removePunctuation from './../../remove-punctuation';\nimport tokenize from '@stdlib/nlp/tokenize';\nimport replace from './../../base/replace';\nimport uppercase from './../../base/uppercase';\nimport lowercase from './../../base/lowercase';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport format from './../../format';\nimport validate from './validate.js';\nimport STOPWORDS from './stopwords.json';\n\n\n// VARIABLES //\n\nvar RE_HYPHEN = /-/g;\n\n\n// MAIN //\n\n/**\n* Generates an acronym for a given string.\n*\n* ## Notes\n*\n* - The acronym is generated by capitalizing the first letter of each word in the string.\n* - The function removes stop words from the string before generating the acronym.\n* - The function splits hyphenated words and uses the first character of each hyphenated part.\n*\n* @param {string} str - input string\n* @param {Options} [options] - function options\n* @param {StringArray} [options.stopwords] - custom stop words\n* @throws {TypeError} must provide a string primitive\n* @throws {TypeError} must provide valid options\n* @returns {string} generated acronym\n*\n* @example\n* var out = acronym( 'the quick brown fox' );\n* // returns 'QBF'\n*\n* @example\n* var out = acronym( 'Hard-boiled eggs' );\n* // returns 'HBE'\n*\n* @example\n* var out = acronym( 'National Association of Securities Dealers Automated Quotation' );\n* // returns 'NASDAQ'\n*/\nfunction acronym( str, options ) {\n\tvar isStopWord;\n\tvar words;\n\tvar opts;\n\tvar err;\n\tvar out;\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\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tisStopWord = contains( opts.stopwords || STOPWORDS );\n\tstr = removePunctuation( str );\n\tstr = replace( str, RE_HYPHEN, ' ' );\n\twords = tokenize( str );\n\tout = '';\n\tfor ( i = 0; i < words.length; i++ ) {\n\t\tif ( isStopWord( lowercase( words[ i ] ) ) === false ) {\n\t\t\tout += uppercase( words[ i ].charAt( 0 ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default acronym;\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// EXPORTS //\n\nexport default atob;\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 globalAtob from './global.js';\n\n\n// MAIN //\n\n/**\n* Decodes a string of data which has been encoded using Base64 encoding.\n*\n* @param {string} str - binary string containing base64-encoded data\n* @returns {(string|null)} an ASCII string containing decoded data\n*\n* @example\n* var out = atob( 'SGVsbG8sIHdvcmxk' );\n* // returns 'Hello, world'\n*/\nfunction atob( str ) { // eslint-disable-line stdlib/no-redeclare\n\ttry {\n\t\treturn globalAtob( str );\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn null;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default atob;\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* Capitalizes the first character in a string.\n*\n* @param {string} str - input string\n* @returns {string} capitalized string\n*\n* @example\n* var out = capitalize( 'last man standing' );\n* // returns 'Last man standing'\n*\n* @example\n* var out = capitalize( 'presidential election' );\n* // returns 'Presidential election'\n*\n* @example\n* var out = capitalize( 'javaScript' );\n* // returns 'JavaScript'\n*\n* @example\n* var out = capitalize( 'Hidden Treasures' );\n* // returns 'Hidden Treasures'\n*/\nfunction capitalize( str ) {\n\tif ( str === '' ) {\n\t\treturn '';\n\t}\n\treturn str.charAt( 0 ).toUpperCase() + str.slice( 1 );\n}\n\n\n// EXPORTS //\n\nexport default capitalize;\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 bool = ( typeof String.prototype.trim !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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 trim = String.prototype.trim;\n\n\n// EXPORTS //\n\nexport default trim;\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 replace from './../../../base/replace';\n\n\n// VARIABLES //\n\n// The following regular expression should suffice to polyfill (most?) all environments.\nvar RE = /^[\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*([\\S\\s]*?)[\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*$/;\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning and end of a string.\n*\n* @private\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = trim( ' Whitespace ' );\n* // returns 'Whitespace'\n*\n* @example\n* var out = trim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs'\n*\n* @example\n* var out = trim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines'\n*/\nfunction trim( str ) {\n\treturn replace( str, RE, '$1' );\n}\n\n\n// EXPORTS //\n\nexport default trim;\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* Trim whitespace characters from the beginning and end of a string.\n*\n* @module @stdlib/string/base/trim\n*\n* @example\n* import trim from '@stdlib/string/base/trim';\n*\n* var out = trim( ' Whitespace ' );\n* // returns 'Whitespace'\n*\n* out = trim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs'\n*\n* out = trim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines'\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport check from './check.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar trim;\nif ( HAS_BUILTIN && check() ) {\n\ttrim = main;\n} else {\n\ttrim = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default trim;\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 trim from './builtin.js';\n\n\n// VARIABLES //\n\nvar str1 = ' \\n\\t\\r\\n\\f\\v\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff';\nvar str2 = '\\u180e';\n\n\n// MAIN //\n\n/**\n* Tests the built-in `String.prototype.trim()` implementation when provided whitespace.\n*\n* ## Notes\n*\n* - For context, see . In short, we can only rely on the built-in `trim` method when it does not consider the Mongolian space separator as whitespace.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected value\n*\n* @example\n* var b = test();\n* // returns \n*/\nfunction test() {\n\treturn ( trim.call( str1 ) === '' ) && ( trim.call( str2 ) === str2 );\n}\n\n\n// EXPORTS //\n\nexport default test;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning and end of a string.\n*\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = trim( ' Whitespace ' );\n* // returns 'Whitespace'\n*\n* @example\n* var out = trim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs'\n*\n* @example\n* var out = trim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines'\n*/\nfunction trim( str ) {\n\treturn builtin.call( str );\n}\n\n\n// EXPORTS //\n\nexport default trim;\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 capitalize from './../../../base/capitalize';\nimport lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_TO_CAMEL = /(?:\\s|^)([^\\s]+)(?=\\s|$)/g;\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Converts first capture group to uppercase.\n*\n* @private\n* @param {string} match - entire match\n* @param {string} p1 - first capture group\n* @param {number} offset - offset of the matched substring in entire string\n* @returns {string} uppercased capture group\n*/\nfunction replacer( match, p1, offset ) {\n\tp1 = lowercase( p1 );\n\treturn ( offset === 0 ) ? p1 : capitalize( p1 );\n}\n\n\n// MAIN //\n\n/**\n* Converts a string to camel case.\n*\n* @param {string} str - string to convert\n* @returns {string} camel-cased string\n*\n* @example\n* var out = camelcase( 'foo bar' );\n* // returns 'fooBar'\n*\n* @example\n* var out = camelcase( 'IS_MOBILE' );\n* // returns 'isMobile'\n*\n* @example\n* var out = camelcase( 'Hello World!' );\n* // returns 'helloWorld'\n*\n* @example\n* var out = camelcase( '--foo-bar--' );\n* // returns 'fooBar'\n*/\nfunction camelcase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_WHITESPACE, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\treturn replace( str, RE_TO_CAMEL, replacer );\n}\n\n\n// EXPORTS //\n\nexport default camelcase;\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\n// Factors for converting individual surrogates...\nvar Ox10000 = 0x10000|0; // 65536\nvar Ox400 = 0x400|0; // 1024\n\n// Range for a high surrogate\nvar OxD800 = 0xD800|0; // 55296\nvar OxDBFF = 0xDBFF|0; // 56319\n\n// Range for a low surrogate\nvar OxDC00 = 0xDC00|0; // 56320\nvar OxDFFF = 0xDFFF|0; // 57343\n\n\n// MAIN //\n\n/**\n* Returns a Unicode code point from a string at a specified position.\n*\n* ## Notes\n*\n* - UTF-16 encoding uses one 16-bit unit for non-surrogates (U+0000 to U+D7FF and U+E000 to U+FFFF).\n* - UTF-16 encoding uses two 16-bit units (surrogate pairs) for U+10000 to U+10FFFF and encodes U+10000-U+10FFFF by subtracting 0x10000 from the code point, expressing the result as a 20-bit binary, and splitting the 20 bits of 0x0-0xFFFFF as upper and lower 10-bits. The respective 10-bits are stored in two 16-bit words: a high and a low surrogate.\n*\n* @param {string} str - input string\n* @param {integer} idx - position\n* @param {boolean} backward - backward iteration for low surrogates\n* @returns {NonNegativeInteger} code point\n*\n* @example\n* var out = codePointAt( 'last man standing', 4, false );\n* // returns 32\n*\n* @example\n* var out = codePointAt( 'presidential election', 8, true );\n* // returns 116\n*\n* @example\n* var out = codePointAt( 'अनुच्छेद', 2, false );\n* // returns 2369\n*\n* @example\n* var out = codePointAt( '🌷', 1, true );\n* // returns 127799\n*/\nfunction codePointAt( str, idx, backward ) {\n\tvar code;\n\tvar low;\n\tvar hi;\n\n\tif ( idx < 0 ) {\n\t\tidx += str.length;\n\t}\n\tcode = str.charCodeAt( idx );\n\n\t// High surrogate\n\tif ( code >= OxD800 && code <= OxDBFF && idx < str.length - 1 ) {\n\t\thi = code;\n\t\tlow = str.charCodeAt( idx+1 );\n\t\tif ( OxDC00 <= low && low <= OxDFFF ) {\n\t\t\treturn ( ( hi - OxD800 ) * Ox400 ) + ( low - OxDC00 ) + Ox10000;\n\t\t}\n\t\treturn hi;\n\t}\n\t// Low surrogate - support only if backward iteration is desired\n\tif ( backward ) {\n\t\tif ( code >= OxDC00 && code <= OxDFFF && idx >= 1 ) {\n\t\t\thi = str.charCodeAt( idx-1 );\n\t\t\tlow = code;\n\t\t\tif ( OxD800 <= hi && hi <= OxDBFF ) {\n\t\t\t\treturn ( ( hi - OxD800 ) * Ox400 ) + ( low - OxDC00 ) + Ox10000;\n\t\t\t}\n\t\t\treturn low;\n\t\t}\n\t}\n\treturn code;\n}\n\n\n// EXPORTS //\n\nexport default codePointAt;\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 uppercase from './../../../base/uppercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[\\-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// MAIN //\n\n/**\n* Converts a string to constant case.\n*\n* @param {string} str - string to convert\n* @returns {string} constant-cased string\n*\n* @example\n* var str = constantcase( 'beep' );\n* // returns 'BEEP'\n*\n* @example\n* var str = constantcase( 'beep boop' );\n* // returns 'BEEP_BOOP'\n*\n* @example\n* var str = constantcase( 'isMobile' );\n* // returns 'IS_MOBILE'\n*\n* @example\n* var str = constantcase( 'Hello World!' );\n* // returns 'HELLO_WORLD'\n*/\nfunction constantcase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\tstr = replace( str, RE_WHITESPACE, '_' );\n\treturn uppercase( str );\n}\n\n\n// EXPORTS //\n\nexport default constantcase;\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 if a double-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 7.0 );\n* // returns false\n*/\nfunction isnan( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 isNegativeZero from './../../../../base/assert/is-negative-zero';\nimport isnan from './../../../../base/assert/is-nan';\nimport NINF from '@stdlib/constants/float64/ninf';\n\n\n// MAIN //\n\n/**\n* Returns the minimum value.\n*\n* @param {number} x - first number\n* @param {number} y - second number\n* @returns {number} minimum value\n*\n* @example\n* var v = min( 3.14, 4.2 );\n* // returns 3.14\n*\n* @example\n* var v = min( 3.14, NaN );\n* // returns NaN\n*\n* @example\n* var v = min( +0.0, -0.0 );\n* // returns -0.0\n*/\nfunction min( x, y ) {\n\tif ( isnan( x ) || isnan( y ) ) {\n\t\treturn NaN;\n\t}\n\tif ( x === NINF || y === NINF ) {\n\t\treturn NINF;\n\t}\n\tif ( x === y && x === 0.0 ) {\n\t\tif ( isNegativeZero( x ) ) {\n\t\t\treturn x;\n\t\t}\n\t\treturn y;\n\t}\n\tif ( x < y ) {\n\t\treturn x;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default min;\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 NINF from '@stdlib/constants/float64/ninf';\n\n\n// MAIN //\n\n/**\n* Tests if a double-precision floating-point numeric value is negative zero.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is negative zero\n*\n* @example\n* var bool = isNegativeZero( -0.0 );\n* // returns true\n*\n* @example\n* var bool = isNegativeZero( 0.0 );\n* // returns false\n*/\nfunction isNegativeZero( x ) {\n\treturn (x === 0.0 && 1.0/x === NINF);\n}\n\n\n// EXPORTS //\n\nexport default isNegativeZero;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/*\n* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace ns\n*/\nvar ns = {};\n\n/**\n* @name hammingDistance\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/distances/hamming}\n*/\nimport hammingDistance from './../../../base/distances/hamming';\nsetReadOnly( ns, 'hammingDistance', hammingDistance );\n\n/**\n* @name levenshteinDistance\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/distances/levenshtein}\n*/\nimport levenshteinDistance from './../../../base/distances/levenshtein';\nsetReadOnly( ns, 'levenshteinDistance', levenshteinDistance );\n\n\n// EXPORTS //\n\nexport default ns;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../../../format';\n\n\n// MAIN //\n\n/**\n* Calculates the Hamming distance between two equal-length strings.\n*\n* ## Notes\n*\n* - The function returns a sentinel value of `-1` if the input string lengths differ.\n*\n* @param {string} s1 - first input string\n* @param {string} s2 - second input string\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @returns {integer} Hamming distance\n*\n* @example\n* var distance = hammingDistance( 'algorithm', 'altruistic' );\n* // returns -1\n*/\nfunction hammingDistance( s1, s2 ) {\n\tvar out;\n\tvar i;\n\n\tif ( !isString( s1 ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', s1 ) );\n\t}\n\tif ( !isString( s2 ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', s2 ) );\n\t}\n\tif ( s1.length !== s2.length ) {\n\t\treturn -1;\n\t}\n\tout = 0;\n\tfor ( i = 0; i < s1.length; i++ ) {\n\t\tif (s1[ i ] !== s2[ i ] ) {\n\t\t\tout += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default hammingDistance;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../../../format';\nimport min from '@stdlib/math/base/special/min';\n\n\n// MAIN //\n\n/**\n* Calculates the Levenshtein (edit) distance between two strings.\n*\n* @param {string} s1 - first string value\n* @param {string} s2 - second string value\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @returns {NonNegativeInteger} Levenshtein distance\n*\n* @example\n* var distance = levenshteinDistance( 'algorithm', 'altruistic' );\n* // returns 6\n*/\nfunction levenshteinDistance( s1, s2 ) {\n\tvar temp;\n\tvar row;\n\tvar pre;\n\tvar m;\n\tvar n;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\tif ( !isString( s1 ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', s1 ) );\n\t}\n\tif ( !isString( s2 ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', s2 ) );\n\t}\n\tn = s1.length;\n\tm = s2.length;\n\n\t// If either string is empty, the edit distance is equal to the number of characters in the non-empty string...\n\tif ( n === 0 ) {\n\t\treturn m;\n\t}\n\tif ( m === 0 ) {\n\t\treturn n;\n\t}\n\n\trow = [];\n\tfor ( i = 0; i <= m; i++ ) {\n\t\trow.push( i );\n\t}\n\n\tfor ( i = 0; i < n; i++ ) {\n\t\tpre = row[ 0 ];\n\t\trow[ 0 ] = i + 1;\n\t\tfor ( j = 0; j < m; j++ ) {\n\t\t\tk = j + 1;\n\t\t\ttemp = row[ k ];\n\t\t\tif ( s1[ i ] === s2[ j ] ) {\n\t\t\t\trow[ k ] = pre;\n\t\t\t} else {\n\t\t\t\trow[ k ] = min( pre, min( row[ j ], row[ k ] ) ) + 1;\n\t\t\t}\n\t\t\tpre = temp;\n\t\t}\n\t}\n\treturn row[ m ];\n}\n\n\n// EXPORTS //\n\nexport default levenshteinDistance;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[\\-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// MAIN //\n\n/**\n* Converts a string to dot case.\n*\n* @param {string} str - string to convert\n* @returns {string} dot-cased string\n*\n* @example\n* var str = dotcase( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var str = dotcase( 'beep boop' );\n* // returns 'beep.boop'\n*\n* @example\n* var str = dotcase( 'isMobile' );\n* // returns 'is.mobile'\n*\n* @example\n* var str = dotcase( 'Hello World!' );\n* // returns 'hello.world'\n*/\nfunction dotcase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\tstr = replace( str, RE_WHITESPACE, '.' );\n\treturn lowercase( str );\n}\n\n\n// EXPORTS //\n\nexport default dotcase;\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 bool = ( typeof String.prototype.endsWith !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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* Test if a string ends with the characters of another string.\n*\n* @module @stdlib/string/base/ends-with\n*\n* @example\n* import endsWith from '@stdlib/string/base/ends-with';\n*\n* var str = 'Fair is foul, and foul is fair, hover through fog and filthy air';\n*\n* var bool = endsWith( str, 'air', str.length );\n* // returns true\n*\n* bool = endsWith( str, 'fair', str.length );\n* // returns false\n*\n* bool = endsWith( str, 'fair', 30 );\n* // returns true\n*\n* bool = endsWith( str, 'fair', -34 );\n* // returns true\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar endsWith;\nif ( HAS_BUILTIN ) {\n\tendsWith = main;\n} else {\n\tendsWith = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default endsWith;\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 endsWith = String.prototype.endsWith;\n\n\n// EXPORTS //\n\nexport default endsWith;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Tests if a string ends with the characters of another string.\n*\n* ## Notes\n*\n* - The last parameter restricts the search to a substring within the input string beginning from the leftmost character. If provided a negative value, `len` indicates to ignore the last `len` characters, and is thus equivalent to `str.length + len`.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} len - substring length\n* @returns {boolean} boolean indicating if the input string ends with the search string\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 );\n* // returns true\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 );\n* // returns true\n*/\nfunction endsWith( str, search, len ) {\n\tvar idx;\n\tvar N;\n\n\tN = search.length;\n\tif ( len === 0 ) {\n\t\treturn ( N === 0 );\n\t}\n\tif ( len < 0 ) {\n\t\tidx = str.length + len;\n\t} else {\n\t\tidx = len;\n\t}\n\tif ( N === 0 ) {\n\t\t// Based on the premise that every string can be \"surrounded\" by empty strings (e.g., \"\" + \"a\" + \"\" + \"b\" + \"\" === \"ab\"):\n\t\treturn true;\n\t}\n\tif ( idx - N < 0 || idx > str.length ) {\n\t\treturn false;\n\t}\n\treturn builtin.call( str, search, idx );\n}\n\n\n// EXPORTS //\n\nexport default endsWith;\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* Tests if a string ends with the characters of another string.\n*\n* ## Notes\n*\n* - The last parameter restricts the search to a substring within the input string beginning from the leftmost character. If provided a negative value, `len` indicates to ignore the last `len` characters, and is thus equivalent to `str.length + len`.\n*\n* @private\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} len - substring length\n* @returns {boolean} boolean indicating if the input string ends with the search string\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 );\n* // returns true\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 );\n* // returns true\n*/\nfunction endsWith( str, search, len ) {\n\tvar idx;\n\tvar N;\n\tvar i;\n\n\tN = search.length;\n\tif ( len === 0 ) {\n\t\treturn ( N === 0 );\n\t}\n\tif ( len < 0 ) {\n\t\tidx = str.length + len;\n\t} else {\n\t\tidx = len;\n\t}\n\tif ( N === 0 ) {\n\t\t// Based on the premise that every string can be \"surrounded\" by empty strings (e.g., \"\" + \"a\" + \"\" + \"b\" + \"\" === \"ab\"):\n\t\treturn true;\n\t}\n\tidx -= N;\n\tif ( idx < 0 ) {\n\t\treturn false;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\tif ( str.charCodeAt( idx + i ) !== search.charCodeAt( i ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// EXPORTS //\n\nexport default endsWith;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns the first `n` UTF-16 code units of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of UTF-16 code units to return\n* @returns {string} output string\n*\n* @example\n* var out = first( 'last man standing', 1 );\n* // returns 'l'\n*\n* @example\n* var out = first( 'presidential election', 1 );\n* // returns 'p'\n*\n* @example\n* var out = first( 'JavaScript', 1 );\n* // returns 'J'\n*\n* @example\n* var out = first( 'Hidden Treasures', 1 );\n* // returns 'H'\n*/\nfunction first( str, n ) {\n\treturn str.substring( 0, n );\n}\n\n\n// EXPORTS //\n\nexport default first;\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 match a UTF-16 surrogate pair.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_UTF16_SURROGATE_PAIR = reUtf16SurrogatePair();\n*\n* var bool = RE_UTF16_SURROGATE_PAIR.test( '\\uD800\\uDC00' );\n* // returns true\n*\n* bool = RE_UTF16_SURROGATE_PAIR.test( 'abc\\uD800\\uDC00def' );\n* // returns true\n*\n* bool = RE_UTF16_SURROGATE_PAIR.test( 'abc' );\n* // returns false\n*/\nfunction reUtf16SurrogatePair() {\n\treturn /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/;\n}\n\n\n// EXPORTS //\n\nexport default reUtf16SurrogatePair;\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 reUtf16SurrogatePair from './main.js';\n\n\n// MAIN //\n\n/**\n* Matches a UTF-16 surrogate pair.\n*\n* Regular expression: `/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/`\n*\n* - `[\\uD800-\\uDBFF]`\n* - match a high surrogate\n*\n* - `[\\uDC00-\\uDFFF]`\n* - match a low surrogate\n*\n* @constant\n* @type {RegExp}\n* @default /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/\n*/\nvar RE_UTF16_SURROGATE_PAIR = reUtf16SurrogatePair();\n\n\n// EXPORTS //\n\nexport default RE_UTF16_SURROGATE_PAIR;\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* Return a regular expression to match a UTF-16 surrogate pair.\n*\n* @module @stdlib/regexp/utf16-surrogate-pair\n*\n* @example\n* import reUtf16SurrogatePair from '@stdlib/regexp/utf16-surrogate-pair';\n*\n* var RE_UTF16_SURROGATE_PAIR = reUtf16SurrogatePair();\n*\n* var bool = RE_UTF16_SURROGATE_PAIR.test( '\\uD800\\uDC00' );\n* // returns true\n*\n* bool = RE_UTF16_SURROGATE_PAIR.test( 'abc\\uD800\\uDC00def' );\n* // returns true\n*\n* bool = RE_UTF16_SURROGATE_PAIR.test( 'abc' );\n* // returns false\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) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { REGEXP as RE_UTF16_SURROGATE_PAIR } from '@stdlib/regexp/utf16-surrogate-pair';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Returns the first `n` Unicode code points of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of Unicode code points to return\n* @returns {string} output string\n*\n* @example\n* var out = first( 'last man standing', 1 );\n* // returns 'l'\n*\n* @example\n* var out = first( 'presidential election', 1 );\n* // returns 'p'\n*\n* @example\n* var out = first( 'JavaScript', 1 );\n* // returns 'J'\n*\n* @example\n* var out = first( 'Hidden Treasures', 1 );\n* // returns 'H'\n*/\nfunction first( str, n ) {\n\tvar len;\n\tvar out;\n\tvar ch1;\n\tvar ch2;\n\tvar cnt;\n\tvar i;\n\tif ( str === '' || n === 0 ) {\n\t\treturn '';\n\t}\n\tif ( n === 1 ) {\n\t\tstr = str.substring( 0, 2 );\n\t\tif ( RE_UTF16_SURROGATE_PAIR.test( str ) ) {\n\t\t\treturn str;\n\t\t}\n\t\treturn str[ 0 ];\n\t}\n\tlen = str.length;\n\tout = '';\n\tcnt = 0;\n\n\t// Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tch1 = str[ i ];\n\t\tout += ch1;\n\t\tcnt += 1;\n\n\t\t// Check for a high UTF-16 surrogate...\n\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check for an unpaired surrogate at the end of the input string...\n\t\t\tif ( i === len-1 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i+1 ];\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tout += ch2;\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Check whether we've found the desired number of code points...\n\t\tif ( cnt === n ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default first;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport format from './../../format';\nimport base from './../../base/code-point-at';\n\n\n// MAIN //\n\n/**\n* Returns a Unicode code point from a string at a specified position.\n*\n* @param {string} str - input string\n* @param {integer} idx - position\n* @param {boolean} [backward=false] - backward iteration for low surrogates\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be a boolean\n* @throws {RangeError} position must be a valid index in string\n* @returns {NonNegativeInteger} code point\n*\n* @example\n* var out = codePointAt( 'last man standing', 4 );\n* // returns 32\n*\n* @example\n* var out = codePointAt( 'presidential election', 8, true );\n* // returns 116\n*\n* @example\n* var out = codePointAt( 'अनुच्छेद', 2 );\n* // returns 2369\n*\n* @example\n* var out = codePointAt( '🌷', 1, true );\n* // returns 127799\n*/\nfunction codePointAt( str, idx, backward ) {\n\tvar FLG;\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\tif ( !isInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', idx ) );\n\t}\n\tif ( idx < 0 ) {\n\t\tidx += str.length;\n\t}\n\tif ( idx < 0 || idx >= str.length ) {\n\t\tthrow new RangeError( format( 'invalid argument. Second argument must be a valid position (i.e., be within string bounds). Value: `%d`.', idx ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isBoolean( backward ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a boolean. Value: `%s`.', backward ) );\n\t\t}\n\t\tFLG = backward;\n\t} else {\n\t\tFLG = false;\n\t}\n\treturn base( str, idx, FLG );\n}\n\n\n// EXPORTS //\n\nexport default codePointAt;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from './../../is-string';\nimport { isPrimitive as isNonNegativeInteger } from './../../is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\n// Range for a high surrogate\nvar OxD800 = 0xD800|0; // 55296\nvar OxDBFF = 0xDBFF|0; // 56319\n\n// Range for a low surrogate\nvar OxDC00 = 0xDC00|0; // 56320\nvar OxDFFF = 0xDFFF|0; // 57343\n\n\n// MAIN //\n\n/**\n* Tests if a position in a string marks the start of a UTF-16 surrogate pair.\n*\n* @private\n* @param {string} str - input string\n* @param {NonNegativeInteger} pos - position in string\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} position must be a valid index in string\n* @returns {boolean} boolean indicating whether the string has a surrogate pair at a position\n*\n* @example\n* var out = hasUTF16SurrogatePairAt( '🌷', 0 );\n* // returns true\n*\n* @example\n* var out = hasUTF16SurrogatePairAt( '🌷', 1 );\n* // returns false\n*/\nfunction hasUTF16SurrogatePairAt( str, pos ) {\n\tvar ch1;\n\tvar ch2;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( pos ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a valid position (i.e., a nonnegative integer). Value: `%s`.', pos ) );\n\t}\n\tif ( pos >= str.length ) {\n\t\tthrow new RangeError( format( 'invalid argument. Must provide a valid position (i.e., within string bounds). Value: `%u`.', pos ) );\n\t}\n\tch1 = str.charCodeAt( pos );\n\tch2 = str.charCodeAt( pos + 1 );\n\treturn ch1 >= OxD800 && ch1 <= OxDBFF && ch2 >= OxDC00 && ch2 <= OxDFFF;\n}\n\n\n// EXPORTS //\n\nexport default hasUTF16SurrogatePairAt;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 consts = {\n\t'CR': 0,\n\t'LF': 1,\n\t'Control': 2,\n\t'Extend': 3,\n\t'RegionalIndicator': 4,\n\t'SpacingMark': 5,\n\t'L': 6,\n\t'V': 7,\n\t'T': 8,\n\t'LV': 9,\n\t'LVT': 10,\n\t'Other': 11,\n\t'Prepend': 12,\n\t'ZWJ': 13,\n\t'NotBreak': 0,\n\t'BreakStart': 1,\n\t'Break': 2,\n\t'BreakLastRegional': 3,\n\t'BreakPenultimateRegional': 4,\n\t'ExtendedPictographic': 101\n};\n\n\n// EXPORTS //\n\nexport default consts;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 constants from './constants.js';\n\n\n// FUNCTIONS //\n\n/**\n* Returns number of elements in array equal to a provided value.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} start - starting search index (inclusive)\n* @param {NonNegativeInteger} end - ending search index (inclusive)\n* @param {*} value - input value\n* @returns {NonNegativeInteger} number of elements in array equal to a provided value\n*/\nfunction count( arr, start, end, value ) {\n\tvar cnt;\n\tvar i;\n\n\tif ( end >= arr.length ) {\n\t\tend = arr.length - 1;\n\t}\n\tcnt = 0;\n\tfor ( i = start; i <= end; i++ ) {\n\t\tif ( arr[ i ] === value ) {\n\t\t\tcnt += 1;\n\t\t}\n\t}\n\treturn cnt;\n}\n\n/**\n* Returns whether every indexed array element is equal to a provided value.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} start - starting search index (inclusive)\n* @param {NonNegativeInteger} end - ending search index (inclusive)\n* @param {*} value - search value\n* @returns {boolean} boolean indicating whether all the values in array in the given range are equal to the provided value\n*/\nfunction every( arr, start, end, value ) {\n\tvar i;\n\n\tif ( end >= arr.length ) {\n\t\tend = arr.length - 1;\n\t}\n\tfor ( i = start; i <= end; i++ ) {\n\t\tif ( arr[ i ] !== value ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n/**\n* Returns the index of the first occurrence of a value in a provided array.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} start - starting search index (inclusive)\n* @param {NonNegativeInteger} end - ending search index (inclusive)\n* @param {*} value - search value\n* @returns {integer} index of the first occurrence\n*/\nfunction indexOf( arr, start, end, value ) {\n\tvar i;\n\n\tif ( end >= arr.length ) {\n\t\tend = arr.length - 1;\n\t}\n\tfor ( i = start; i <= end; i++ ) {\n\t\tif ( arr[ i ] === value ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n* Returns the index of the last occurrence of a value in a provided array.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} start - starting search index at which to start searching backwards (inclusive)\n* @param {NonNegativeInteger} end - ending search index (inclusive)\n* @param {*} value - search value\n* @returns {integer} index of the last occurrence\n*/\nfunction lastIndexOf( arr, start, end, value ) {\n\tvar i;\n\n\tif ( start >= arr.length-1 ) {\n\t\tstart = arr.length - 1;\n\t}\n\tfor ( i = start; i >= end; i-- ) {\n\t\tif ( arr[ i ] === value ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// MAIN //\n\n/**\n* Returns the break type between grapheme breaking classes according to _UAX #29 3.1.1 Grapheme Cluster Boundary Rules_ on extended grapheme clusters.\n*\n* @private\n* @param {Array} breaks - list of grapheme break properties\n* @param {Array} emoji - list of emoji properties\n* @returns {NonNegativeInteger} break type\n*\n* @example\n* var out = breakType( [ 11, 3, 11 ], [ 11, 11, 11 ] );\n* // returns 1\n*/\nfunction breakType( breaks, emoji ) {\n\tvar nextEmoji;\n\tvar next;\n\tvar prev;\n\tvar idx;\n\tvar N;\n\tvar M;\n\n\tN = breaks.length;\n\tM = N - 1;\n\n\tprev = breaks[ M-1 ];\n\tnext = breaks[ M ];\n\tnextEmoji = emoji[ M ];\n\n\tidx = lastIndexOf( breaks, M, 0, constants.RegionalIndicator );\n\tif (\n\t\tidx > 0 &&\n\t\tprev !== constants.Prepend &&\n\t\tprev !== constants.RegionalIndicator &&\n\t\tevery( breaks, 1, idx-1, constants.RegionalIndicator )\n\t) {\n\t\tif ( count( breaks, 0, M, constants.RegionalIndicator ) % 2 === 1 ) {\n\t\t\treturn constants.BreakLastRegional;\n\t\t}\n\t\treturn constants.BreakPenultimateRegional;\n\t}\n\t// GB3: CR × LF\n\tif (\n\t\tprev === constants.CR &&\n\t\tnext === constants.LF\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB4: (Control|CR|LF) ÷\n\tif (\n\t\tprev === constants.Control ||\n\t\tprev === constants.CR ||\n\t\tprev === constants.LF\n\t) {\n\t\treturn constants.BreakStart;\n\t}\n\t// GB5: ÷ (Control|CR|LF)\n\tif (\n\t\tnext === constants.Control ||\n\t\tnext === constants.CR ||\n\t\tnext === constants.LF\n\t) {\n\t\treturn constants.BreakStart;\n\t}\n\t// GB6: L × (L|V|LV|LVT)\n\tif (\n\t\tprev === constants.L &&\n\t\t(\n\t\t\tnext === constants.L ||\n\t\t\tnext === constants.V ||\n\t\t\tnext === constants.LV ||\n\t\t\tnext === constants.LVT\n\t\t)\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB7: (LV|V) × (V|T)\n\tif (\n\t\t( prev === constants.LV || prev === constants.V ) &&\n\t\t( next === constants.V || next === constants.T )\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB8: (LVT|T) × (T)\n\tif (\n\t\t( prev === constants.LVT || prev === constants.T ) &&\n\t\tnext === constants.T\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB9: × (Extend|ZWJ)\n\tif (\n\t\tnext === constants.Extend ||\n\t\tnext === constants.ZWJ\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB9a: × SpacingMark\n\tif ( next === constants.SpacingMark ) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB9b: Prepend ×\n\tif ( prev === constants.Prepend ) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB11: \\p{Extended_Pictographic} Extend* ZWJ × \\p{Extended_Pictographic}\n\tidx = lastIndexOf( emoji, M-1, 0, constants.ExtendedPictographic );\n\tif (\n\t\tidx >= 0 &&\n\t\tprev === constants.ZWJ &&\n\t\tnextEmoji === constants.ExtendedPictographic &&\n\t\temoji[ idx ] === constants.ExtendedPictographic &&\n\t\tevery( breaks, idx+1, M-2, constants.Extend )\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB12: ^ (RI RI)* RI × RI\n\t// GB13: [^RI] (RI RI)* RI × RI\n\tif ( indexOf( breaks, 1, M-1, constants.RegionalIndicator ) >= 0 ) {\n\t\treturn constants.Break;\n\t}\n\tif (\n\t\tprev === constants.RegionalIndicator &&\n\t\tnext === constants.RegionalIndicator\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB999: Any ? Any\n\treturn constants.BreakStart;\n}\n\n\n// EXPORTS //\n\nexport default breakType;\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* Grapheme cluster break tooling.\n*\n* @module @stdlib/string/tools/grapheme-cluster-break\n*\n* @example\n* import grapheme from '@stdlib/string/tools/grapheme-cluster-break';\n*\n* var out = grapheme.emojiProperty( 0x23EC );\n* // returns 101\n*\n* out = grapheme.breakProperty( 0x008f );\n* // returns 2\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport constants from './constants.js';\nimport breakType from './break_type.js';\nimport emojiProperty from './emoji_property.js';\nimport breakProperty from './break_property.js';\n\n\n// MAIN //\n\nvar main = {};\nsetReadOnly( main, 'constants', constants );\nsetReadOnly( main, 'breakType', breakType );\nsetReadOnly( main, 'emojiProperty', emojiProperty );\nsetReadOnly( main, 'breakProperty', breakProperty );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY 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 @cspell/spellchecker, max-lines-per-function, max-lines */\n\n'use strict';\n\n// MODULES //\n\nimport constants from './constants.js';\n\n\n// MAIN //\n\n/**\n* Returns the emoji property from the [Unicode Standard][1].\n*\n* [1]: https://www.unicode.org/Public/13.0.0/ucd/emoji/emoji-data.txt\n*\n* @private\n* @param {NonNegativeInteger} code - Unicode code point\n* @returns {NonNegativeInteger} emoji property\n*\n* @example\n* var out = emojiProperty( 0x23EC );\n* // returns 101\n*\n* @example\n* var out = emojiProperty( 0x1FFFE );\n* // returns 11\n*/\nfunction emojiProperty( code ) {\n\tif (\n\t\tcode === 0x00A9 || // E0.6 [1] (©️) copyright\n\t\tcode === 0x00AE || // E0.6 [1] (®️) registered\n\t\tcode === 0x203C || // E0.6 [1] (‼️) double exclamation mark\n\t\tcode === 0x2049 || // E0.6 [1] (⁉️) exclamation question mark\n\t\tcode === 0x2122 || // E0.6 [1] (™️) trade mark\n\t\tcode === 0x2139 || // E0.6 [1] (ℹ️) information\n\t\t( 0x2194 <= code && code <= 0x2199 ) || // E0.6 [6] (↔️..↙️) left-right arrow..down-left arrow\n\t\t( 0x21A9 <= code && code <= 0x21AA ) || // E0.6 [2] (↩️..↪️) right arrow curving left..left arrow curving right\n\t\t( 0x231A <= code && code <= 0x231B ) || // E0.6 [2] (⌚..⌛) watch..hourglass done\n\t\tcode === 0x2328 || // E1.0 [1] (⌨️) keyboard\n\t\tcode === 0x2388 || // E0.0 [1] (⎈) HELM SYMBOL\n\t\tcode === 0x23CF || // E1.0 [1] (⏏️) eject button\n\t\t( 0x23E9 <= code && code <= 0x23EC ) || // E0.6 [4] (⏩..⏬) fast-forward button..fast down button\n\t\t( 0x23ED <= code && code <= 0x23EE ) || // E0.7 [2] (⏭️..⏮️) next track button..last track button\n\t\tcode === 0x23EF || // E1.0 [1] (⏯️) play or pause button\n\t\tcode === 0x23F0 || // E0.6 [1] (⏰) alarm clock\n\t\t( 0x23F1 <= code && code <= 0x23F2 ) || // E1.0 [2] (⏱️..⏲️) stopwatch..timer clock\n\t\tcode === 0x23F3 || // E0.6 [1] (⏳) hourglass not done\n\t\t( 0x23F8 <= code && code <= 0x23FA ) || // E0.7 [3] (⏸️..⏺️) pause button..record button\n\t\tcode === 0x24C2 || // E0.6 [1] (Ⓜ️) circled M\n\t\t( 0x25AA <= code && code <= 0x25AB ) || // E0.6 [2] (▪️..▫️) black small square..white small square\n\t\tcode === 0x25B6 || // E0.6 [1] (▶️) play button\n\t\tcode === 0x25C0 || // E0.6 [1] (◀️) reverse button\n\t\t( 0x25FB <= code && code <= 0x25FE ) || // E0.6 [4] (◻️..◾) white medium square..black medium-small square\n\t\t( 0x2600 <= code && code <= 0x2601 ) || // E0.6 [2] (☀️..☁️) sun..cloud\n\t\t( 0x2602 <= code && code <= 0x2603 ) || // E0.7 [2] (☂️..☃️) umbrella..snowman\n\t\tcode === 0x2604 || // E1.0 [1] (☄️) comet\n\t\tcode === 0x2605 || // E0.0 [1] (★) BLACK STAR\n\t\t( 0x2607 <= code && code <= 0x260D ) || // E0.0 [7] (☇..☍) LIGHTNING..OPPOSITION\n\t\tcode === 0x260E || // E0.6 [1] (☎️) telephone\n\t\t( 0x260F <= code && code <= 0x2610 ) || // E0.0 [2] (☏..☐) WHITE TELEPHONE..BALLOT BOX\n\t\tcode === 0x2611 || // E0.6 [1] (☑️) check box with check\n\t\tcode === 0x2612 || // E0.0 [1] (☒) BALLOT BOX WITH X\n\t\t( 0x2614 <= code && code <= 0x2615 ) || // E0.6 [2] (☔..☕) umbrella with rain drops..hot beverage\n\t\t( 0x2616 <= code && code <= 0x2617 ) || // E0.0 [2] (☖..☗) WHITE SHOGI PIECE..BLACK SHOGI PIECE\n\t\tcode === 0x2618 || // E1.0 [1] (☘️) shamrock\n\t\t( 0x2619 <= code && code <= 0x261C ) || // E0.0 [4] (☙..☜) REVERSED ROTATED FLORAL HEART BULLET..WHITE LEFT POINTING INDEX\n\t\tcode === 0x261D || // E0.6 [1] (☝️) index pointing up\n\t\t( 0x261E <= code && code <= 0x261F ) || // E0.0 [2] (☞..☟) WHITE RIGHT POINTING INDEX..WHITE DOWN POINTING INDEX\n\t\tcode === 0x2620 || // E1.0 [1] (☠️) skull and crossbones\n\t\tcode === 0x2621 || // E0.0 [1] (☡) CAUTION SIGN\n\t\t( 0x2622 <= code && code <= 0x2623 ) || // E1.0 [2] (☢️..☣️) radioactive..biohazard\n\t\t( 0x2624 <= code && code <= 0x2625 ) || // E0.0 [2] (☤..☥) CADUCEUS..ANKH\n\t\tcode === 0x2626 || // E1.0 [1] (☦️) orthodox cross\n\t\t( 0x2627 <= code && code <= 0x2629 ) || // E0.0 [3] (☧..☩) CHI RHO..CROSS OF JERUSALEM\n\t\tcode === 0x262A || // E0.7 [1] (☪️) star and crescent\n\t\t( 0x262B <= code && code <= 0x262D ) || // E0.0 [3] (☫..☭) FARSI SYMBOL..HAMMER AND SICKLE\n\t\tcode === 0x262E || // E1.0 [1] (☮️) peace symbol\n\t\tcode === 0x262F || // E0.7 [1] (☯️) yin yang\n\t\t( 0x2630 <= code && code <= 0x2637 ) || // E0.0 [8] (☰..☷) TRIGRAM FOR HEAVEN..TRIGRAM FOR EARTH\n\t\t( 0x2638 <= code && code <= 0x2639 ) || // E0.7 [2] (☸️..☹️) wheel of dharma..frowning face\n\t\tcode === 0x263A || // E0.6 [1] (☺️) smiling face\n\t\t( 0x263B <= code && code <= 0x263F ) || // E0.0 [5] (☻..☿) BLACK SMILING FACE..MERCURY\n\t\tcode === 0x2640 || // E4.0 [1] (♀️) female sign\n\t\tcode === 0x2641 || // E0.0 [1] (♁) EARTH\n\t\tcode === 0x2642 || // E4.0 [1] (♂️) male sign\n\t\t( 0x2643 <= code && code <= 0x2647 ) || // E0.0 [5] (♃..♇) JUPITER..PLUTO\n\t\t( 0x2648 <= code && code <= 0x2653 ) || // E0.6 [12] (♈..♓) Aries..Pisces\n\t\t( 0x2654 <= code && code <= 0x265E ) || // E0.0 [11] (♔..♞) WHITE CHESS KING..BLACK CHESS KNIGHT\n\t\tcode === 0x265F || // E11.0 [1] (♟️) chess pawn\n\t\tcode === 0x2660 || // E0.6 [1] (♠️) spade suit\n\t\t( 0x2661 <= code && code <= 0x2662 ) || // E0.0 [2] (♡..♢) WHITE HEART SUIT..WHITE DIAMOND SUIT\n\t\tcode === 0x2663 || // E0.6 [1] (♣️) club suit\n\t\tcode === 0x2664 || // E0.0 [1] (♤) WHITE SPADE SUIT\n\t\t( 0x2665 <= code && code <= 0x2666 ) || // E0.6 [2] (♥️..♦️) heart suit..diamond suit\n\t\tcode === 0x2667 || // E0.0 [1] (♧) WHITE CLUB SUIT\n\t\tcode === 0x2668 || // E0.6 [1] (♨️) hot springs\n\t\t( 0x2669 <= code && code <= 0x267A ) || // E0.0 [18] (♩..♺) QUARTER NOTE..RECYCLING SYMBOL FOR GENERIC MATERIALS\n\t\tcode === 0x267B || // E0.6 [1] (♻️) recycling symbol\n\t\t( 0x267C <= code && code <= 0x267D ) || // E0.0 [2] (♼..♽) RECYCLED PAPER SYMBOL..PARTIALLY-RECYCLED PAPER SYMBOL\n\t\tcode === 0x267E || // E11.0 [1] (♾️) infinity\n\t\tcode === 0x267F || // E0.6 [1] (♿) wheelchair symbol\n\t\t( 0x2680 <= code && code <= 0x2685 ) || // E0.0 [6] (⚀..⚅) DIE FACE-1..DIE FACE-6\n\t\t( 0x2690 <= code && code <= 0x2691 ) || // E0.0 [2] (⚐..⚑) WHITE FLAG..BLACK FLAG\n\t\tcode === 0x2692 || // E1.0 [1] (⚒️) hammer and pick\n\t\tcode === 0x2693 || // E0.6 [1] (⚓) anchor\n\t\tcode === 0x2694 || // E1.0 [1] (⚔️) crossed swords\n\t\tcode === 0x2695 || // E4.0 [1] (⚕️) medical symbol\n\t\t( 0x2696 <= code && code <= 0x2697 ) || // E1.0 [2] (⚖️..⚗️) balance scale..alembic\n\t\tcode === 0x2698 || // E0.0 [1] (⚘) FLOWER\n\t\tcode === 0x2699 || // E1.0 [1] (⚙️) gear\n\t\tcode === 0x269A || // E0.0 [1] (⚚) STAFF OF HERMES\n\t\t( 0x269B <= code && code <= 0x269C ) || // E1.0 [2] (⚛️..⚜️) atom symbol..fleur-de-lis\n\t\t( 0x269D <= code && code <= 0x269F ) || // E0.0 [3] (⚝..⚟) OUTLINED WHITE STAR..THREE LINES CONVERGING LEFT\n\t\t( 0x26A0 <= code && code <= 0x26A1 ) || // E0.6 [2] (⚠️..⚡) warning..high voltage\n\t\t( 0x26A2 <= code && code <= 0x26A6 ) || // E0.0 [5] (⚢..⚦) DOUBLED FEMALE SIGN..MALE WITH STROKE SIGN\n\t\tcode === 0x26A7 || // E13.0 [1] (⚧️) transgender symbol\n\t\t( 0x26A8 <= code && code <= 0x26A9 ) || // E0.0 [2] (⚨..⚩) VERTICAL MALE WITH STROKE SIGN..HORIZONTAL MALE WITH STROKE SIGN\n\t\t( 0x26AA <= code && code <= 0x26AB ) || // E0.6 [2] (⚪..⚫) white circle..black circle\n\t\t( 0x26AC <= code && code <= 0x26AF ) || // E0.0 [4] (⚬..⚯) MEDIUM SMALL WHITE CIRCLE..UNMARRIED PARTNERSHIP SYMBOL\n\t\t( 0x26B0 <= code && code <= 0x26B1 ) || // E1.0 [2] (⚰️..⚱️) coffin..funeral urn\n\t\t( 0x26B2 <= code && code <= 0x26BC ) || // E0.0 [11] (⚲..⚼) NEUTER..SESQUIQUADRATE\n\t\t( 0x26BD <= code && code <= 0x26BE ) || // E0.6 [2] (⚽..⚾) soccer ball..baseball\n\t\t( 0x26BF <= code && code <= 0x26C3 ) || // E0.0 [5] (⚿..⛃) SQUARED KEY..BLACK DRAUGHTS KING\n\t\t( 0x26C4 <= code && code <= 0x26C5 ) || // E0.6 [2] (⛄..⛅) snowman without snow..sun behind cloud\n\t\t( 0x26C6 <= code && code <= 0x26C7 ) || // E0.0 [2] (⛆..⛇) RAIN..BLACK SNOWMAN\n\t\tcode === 0x26C8 || // E0.7 [1] (⛈️) cloud with lightning and rain\n\t\t( 0x26C9 <= code && code <= 0x26CD ) || // E0.0 [5] (⛉..⛍) TURNED WHITE SHOGI PIECE..DISABLED CAR\n\t\tcode === 0x26CE || // E0.6 [1] (⛎) Ophiuchus\n\t\tcode === 0x26CF || // E0.7 [1] (⛏️) pick\n\t\tcode === 0x26D0 || // E0.0 [1] (⛐) CAR SLIDING\n\t\tcode === 0x26D1 || // E0.7 [1] (⛑️) rescue worker’s helmet\n\t\tcode === 0x26D2 || // E0.0 [1] (⛒) CIRCLED CROSSING LANES\n\t\tcode === 0x26D3 || // E0.7 [1] (⛓️) chains\n\t\tcode === 0x26D4 || // E0.6 [1] (⛔) no entry\n\t\t( 0x26D5 <= code && code <= 0x26E8 ) || // E0.0 [20] (⛕..⛨) ALTERNATE ONE-WAY LEFT WAY TRAFFIC..BLACK CROSS ON SHIELD\n\t\tcode === 0x26E9 || // E0.7 [1] (⛩️) shinto shrine\n\t\tcode === 0x26EA || // E0.6 [1] (⛪) church\n\t\t( 0x26EB <= code && code <= 0x26EF ) || // E0.0 [5] (⛫..⛯) CASTLE..MAP SYMBOL FOR LIGHTHOUSE\n\t\t( 0x26F0 <= code && code <= 0x26F1 ) || // E0.7 [2] (⛰️..⛱️) mountain..umbrella on ground\n\t\t( 0x26F2 <= code && code <= 0x26F3 ) || // E0.6 [2] (⛲..⛳) fountain..flag in hole\n\t\tcode === 0x26F4 || // E0.7 [1] (⛴️) ferry\n\t\tcode === 0x26F5 || // E0.6 [1] (⛵) sailboat\n\t\tcode === 0x26F6 || // E0.0 [1] (⛶) SQUARE FOUR CORNERS\n\t\t( 0x26F7 <= code && code <= 0x26F9 ) || // E0.7 [3] (⛷️..⛹️) skier..person bouncing ball\n\t\tcode === 0x26FA || // E0.6 [1] (⛺) tent\n\t\t( 0x26FB <= code && code <= 0x26FC ) || // E0.0 [2] (⛻..⛼) JAPANESE BANK SYMBOL..HEADSTONE GRAVEYARD SYMBOL\n\t\tcode === 0x26FD || // E0.6 [1] (⛽) fuel pump\n\t\t( 0x26FE <= code && code <= 0x2701 ) || // E0.0 [4] (⛾..✁) CUP ON BLACK SQUARE..UPPER BLADE SCISSORS\n\t\tcode === 0x2702 || // E0.6 [1] (✂️) scissors\n\t\t( 0x2703 <= code && code <= 0x2704 ) || // E0.0 [2] (✃..✄) LOWER BLADE SCISSORS..WHITE SCISSORS\n\t\tcode === 0x2705 || // E0.6 [1] (✅) check mark button\n\t\t( 0x2708 <= code && code <= 0x270C ) || // E0.6 [5] (✈️..✌️) airplane..victory hand\n\t\tcode === 0x270D || // E0.7 [1] (✍️) writing hand\n\t\tcode === 0x270E || // E0.0 [1] (✎) LOWER RIGHT PENCIL\n\t\tcode === 0x270F || // E0.6 [1] (✏️) pencil\n\t\t( 0x2710 <= code && code <= 0x2711 ) || // E0.0 [2] (✐..✑) UPPER RIGHT PENCIL..WHITE NIB\n\t\tcode === 0x2712 || // E0.6 [1] (✒️) black nib\n\t\tcode === 0x2714 || // E0.6 [1] (✔️) check mark\n\t\tcode === 0x2716 || // E0.6 [1] (✖️) multiply\n\t\tcode === 0x271D || // E0.7 [1] (✝️) latin cross\n\t\tcode === 0x2721 || // E0.7 [1] (✡️) star of David\n\t\tcode === 0x2728 || // E0.6 [1] (✨) sparkles\n\t\t( 0x2733 <= code && code <= 0x2734 ) || // E0.6 [2] (✳️..✴️) eight-spoked asterisk..eight-pointed star\n\t\tcode === 0x2744 || // E0.6 [1] (❄️) snowflake\n\t\tcode === 0x2747 || // E0.6 [1] (❇️) sparkle\n\t\tcode === 0x274C || // E0.6 [1] (❌) cross mark\n\t\tcode === 0x274E || // E0.6 [1] (❎) cross mark button\n\t\t( 0x2753 <= code && code <= 0x2755 ) || // E0.6 [3] (❓..❕) question mark..white exclamation mark\n\t\tcode === 0x2757 || // E0.6 [1] (❗) exclamation mark\n\t\tcode === 0x2763 || // E1.0 [1] (❣️) heart exclamation\n\t\tcode === 0x2764 || // E0.6 [1] (❤️) red heart\n\t\t( 0x2765 <= code && code <= 0x2767 ) || // E0.0 [3] (❥..❧) ROTATED HEAVY BLACK HEART BULLET..ROTATED FLORAL HEART BULLET\n\t\t( 0x2795 <= code && code <= 0x2797 ) || // E0.6 [3] (➕..➗) plus..divide\n\t\tcode === 0x27A1 || // E0.6 [1] (➡️) right arrow\n\t\tcode === 0x27B0 || // E0.6 [1] (➰) curly loop\n\t\tcode === 0x27BF || // E1.0 [1] (➿) double curly loop\n\t\t( 0x2934 <= code && code <= 0x2935 ) || // E0.6 [2] (⤴️..⤵️) right arrow curving up..right arrow curving down\n\t\t( 0x2B05 <= code && code <= 0x2B07 ) || // E0.6 [3] (⬅️..⬇️) left arrow..down arrow\n\t\t( 0x2B1B <= code && code <= 0x2B1C ) || // E0.6 [2] (⬛..⬜) black large square..white large square\n\t\tcode === 0x2B50 || // E0.6 [1] (⭐) star\n\t\tcode === 0x2B55 || // E0.6 [1] (⭕) hollow red circle\n\t\tcode === 0x3030 || // E0.6 [1] (〰️) wavy dash\n\t\tcode === 0x303D || // E0.6 [1] (〽️) part alternation mark\n\t\tcode === 0x3297 || // E0.6 [1] (㊗️) Japanese “congratulations” button\n\t\tcode === 0x3299 || // E0.6 [1] (㊙️) Japanese “secret” button\n\t\t( 0x1F000 <= code && code <= 0x1F003 ) || // E0.0 [4] (🀀..🀃) MAHJONG TILE EAST WIND..MAHJONG TILE NORTH WIND\n\t\tcode === 0x1F004 || // E0.6 [1] (🀄) mahjong red dragon\n\t\t( 0x1F005 <= code && code <= 0x1F0CE ) || // E0.0 [202] (🀅..🃎) MAHJONG TILE GREEN DRAGON..PLAYING CARD KING OF DIAMONDS\n\t\tcode === 0x1F0CF || // E0.6 [1] (🃏) joker\n\t\t( 0x1F0D0 <= code && code <= 0x1F0FF ) || // E0.0 [48] (🃐..🃿) ..\n\t\t( 0x1F10D <= code && code <= 0x1F10F ) || // E0.0 [3] (🄍..🄏) CIRCLED ZERO WITH SLASH..CIRCLED DOLLAR SIGN WITH OVERLAID BACKSLASH\n\t\tcode === 0x1F12F || // E0.0 [1] (🄯) COPYLEFT SYMBOL\n\t\t( 0x1F16C <= code && code <= 0x1F16F ) || // E0.0 [4] (🅬..🅯) RAISED MR SIGN..CIRCLED HUMAN FIGURE\n\t\t( 0x1F170 <= code && code <= 0x1F171 ) || // E0.6 [2] (🅰️..🅱️) A button (blood type)..B button (blood type)\n\t\t( 0x1F17E <= code && code <= 0x1F17F ) || // E0.6 [2] (🅾️..🅿️) O button (blood type)..P button\n\t\tcode === 0x1F18E || // E0.6 [1] (🆎) AB button (blood type)\n\t\t( 0x1F191 <= code && code <= 0x1F19A ) || // E0.6 [10] (🆑..🆚) CL button..VS button\n\t\t( 0x1F1AD <= code && code <= 0x1F1E5 ) || // E0.0 [57] (🆭..🇥) MASK WORK SYMBOL..\n\t\t( 0x1F201 <= code && code <= 0x1F202 ) || // E0.6 [2] (🈁..🈂️) Japanese “here” button..Japanese “service charge” button\n\t\t( 0x1F203 <= code && code <= 0x1F20F ) || // E0.0 [13] (🈃..🈏) ..\n\t\tcode === 0x1F21A || // E0.6 [1] (🈚) Japanese “free of charge” button\n\t\tcode === 0x1F22F || // E0.6 [1] (🈯) Japanese “reserved” button\n\t\t( 0x1F232 <= code && code <= 0x1F23A ) || // E0.6 [9] (🈲..🈺) Japanese “prohibited” button..Japanese “open for business” button\n\t\t( 0x1F23C <= code && code <= 0x1F23F ) || // E0.0 [4] (🈼..🈿) ..\n\t\t( 0x1F249 <= code && code <= 0x1F24F ) || // E0.0 [7] (🉉..🉏) ..\n\t\t( 0x1F250 <= code && code <= 0x1F251 ) || // E0.6 [2] (🉐..🉑) Japanese “bargain” button..Japanese “acceptable” button\n\t\t( 0x1F252 <= code && code <= 0x1F2FF ) || // E0.0 [174] (🉒..🋿) ..\n\t\t( 0x1F300 <= code && code <= 0x1F30C ) || // E0.6 [13] (🌀..🌌) cyclone..milky way\n\t\t( 0x1F30D <= code && code <= 0x1F30E ) || // E0.7 [2] (🌍..🌎) globe showing Europe-Africa..globe showing Americas\n\t\tcode === 0x1F30F || // E0.6 [1] (🌏) globe showing Asia-Australia\n\t\tcode === 0x1F310 || // E1.0 [1] (🌐) globe with meridians\n\t\tcode === 0x1F311 || // E0.6 [1] (🌑) new moon\n\t\tcode === 0x1F312 || // E1.0 [1] (🌒) waxing crescent moon\n\t\t( 0x1F313 <= code && code <= 0x1F315 ) || // E0.6 [3] (🌓..🌕) first quarter moon..full moon\n\t\t( 0x1F316 <= code && code <= 0x1F318 ) || // E1.0 [3] (🌖..🌘) waning gibbous moon..waning crescent moon\n\t\tcode === 0x1F319 || // E0.6 [1] (🌙) crescent moon\n\t\tcode === 0x1F31A || // E1.0 [1] (🌚) new moon face\n\t\tcode === 0x1F31B || // E0.6 [1] (🌛) first quarter moon face\n\t\tcode === 0x1F31C || // E0.7 [1] (🌜) last quarter moon face\n\t\t( 0x1F31D <= code && code <= 0x1F31E ) || // E1.0 [2] (🌝..🌞) full moon face..sun with face\n\t\t( 0x1F31F <= code && code <= 0x1F320 ) || // E0.6 [2] (🌟..🌠) glowing star..shooting star\n\t\tcode === 0x1F321 || // E0.7 [1] (🌡️) thermometer\n\t\t( 0x1F322 <= code && code <= 0x1F323 ) || // E0.0 [2] (🌢..🌣) BLACK DROPLET..WHITE SUN\n\t\t( 0x1F324 <= code && code <= 0x1F32C ) || // E0.7 [9] (🌤️..🌬️) sun behind small cloud..wind face\n\t\t( 0x1F32D <= code && code <= 0x1F32F ) || // E1.0 [3] (🌭..🌯) hot dog..burrito\n\t\t( 0x1F330 <= code && code <= 0x1F331 ) || // E0.6 [2] (🌰..🌱) chestnut..seedling\n\t\t( 0x1F332 <= code && code <= 0x1F333 ) || // E1.0 [2] (🌲..🌳) evergreen tree..deciduous tree\n\t\t( 0x1F334 <= code && code <= 0x1F335 ) || // E0.6 [2] (🌴..🌵) palm tree..cactus\n\t\tcode === 0x1F336 || // E0.7 [1] (🌶️) hot pepper\n\t\t( 0x1F337 <= code && code <= 0x1F34A ) || // E0.6 [20] (🌷..🍊) tulip..tangerine\n\t\tcode === 0x1F34B || // E1.0 [1] (🍋) lemon\n\t\t( 0x1F34C <= code && code <= 0x1F34F ) || // E0.6 [4] (🍌..🍏) banana..green apple\n\t\tcode === 0x1F350 || // E1.0 [1] (🍐) pear\n\t\t( 0x1F351 <= code && code <= 0x1F37B ) || // E0.6 [43] (🍑..🍻) peach..clinking beer mugs\n\t\tcode === 0x1F37C || // E1.0 [1] (🍼) baby bottle\n\t\tcode === 0x1F37D || // E0.7 [1] (🍽️) fork and knife with plate\n\t\t( 0x1F37E <= code && code <= 0x1F37F ) || // E1.0 [2] (🍾..🍿) bottle with popping cork..popcorn\n\t\t( 0x1F380 <= code && code <= 0x1F393 ) || // E0.6 [20] (🎀..🎓) ribbon..graduation cap\n\t\t( 0x1F394 <= code && code <= 0x1F395 ) || // E0.0 [2] (🎔..🎕) HEART WITH TIP ON THE LEFT..BOUQUET OF FLOWERS\n\t\t( 0x1F396 <= code && code <= 0x1F397 ) || // E0.7 [2] (🎖️..🎗️) military medal..reminder ribbon\n\t\tcode === 0x1F398 || // E0.0 [1] (🎘) MUSICAL KEYBOARD WITH JACKS\n\t\t( 0x1F399 <= code && code <= 0x1F39B ) || // E0.7 [3] (🎙️..🎛️) studio microphone..control knobs\n\t\t( 0x1F39C <= code && code <= 0x1F39D ) || // E0.0 [2] (🎜..🎝) BEAMED ASCENDING MUSICAL NOTES..BEAMED DESCENDING MUSICAL NOTES\n\t\t( 0x1F39E <= code && code <= 0x1F39F ) || // E0.7 [2] (🎞️..🎟️) film frames..admission tickets\n\t\t( 0x1F3A0 <= code && code <= 0x1F3C4 ) || // E0.6 [37] (🎠..🏄) carousel horse..person surfing\n\t\tcode === 0x1F3C5 || // E1.0 [1] (🏅) sports medal\n\t\tcode === 0x1F3C6 || // E0.6 [1] (🏆) trophy\n\t\tcode === 0x1F3C7 || // E1.0 [1] (🏇) horse racing\n\t\tcode === 0x1F3C8 || // E0.6 [1] (🏈) american football\n\t\tcode === 0x1F3C9 || // E1.0 [1] (🏉) rugby football\n\t\tcode === 0x1F3CA || // E0.6 [1] (🏊) person swimming\n\t\t( 0x1F3CB <= code && code <= 0x1F3CE ) || // E0.7 [4] (🏋️..🏎️) person lifting weights..racing car\n\t\t( 0x1F3CF <= code && code <= 0x1F3D3 ) || // E1.0 [5] (🏏..🏓) cricket game..ping pong\n\t\t( 0x1F3D4 <= code && code <= 0x1F3DF ) || // E0.7 [12] (🏔️..🏟️) snow-capped mountain..stadium\n\t\t( 0x1F3E0 <= code && code <= 0x1F3E3 ) || // E0.6 [4] (🏠..🏣) house..Japanese post office\n\t\tcode === 0x1F3E4 || // E1.0 [1] (🏤) post office\n\t\t( 0x1F3E5 <= code && code <= 0x1F3F0 ) || // E0.6 [12] (🏥..🏰) hospital..castle\n\t\t( 0x1F3F1 <= code && code <= 0x1F3F2 ) || // E0.0 [2] (🏱..🏲) WHITE PENNANT..BLACK PENNANT\n\t\tcode === 0x1F3F3 || // E0.7 [1] (🏳️) white flag\n\t\tcode === 0x1F3F4 || // E1.0 [1] (🏴) black flag\n\t\tcode === 0x1F3F5 || // E0.7 [1] (🏵️) rosette\n\t\tcode === 0x1F3F6 || // E0.0 [1] (🏶) BLACK ROSETTE\n\t\tcode === 0x1F3F7 || // E0.7 [1] (🏷️) label\n\t\t( 0x1F3F8 <= code && code <= 0x1F3FA ) || // E1.0 [3] (🏸..🏺) badminton..amphora\n\t\t( 0x1F400 <= code && code <= 0x1F407 ) || // E1.0 [8] (🐀..🐇) rat..rabbit\n\t\tcode === 0x1F408 || // E0.7 [1] (🐈) cat\n\t\t( 0x1F409 <= code && code <= 0x1F40B ) || // E1.0 [3] (🐉..🐋) dragon..whale\n\t\t( 0x1F40C <= code && code <= 0x1F40E ) || // E0.6 [3] (🐌..🐎) snail..horse\n\t\t( 0x1F40F <= code && code <= 0x1F410 ) || // E1.0 [2] (🐏..🐐) ram..goat\n\t\t( 0x1F411 <= code && code <= 0x1F412 ) || // E0.6 [2] (🐑..🐒) ewe..monkey\n\t\tcode === 0x1F413 || // E1.0 [1] (🐓) rooster\n\t\tcode === 0x1F414 || // E0.6 [1] (🐔) chicken\n\t\tcode === 0x1F415 || // E0.7 [1] (🐕) dog\n\t\tcode === 0x1F416 || // E1.0 [1] (🐖) pig\n\t\t( 0x1F417 <= code && code <= 0x1F429 ) || // E0.6 [19] (🐗..🐩) boar..poodle\n\t\tcode === 0x1F42A || // E1.0 [1] (🐪) camel\n\t\t( 0x1F42B <= code && code <= 0x1F43E ) || // E0.6 [20] (🐫..🐾) two-hump camel..paw prints\n\t\tcode === 0x1F43F || // E0.7 [1] (🐿️) chipmunk\n\t\tcode === 0x1F440 || // E0.6 [1] (👀) eyes\n\t\tcode === 0x1F441 || // E0.7 [1] (👁️) eye\n\t\t( 0x1F442 <= code && code <= 0x1F464 ) || // E0.6 [35] (👂..👤) ear..bust in silhouette\n\t\tcode === 0x1F465 || // E1.0 [1] (👥) busts in silhouette\n\t\t( 0x1F466 <= code && code <= 0x1F46B ) || // E0.6 [6] (👦..👫) boy..woman and man holding hands\n\t\t( 0x1F46C <= code && code <= 0x1F46D ) || // E1.0 [2] (👬..👭) men holding hands..women holding hands\n\t\t( 0x1F46E <= code && code <= 0x1F4AC ) || // E0.6 [63] (👮..💬) police officer..speech balloon\n\t\tcode === 0x1F4AD || // E1.0 [1] (💭) thought balloon\n\t\t( 0x1F4AE <= code && code <= 0x1F4B5 ) || // E0.6 [8] (💮..💵) white flower..dollar banknote\n\t\t( 0x1F4B6 <= code && code <= 0x1F4B7 ) || // E1.0 [2] (💶..💷) euro banknote..pound banknote\n\t\t( 0x1F4B8 <= code && code <= 0x1F4EB ) || // E0.6 [52] (💸..📫) money with wings..closed mailbox with raised flag\n\t\t( 0x1F4EC <= code && code <= 0x1F4ED ) || // E0.7 [2] (📬..📭) open mailbox with raised flag..open mailbox with lowered flag\n\t\tcode === 0x1F4EE || // E0.6 [1] (📮) postbox\n\t\tcode === 0x1F4EF || // E1.0 [1] (📯) postal horn\n\t\t( 0x1F4F0 <= code && code <= 0x1F4F4 ) || // E0.6 [5] (📰..📴) newspaper..mobile phone off\n\t\tcode === 0x1F4F5 || // E1.0 [1] (📵) no mobile phones\n\t\t( 0x1F4F6 <= code && code <= 0x1F4F7 ) || // E0.6 [2] (📶..📷) antenna bars..camera\n\t\tcode === 0x1F4F8 || // E1.0 [1] (📸) camera with flash\n\t\t( 0x1F4F9 <= code && code <= 0x1F4FC ) || // E0.6 [4] (📹..📼) video camera..videocassette\n\t\tcode === 0x1F4FD || // E0.7 [1] (📽️) film projector\n\t\tcode === 0x1F4FE || // E0.0 [1] (📾) PORTABLE STEREO\n\t\t( 0x1F4FF <= code && code <= 0x1F502 ) || // E1.0 [4] (📿..🔂) prayer beads..repeat single button\n\t\tcode === 0x1F503 || // E0.6 [1] (🔃) clockwise vertical arrows\n\t\t( 0x1F504 <= code && code <= 0x1F507 ) || // E1.0 [4] (🔄..🔇) counterclockwise arrows button..muted speaker\n\t\tcode === 0x1F508 || // E0.7 [1] (🔈) speaker low volume\n\t\tcode === 0x1F509 || // E1.0 [1] (🔉) speaker medium volume\n\t\t( 0x1F50A <= code && code <= 0x1F514 ) || // E0.6 [11] (🔊..🔔) speaker high volume..bell\n\t\tcode === 0x1F515 || // E1.0 [1] (🔕) bell with slash\n\t\t( 0x1F516 <= code && code <= 0x1F52B ) || // E0.6 [22] (🔖..🔫) bookmark..pistol\n\t\t( 0x1F52C <= code && code <= 0x1F52D ) || // E1.0 [2] (🔬..🔭) microscope..telescope\n\t\t( 0x1F52E <= code && code <= 0x1F53D ) || // E0.6 [16] (🔮..🔽) crystal ball..downwards button\n\t\t( 0x1F546 <= code && code <= 0x1F548 ) || // E0.0 [3] (🕆..🕈) WHITE LATIN CROSS..CELTIC CROSS\n\t\t( 0x1F549 <= code && code <= 0x1F54A ) || // E0.7 [2] (🕉️..🕊️) om..dove\n\t\t( 0x1F54B <= code && code <= 0x1F54E ) || // E1.0 [4] (🕋..🕎) kaaba..menorah\n\t\tcode === 0x1F54F || // E0.0 [1] (🕏) BOWL OF HYGIEIA\n\t\t( 0x1F550 <= code && code <= 0x1F55B ) || // E0.6 [12] (🕐..🕛) one o’clock..twelve o’clock\n\t\t( 0x1F55C <= code && code <= 0x1F567 ) || // E0.7 [12] (🕜..🕧) one-thirty..twelve-thirty\n\t\t( 0x1F568 <= code && code <= 0x1F56E ) || // E0.0 [7] (🕨..🕮) RIGHT SPEAKER..BOOK\n\t\t( 0x1F56F <= code && code <= 0x1F570 ) || // E0.7 [2] (🕯️..🕰️) candle..mantelpiece clock\n\t\t( 0x1F571 <= code && code <= 0x1F572 ) || // E0.0 [2] (🕱..🕲) BLACK SKULL AND CROSSBONES..NO PIRACY\n\t\t( 0x1F573 <= code && code <= 0x1F579 ) || // E0.7 [7] (🕳️..🕹️) hole..joystick\n\t\tcode === 0x1F57A || // E3.0 [1] (🕺) man dancing\n\t\t( 0x1F57B <= code && code <= 0x1F586 ) || // E0.0 [12] (🕻..🖆) LEFT HAND TELEPHONE RECEIVER..PEN OVER STAMPED ENVELOPE\n\t\tcode === 0x1F587 || // E0.7 [1] (🖇️) linked paperclips\n\t\t( 0x1F588 <= code && code <= 0x1F589 ) || // E0.0 [2] (🖈..🖉) BLACK PUSHPIN..LOWER LEFT PENCIL\n\t\t( 0x1F58A <= code && code <= 0x1F58D ) || // E0.7 [4] (🖊️..🖍️) pen..crayon\n\t\t( 0x1F58E <= code && code <= 0x1F58F ) || // E0.0 [2] (🖎..🖏) LEFT WRITING HAND..TURNED OK HAND SIGN\n\t\tcode === 0x1F590 || // E0.7 [1] (🖐️) hand with fingers splayed\n\t\t( 0x1F591 <= code && code <= 0x1F594 ) || // E0.0 [4] (🖑..🖔) REVERSED RAISED HAND WITH FINGERS SPLAYED..REVERSED VICTORY HAND\n\t\t( 0x1F595 <= code && code <= 0x1F596 ) || // E1.0 [2] (🖕..🖖) middle finger..vulcan salute\n\t\t( 0x1F597 <= code && code <= 0x1F5A3 ) || // E0.0 [13] (🖗..🖣) WHITE DOWN POINTING LEFT HAND INDEX..BLACK DOWN POINTING BACKHAND INDEX\n\t\tcode === 0x1F5A4 || // E3.0 [1] (🖤) black heart\n\t\tcode === 0x1F5A5 || // E0.7 [1] (🖥️) desktop computer\n\t\t( 0x1F5A6 <= code && code <= 0x1F5A7 ) || // E0.0 [2] (🖦..🖧) KEYBOARD AND MOUSE..THREE NETWORKED COMPUTERS\n\t\tcode === 0x1F5A8 || // E0.7 [1] (🖨️) printer\n\t\t( 0x1F5A9 <= code && code <= 0x1F5B0 ) || // E0.0 [8] (🖩..🖰) POCKET CALCULATOR..TWO BUTTON MOUSE\n\t\t( 0x1F5B1 <= code && code <= 0x1F5B2 ) || // E0.7 [2] (🖱️..🖲️) computer mouse..trackball\n\t\t( 0x1F5B3 <= code && code <= 0x1F5BB ) || // E0.0 [9] (🖳..🖻) OLD PERSONAL COMPUTER..DOCUMENT WITH PICTURE\n\t\tcode === 0x1F5BC || // E0.7 [1] (🖼️) framed picture\n\t\t( 0x1F5BD <= code && code <= 0x1F5C1 ) || // E0.0 [5] (🖽..🗁) FRAME WITH TILES..OPEN FOLDER\n\t\t( 0x1F5C2 <= code && code <= 0x1F5C4 ) || // E0.7 [3] (🗂️..🗄️) card index dividers..file cabinet\n\t\t( 0x1F5C5 <= code && code <= 0x1F5D0 ) || // E0.0 [12] (🗅..🗐) EMPTY NOTE..PAGES\n\t\t( 0x1F5D1 <= code && code <= 0x1F5D3 ) || // E0.7 [3] (🗑️..🗓️) wastebasket..spiral calendar\n\t\t( 0x1F5D4 <= code && code <= 0x1F5DB ) || // E0.0 [8] (🗔..🗛) DESKTOP WINDOW..DECREASE FONT SIZE SYMBOL\n\t\t( 0x1F5DC <= code && code <= 0x1F5DE ) || // E0.7 [3] (🗜️..🗞️) clamp..rolled-up newspaper\n\t\t( 0x1F5DF <= code && code <= 0x1F5E0 ) || // E0.0 [2] (🗟..🗠) PAGE WITH CIRCLED TEXT..STOCK CHART\n\t\tcode === 0x1F5E1 || // E0.7 [1] (🗡️) dagger\n\t\tcode === 0x1F5E2 || // E0.0 [1] (🗢) LIPS\n\t\tcode === 0x1F5E3 || // E0.7 [1] (🗣️) speaking head\n\t\t( 0x1F5E4 <= code && code <= 0x1F5E7 ) || // E0.0 [4] (🗤..🗧) THREE RAYS ABOVE..THREE RAYS RIGHT\n\t\tcode === 0x1F5E8 || // E2.0 [1] (🗨️) left speech bubble\n\t\t( 0x1F5E9 <= code && code <= 0x1F5EE ) || // E0.0 [6] (🗩..🗮) RIGHT SPEECH BUBBLE..LEFT ANGER BUBBLE\n\t\tcode === 0x1F5EF || // E0.7 [1] (🗯️) right anger bubble\n\t\t( 0x1F5F0 <= code && code <= 0x1F5F2 ) || // E0.0 [3] (🗰..🗲) MOOD BUBBLE..LIGHTNING MOOD\n\t\tcode === 0x1F5F3 || // E0.7 [1] (🗳️) ballot box with ballot\n\t\t( 0x1F5F4 <= code && code <= 0x1F5F9 ) || // E0.0 [6] (🗴..🗹) BALLOT SCRIPT X..BALLOT BOX WITH BOLD CHECK\n\t\tcode === 0x1F5FA || // E0.7 [1] (🗺️) world map\n\t\t( 0x1F5FB <= code && code <= 0x1F5FF ) || // E0.6 [5] (🗻..🗿) mount fuji..moai\n\t\tcode === 0x1F600 || // E1.0 [1] (😀) grinning face\n\t\t( 0x1F601 <= code && code <= 0x1F606 ) || // E0.6 [6] (😁..😆) beaming face with smiling eyes..grinning squinting face\n\t\t( 0x1F607 <= code && code <= 0x1F608 ) || // E1.0 [2] (😇..😈) smiling face with halo..smiling face with horns\n\t\t( 0x1F609 <= code && code <= 0x1F60D ) || // E0.6 [5] (😉..😍) winking face..smiling face with heart-eyes\n\t\tcode === 0x1F60E || // E1.0 [1] (😎) smiling face with sunglasses\n\t\tcode === 0x1F60F || // E0.6 [1] (😏) smirking face\n\t\tcode === 0x1F610 || // E0.7 [1] (😐) neutral face\n\t\tcode === 0x1F611 || // E1.0 [1] (😑) expressionless face\n\t\t( 0x1F612 <= code && code <= 0x1F614 ) || // E0.6 [3] (😒..😔) unamused face..pensive face\n\t\tcode === 0x1F615 || // E1.0 [1] (😕) confused face\n\t\tcode === 0x1F616 || // E0.6 [1] (😖) confounded face\n\t\tcode === 0x1F617 || // E1.0 [1] (😗) kissing face\n\t\tcode === 0x1F618 || // E0.6 [1] (😘) face blowing a kiss\n\t\tcode === 0x1F619 || // E1.0 [1] (😙) kissing face with smiling eyes\n\t\tcode === 0x1F61A || // E0.6 [1] (😚) kissing face with closed eyes\n\t\tcode === 0x1F61B || // E1.0 [1] (😛) face with tongue\n\t\t( 0x1F61C <= code && code <= 0x1F61E ) || // E0.6 [3] (😜..😞) winking face with tongue..disappointed face\n\t\tcode === 0x1F61F || // E1.0 [1] (😟) worried face\n\t\t( 0x1F620 <= code && code <= 0x1F625 ) || // E0.6 [6] (😠..😥) angry face..sad but relieved face\n\t\t( 0x1F626 <= code && code <= 0x1F627 ) || // E1.0 [2] (😦..😧) frowning face with open mouth..anguished face\n\t\t( 0x1F628 <= code && code <= 0x1F62B ) || // E0.6 [4] (😨..😫) fearful face..tired face\n\t\tcode === 0x1F62C || // E1.0 [1] (😬) grimacing face\n\t\tcode === 0x1F62D || // E0.6 [1] (😭) loudly crying face\n\t\t( 0x1F62E <= code && code <= 0x1F62F ) || // E1.0 [2] (😮..😯) face with open mouth..hushed face\n\t\t( 0x1F630 <= code && code <= 0x1F633 ) || // E0.6 [4] (😰..😳) anxious face with sweat..flushed face\n\t\tcode === 0x1F634 || // E1.0 [1] (😴) sleeping face\n\t\tcode === 0x1F635 || // E0.6 [1] (😵) dizzy face\n\t\tcode === 0x1F636 || // E1.0 [1] (😶) face without mouth\n\t\t( 0x1F637 <= code && code <= 0x1F640 ) || // E0.6 [10] (😷..🙀) face with medical mask..weary cat\n\t\t( 0x1F641 <= code && code <= 0x1F644 ) || // E1.0 [4] (🙁..🙄) slightly frowning face..face with rolling eyes\n\t\t( 0x1F645 <= code && code <= 0x1F64F ) || // E0.6 [11] (🙅..🙏) person gesturing NO..folded hands\n\t\tcode === 0x1F680 || // E0.6 [1] (🚀) rocket\n\t\t( 0x1F681 <= code && code <= 0x1F682 ) || // E1.0 [2] (🚁..🚂) helicopter..locomotive\n\t\t( 0x1F683 <= code && code <= 0x1F685 ) || // E0.6 [3] (🚃..🚅) railway car..bullet train\n\t\tcode === 0x1F686 || // E1.0 [1] (🚆) train\n\t\tcode === 0x1F687 || // E0.6 [1] (🚇) metro\n\t\tcode === 0x1F688 || // E1.0 [1] (🚈) light rail\n\t\tcode === 0x1F689 || // E0.6 [1] (🚉) station\n\t\t( 0x1F68A <= code && code <= 0x1F68B ) || // E1.0 [2] (🚊..🚋) tram..tram car\n\t\tcode === 0x1F68C || // E0.6 [1] (🚌) bus\n\t\tcode === 0x1F68D || // E0.7 [1] (🚍) oncoming bus\n\t\tcode === 0x1F68E || // E1.0 [1] (🚎) trolleybus\n\t\tcode === 0x1F68F || // E0.6 [1] (🚏) bus stop\n\t\tcode === 0x1F690 || // E1.0 [1] (🚐) minibus\n\t\t( 0x1F691 <= code && code <= 0x1F693 ) || // E0.6 [3] (🚑..🚓) ambulance..police car\n\t\tcode === 0x1F694 || // E0.7 [1] (🚔) oncoming police car\n\t\tcode === 0x1F695 || // E0.6 [1] (🚕) taxi\n\t\tcode === 0x1F696 || // E1.0 [1] (🚖) oncoming taxi\n\t\tcode === 0x1F697 || // E0.6 [1] (🚗) automobile\n\t\tcode === 0x1F698 || // E0.7 [1] (🚘) oncoming automobile\n\t\t( 0x1F699 <= code && code <= 0x1F69A ) || // E0.6 [2] (🚙..🚚) sport utility vehicle..delivery truck\n\t\t( 0x1F69B <= code && code <= 0x1F6A1 ) || // E1.0 [7] (🚛..🚡) articulated lorry..aerial tramway\n\t\tcode === 0x1F6A2 || // E0.6 [1] (🚢) ship\n\t\tcode === 0x1F6A3 || // E1.0 [1] (🚣) person rowing boat\n\t\t( 0x1F6A4 <= code && code <= 0x1F6A5 ) || // E0.6 [2] (🚤..🚥) speedboat..horizontal traffic light\n\t\tcode === 0x1F6A6 || // E1.0 [1] (🚦) vertical traffic light\n\t\t( 0x1F6A7 <= code && code <= 0x1F6AD ) || // E0.6 [7] (🚧..🚭) construction..no smoking\n\t\t( 0x1F6AE <= code && code <= 0x1F6B1 ) || // E1.0 [4] (🚮..🚱) litter in bin sign..non-potable water\n\t\tcode === 0x1F6B2 || // E0.6 [1] (🚲) bicycle\n\t\t( 0x1F6B3 <= code && code <= 0x1F6B5 ) || // E1.0 [3] (🚳..🚵) no bicycles..person mountain biking\n\t\tcode === 0x1F6B6 || // E0.6 [1] (🚶) person walking\n\t\t( 0x1F6B7 <= code && code <= 0x1F6B8 ) || // E1.0 [2] (🚷..🚸) no pedestrians..children crossing\n\t\t( 0x1F6B9 <= code && code <= 0x1F6BE ) || // E0.6 [6] (🚹..🚾) men’s room..water closet\n\t\tcode === 0x1F6BF || // E1.0 [1] (🚿) shower\n\t\tcode === 0x1F6C0 || // E0.6 [1] (🛀) person taking bath\n\t\t( 0x1F6C1 <= code && code <= 0x1F6C5 ) || // E1.0 [5] (🛁..🛅) bathtub..left luggage\n\t\t( 0x1F6C6 <= code && code <= 0x1F6CA ) || // E0.0 [5] (🛆..🛊) TRIANGLE WITH ROUNDED CORNERS..GIRLS SYMBOL\n\t\tcode === 0x1F6CB || // E0.7 [1] (🛋️) couch and lamp\n\t\tcode === 0x1F6CC || // E1.0 [1] (🛌) person in bed\n\t\t( 0x1F6CD <= code && code <= 0x1F6CF ) || // E0.7 [3] (🛍️..🛏️) shopping bags..bed\n\t\tcode === 0x1F6D0 || // E1.0 [1] (🛐) place of worship\n\t\t( 0x1F6D1 <= code && code <= 0x1F6D2 ) || // E3.0 [2] (🛑..🛒) stop sign..shopping cart\n\t\t( 0x1F6D3 <= code && code <= 0x1F6D4 ) || // E0.0 [2] (🛓..🛔) STUPA..PAGODA\n\t\tcode === 0x1F6D5 || // E12.0 [1] (🛕) hindu temple\n\t\t( 0x1F6D6 <= code && code <= 0x1F6D7 ) || // E13.0 [2] (🛖..🛗) hut..elevator\n\t\t( 0x1F6D8 <= code && code <= 0x1F6DF ) || // E0.0 [8] (🛘..🛟) ..\n\t\t( 0x1F6E0 <= code && code <= 0x1F6E5 ) || // E0.7 [6] (🛠️..🛥️) hammer and wrench..motor boat\n\t\t( 0x1F6E6 <= code && code <= 0x1F6E8 ) || // E0.0 [3] (🛦..🛨) UP-POINTING MILITARY AIRPLANE..UP-POINTING SMALL AIRPLANE\n\t\tcode === 0x1F6E9 || // E0.7 [1] (🛩️) small airplane\n\t\tcode === 0x1F6EA || // E0.0 [1] (🛪) NORTHEAST-POINTING AIRPLANE\n\t\t( 0x1F6EB <= code && code <= 0x1F6EC ) || // E1.0 [2] (🛫..🛬) airplane departure..airplane arrival\n\t\t( 0x1F6ED <= code && code <= 0x1F6EF ) || // E0.0 [3] (🛭..🛯) ..\n\t\tcode === 0x1F6F0 || // E0.7 [1] (🛰️) satellite\n\t\t( 0x1F6F1 <= code && code <= 0x1F6F2 ) || // E0.0 [2] (🛱..🛲) ONCOMING FIRE ENGINE..DIESEL LOCOMOTIVE\n\t\tcode === 0x1F6F3 || // E0.7 [1] (🛳️) passenger ship\n\t\t( 0x1F6F4 <= code && code <= 0x1F6F6 ) || // E3.0 [3] (🛴..🛶) kick scooter..canoe\n\t\t( 0x1F6F7 <= code && code <= 0x1F6F8 ) || // E5.0 [2] (🛷..🛸) sled..flying saucer\n\t\tcode === 0x1F6F9 || // E11.0 [1] (🛹) skateboard\n\t\tcode === 0x1F6FA || // E12.0 [1] (🛺) auto rickshaw\n\t\t( 0x1F6FB <= code && code <= 0x1F6FC ) || // E13.0 [2] (🛻..🛼) pickup truck..roller skate\n\t\t( 0x1F6FD <= code && code <= 0x1F6FF ) || // E0.0 [3] (🛽..🛿) ..\n\t\t( 0x1F774 <= code && code <= 0x1F77F ) || // E0.0 [12] (🝴..🝿) ..\n\t\t( 0x1F7D5 <= code && code <= 0x1F7DF ) || // E0.0 [11] (🟕..🟟) CIRCLED TRIANGLE..\n\t\t( 0x1F7E0 <= code && code <= 0x1F7EB ) || // E12.0 [12] (🟠..🟫) orange circle..brown square\n\t\t( 0x1F7EC <= code && code <= 0x1F7FF ) || // E0.0 [20] (🟬..🟿) ..\n\t\t( 0x1F80C <= code && code <= 0x1F80F ) || // E0.0 [4] (🠌..🠏) ..\n\t\t( 0x1F848 <= code && code <= 0x1F84F ) || // E0.0 [8] (🡈..🡏) ..\n\t\t( 0x1F85A <= code && code <= 0x1F85F ) || // E0.0 [6] (🡚..🡟) ..\n\t\t( 0x1F888 <= code && code <= 0x1F88F ) || // E0.0 [8] (🢈..🢏) ..\n\t\t( 0x1F8AE <= code && code <= 0x1F8FF ) || // E0.0 [82] (🢮..🣿) ..\n\t\tcode === 0x1F90C || // E13.0 [1] (🤌) pinched fingers\n\t\t( 0x1F90D <= code && code <= 0x1F90F ) || // E12.0 [3] (🤍..🤏) white heart..pinching hand\n\t\t( 0x1F910 <= code && code <= 0x1F918 ) || // E1.0 [9] (🤐..🤘) zipper-mouth face..sign of the horns\n\t\t( 0x1F919 <= code && code <= 0x1F91E ) || // E3.0 [6] (🤙..🤞) call me hand..crossed fingers\n\t\tcode === 0x1F91F || // E5.0 [1] (🤟) love-you gesture\n\t\t( 0x1F920 <= code && code <= 0x1F927 ) || // E3.0 [8] (🤠..🤧) cowboy hat face..sneezing face\n\t\t( 0x1F928 <= code && code <= 0x1F92F ) || // E5.0 [8] (🤨..🤯) face with raised eyebrow..exploding head\n\t\tcode === 0x1F930 || // E3.0 [1] (🤰) pregnant woman\n\t\t( 0x1F931 <= code && code <= 0x1F932 ) || // E5.0 [2] (🤱..🤲) breast-feeding..palms up together\n\t\t( 0x1F933 <= code && code <= 0x1F93A ) || // E3.0 [8] (🤳..🤺) selfie..person fencing\n\t\t( 0x1F93C <= code && code <= 0x1F93E ) || // E3.0 [3] (🤼..🤾) people wrestling..person playing handball\n\t\tcode === 0x1F93F || // E12.0 [1] (🤿) diving mask\n\t\t( 0x1F940 <= code && code <= 0x1F945 ) || // E3.0 [6] (🥀..🥅) wilted flower..goal net\n\t\t( 0x1F947 <= code && code <= 0x1F94B ) || // E3.0 [5] (🥇..🥋) 1st place medal..martial arts uniform\n\t\tcode === 0x1F94C || // E5.0 [1] (🥌) curling stone\n\t\t( 0x1F94D <= code && code <= 0x1F94F ) || // E11.0 [3] (🥍..🥏) lacrosse..flying disc\n\t\t( 0x1F950 <= code && code <= 0x1F95E ) || // E3.0 [15] (🥐..🥞) croissant..pancakes\n\t\t( 0x1F95F <= code && code <= 0x1F96B ) || // E5.0 [13] (🥟..🥫) dumpling..canned food\n\t\t( 0x1F96C <= code && code <= 0x1F970 ) || // E11.0 [5] (🥬..🥰) leafy green..smiling face with hearts\n\t\tcode === 0x1F971 || // E12.0 [1] (🥱) yawning face\n\t\tcode === 0x1F972 || // E13.0 [1] (🥲) smiling face with tear\n\t\t( 0x1F973 <= code && code <= 0x1F976 ) || // E11.0 [4] (🥳..🥶) partying face..cold face\n\t\t( 0x1F977 <= code && code <= 0x1F978 ) || // E13.0 [2] (🥷..🥸) ninja..disguised face\n\t\tcode === 0x1F979 || // E0.0 [1] (🥹) \n\t\tcode === 0x1F97A || // E11.0 [1] (🥺) pleading face\n\t\tcode === 0x1F97B || // E12.0 [1] (🥻) sari\n\t\t( 0x1F97C <= code && code <= 0x1F97F ) || // E11.0 [4] (🥼..🥿) lab coat..flat shoe\n\t\t( 0x1F980 <= code && code <= 0x1F984 ) || // E1.0 [5] (🦀..🦄) crab..unicorn\n\t\t( 0x1F985 <= code && code <= 0x1F991 ) || // E3.0 [13] (🦅..🦑) eagle..squid\n\t\t( 0x1F992 <= code && code <= 0x1F997 ) || // E5.0 [6] (🦒..🦗) giraffe..cricket\n\t\t( 0x1F998 <= code && code <= 0x1F9A2 ) || // E11.0 [11] (🦘..🦢) kangaroo..swan\n\t\t( 0x1F9A3 <= code && code <= 0x1F9A4 ) || // E13.0 [2] (🦣..🦤) mammoth..dodo\n\t\t( 0x1F9A5 <= code && code <= 0x1F9AA ) || // E12.0 [6] (🦥..🦪) sloth..oyster\n\t\t( 0x1F9AB <= code && code <= 0x1F9AD ) || // E13.0 [3] (🦫..🦭) beaver..seal\n\t\t( 0x1F9AE <= code && code <= 0x1F9AF ) || // E12.0 [2] (🦮..🦯) guide dog..white cane\n\t\t( 0x1F9B0 <= code && code <= 0x1F9B9 ) || // E11.0 [10] (🦰..🦹) red hair..supervillain\n\t\t( 0x1F9BA <= code && code <= 0x1F9BF ) || // E12.0 [6] (🦺..🦿) safety vest..mechanical leg\n\t\tcode === 0x1F9C0 || // E1.0 [1] (🧀) cheese wedge\n\t\t( 0x1F9C1 <= code && code <= 0x1F9C2 ) || // E11.0 [2] (🧁..🧂) cupcake..salt\n\t\t( 0x1F9C3 <= code && code <= 0x1F9CA ) || // E12.0 [8] (🧃..🧊) beverage box..ice\n\t\tcode === 0x1F9CB || // E13.0 [1] (🧋) bubble tea\n\t\tcode === 0x1F9CC || // E0.0 [1] (🧌) \n\t\t( 0x1F9CD <= code && code <= 0x1F9CF ) || // E12.0 [3] (🧍..🧏) person standing..deaf person\n\t\t( 0x1F9D0 <= code && code <= 0x1F9E6 ) || // E5.0 [23] (🧐..🧦) face with monocle..socks\n\t\t( 0x1F9E7 <= code && code <= 0x1F9FF ) || // E11.0 [25] (🧧..🧿) red envelope..nazar amulet\n\t\t( 0x1FA00 <= code && code <= 0x1FA6F ) || // E0.0 [112] (🨀..🩯) NEUTRAL CHESS KING..\n\t\t( 0x1FA70 <= code && code <= 0x1FA73 ) || // E12.0 [4] (🩰..🩳) ballet shoes..shorts\n\t\tcode === 0x1FA74 || // E13.0 [1] (🩴) thong sandal\n\t\t( 0x1FA75 <= code && code <= 0x1FA77 ) || // E0.0 [3] (🩵..🩷) ..\n\t\t( 0x1FA78 <= code && code <= 0x1FA7A ) || // E12.0 [3] (🩸..🩺) drop of blood..stethoscope\n\t\t( 0x1FA7B <= code && code <= 0x1FA7F ) || // E0.0 [5] (🩻..🩿) ..\n\t\t( 0x1FA80 <= code && code <= 0x1FA82 ) || // E12.0 [3] (🪀..🪂) yo-yo..parachute\n\t\t( 0x1FA83 <= code && code <= 0x1FA86 ) || // E13.0 [4] (🪃..🪆) boomerang..nesting dolls\n\t\t( 0x1FA87 <= code && code <= 0x1FA8F ) || // E0.0 [9] (🪇..🪏) ..\n\t\t( 0x1FA90 <= code && code <= 0x1FA95 ) || // E12.0 [6] (🪐..🪕) ringed planet..banjo\n\t\t( 0x1FA96 <= code && code <= 0x1FAA8 ) || // E13.0 [19] (🪖..🪨) military helmet..rock\n\t\t( 0x1FAA9 <= code && code <= 0x1FAAF ) || // E0.0 [7] (🪩..🪯) ..\n\t\t( 0x1FAB0 <= code && code <= 0x1FAB6 ) || // E13.0 [7] (🪰..🪶) fly..feather\n\t\t( 0x1FAB7 <= code && code <= 0x1FABF ) || // E0.0 [9] (🪷..🪿) ..\n\t\t( 0x1FAC0 <= code && code <= 0x1FAC2 ) || // E13.0 [3] (🫀..🫂) anatomical heart..people hugging\n\t\t( 0x1FAC3 <= code && code <= 0x1FACF ) || // E0.0 [13] (🫃..🫏) ..\n\t\t( 0x1FAD0 <= code && code <= 0x1FAD6 ) || // E13.0 [7] (🫐..🫖) blueberries..teapot\n\t\t( 0x1FAD7 <= code && code <= 0x1FAFF ) || // E0.0 [41] (🫗..🫿) ..\n\t\t( 0x1FC00 <= code && code <= 0x1FFFD ) // E0.0[1022] (🰀..🿽) ..\n\t) {\n\t\treturn constants.ExtendedPictographic;\n\t}\n\treturn constants.Other;\n}\n\n\n// EXPORTS //\n\nexport default emojiProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY 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 max-lines-per-function, max-lines */\n\n'use strict';\n\n// MODULES //\n\nimport constants from './constants.js';\n\n\n// MAIN //\n\n/**\n* Returns the grapheme break property from the [Unicode Standard][1].\n*\n* [1]: https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt\n*\n* @private\n* @param {NonNegativeInteger} code - Unicode code point\n* @returns {NonNegativeInteger} grapheme break property\n*\n* @example\n* var out = graphemeBreakProperty( 0x008f );\n* // returns 2\n*\n* @example\n* var out = graphemeBreakProperty( 0x111C2 );\n* // returns 12\n*\n* @example\n* var out = graphemeBreakProperty( 0x1F3FC );\n* // returns 3\n*/\nfunction graphemeBreakProperty( code ) {\n\tif (\n\t\t( 0x0600 <= code && code <= 0x0605 ) || // Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER MARK ABOVE\n\t\tcode === 0x06DD || // Cf ARABIC END OF AYAH\n\t\tcode === 0x070F || // Cf SYRIAC ABBREVIATION MARK\n\t\tcode === 0x08E2 || // Cf ARABIC DISPUTED END OF AYAH\n\t\tcode === 0x0D4E || // Lo MALAYALAM LETTER DOT REPH\n\t\tcode === 0x110BD || // Cf KAITHI NUMBER SIGN\n\t\tcode === 0x110CD || // Cf KAITHI NUMBER SIGN ABOVE\n\t\t( 0x111C2 <= code && code <= 0x111C3 ) || // Lo [2] SHARADA SIGN JIHVAMULIYA..SHARADA SIGN UPADHMANIYA\n\t\tcode === 0x1193F || // Lo DIVES AKURU PREFIXED NASAL SIGN\n\t\tcode === 0x11941 || // Lo DIVES AKURU INITIAL RA\n\t\tcode === 0x11A3A || // Lo ZANABAZAR SQUARE CLUSTER-INITIAL LETTER RA\n\t\t( 0x11A84 <= code && code <= 0x11A89 ) || // Lo [6] SOYOMBO SIGN JIHVAMULIYA..SOYOMBO CLUSTER-INITIAL LETTER SA\n\t\tcode === 0x11D46 // Lo MASARAM GONDI REPHA\n\t) {\n\t\treturn constants.Prepend;\n\t}\n\tif (\n\t\tcode === 0x000D // Cc \n\t) {\n\t\treturn constants.CR;\n\t}\n\tif (\n\t\tcode === 0x000A // Cc \n\t) {\n\t\treturn constants.LF;\n\t}\n\tif (\n\t\t( 0x0000 <= code && code <= 0x0009 ) || // Cc [10] ..\n\t\t( 0x000B <= code && code <= 0x000C ) || // Cc [2] ..\n\t\t( 0x000E <= code && code <= 0x001F ) || // Cc [18] ..\n\t\t( 0x007F <= code && code <= 0x009F ) || // Cc [33] ..\n\t\tcode === 0x00AD || // Cf SOFT HYPHEN\n\t\tcode === 0x061C || // Cf ARABIC LETTER MARK\n\t\tcode === 0x180E || // Cf MONGOLIAN VOWEL SEPARATOR\n\t\tcode === 0x200B || // Cf ZERO WIDTH SPACE\n\t\t( 0x200E <= code && code <= 0x200F ) || // Cf [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT MARK\n\t\tcode === 0x2028 || // Zl LINE SEPARATOR\n\t\tcode === 0x2029 || // Zp PARAGRAPH SEPARATOR\n\t\t( 0x202A <= code && code <= 0x202E ) || // Cf [5] LEFT-TO-RIGHT EMBEDDING..RIGHT-TO-LEFT OVERRIDE\n\t\t( 0x2060 <= code && code <= 0x2064 ) || // Cf [5] WORD JOINER..INVISIBLE PLUS\n\t\tcode === 0x2065 || // Cn \n\t\t( 0x2066 <= code && code <= 0x206F ) || // Cf [10] LEFT-TO-RIGHT ISOLATE..NOMINAL DIGIT SHAPES\n\t\tcode === 0xFEFF || // Cf ZERO WIDTH NO-BREAK SPACE\n\t\t( 0xFFF0 <= code && code <= 0xFFF8 ) || // Cn [9] ..\n\t\t( 0xFFF9 <= code && code <= 0xFFFB ) || // Cf [3] INTERLINEAR ANNOTATION ANCHOR..INTERLINEAR ANNOTATION TERMINATOR\n\t\t( 0x13430 <= code && code <= 0x13438 ) || // Cf [9] EGYPTIAN HIEROGLYPH VERTICAL JOINER..EGYPTIAN HIEROGLYPH END SEGMENT\n\t\t( 0x1BCA0 <= code && code <= 0x1BCA3 ) || // Cf [4] SHORTHAND FORMAT LETTER OVERLAP..SHORTHAND FORMAT UP STEP\n\t\t( 0x1D173 <= code && code <= 0x1D17A ) || // Cf [8] MUSICAL SYMBOL BEGIN BEAM..MUSICAL SYMBOL END PHRASE\n\t\tcode === 0xE0000 || // Cn \n\t\tcode === 0xE0001 || // Cf LANGUAGE TAG\n\t\t( 0xE0002 <= code && code <= 0xE001F ) || // Cn [30] ..\n\t\t( 0xE0080 <= code && code <= 0xE00FF ) || // Cn [128] ..\n\t\t( 0xE01F0 <= code && code <= 0xE0FFF ) // Cn [3600] ..\n\t) {\n\t\treturn constants.Control;\n\t}\n\tif (\n\t\t( 0x0300 <= code && code <= 0x036F ) || // Mn [112] COMBINING GRAVE ACCENT..COMBINING LATIN SMALL LETTER X\n\t\t( 0x0483 <= code && code <= 0x0487 ) || // Mn [5] COMBINING CYRILLIC TITLO..COMBINING CYRILLIC POKRYTIE\n\t\t( 0x0488 <= code && code <= 0x0489 ) || // Me [2] COMBINING CYRILLIC HUNDRED THOUSANDS SIGN..COMBINING CYRILLIC MILLIONS SIGN\n\t\t( 0x0591 <= code && code <= 0x05BD ) || // Mn [45] HEBREW ACCENT ETNAHTA..HEBREW POINT METEG\n\t\tcode === 0x05BF || // Mn HEBREW POINT RAFE\n\t\t( 0x05C1 <= code && code <= 0x05C2 ) || // Mn [2] HEBREW POINT SHIN DOT..HEBREW POINT SIN DOT\n\t\t( 0x05C4 <= code && code <= 0x05C5 ) || // Mn [2] HEBREW MARK UPPER DOT..HEBREW MARK LOWER DOT\n\t\tcode === 0x05C7 || // Mn HEBREW POINT QAMATS QATAN\n\t\t( 0x0610 <= code && code <= 0x061A ) || // Mn [11] ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM..ARABIC SMALL KASRA\n\t\t( 0x064B <= code && code <= 0x065F ) || // Mn [21] ARABIC FATHATAN..ARABIC WAVY HAMZA BELOW\n\t\tcode === 0x0670 || // Mn ARABIC LETTER SUPERSCRIPT ALEF\n\t\t( 0x06D6 <= code && code <= 0x06DC ) || // Mn [7] ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA..ARABIC SMALL HIGH SEEN\n\t\t( 0x06DF <= code && code <= 0x06E4 ) || // Mn [6] ARABIC SMALL HIGH ROUNDED ZERO..ARABIC SMALL HIGH MADDA\n\t\t( 0x06E7 <= code && code <= 0x06E8 ) || // Mn [2] ARABIC SMALL HIGH YEH..ARABIC SMALL HIGH NOON\n\t\t( 0x06EA <= code && code <= 0x06ED ) || // Mn [4] ARABIC EMPTY CENTRE LOW STOP..ARABIC SMALL LOW MEEM\n\t\tcode === 0x0711 || // Mn SYRIAC LETTER SUPERSCRIPT ALAPH\n\t\t( 0x0730 <= code && code <= 0x074A ) || // Mn [27] SYRIAC PTHAHA ABOVE..SYRIAC BARREKH\n\t\t( 0x07A6 <= code && code <= 0x07B0 ) || // Mn [11] THAANA ABAFILI..THAANA SUKUN\n\t\t( 0x07EB <= code && code <= 0x07F3 ) || // Mn [9] NKO COMBINING SHORT HIGH TONE..NKO COMBINING DOUBLE DOT ABOVE\n\t\tcode === 0x07FD || // Mn NKO DANTAYALAN\n\t\t( 0x0816 <= code && code <= 0x0819 ) || // Mn [4] SAMARITAN MARK IN..SAMARITAN MARK DAGESH\n\t\t( 0x081B <= code && code <= 0x0823 ) || // Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAMARITAN VOWEL SIGN A\n\t\t( 0x0825 <= code && code <= 0x0827 ) || // Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMARITAN VOWEL SIGN U\n\t\t( 0x0829 <= code && code <= 0x082D ) || // Mn [5] SAMARITAN VOWEL SIGN LONG I..SAMARITAN MARK NEQUDAA\n\t\t( 0x0859 <= code && code <= 0x085B ) || // Mn [3] MANDAIC AFFRICATION MARK..MANDAIC GEMINATION MARK\n\t\t( 0x08D3 <= code && code <= 0x08E1 ) || // Mn [15] ARABIC SMALL LOW WAW..ARABIC SMALL HIGH SIGN SAFHA\n\t\t( 0x08E3 <= code && code <= 0x0902 ) || // Mn [32] ARABIC TURNED DAMMA BELOW..DEVANAGARI SIGN ANUSVARA\n\t\tcode === 0x093A || // Mn DEVANAGARI VOWEL SIGN OE\n\t\tcode === 0x093C || // Mn DEVANAGARI SIGN NUKTA\n\t\t( 0x0941 <= code && code <= 0x0948 ) || // Mn [8] DEVANAGARI VOWEL SIGN U..DEVANAGARI VOWEL SIGN AI\n\t\tcode === 0x094D || // Mn DEVANAGARI SIGN VIRAMA\n\t\t( 0x0951 <= code && code <= 0x0957 ) || // Mn [7] DEVANAGARI STRESS SIGN UDATTA..DEVANAGARI VOWEL SIGN UUE\n\t\t( 0x0962 <= code && code <= 0x0963 ) || // Mn [2] DEVANAGARI VOWEL SIGN VOCALIC L..DEVANAGARI VOWEL SIGN VOCALIC LL\n\t\tcode === 0x0981 || // Mn BENGALI SIGN CANDRABINDU\n\t\tcode === 0x09BC || // Mn BENGALI SIGN NUKTA\n\t\tcode === 0x09BE || // Mc BENGALI VOWEL SIGN AA\n\t\t( 0x09C1 <= code && code <= 0x09C4 ) || // Mn [4] BENGALI VOWEL SIGN U..BENGALI VOWEL SIGN VOCALIC RR\n\t\tcode === 0x09CD || // Mn BENGALI SIGN VIRAMA\n\t\tcode === 0x09D7 || // Mc BENGALI AU LENGTH MARK\n\t\t( 0x09E2 <= code && code <= 0x09E3 ) || // Mn [2] BENGALI VOWEL SIGN VOCALIC L..BENGALI VOWEL SIGN VOCALIC LL\n\t\tcode === 0x09FE || // Mn BENGALI SANDHI MARK\n\t\t( 0x0A01 <= code && code <= 0x0A02 ) || // Mn [2] GURMUKHI SIGN ADAK BINDI..GURMUKHI SIGN BINDI\n\t\tcode === 0x0A3C || // Mn GURMUKHI SIGN NUKTA\n\t\t( 0x0A41 <= code && code <= 0x0A42 ) || // Mn [2] GURMUKHI VOWEL SIGN U..GURMUKHI VOWEL SIGN UU\n\t\t( 0x0A47 <= code && code <= 0x0A48 ) || // Mn [2] GURMUKHI VOWEL SIGN EE..GURMUKHI VOWEL SIGN AI\n\t\t( 0x0A4B <= code && code <= 0x0A4D ) || // Mn [3] GURMUKHI VOWEL SIGN OO..GURMUKHI SIGN VIRAMA\n\t\tcode === 0x0A51 || // Mn GURMUKHI SIGN UDAAT\n\t\t( 0x0A70 <= code && code <= 0x0A71 ) || // Mn [2] GURMUKHI TIPPI..GURMUKHI ADDAK\n\t\tcode === 0x0A75 || // Mn GURMUKHI SIGN YAKASH\n\t\t( 0x0A81 <= code && code <= 0x0A82 ) || // Mn [2] GUJARATI SIGN CANDRABINDU..GUJARATI SIGN ANUSVARA\n\t\tcode === 0x0ABC || // Mn GUJARATI SIGN NUKTA\n\t\t( 0x0AC1 <= code && code <= 0x0AC5 ) || // Mn [5] GUJARATI VOWEL SIGN U..GUJARATI VOWEL SIGN CANDRA E\n\t\t( 0x0AC7 <= code && code <= 0x0AC8 ) || // Mn [2] GUJARATI VOWEL SIGN E..GUJARATI VOWEL SIGN AI\n\t\tcode === 0x0ACD || // Mn GUJARATI SIGN VIRAMA\n\t\t( 0x0AE2 <= code && code <= 0x0AE3 ) || // Mn [2] GUJARATI VOWEL SIGN VOCALIC L..GUJARATI VOWEL SIGN VOCALIC LL\n\t\t( 0x0AFA <= code && code <= 0x0AFF ) || // Mn [6] GUJARATI SIGN SUKUN..GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE\n\t\tcode === 0x0B01 || // Mn ORIYA SIGN CANDRABINDU\n\t\tcode === 0x0B3C || // Mn ORIYA SIGN NUKTA\n\t\tcode === 0x0B3E || // Mc ORIYA VOWEL SIGN AA\n\t\tcode === 0x0B3F || // Mn ORIYA VOWEL SIGN I\n\t\t( 0x0B41 <= code && code <= 0x0B44 ) || // Mn [4] ORIYA VOWEL SIGN U..ORIYA VOWEL SIGN VOCALIC RR\n\t\tcode === 0x0B4D || // Mn ORIYA SIGN VIRAMA\n\t\t( 0x0B55 <= code && code <= 0x0B56 ) || // Mn [2] ORIYA SIGN OVERLINE..ORIYA AI LENGTH MARK\n\t\tcode === 0x0B57 || // Mc ORIYA AU LENGTH MARK\n\t\t( 0x0B62 <= code && code <= 0x0B63 ) || // Mn [2] ORIYA VOWEL SIGN VOCALIC L..ORIYA VOWEL SIGN VOCALIC LL\n\t\tcode === 0x0B82 || // Mn TAMIL SIGN ANUSVARA\n\t\tcode === 0x0BBE || // Mc TAMIL VOWEL SIGN AA\n\t\tcode === 0x0BC0 || // Mn TAMIL VOWEL SIGN II\n\t\tcode === 0x0BCD || // Mn TAMIL SIGN VIRAMA\n\t\tcode === 0x0BD7 || // Mc TAMIL AU LENGTH MARK\n\t\tcode === 0x0C00 || // Mn TELUGU SIGN COMBINING CANDRABINDU ABOVE\n\t\tcode === 0x0C04 || // Mn TELUGU SIGN COMBINING ANUSVARA ABOVE\n\t\t( 0x0C3E <= code && code <= 0x0C40 ) || // Mn [3] TELUGU VOWEL SIGN AA..TELUGU VOWEL SIGN II\n\t\t( 0x0C46 <= code && code <= 0x0C48 ) || // Mn [3] TELUGU VOWEL SIGN E..TELUGU VOWEL SIGN AI\n\t\t( 0x0C4A <= code && code <= 0x0C4D ) || // Mn [4] TELUGU VOWEL SIGN O..TELUGU SIGN VIRAMA\n\t\t( 0x0C55 <= code && code <= 0x0C56 ) || // Mn [2] TELUGU LENGTH MARK..TELUGU AI LENGTH MARK\n\t\t( 0x0C62 <= code && code <= 0x0C63 ) || // Mn [2] TELUGU VOWEL SIGN VOCALIC L..TELUGU VOWEL SIGN VOCALIC LL\n\t\tcode === 0x0C81 || // Mn KANNADA SIGN CANDRABINDU\n\t\tcode === 0x0CBC || // Mn KANNADA SIGN NUKTA\n\t\tcode === 0x0CBF || // Mn KANNADA VOWEL SIGN I\n\t\tcode === 0x0CC2 || // Mc KANNADA VOWEL SIGN UU\n\t\tcode === 0x0CC6 || // Mn KANNADA VOWEL SIGN E\n\t\t( 0x0CCC <= code && code <= 0x0CCD ) || // Mn [2] KANNADA VOWEL SIGN AU..KANNADA SIGN VIRAMA\n\t\t( 0x0CD5 <= code && code <= 0x0CD6 ) || // Mc [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK\n\t\t( 0x0CE2 <= code && code <= 0x0CE3 ) || // Mn [2] KANNADA VOWEL SIGN VOCALIC L..KANNADA VOWEL SIGN VOCALIC LL\n\t\t( 0x0D00 <= code && code <= 0x0D01 ) || // Mn [2] MALAYALAM SIGN COMBINING ANUSVARA ABOVE..MALAYALAM SIGN CANDRABINDU\n\t\t( 0x0D3B <= code && code <= 0x0D3C ) || // Mn [2] MALAYALAM SIGN VERTICAL BAR VIRAMA..MALAYALAM SIGN CIRCULAR VIRAMA\n\t\tcode === 0x0D3E || // Mc MALAYALAM VOWEL SIGN AA\n\t\t( 0x0D41 <= code && code <= 0x0D44 ) || // Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM VOWEL SIGN VOCALIC RR\n\t\tcode === 0x0D4D || // Mn MALAYALAM SIGN VIRAMA\n\t\tcode === 0x0D57 || // Mc MALAYALAM AU LENGTH MARK\n\t\t( 0x0D62 <= code && code <= 0x0D63 ) || // Mn [2] MALAYALAM VOWEL SIGN VOCALIC L..MALAYALAM VOWEL SIGN VOCALIC LL\n\t\tcode === 0x0D81 || // Mn SINHALA SIGN CANDRABINDU\n\t\tcode === 0x0DCA || // Mn SINHALA SIGN AL-LAKUNA\n\t\tcode === 0x0DCF || // Mc SINHALA VOWEL SIGN AELA-PILLA\n\t\t( 0x0DD2 <= code && code <= 0x0DD4 ) || // Mn [3] SINHALA VOWEL SIGN KETTI IS-PILLA..SINHALA VOWEL SIGN KETTI PAA-PILLA\n\t\tcode === 0x0DD6 || // Mn SINHALA VOWEL SIGN DIGA PAA-PILLA\n\t\tcode === 0x0DDF || // Mc SINHALA VOWEL SIGN GAYANUKITTA\n\t\tcode === 0x0E31 || // Mn THAI CHARACTER MAI HAN-AKAT\n\t\t( 0x0E34 <= code && code <= 0x0E3A ) || // Mn [7] THAI CHARACTER SARA I..THAI CHARACTER PHINTHU\n\t\t( 0x0E47 <= code && code <= 0x0E4E ) || // Mn [8] THAI CHARACTER MAITAIKHU..THAI CHARACTER YAMAKKAN\n\t\tcode === 0x0EB1 || // Mn LAO VOWEL SIGN MAI KAN\n\t\t( 0x0EB4 <= code && code <= 0x0EBC ) || // Mn [9] LAO VOWEL SIGN I..LAO SEMIVOWEL SIGN LO\n\t\t( 0x0EC8 <= code && code <= 0x0ECD ) || // Mn [6] LAO TONE MAI EK..LAO NIGGAHITA\n\t\t( 0x0F18 <= code && code <= 0x0F19 ) || // Mn [2] TIBETAN ASTROLOGICAL SIGN -KHYUD PA..TIBETAN ASTROLOGICAL SIGN SDONG TSHUGS\n\t\tcode === 0x0F35 || // Mn TIBETAN MARK NGAS BZUNG NYI ZLA\n\t\tcode === 0x0F37 || // Mn TIBETAN MARK NGAS BZUNG SGOR RTAGS\n\t\tcode === 0x0F39 || // Mn TIBETAN MARK TSA -PHRU\n\t\t( 0x0F71 <= code && code <= 0x0F7E ) || // Mn [14] TIBETAN VOWEL SIGN AA..TIBETAN SIGN RJES SU NGA RO\n\t\t( 0x0F80 <= code && code <= 0x0F84 ) || // Mn [5] TIBETAN VOWEL SIGN REVERSED I..TIBETAN MARK HALANTA\n\t\t( 0x0F86 <= code && code <= 0x0F87 ) || // Mn [2] TIBETAN SIGN LCI RTAGS..TIBETAN SIGN YANG RTAGS\n\t\t( 0x0F8D <= code && code <= 0x0F97 ) || // Mn [11] TIBETAN SUBJOINED SIGN LCE TSA CAN..TIBETAN SUBJOINED LETTER JA\n\t\t( 0x0F99 <= code && code <= 0x0FBC ) || // Mn [36] TIBETAN SUBJOINED LETTER NYA..TIBETAN SUBJOINED LETTER FIXED-FORM RA\n\t\tcode === 0x0FC6 || // Mn TIBETAN SYMBOL PADMA GDAN\n\t\t( 0x102D <= code && code <= 0x1030 ) || // Mn [4] MYANMAR VOWEL SIGN I..MYANMAR VOWEL SIGN UU\n\t\t( 0x1032 <= code && code <= 0x1037 ) || // Mn [6] MYANMAR VOWEL SIGN AI..MYANMAR SIGN DOT BELOW\n\t\t( 0x1039 <= code && code <= 0x103A ) || // Mn [2] MYANMAR SIGN VIRAMA..MYANMAR SIGN ASAT\n\t\t( 0x103D <= code && code <= 0x103E ) || // Mn [2] MYANMAR CONSONANT SIGN MEDIAL WA..MYANMAR CONSONANT SIGN MEDIAL HA\n\t\t( 0x1058 <= code && code <= 0x1059 ) || // Mn [2] MYANMAR VOWEL SIGN VOCALIC L..MYANMAR VOWEL SIGN VOCALIC LL\n\t\t( 0x105E <= code && code <= 0x1060 ) || // Mn [3] MYANMAR CONSONANT SIGN MON MEDIAL NA..MYANMAR CONSONANT SIGN MON MEDIAL LA\n\t\t( 0x1071 <= code && code <= 0x1074 ) || // Mn [4] MYANMAR VOWEL SIGN GEBA KAREN I..MYANMAR VOWEL SIGN KAYAH EE\n\t\tcode === 0x1082 || // Mn MYANMAR CONSONANT SIGN SHAN MEDIAL WA\n\t\t( 0x1085 <= code && code <= 0x1086 ) || // Mn [2] MYANMAR VOWEL SIGN SHAN E ABOVE..MYANMAR VOWEL SIGN SHAN FINAL Y\n\t\tcode === 0x108D || // Mn MYANMAR SIGN SHAN COUNCIL EMPHATIC TONE\n\t\tcode === 0x109D || // Mn MYANMAR VOWEL SIGN AITON AI\n\t\t( 0x135D <= code && code <= 0x135F ) || // Mn [3] ETHIOPIC COMBINING GEMINATION AND VOWEL LENGTH MARK..ETHIOPIC COMBINING GEMINATION MARK\n\t\t( 0x1712 <= code && code <= 0x1714 ) || // Mn [3] TAGALOG VOWEL SIGN I..TAGALOG SIGN VIRAMA\n\t\t( 0x1732 <= code && code <= 0x1734 ) || // Mn [3] HANUNOO VOWEL SIGN I..HANUNOO SIGN PAMUDPOD\n\t\t( 0x1752 <= code && code <= 0x1753 ) || // Mn [2] BUHID VOWEL SIGN I..BUHID VOWEL SIGN U\n\t\t( 0x1772 <= code && code <= 0x1773 ) || // Mn [2] TAGBANWA VOWEL SIGN I..TAGBANWA VOWEL SIGN U\n\t\t( 0x17B4 <= code && code <= 0x17B5 ) || // Mn [2] KHMER VOWEL INHERENT AQ..KHMER VOWEL INHERENT AA\n\t\t( 0x17B7 <= code && code <= 0x17BD ) || // Mn [7] KHMER VOWEL SIGN I..KHMER VOWEL SIGN UA\n\t\tcode === 0x17C6 || // Mn KHMER SIGN NIKAHIT\n\t\t( 0x17C9 <= code && code <= 0x17D3 ) || // Mn [11] KHMER SIGN MUUSIKATOAN..KHMER SIGN BATHAMASAT\n\t\tcode === 0x17DD || // Mn KHMER SIGN ATTHACAN\n\t\t( 0x180B <= code && code <= 0x180D ) || // Mn [3] MONGOLIAN FREE VARIATION SELECTOR ONE..MONGOLIAN FREE VARIATION SELECTOR THREE\n\t\t( 0x1885 <= code && code <= 0x1886 ) || // Mn [2] MONGOLIAN LETTER ALI GALI BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA\n\t\tcode === 0x18A9 || // Mn MONGOLIAN LETTER ALI GALI DAGALGA\n\t\t( 0x1920 <= code && code <= 0x1922 ) || // Mn [3] LIMBU VOWEL SIGN A..LIMBU VOWEL SIGN U\n\t\t( 0x1927 <= code && code <= 0x1928 ) || // Mn [2] LIMBU VOWEL SIGN E..LIMBU VOWEL SIGN O\n\t\tcode === 0x1932 || // Mn LIMBU SMALL LETTER ANUSVARA\n\t\t( 0x1939 <= code && code <= 0x193B ) || // Mn [3] LIMBU SIGN MUKPHRENG..LIMBU SIGN SA-I\n\t\t( 0x1A17 <= code && code <= 0x1A18 ) || // Mn [2] BUGINESE VOWEL SIGN I..BUGINESE VOWEL SIGN U\n\t\tcode === 0x1A1B || // Mn BUGINESE VOWEL SIGN AE\n\t\tcode === 0x1A56 || // Mn TAI THAM CONSONANT SIGN MEDIAL LA\n\t\t( 0x1A58 <= code && code <= 0x1A5E ) || // Mn [7] TAI THAM SIGN MAI KANG LAI..TAI THAM CONSONANT SIGN SA\n\t\tcode === 0x1A60 || // Mn TAI THAM SIGN SAKOT\n\t\tcode === 0x1A62 || // Mn TAI THAM VOWEL SIGN MAI SAT\n\t\t( 0x1A65 <= code && code <= 0x1A6C ) || // Mn [8] TAI THAM VOWEL SIGN I..TAI THAM VOWEL SIGN OA BELOW\n\t\t( 0x1A73 <= code && code <= 0x1A7C ) || // Mn [10] TAI THAM VOWEL SIGN OA ABOVE..TAI THAM SIGN KHUEN-LUE KARAN\n\t\tcode === 0x1A7F || // Mn TAI THAM COMBINING CRYPTOGRAMMIC DOT\n\t\t( 0x1AB0 <= code && code <= 0x1ABD ) || // Mn [14] COMBINING DOUBLED CIRCUMFLEX ACCENT..COMBINING PARENTHESES BELOW\n\t\tcode === 0x1ABE || // Me COMBINING PARENTHESES OVERLAY\n\t\t( 0x1ABF <= code && code <= 0x1AC0 ) || // Mn [2] COMBINING LATIN SMALL LETTER W BELOW..COMBINING LATIN SMALL LETTER TURNED W BELOW\n\t\t( 0x1B00 <= code && code <= 0x1B03 ) || // Mn [4] BALINESE SIGN ULU RICEM..BALINESE SIGN SURANG\n\t\tcode === 0x1B34 || // Mn BALINESE SIGN REREKAN\n\t\tcode === 0x1B35 || // Mc BALINESE VOWEL SIGN TEDUNG\n\t\t( 0x1B36 <= code && code <= 0x1B3A) || // Mn [5] BALINESE VOWEL SIGN ULU..BALINESE VOWEL SIGN RA REPA\n\t\tcode === 0x1B3C || // Mn BALINESE VOWEL SIGN LA LENGA\n\t\tcode === 0x1B42 || // Mn BALINESE VOWEL SIGN PEPET\n\t\t( 0x1B6B <= code && code <= 0x1B73 ) || // Mn [9] BALINESE MUSICAL SYMBOL COMBINING TEGEH..BALINESE MUSICAL SYMBOL COMBINING GONG\n\t\t( 0x1B80 <= code && code <= 0x1B81 ) || // Mn [2] SUNDANESE SIGN PANYECEK..SUNDANESE SIGN PANGLAYAR\n\t\t( 0x1BA2 <= code && code <= 0x1BA5 ) || // Mn [4] SUNDANESE CONSONANT SIGN PANYAKRA..SUNDANESE VOWEL SIGN PANYUKU\n\t\t( 0x1BA8 <= code && code <= 0x1BA9 ) || // Mn [2] SUNDANESE VOWEL SIGN PAMEPET..SUNDANESE VOWEL SIGN PANEULEUNG\n\t\t( 0x1BAB <= code && code <= 0x1BAD ) || // Mn [3] SUNDANESE SIGN VIRAMA..SUNDANESE CONSONANT SIGN PASANGAN WA\n\t\tcode === 0x1BE6 || // Mn BATAK SIGN TOMPI\n\t\t( 0x1BE8 <= code && code <= 0x1BE9) || // Mn [2] BATAK VOWEL SIGN PAKPAK E..BATAK VOWEL SIGN EE\n\t\tcode === 0x1BED || // Mn BATAK VOWEL SIGN KARO O\n\t\t( 0x1BEF <= code && code <= 0x1BF1 ) || // Mn [3] BATAK VOWEL SIGN U FOR SIMALUNGUN SA..BATAK CONSONANT SIGN H\n\t\t( 0x1C2C <= code && code <= 0x1C33 ) || // Mn [8] LEPCHA VOWEL SIGN E..LEPCHA CONSONANT SIGN T\n\t\t( 0x1C36 <= code && code <= 0x1C37 ) || // Mn [2] LEPCHA SIGN RAN..LEPCHA SIGN NUKTA\n\t\t( 0x1CD0 <= code && code <= 0x1CD2 ) || // Mn [3] VEDIC TONE KARSHANA..VEDIC TONE PRENKHA\n\t\t( 0x1CD4 <= code && code <= 0x1CE0 ) || // Mn [13] VEDIC SIGN YAJURVEDIC MIDLINE SVARITA..VEDIC TONE RIGVEDIC KASHMIRI INDEPENDENT SVARITA\n\t\t( 0x1CE2 <= code && code <= 0x1CE8 ) || // Mn [7] VEDIC SIGN VISARGA SVARITA..VEDIC SIGN VISARGA ANUDATTA WITH TAIL\n\t\tcode === 0x1CED || // Mn VEDIC SIGN TIRYAK\n\t\tcode === 0x1CF4 || // Mn VEDIC TONE CANDRA ABOVE\n\t\t( 0x1CF8 <= code && code <= 0x1CF9 ) || // Mn [2] VEDIC TONE RING ABOVE..VEDIC TONE DOUBLE RING ABOVE\n\t\t( 0x1DC0 <= code && code <= 0x1DF9 ) || // Mn [58] COMBINING DOTTED GRAVE ACCENT..COMBINING WIDE INVERTED BRIDGE BELOW\n\t\t( 0x1DFB <= code && code <= 0x1DFF ) || // Mn [5] COMBINING DELETION MARK..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW\n\t\tcode === 0x200C || // Cf ZERO WIDTH NON-JOINER\n\t\t( 0x20D0 <= code && code <= 0x20DC ) || // Mn [13] COMBINING LEFT HARPOON ABOVE..COMBINING FOUR DOTS ABOVE\n\t\t( 0x20DD <= code && code <= 0x20E0 ) || // Me [4] COMBINING ENCLOSING CIRCLE..COMBINING ENCLOSING CIRCLE BACKSLASH\n\t\tcode === 0x20E1 || // Mn COMBINING LEFT RIGHT ARROW ABOVE\n\t\t( 0x20E2 <= code && code <= 0x20E4 ) || // Me [3] COMBINING ENCLOSING SCREEN..COMBINING ENCLOSING UPWARD POINTING TRIANGLE\n\t\t( 0x20E5 <= code && code <= 0x20F0 ) || // Mn [12] COMBINING REVERSE SOLIDUS OVERLAY..COMBINING ASTERISK ABOVE\n\t\t( 0x2CEF <= code && code <= 0x2CF1 ) || // Mn [3] COPTIC COMBINING NI ABOVE..COPTIC COMBINING SPIRITUS LENIS\n\t\tcode === 0x2D7F || // Mn TIFINAGH CONSONANT JOINER\n\t\t( 0x2DE0 <= code && code <= 0x2DFF ) || // Mn [32] COMBINING CYRILLIC LETTER BE..COMBINING CYRILLIC LETTER IOTIFIED BIG YUS\n\t\t( 0x302A <= code && code <= 0x302D ) || // Mn [4] IDEOGRAPHIC LEVEL TONE MARK..IDEOGRAPHIC ENTERING TONE MARK\n\t\t( 0x302E <= code && code <= 0x302F ) || // Mc [2] HANGUL SINGLE DOT TONE MARK..HANGUL DOUBLE DOT TONE MARK\n\t\t( 0x3099 <= code && code <= 0x309A ) || // Mn [2] COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK..COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK\n\t\tcode === 0xA66F || // Mn COMBINING CYRILLIC VZMET\n\t\t( 0xA670 <= code && code <= 0xA672 ) || // Me [3] COMBINING CYRILLIC TEN MILLIONS SIGN..COMBINING CYRILLIC THOUSAND MILLIONS SIGN\n\t\t( 0xA674 <= code && code <= 0xA67D ) || // Mn [10] COMBINING CYRILLIC LETTER UKRAINIAN IE..COMBINING CYRILLIC PAYEROK\n\t\t( 0xA69E <= code && code <= 0xA69F ) || // Mn [2] COMBINING CYRILLIC LETTER EF..COMBINING CYRILLIC LETTER IOTIFIED E\n\t\t( 0xA6F0 <= code && code <= 0xA6F1 ) || // Mn [2] BAMUM COMBINING MARK KOQNDON..BAMUM COMBINING MARK TUKWENTIS\n\t\tcode === 0xA802 || // Mn SYLOTI NAGRI SIGN DVISVARA\n\t\tcode === 0xA806 || // Mn SYLOTI NAGRI SIGN HASANTA\n\t\tcode === 0xA80B || // Mn SYLOTI NAGRI SIGN ANUSVARA\n\t\t( 0xA825 <= code && code <= 0xA826 ) || // Mn [2] SYLOTI NAGRI VOWEL SIGN U..SYLOTI NAGRI VOWEL SIGN E\n\t\tcode === 0xA82C || // Mn SYLOTI NAGRI SIGN ALTERNATE HASANTA\n\t\t( 0xA8C4 <= code && code <= 0xA8C5 ) || // Mn [2] SAURASHTRA SIGN VIRAMA..SAURASHTRA SIGN CANDRABINDU\n\t\t( 0xA8E0 <= code && code <= 0xA8F1 ) || // Mn [18] COMBINING DEVANAGARI DIGIT ZERO..COMBINING DEVANAGARI SIGN AVAGRAHA\n\t\tcode === 0xA8FF || // Mn DEVANAGARI VOWEL SIGN AY\n\t\t( 0xA926 <= code && code <= 0xA92D ) || // Mn [8] KAYAH LI VOWEL UE..KAYAH LI TONE CALYA PLOPHU\n\t\t( 0xA947 <= code && code <= 0xA951 ) || // Mn [11] REJANG VOWEL SIGN I..REJANG CONSONANT SIGN R\n\t\t( 0xA980 <= code && code <= 0xA982 ) || // Mn [3] JAVANESE SIGN PANYANGGA..JAVANESE SIGN LAYAR\n\t\tcode === 0xA9B3 || // Mn JAVANESE SIGN CECAK TELU\n\t\t( 0xA9B6 <= code && code <= 0xA9B9 ) || // Mn [4] JAVANESE VOWEL SIGN WULU..JAVANESE VOWEL SIGN SUKU MENDUT\n\t\t( 0xA9BC <= code && code <= 0xA9BD ) || // Mn [2] JAVANESE VOWEL SIGN PEPET..JAVANESE CONSONANT SIGN KERET\n\t\tcode === 0xA9E5 || // Mn MYANMAR SIGN SHAN SAW\n\t\t( 0xAA29 <= code && code <= 0xAA2E ) || // Mn [6] CHAM VOWEL SIGN AA..CHAM VOWEL SIGN OE\n\t\t( 0xAA31 <= code && code <= 0xAA32 ) || // Mn [2] CHAM VOWEL SIGN AU..CHAM VOWEL SIGN UE\n\t\t( 0xAA35 <= code && code <= 0xAA36 ) || // Mn [2] CHAM CONSONANT SIGN LA..CHAM CONSONANT SIGN WA\n\t\tcode === 0xAA43 || // Mn CHAM CONSONANT SIGN FINAL NG\n\t\tcode === 0xAA4C || // Mn CHAM CONSONANT SIGN FINAL M\n\t\tcode === 0xAA7C || // Mn MYANMAR SIGN TAI LAING TONE-2\n\t\tcode === 0xAAB0 || // Mn TAI VIET MAI KANG\n\t\t( 0xAAB2 <= code && code <= 0xAAB4 ) || // Mn [3] TAI VIET VOWEL I..TAI VIET VOWEL U\n\t\t( 0xAAB7 <= code && code <= 0xAAB8 ) || // Mn [2] TAI VIET MAI KHIT..TAI VIET VOWEL IA\n\t\t( 0xAABE <= code && code <= 0xAABF ) || // Mn [2] TAI VIET VOWEL AM..TAI VIET TONE MAI EK\n\t\tcode === 0xAAC1 || // Mn TAI VIET TONE MAI THO\n\t\t( 0xAAEC <= code && code <= 0xAAED ) || // Mn [2] MEETEI MAYEK VOWEL SIGN UU..MEETEI MAYEK VOWEL SIGN AAI\n\t\tcode === 0xAAF6 || // Mn MEETEI MAYEK VIRAMA\n\t\tcode === 0xABE5 || // Mn MEETEI MAYEK VOWEL SIGN ANAP\n\t\tcode === 0xABE8 || // Mn MEETEI MAYEK VOWEL SIGN UNAP\n\t\tcode === 0xABED || // Mn MEETEI MAYEK APUN IYEK\n\t\tcode === 0xFB1E || // Mn HEBREW POINT JUDEO-SPANISH VARIKA\n\t\t( 0xFE00 <= code && code <= 0xFE0F ) || // Mn [16] VARIATION SELECTOR-1..VARIATION SELECTOR-16\n\t\t( 0xFE20 <= code && code <= 0xFE2F ) || // Mn [16] COMBINING LIGATURE LEFT HALF..COMBINING CYRILLIC TITLO RIGHT HALF\n\t\t( 0xFF9E <= code && code <= 0xFF9F ) || // Lm [2] HALFWIDTH KATAKANA VOICED SOUND MARK..HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK\n\t\tcode === 0x101FD || // Mn PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE\n\t\tcode === 0x102E0 || // Mn COPTIC EPACT THOUSANDS MARK\n\t\t( 0x10376 <= code && code <= 0x1037A ) || // Mn [5] COMBINING OLD PERMIC LETTER AN..COMBINING OLD PERMIC LETTER SII\n\t\t( 0x10A01 <= code && code <= 0x10A03 ) || // Mn [3] KHAROSHTHI VOWEL SIGN I..KHAROSHTHI VOWEL SIGN VOCALIC R\n\t\t( 0x10A05 <= code && code <= 0x10A06 ) || // Mn [2] KHAROSHTHI VOWEL SIGN E..KHAROSHTHI VOWEL SIGN O\n\t\t( 0x10A0C <= code && code <= 0x10A0F ) || // Mn [4] KHAROSHTHI VOWEL LENGTH MARK..KHAROSHTHI SIGN VISARGA\n\t\t( 0x10A38 <= code && code <= 0x10A3A ) || // Mn [3] KHAROSHTHI SIGN BAR ABOVE..KHAROSHTHI SIGN DOT BELOW\n\t\tcode === 0x10A3F || // Mn KHAROSHTHI VIRAMA\n\t\t( 0x10AE5 <= code && code <= 0x10AE6 ) || // Mn [2] MANICHAEAN ABBREVIATION MARK ABOVE..MANICHAEAN ABBREVIATION MARK BELOW\n\t\t( 0x10D24 <= code && code <= 0x10D27 ) || // Mn [4] HANIFI ROHINGYA SIGN HARBAHAY..HANIFI ROHINGYA SIGN TASSI\n\t\t( 0x10EAB <= code && code <= 0x10EAC ) || // Mn [2] YEZIDI COMBINING HAMZA MARK..YEZIDI COMBINING MADDA MARK\n\t\t( 0x10F46 <= code && code <= 0x10F50 ) || // Mn [11] SOGDIAN COMBINING DOT BELOW..SOGDIAN COMBINING STROKE BELOW\n\t\tcode === 0x11001 || // Mn BRAHMI SIGN ANUSVARA\n\t\t( 0x11038 <= code && code <= 0x11046 ) || // Mn [15] BRAHMI VOWEL SIGN AA..BRAHMI VIRAMA\n\t\t( 0x1107F <= code && code <= 0x11081 ) || // Mn [3] BRAHMI NUMBER JOINER..KAITHI SIGN ANUSVARA\n\t\t( 0x110B3 <= code && code <= 0x110B6 ) || // Mn [4] KAITHI VOWEL SIGN U..KAITHI VOWEL SIGN AI\n\t\t( 0x110B9 <= code && code <= 0x110BA ) || // Mn [2] KAITHI SIGN VIRAMA..KAITHI SIGN NUKTA\n\t\t( 0x11100 <= code && code <= 0x11102 ) || // Mn [3] CHAKMA SIGN CANDRABINDU..CHAKMA SIGN VISARGA\n\t\t( 0x11127 <= code && code <= 0x1112B ) || // Mn [5] CHAKMA VOWEL SIGN A..CHAKMA VOWEL SIGN UU\n\t\t( 0x1112D <= code && code <= 0x11134 ) || // Mn [8] CHAKMA VOWEL SIGN AI..CHAKMA MAAYYAA\n\t\tcode === 0x11173 || // Mn MAHAJANI SIGN NUKTA\n\t\t( 0x11180 <= code && code <= 0x11181 ) || // Mn [2] SHARADA SIGN CANDRABINDU..SHARADA SIGN ANUSVARA\n\t\t( 0x111B6 <= code && code <= 0x111BE ) || // Mn [9] SHARADA VOWEL SIGN U..SHARADA VOWEL SIGN O\n\t\t( 0x111C9 <= code && code <= 0x111CC ) || // Mn [4] SHARADA SANDHI MARK..SHARADA EXTRA SHORT VOWEL MARK\n\t\tcode === 0x111CF || // Mn SHARADA SIGN INVERTED CANDRABINDU\n\t\t( 0x1122F <= code && code <= 0x11231 ) || // Mn [3] KHOJKI VOWEL SIGN U..KHOJKI VOWEL SIGN AI\n\t\tcode === 0x11234 || // Mn KHOJKI SIGN ANUSVARA\n\t\t( 0x11236 <= code && code <= 0x11237 ) || // Mn [2] KHOJKI SIGN NUKTA..KHOJKI SIGN SHADDA\n\t\tcode === 0x1123E || // Mn KHOJKI SIGN SUKUN\n\t\tcode === 0x112DF || // Mn KHUDAWADI SIGN ANUSVARA\n\t\t( 0x112E3 <= code && code <= 0x112EA ) || // Mn [8] KHUDAWADI VOWEL SIGN U..KHUDAWADI SIGN VIRAMA\n\t\t( 0x11300 <= code && code <= 0x11301 ) || // Mn [2] GRANTHA SIGN COMBINING ANUSVARA ABOVE..GRANTHA SIGN CANDRABINDU\n\t\t( 0x1133B <= code && code <= 0x1133C ) || // Mn [2] COMBINING BINDU BELOW..GRANTHA SIGN NUKTA\n\t\tcode === 0x1133E || // Mc GRANTHA VOWEL SIGN AA\n\t\tcode === 0x11340 || // Mn GRANTHA VOWEL SIGN II\n\t\tcode === 0x11357 || // Mc GRANTHA AU LENGTH MARK\n\t\t( 0x11366 <= code && code <= 0x1136C ) || // Mn [7] COMBINING GRANTHA DIGIT ZERO..COMBINING GRANTHA DIGIT SIX\n\t\t( 0x11370 <= code && code <= 0x11374 ) || // Mn [5] COMBINING GRANTHA LETTER A..COMBINING GRANTHA LETTER PA\n\t\t( 0x11438 <= code && code <= 0x1143F ) || // Mn [8] NEWA VOWEL SIGN U..NEWA VOWEL SIGN AI\n\t\t( 0x11442 <= code && code <= 0x11444 ) || // Mn [3] NEWA SIGN VIRAMA..NEWA SIGN ANUSVARA\n\t\tcode === 0x11446 || // Mn NEWA SIGN NUKTA\n\t\tcode === 0x1145E || // Mn NEWA SANDHI MARK\n\t\tcode === 0x114B0 || // Mc TIRHUTA VOWEL SIGN AA\n\t\t( 0x114B3 <= code && code <= 0x114B8 ) || // Mn [6] TIRHUTA VOWEL SIGN U..TIRHUTA VOWEL SIGN VOCALIC LL\n\t\tcode === 0x114BA || // Mn TIRHUTA VOWEL SIGN SHORT E\n\t\tcode === 0x114BD || // Mc TIRHUTA VOWEL SIGN SHORT O\n\t\t( 0x114BF <= code && code <= 0x114C0 ) || // Mn [2] TIRHUTA SIGN CANDRABINDU..TIRHUTA SIGN ANUSVARA\n\t\t( 0x114C2 <= code && code <= 0x114C3 ) || // Mn [2] TIRHUTA SIGN VIRAMA..TIRHUTA SIGN NUKTA\n\t\tcode === 0x115AF || // Mc SIDDHAM VOWEL SIGN AA\n\t\t( 0x115B2 <= code && code <= 0x115B5 ) || // Mn [4] SIDDHAM VOWEL SIGN U..SIDDHAM VOWEL SIGN VOCALIC RR\n\t\t( 0x115BC <= code && code <= 0x115BD ) || // Mn [2] SIDDHAM SIGN CANDRABINDU..SIDDHAM SIGN ANUSVARA\n\t\t( 0x115BF <= code && code <= 0x115C0 ) || // Mn [2] SIDDHAM SIGN VIRAMA..SIDDHAM SIGN NUKTA\n\t\t( 0x115DC <= code && code <= 0x115DD ) || // Mn [2] SIDDHAM VOWEL SIGN ALTERNATE U..SIDDHAM VOWEL SIGN ALTERNATE UU\n\t\t( 0x11633 <= code && code <= 0x1163A ) || // Mn [8] MODI VOWEL SIGN U..MODI VOWEL SIGN AI\n\t\tcode === 0x1163D || // Mn MODI SIGN ANUSVARA\n\t\t( 0x1163F <= code && code <= 0x11640 ) || // Mn [2] MODI SIGN VIRAMA..MODI SIGN ARDHACANDRA\n\t\tcode === 0x116AB || // Mn TAKRI SIGN ANUSVARA\n\t\tcode === 0x116AD || // Mn TAKRI VOWEL SIGN AA\n\t\t( 0x116B0 <= code && code <= 0x116B5 ) || // Mn [6] TAKRI VOWEL SIGN U..TAKRI VOWEL SIGN AU\n\t\tcode === 0x116B7 || // Mn TAKRI SIGN NUKTA\n\t\t( 0x1171D <= code && code <= 0x1171F ) || // Mn [3] AHOM CONSONANT SIGN MEDIAL LA..AHOM CONSONANT SIGN MEDIAL LIGATING RA\n\t\t( 0x11722 <= code && code <= 0x11725 ) || // Mn [4] AHOM VOWEL SIGN I..AHOM VOWEL SIGN UU\n\t\t( 0x11727 <= code && code <= 0x1172B ) || // Mn [5] AHOM VOWEL SIGN AW..AHOM SIGN KILLER\n\t\t( 0x1182F <= code && code <= 0x11837 ) || // Mn [9] DOGRA VOWEL SIGN U..DOGRA SIGN ANUSVARA\n\t\t( 0x11839 <= code && code <= 0x1183A ) || // Mn [2] DOGRA SIGN VIRAMA..DOGRA SIGN NUKTA\n\t\tcode === 0x11930 || // Mc DIVES AKURU VOWEL SIGN AA\n\t\t( 0x1193B <= code && code <= 0x1193C ) || // Mn [2] DIVES AKURU SIGN ANUSVARA..DIVES AKURU SIGN CANDRABINDU\n\t\tcode === 0x1193E || // Mn DIVES AKURU VIRAMA\n\t\tcode === 0x11943 || // Mn DIVES AKURU SIGN NUKTA\n\t\t( 0x119D4 <= code && code <= 0x119D7 ) || // Mn [4] NANDINAGARI VOWEL SIGN U..NANDINAGARI VOWEL SIGN VOCALIC RR\n\t\t( 0x119DA <= code && code <= 0x119DB ) || // Mn [2] NANDINAGARI VOWEL SIGN E..NANDINAGARI VOWEL SIGN AI\n\t\tcode === 0x119E0 || // Mn NANDINAGARI SIGN VIRAMA\n\t\t( 0x11A01 <= code && code <= 0x11A0A ) || // Mn [10] ZANABAZAR SQUARE VOWEL SIGN I..ZANABAZAR SQUARE VOWEL LENGTH MARK\n\t\t( 0x11A33 <= code && code <= 0x11A38 ) || // Mn [6] ZANABAZAR SQUARE FINAL CONSONANT MARK..ZANABAZAR SQUARE SIGN ANUSVARA\n\t\t( 0x11A3B <= code && code <= 0x11A3E ) || // Mn [4] ZANABAZAR SQUARE CLUSTER-FINAL LETTER YA..ZANABAZAR SQUARE CLUSTER-FINAL LETTER VA\n\t\tcode === 0x11A47 || // Mn ZANABAZAR SQUARE SUBJOINER\n\t\t( 0x11A51 <= code && code <= 0x11A56 ) || // Mn [6] SOYOMBO VOWEL SIGN I..SOYOMBO VOWEL SIGN OE\n\t\t( 0x11A59 <= code && code <= 0x11A5B ) || // Mn [3] SOYOMBO VOWEL SIGN VOCALIC R..SOYOMBO VOWEL LENGTH MARK\n\t\t( 0x11A8A <= code && code <= 0x11A96 ) || // Mn [13] SOYOMBO FINAL CONSONANT SIGN G..SOYOMBO SIGN ANUSVARA\n\t\t( 0x11A98 <= code && code <= 0x11A99 ) || // Mn [2] SOYOMBO GEMINATION MARK..SOYOMBO SUBJOINER\n\t\t( 0x11C30 <= code && code <= 0x11C36 ) || // Mn [7] BHAIKSUKI VOWEL SIGN I..BHAIKSUKI VOWEL SIGN VOCALIC L\n\t\t( 0x11C38 <= code && code <= 0x11C3D ) || // Mn [6] BHAIKSUKI VOWEL SIGN E..BHAIKSUKI SIGN ANUSVARA\n\t\tcode === 0x11C3F || // Mn BHAIKSUKI SIGN VIRAMA\n\t\t( 0x11C92 <= code && code <= 0x11CA7 ) || // Mn [22] MARCHEN SUBJOINED LETTER KA..MARCHEN SUBJOINED LETTER ZA\n\t\t( 0x11CAA <= code && code <= 0x11CB0 ) || // Mn [7] MARCHEN SUBJOINED LETTER RA..MARCHEN VOWEL SIGN AA\n\t\t( 0x11CB2 <= code && code <= 0x11CB3 ) || // Mn [2] MARCHEN VOWEL SIGN U..MARCHEN VOWEL SIGN E\n\t\t( 0x11CB5 <= code && code <= 0x11CB6 ) || // Mn [2] MARCHEN SIGN ANUSVARA..MARCHEN SIGN CANDRABINDU\n\t\t( 0x11D31 <= code && code <= 0x11D36 ) || // Mn [6] MASARAM GONDI VOWEL SIGN AA..MASARAM GONDI VOWEL SIGN VOCALIC R\n\t\tcode === 0x11D3A || // Mn MASARAM GONDI VOWEL SIGN E\n\t\t( 0x11D3C <= code && code <= 0x11D3D ) || // Mn [2] MASARAM GONDI VOWEL SIGN AI..MASARAM GONDI VOWEL SIGN O\n\t\t( 0x11D3F <= code && code <= 0x11D45 ) || // Mn [7] MASARAM GONDI VOWEL SIGN AU..MASARAM GONDI VIRAMA\n\t\tcode === 0x11D47 || // Mn MASARAM GONDI RA-KARA\n\t\t( 0x11D90 <= code && code <= 0x11D91 ) || // Mn [2] GUNJALA GONDI VOWEL SIGN EE..GUNJALA GONDI VOWEL SIGN AI\n\t\tcode === 0x11D95 || // Mn GUNJALA GONDI SIGN ANUSVARA\n\t\tcode === 0x11D97 || // Mn GUNJALA GONDI VIRAMA\n\t\t( 0x11EF3 <= code && code <= 0x11EF4 ) || // Mn [2] MAKASAR VOWEL SIGN I..MAKASAR VOWEL SIGN U\n\t\t( 0x16AF0 <= code && code <= 0x16AF4 ) || // Mn [5] BASSA VAH COMBINING HIGH TONE..BASSA VAH COMBINING HIGH-LOW TONE\n\t\t( 0x16B30 <= code && code <= 0x16B36 ) || // Mn [7] PAHAWH HMONG MARK CIM TUB..PAHAWH HMONG MARK CIM TAUM\n\t\tcode === 0x16F4F || // Mn MIAO SIGN CONSONANT MODIFIER BAR\n\t\t( 0x16F8F <= code && code <= 0x16F92 ) || // Mn [4] MIAO TONE RIGHT..MIAO TONE BELOW\n\t\tcode === 0x16FE4 || // Mn KHITAN SMALL SCRIPT FILLER\n\t\t( 0x1BC9D <= code && code <= 0x1BC9E ) || // Mn [2] DUPLOYAN THICK LETTER SELECTOR..DUPLOYAN DOUBLE MARK\n\t\tcode === 0x1D165 || // Mc MUSICAL SYMBOL COMBINING STEM\n\t\t( 0x1D167 <= code && code <= 0x1D169 ) || // Mn [3] MUSICAL SYMBOL COMBINING TREMOLO-1..MUSICAL SYMBOL COMBINING TREMOLO-3\n\t\t( 0x1D16E <= code && code <= 0x1D172 ) || // Mc [5] MUSICAL SYMBOL COMBINING FLAG-1..MUSICAL SYMBOL COMBINING FLAG-5\n\t\t( 0x1D17B <= code && code <= 0x1D182 ) || // Mn [8] MUSICAL SYMBOL COMBINING ACCENT..MUSICAL SYMBOL COMBINING LOURE\n\t\t( 0x1D185 <= code && code <= 0x1D18B ) || // Mn [7] MUSICAL SYMBOL COMBINING DOIT..MUSICAL SYMBOL COMBINING TRIPLE TONGUE\n\t\t( 0x1D1AA <= code && code <= 0x1D1AD ) || // Mn [4] MUSICAL SYMBOL COMBINING DOWN BOW..MUSICAL SYMBOL COMBINING SNAP PIZZICATO\n\t\t( 0x1D242 <= code && code <= 0x1D244 ) || // Mn [3] COMBINING GREEK MUSICAL TRISEME..COMBINING GREEK MUSICAL PENTASEME\n\t\t( 0x1DA00 <= code && code <= 0x1DA36 ) || // Mn [55] SIGNWRITING HEAD RIM..SIGNWRITING AIR SUCKING IN\n\t\t( 0x1DA3B <= code && code <= 0x1DA6C ) || // Mn [50] SIGNWRITING MOUTH CLOSED NEUTRAL..SIGNWRITING EXCITEMENT\n\t\tcode === 0x1DA75 || // Mn SIGNWRITING UPPER BODY TILTING FROM HIP JOINTS\n\t\tcode === 0x1DA84 || // Mn SIGNWRITING LOCATION HEAD NECK\n\t\t( 0x1DA9B <= code && code <= 0x1DA9F ) || // Mn [5] SIGNWRITING FILL MODIFIER-2..SIGNWRITING FILL MODIFIER-6\n\t\t( 0x1DAA1 <= code && code <= 0x1DAAF ) || // Mn [15] SIGNWRITING ROTATION MODIFIER-2..SIGNWRITING ROTATION MODIFIER-16\n\t\t( 0x1E000 <= code && code <= 0x1E006 ) || // Mn [7] COMBINING GLAGOLITIC LETTER AZU..COMBINING GLAGOLITIC LETTER ZHIVETE\n\t\t( 0x1E008 <= code && code <= 0x1E018 ) || // Mn [17] COMBINING GLAGOLITIC LETTER ZEMLJA..COMBINING GLAGOLITIC LETTER HERU\n\t\t( 0x1E01B <= code && code <= 0x1E021 ) || // Mn [7] COMBINING GLAGOLITIC LETTER SHTA..COMBINING GLAGOLITIC LETTER YATI\n\t\t( 0x1E023 <= code && code <= 0x1E024 ) || // Mn [2] COMBINING GLAGOLITIC LETTER YU..COMBINING GLAGOLITIC LETTER SMALL YUS\n\t\t( 0x1E026 <= code && code <= 0x1E02A ) || // Mn [5] COMBINING GLAGOLITIC LETTER YO..COMBINING GLAGOLITIC LETTER FITA\n\t\t( 0x1E130 <= code && code <= 0x1E136 ) || // Mn [7] NYIAKENG PUACHUE HMONG TONE-B..NYIAKENG PUACHUE HMONG TONE-D\n\t\t( 0x1E2EC <= code && code <= 0x1E2EF ) || // Mn [4] WANCHO TONE TUP..WANCHO TONE KOINI\n\t\t( 0x1E8D0 <= code && code <= 0x1E8D6 ) || // Mn [7] MENDE KIKAKUI COMBINING NUMBER TEENS..MENDE KIKAKUI COMBINING NUMBER MILLIONS\n\t\t( 0x1E944 <= code && code <= 0x1E94A ) || // Mn [7] ADLAM ALIF LENGTHENER..ADLAM NUKTA\n\t\t( 0x1F3FB <= code && code <= 0x1F3FF ) || // Sk [5] EMOJI MODIFIER FITZPATRICK TYPE-1-2..EMOJI MODIFIER FITZPATRICK TYPE-6\n\t\t( 0xE0020 <= code && code <= 0xE007F ) || // Cf [96] TAG SPACE..CANCEL TAG\n\t\t( 0xE0100 <= code && code <= 0xE01EF ) // Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-256\n\t) {\n\t\treturn constants.Extend;\n\t}\n\tif (\n\t\t( 0x1F1E6 <= code && code <= 0x1F1FF ) // So [26] REGIONAL INDICATOR SYMBOL LETTER A..REGIONAL INDICATOR SYMBOL LETTER Z\n\t) {\n\t\treturn constants.RegionalIndicator;\n\t}\n\tif (\n\t\tcode === 0x0903 || // Mc DEVANAGARI SIGN VISARGA\n\t\tcode === 0x093B || // Mc DEVANAGARI VOWEL SIGN OOE\n\t\t( 0x093E <= code && code <= 0x0940 ) || // Mc [3] DEVANAGARI VOWEL SIGN AA..DEVANAGARI VOWEL SIGN II\n\t\t( 0x0949 <= code && code <= 0x094C ) || // Mc [4] DEVANAGARI VOWEL SIGN CANDRA O..DEVANAGARI VOWEL SIGN AU\n\t\t( 0x094E <= code && code <= 0x094F ) || // Mc [2] DEVANAGARI VOWEL SIGN PRISHTHAMATRA E..DEVANAGARI VOWEL SIGN AW\n\t\t( 0x0982 <= code && code <= 0x0983 ) || // Mc [2] BENGALI SIGN ANUSVARA..BENGALI SIGN VISARGA\n\t\t( 0x09BF <= code && code <= 0x09C0 ) || // Mc [2] BENGALI VOWEL SIGN I..BENGALI VOWEL SIGN II\n\t\t( 0x09C7 <= code && code <= 0x09C8 ) || // Mc [2] BENGALI VOWEL SIGN E..BENGALI VOWEL SIGN AI\n\t\t( 0x09CB <= code && code <= 0x09CC ) || // Mc [2] BENGALI VOWEL SIGN O..BENGALI VOWEL SIGN AU\n\t\tcode === 0x0A03 || // Mc GURMUKHI SIGN VISARGA\n\t\t( 0x0A3E <= code && code <= 0x0A40 ) || // Mc [3] GURMUKHI VOWEL SIGN AA..GURMUKHI VOWEL SIGN II\n\t\tcode === 0x0A83 || // Mc GUJARATI SIGN VISARGA\n\t\t( 0x0ABE <= code && code <= 0x0AC0 ) || // Mc [3] GUJARATI VOWEL SIGN AA..GUJARATI VOWEL SIGN II\n\t\tcode === 0x0AC9 || // Mc GUJARATI VOWEL SIGN CANDRA O\n\t\t( 0x0ACB <= code && code <= 0x0ACC ) || // Mc [2] GUJARATI VOWEL SIGN O..GUJARATI VOWEL SIGN AU\n\t\t( 0x0B02 <= code && code <= 0x0B03 ) || // Mc [2] ORIYA SIGN ANUSVARA..ORIYA SIGN VISARGA\n\t\tcode === 0x0B40 || // Mc ORIYA VOWEL SIGN II\n\t\t( 0x0B47 <= code && code <= 0x0B48 ) || // Mc [2] ORIYA VOWEL SIGN E..ORIYA VOWEL SIGN AI\n\t\t( 0x0B4B <= code && code <= 0x0B4C ) || // Mc [2] ORIYA VOWEL SIGN O..ORIYA VOWEL SIGN AU\n\t\tcode === 0x0BBF || // Mc TAMIL VOWEL SIGN I\n\t\t( 0x0BC1 <= code && code <= 0x0BC2 ) || // Mc [2] TAMIL VOWEL SIGN U..TAMIL VOWEL SIGN UU\n\t\t( 0x0BC6 <= code && code <= 0x0BC8 ) || // Mc [3] TAMIL VOWEL SIGN E..TAMIL VOWEL SIGN AI\n\t\t( 0x0BCA <= code && code <= 0x0BCC ) || // Mc [3] TAMIL VOWEL SIGN O..TAMIL VOWEL SIGN AU\n\t\t( 0x0C01 <= code && code <= 0x0C03 ) || // Mc [3] TELUGU SIGN CANDRABINDU..TELUGU SIGN VISARGA\n\t\t( 0x0C41 <= code && code <= 0x0C44 ) || // Mc [4] TELUGU VOWEL SIGN U..TELUGU VOWEL SIGN VOCALIC RR\n\t\t( 0x0C82 <= code && code <= 0x0C83 ) || // Mc [2] KANNADA SIGN ANUSVARA..KANNADA SIGN VISARGA\n\t\tcode === 0x0CBE || // Mc KANNADA VOWEL SIGN AA\n\t\t( 0x0CC0 <= code && code <= 0x0CC1 ) || // Mc [2] KANNADA VOWEL SIGN II..KANNADA VOWEL SIGN U\n\t\t( 0x0CC3 <= code && code <= 0x0CC4 ) || // Mc [2] KANNADA VOWEL SIGN VOCALIC R..KANNADA VOWEL SIGN VOCALIC RR\n\t\t( 0x0CC7 <= code && code <= 0x0CC8 ) || // Mc [2] KANNADA VOWEL SIGN EE..KANNADA VOWEL SIGN AI\n\t\t( 0x0CCA <= code && code <= 0x0CCB ) || // Mc [2] KANNADA VOWEL SIGN O..KANNADA VOWEL SIGN OO\n\t\t( 0x0D02 <= code && code <= 0x0D03 ) || // Mc [2] MALAYALAM SIGN ANUSVARA..MALAYALAM SIGN VISARGA\n\t\t( 0x0D3F <= code && code <= 0x0D40 ) || // Mc [2] MALAYALAM VOWEL SIGN I..MALAYALAM VOWEL SIGN II\n\t\t( 0x0D46 <= code && code <= 0x0D48 ) || // Mc [3] MALAYALAM VOWEL SIGN E..MALAYALAM VOWEL SIGN AI\n\t\t( 0x0D4A <= code && code <= 0x0D4C ) || // Mc [3] MALAYALAM VOWEL SIGN O..MALAYALAM VOWEL SIGN AU\n\t\t( 0x0D82 <= code && code <= 0x0D83 ) || // Mc [2] SINHALA SIGN ANUSVARAYA..SINHALA SIGN VISARGAYA\n\t\t( 0x0DD0 <= code && code <= 0x0DD1 ) || // Mc [2] SINHALA VOWEL SIGN KETTI AEDA-PILLA..SINHALA VOWEL SIGN DIGA AEDA-PILLA\n\t\t( 0x0DD8 <= code && code <= 0x0DDE ) || // Mc [7] SINHALA VOWEL SIGN GAETTA-PILLA..SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA\n\t\t( 0x0DF2 <= code && code <= 0x0DF3 ) || // Mc [2] SINHALA VOWEL SIGN DIGA GAETTA-PILLA..SINHALA VOWEL SIGN DIGA GAYANUKITTA\n\t\tcode === 0x0E33 || // Lo THAI CHARACTER SARA AM\n\t\tcode === 0x0EB3 || // Lo LAO VOWEL SIGN AM\n\t\t( 0x0F3E <= code && code <= 0x0F3F ) || // Mc [2] TIBETAN SIGN YAR TSHES..TIBETAN SIGN MAR TSHES\n\t\tcode === 0x0F7F || // Mc TIBETAN SIGN RNAM BCAD\n\t\tcode === 0x1031 || // Mc MYANMAR VOWEL SIGN E\n\t\t( 0x103B <= code && code <= 0x103C ) || // Mc [2] MYANMAR CONSONANT SIGN MEDIAL YA..MYANMAR CONSONANT SIGN MEDIAL RA\n\t\t( 0x1056 <= code && code <= 0x1057 ) || // Mc [2] MYANMAR VOWEL SIGN VOCALIC R..MYANMAR VOWEL SIGN VOCALIC RR\n\t\tcode === 0x1084 || // Mc MYANMAR VOWEL SIGN SHAN E\n\t\tcode === 0x17B6 || // Mc KHMER VOWEL SIGN AA\n\t\t( 0x17BE <= code && code <= 0x17C5 ) || // Mc [8] KHMER VOWEL SIGN OE..KHMER VOWEL SIGN AU\n\t\t( 0x17C7 <= code && code <= 0x17C8 ) || // Mc [2] KHMER SIGN REAHMUK..KHMER SIGN YUUKALEAPINTU\n\t\t( 0x1923 <= code && code <= 0x1926 ) || // Mc [4] LIMBU VOWEL SIGN EE..LIMBU VOWEL SIGN AU\n\t\t( 0x1929 <= code && code <= 0x192B ) || // Mc [3] LIMBU SUBJOINED LETTER YA..LIMBU SUBJOINED LETTER WA\n\t\t( 0x1930 <= code && code <= 0x1931 ) || // Mc [2] LIMBU SMALL LETTER KA..LIMBU SMALL LETTER NGA\n\t\t( 0x1933 <= code && code <= 0x1938 ) || // Mc [6] LIMBU SMALL LETTER TA..LIMBU SMALL LETTER LA\n\t\t( 0x1A19 <= code && code <= 0x1A1A ) || // Mc [2] BUGINESE VOWEL SIGN E..BUGINESE VOWEL SIGN O\n\t\tcode === 0x1A55 || // Mc TAI THAM CONSONANT SIGN MEDIAL RA\n\t\tcode === 0x1A57 || // Mc TAI THAM CONSONANT SIGN LA TANG LAI\n\t\t( 0x1A6D <= code && code <= 0x1A72 ) || // Mc [6] TAI THAM VOWEL SIGN OY..TAI THAM VOWEL SIGN THAM AI\n\t\tcode === 0x1B04 || // Mc BALINESE SIGN BISAH\n\t\tcode === 0x1B3B || // Mc BALINESE VOWEL SIGN RA REPA TEDUNG\n\t\t( 0x1B3D <= code && code <= 0x1B41 ) || // Mc [5] BALINESE VOWEL SIGN LA LENGA TEDUNG..BALINESE VOWEL SIGN TALING REPA TEDUNG\n\t\t( 0x1B43 <= code && code <= 0x1B44 ) || // Mc [2] BALINESE VOWEL SIGN PEPET TEDUNG..BALINESE ADEG ADEG\n\t\tcode === 0x1B82 || // Mc SUNDANESE SIGN PANGWISAD\n\t\tcode === 0x1BA1 || // Mc SUNDANESE CONSONANT SIGN PAMINGKAL\n\t\t( 0x1BA6 <= code && code <= 0x1BA7 ) || // Mc [2] SUNDANESE VOWEL SIGN PANAELAENG..SUNDANESE VOWEL SIGN PANOLONG\n\t\tcode === 0x1BAA || // Mc SUNDANESE SIGN PAMAAEH\n\t\tcode === 0x1BE7 || // Mc BATAK VOWEL SIGN E\n\t\t( 0x1BEA <= code && code <= 0x1BEC ) || // Mc [3] BATAK VOWEL SIGN I..BATAK VOWEL SIGN O\n\t\tcode === 0x1BEE || // Mc BATAK VOWEL SIGN U\n\t\t( 0x1BF2 <= code && code <= 0x1BF3 ) || // Mc [2] BATAK PANGOLAT..BATAK PANONGONAN\n\t\t( 0x1C24 <= code && code <= 0x1C2B ) || // Mc [8] LEPCHA SUBJOINED LETTER YA..LEPCHA VOWEL SIGN UU\n\t\t( 0x1C34 <= code && code <= 0x1C35 ) || // Mc [2] LEPCHA CONSONANT SIGN NYIN-DO..LEPCHA CONSONANT SIGN KANG\n\t\tcode === 0x1CE1 || // Mc VEDIC TONE ATHARVAVEDIC INDEPENDENT SVARITA\n\t\tcode === 0x1CF7 || // Mc VEDIC SIGN ATIKRAMA\n\t\t( 0xA823 <= code && code <= 0xA824 ) || // Mc [2] SYLOTI NAGRI VOWEL SIGN A..SYLOTI NAGRI VOWEL SIGN I\n\t\tcode === 0xA827 || // Mc SYLOTI NAGRI VOWEL SIGN OO\n\t\t( 0xA880 <= code && code <= 0xA881 ) || // Mc [2] SAURASHTRA SIGN ANUSVARA..SAURASHTRA SIGN VISARGA\n\t\t( 0xA8B4 <= code && code <= 0xA8C3 ) || // Mc [16] SAURASHTRA CONSONANT SIGN HAARU..SAURASHTRA VOWEL SIGN AU\n\t\t( 0xA952 <= code && code <= 0xA953 ) || // Mc [2] REJANG CONSONANT SIGN H..REJANG VIRAMA\n\t\tcode === 0xA983 || // Mc JAVANESE SIGN WIGNYAN\n\t\t( 0xA9B4 <= code && code <= 0xA9B5 ) || // Mc [2] JAVANESE VOWEL SIGN TARUNG..JAVANESE VOWEL SIGN TOLONG\n\t\t( 0xA9BA <= code && code <= 0xA9BB ) || // Mc [2] JAVANESE VOWEL SIGN TALING..JAVANESE VOWEL SIGN DIRGA MURE\n\t\t( 0xA9BE <= code && code <= 0xA9C0 ) || // Mc [3] JAVANESE CONSONANT SIGN PENGKAL..JAVANESE PANGKON\n\t\t( 0xAA2F <= code && code <= 0xAA30 ) || // Mc [2] CHAM VOWEL SIGN O..CHAM VOWEL SIGN AI\n\t\t( 0xAA33 <= code && code <= 0xAA34 ) || // Mc [2] CHAM CONSONANT SIGN YA..CHAM CONSONANT SIGN RA\n\t\tcode === 0xAA4D || // Mc CHAM CONSONANT SIGN FINAL H\n\t\tcode === 0xAAEB || // Mc MEETEI MAYEK VOWEL SIGN II\n\t\t( 0xAAEE <= code && code <= 0xAAEF ) || // Mc [2] MEETEI MAYEK VOWEL SIGN AU..MEETEI MAYEK VOWEL SIGN AAU\n\t\tcode === 0xAAF5 || // Mc MEETEI MAYEK VOWEL SIGN VISARGA\n\t\t( 0xABE3 <= code && code <= 0xABE4 ) || // Mc [2] MEETEI MAYEK VOWEL SIGN ONAP..MEETEI MAYEK VOWEL SIGN INAP\n\t\t( 0xABE6 <= code && code <= 0xABE7 ) || // Mc [2] MEETEI MAYEK VOWEL SIGN YENAP..MEETEI MAYEK VOWEL SIGN SOUNAP\n\t\t( 0xABE9 <= code && code <= 0xABEA ) || // Mc [2] MEETEI MAYEK VOWEL SIGN CHEINAP..MEETEI MAYEK VOWEL SIGN NUNG\n\t\tcode === 0xABEC || // Mc MEETEI MAYEK LUM IYEK\n\t\tcode === 0x11000 || // Mc BRAHMI SIGN CANDRABINDU\n\t\tcode === 0x11002 || // Mc BRAHMI SIGN VISARGA\n\t\tcode === 0x11082 || // Mc KAITHI SIGN VISARGA\n\t\t( 0x110B0 <= code && code <= 0x110B2 ) || // Mc [3] KAITHI VOWEL SIGN AA..KAITHI VOWEL SIGN II\n\t\t( 0x110B7 <= code && code <= 0x110B8 ) || // Mc [2] KAITHI VOWEL SIGN O..KAITHI VOWEL SIGN AU\n\t\tcode === 0x1112C || // Mc CHAKMA VOWEL SIGN E\n\t\t( 0x11145 <= code && code <= 0x11146 ) || // Mc [2] CHAKMA VOWEL SIGN AA..CHAKMA VOWEL SIGN EI\n\t\tcode === 0x11182 || // Mc SHARADA SIGN VISARGA\n\t\t( 0x111B3 <= code && code <= 0x111B5 ) || // Mc [3] SHARADA VOWEL SIGN AA..SHARADA VOWEL SIGN II\n\t\t( 0x111BF <= code && code <= 0x111C0 ) || // Mc [2] SHARADA VOWEL SIGN AU..SHARADA SIGN VIRAMA\n\t\tcode === 0x111CE || // Mc SHARADA VOWEL SIGN PRISHTHAMATRA E\n\t\t( 0x1122C <= code && code <= 0x1122E ) || // Mc [3] KHOJKI VOWEL SIGN AA..KHOJKI VOWEL SIGN II\n\t\t( 0x11232 <= code && code <= 0x11233 ) || // Mc [2] KHOJKI VOWEL SIGN O..KHOJKI VOWEL SIGN AU\n\t\tcode === 0x11235 || // Mc KHOJKI SIGN VIRAMA\n\t\t( 0x112E0 <= code && code <= 0x112E2 ) || // Mc [3] KHUDAWADI VOWEL SIGN AA..KHUDAWADI VOWEL SIGN II\n\t\t( 0x11302 <= code && code <= 0x11303 ) || // Mc [2] GRANTHA SIGN ANUSVARA..GRANTHA SIGN VISARGA\n\t\tcode === 0x1133F || // Mc GRANTHA VOWEL SIGN I\n\t\t( 0x11341 <= code && code <= 0x11344 ) || // Mc [4] GRANTHA VOWEL SIGN U..GRANTHA VOWEL SIGN VOCALIC RR\n\t\t( 0x11347 <= code && code <= 0x11348 ) || // Mc [2] GRANTHA VOWEL SIGN EE..GRANTHA VOWEL SIGN AI\n\t\t( 0x1134B <= code && code <= 0x1134D ) || // Mc [3] GRANTHA VOWEL SIGN OO..GRANTHA SIGN VIRAMA\n\t\t( 0x11362 <= code && code <= 0x11363 ) || // Mc [2] GRANTHA VOWEL SIGN VOCALIC L..GRANTHA VOWEL SIGN VOCALIC LL\n\t\t( 0x11435 <= code && code <= 0x11437 ) || // Mc [3] NEWA VOWEL SIGN AA..NEWA VOWEL SIGN II\n\t\t( 0x11440 <= code && code <= 0x11441 ) || // Mc [2] NEWA VOWEL SIGN O..NEWA VOWEL SIGN AU\n\t\tcode === 0x11445 || // Mc NEWA SIGN VISARGA\n\t\t( 0x114B1 <= code && code <= 0x114B2 ) || // Mc [2] TIRHUTA VOWEL SIGN I..TIRHUTA VOWEL SIGN II\n\t\tcode === 0x114B9 || // Mc TIRHUTA VOWEL SIGN E\n\t\t( 0x114BB <= code && code <= 0x114BC ) || // Mc [2] TIRHUTA VOWEL SIGN AI..TIRHUTA VOWEL SIGN O\n\t\tcode === 0x114BE || // Mc TIRHUTA VOWEL SIGN AU\n\t\tcode === 0x114C1 || // Mc TIRHUTA SIGN VISARGA\n\t\t( 0x115B0 <= code && code <= 0x115B1 ) || // Mc [2] SIDDHAM VOWEL SIGN I..SIDDHAM VOWEL SIGN II\n\t\t( 0x115B8 <= code && code <= 0x115BB ) || // Mc [4] SIDDHAM VOWEL SIGN E..SIDDHAM VOWEL SIGN AU\n\t\tcode === 0x115BE || // Mc SIDDHAM SIGN VISARGA\n\t\t( 0x11630 <= code && code <= 0x11632 ) || // Mc [3] MODI VOWEL SIGN AA..MODI VOWEL SIGN II\n\t\t( 0x1163B <= code && code <= 0x1163C ) || // Mc [2] MODI VOWEL SIGN O..MODI VOWEL SIGN AU\n\t\tcode === 0x1163E || // Mc MODI SIGN VISARGA\n\t\tcode === 0x116AC || // Mc TAKRI SIGN VISARGA\n\t\t( 0x116AE <= code && code <= 0x116AF ) || // Mc [2] TAKRI VOWEL SIGN I..TAKRI VOWEL SIGN II\n\t\tcode === 0x116B6 || // Mc TAKRI SIGN VIRAMA\n\t\t( 0x11720 <= code && code <= 0x11721 ) || // Mc [2] AHOM VOWEL SIGN A..AHOM VOWEL SIGN AA\n\t\tcode === 0x11726 || // Mc AHOM VOWEL SIGN E\n\t\t( 0x1182C <= code && code <= 0x1182E ) || // Mc [3] DOGRA VOWEL SIGN AA..DOGRA VOWEL SIGN II\n\t\tcode === 0x11838 || // Mc DOGRA SIGN VISARGA\n\t\t( 0x11931 <= code && code <= 0x11935 ) || // Mc [5] DIVES AKURU VOWEL SIGN I..DIVES AKURU VOWEL SIGN E\n\t\t( 0x11937 <= code && code <= 0x11938 ) || // Mc [2] DIVES AKURU VOWEL SIGN AI..DIVES AKURU VOWEL SIGN O\n\t\tcode === 0x1193D || // Mc DIVES AKURU SIGN HALANTA\n\t\tcode === 0x11940 || // Mc DIVES AKURU MEDIAL YA\n\t\tcode === 0x11942 || // Mc DIVES AKURU MEDIAL RA\n\t\t( 0x119D1 <= code && code <= 0x119D3 ) || // Mc [3] NANDINAGARI VOWEL SIGN AA..NANDINAGARI VOWEL SIGN II\n\t\t( 0x119DC <= code && code <= 0x119DF ) || // Mc [4] NANDINAGARI VOWEL SIGN O..NANDINAGARI SIGN VISARGA\n\t\tcode === 0x119E4 || // Mc NANDINAGARI VOWEL SIGN PRISHTHAMATRA E\n\t\tcode === 0x11A39 || // Mc ZANABAZAR SQUARE SIGN VISARGA\n\t\t( 0x11A57 <= code && code <= 0x11A58 ) || // Mc [2] SOYOMBO VOWEL SIGN AI..SOYOMBO VOWEL SIGN AU\n\t\tcode === 0x11A97 || // Mc SOYOMBO SIGN VISARGA\n\t\tcode === 0x11C2F || // Mc BHAIKSUKI VOWEL SIGN AA\n\t\tcode === 0x11C3E || // Mc BHAIKSUKI SIGN VISARGA\n\t\tcode === 0x11CA9 || // Mc MARCHEN SUBJOINED LETTER YA\n\t\tcode === 0x11CB1 || // Mc MARCHEN VOWEL SIGN I\n\t\tcode === 0x11CB4 || // Mc MARCHEN VOWEL SIGN O\n\t\t( 0x11D8A <= code && code <= 0x11D8E ) || // Mc [5] GUNJALA GONDI VOWEL SIGN AA..GUNJALA GONDI VOWEL SIGN UU\n\t\t( 0x11D93 <= code && code <= 0x11D94 ) || // Mc [2] GUNJALA GONDI VOWEL SIGN OO..GUNJALA GONDI VOWEL SIGN AU\n\t\tcode === 0x11D96 || // Mc GUNJALA GONDI SIGN VISARGA\n\t\t( 0x11EF5 <= code && code <= 0x11EF6 ) || // Mc [2] MAKASAR VOWEL SIGN E..MAKASAR VOWEL SIGN O\n\t\t( 0x16F51 <= code && code <= 0x16F87 ) || // Mc [55] MIAO SIGN ASPIRATION..MIAO VOWEL SIGN UI\n\t\t( 0x16FF0 <= code && code <= 0x16FF1 ) || // Mc [2] VIETNAMESE ALTERNATE READING MARK CA..VIETNAMESE ALTERNATE READING MARK NHAY\n\t\tcode === 0x1D166 || // Mc MUSICAL SYMBOL COMBINING SPRECHGESANG STEM\n\t\tcode === 0x1D16D // Mc MUSICAL SYMBOL COMBINING AUGMENTATION DOT\n\t) {\n\t\treturn constants.SpacingMark;\n\t}\n\tif (\n\t\t( 0x1100 <= code && code <= 0x115F ) || // Lo [96] HANGUL CHOSEONG KIYEOK..HANGUL CHOSEONG FILLER\n\t\t( 0xA960 <= code && code <= 0xA97C ) // Lo [29] HANGUL CHOSEONG TIKEUT-MIEUM..HANGUL CHOSEONG SSANGYEORINHIEUH\n\t) {\n\t\treturn constants.L;\n\t}\n\tif (\n\t\t( 0x1160 <= code && code <= 0x11A7 ) || // Lo [72] HANGUL JUNGSEONG FILLER..HANGUL JUNGSEONG O-YAE\n\t\t( 0xD7B0 <= code && code <= 0xD7C6 ) // Lo [23] HANGUL JUNGSEONG O-YEO..HANGUL JUNGSEONG ARAEA-E\n\t) {\n\t\treturn constants.V;\n\t}\n\tif (\n\t\t( 0x11A8 <= code && code <= 0x11FF ) || // Lo [88] HANGUL JONGSEONG KIYEOK..HANGUL JONGSEONG SSANGNIEUN\n\t\t( 0xD7CB <= code && code <= 0xD7FB ) // Lo [49] HANGUL JONGSEONG NIEUN-RIEUL..HANGUL JONGSEONG PHIEUPH-THIEUTH\n\t) {\n\t\treturn constants.T;\n\t}\n\tif (\n\t\tcode === 0xAC00 || // Lo HANGUL SYLLABLE GA\n\t\tcode === 0xAC1C || // Lo HANGUL SYLLABLE GAE\n\t\tcode === 0xAC38 || // Lo HANGUL SYLLABLE GYA\n\t\tcode === 0xAC54 || // Lo HANGUL SYLLABLE GYAE\n\t\tcode === 0xAC70 || // Lo HANGUL SYLLABLE GEO\n\t\tcode === 0xAC8C || // Lo HANGUL SYLLABLE GE\n\t\tcode === 0xACA8 || // Lo HANGUL SYLLABLE GYEO\n\t\tcode === 0xACC4 || // Lo HANGUL SYLLABLE GYE\n\t\tcode === 0xACE0 || // Lo HANGUL SYLLABLE GO\n\t\tcode === 0xACFC || // Lo HANGUL SYLLABLE GWA\n\t\tcode === 0xAD18 || // Lo HANGUL SYLLABLE GWAE\n\t\tcode === 0xAD34 || // Lo HANGUL SYLLABLE GOE\n\t\tcode === 0xAD50 || // Lo HANGUL SYLLABLE GYO\n\t\tcode === 0xAD6C || // Lo HANGUL SYLLABLE GU\n\t\tcode === 0xAD88 || // Lo HANGUL SYLLABLE GWEO\n\t\tcode === 0xADA4 || // Lo HANGUL SYLLABLE GWE\n\t\tcode === 0xADC0 || // Lo HANGUL SYLLABLE GWI\n\t\tcode === 0xADDC || // Lo HANGUL SYLLABLE GYU\n\t\tcode === 0xADF8 || // Lo HANGUL SYLLABLE GEU\n\t\tcode === 0xAE14 || // Lo HANGUL SYLLABLE GYI\n\t\tcode === 0xAE30 || // Lo HANGUL SYLLABLE GI\n\t\tcode === 0xAE4C || // Lo HANGUL SYLLABLE GGA\n\t\tcode === 0xAE68 || // Lo HANGUL SYLLABLE GGAE\n\t\tcode === 0xAE84 || // Lo HANGUL SYLLABLE GGYA\n\t\tcode === 0xAEA0 || // Lo HANGUL SYLLABLE GGYAE\n\t\tcode === 0xAEBC || // Lo HANGUL SYLLABLE GGEO\n\t\tcode === 0xAED8 || // Lo HANGUL SYLLABLE GGE\n\t\tcode === 0xAEF4 || // Lo HANGUL SYLLABLE GGYEO\n\t\tcode === 0xAF10 || // Lo HANGUL SYLLABLE GGYE\n\t\tcode === 0xAF2C || // Lo HANGUL SYLLABLE GGO\n\t\tcode === 0xAF48 || // Lo HANGUL SYLLABLE GGWA\n\t\tcode === 0xAF64 || // Lo HANGUL SYLLABLE GGWAE\n\t\tcode === 0xAF80 || // Lo HANGUL SYLLABLE GGOE\n\t\tcode === 0xAF9C || // Lo HANGUL SYLLABLE GGYO\n\t\tcode === 0xAFB8 || // Lo HANGUL SYLLABLE GGU\n\t\tcode === 0xAFD4 || // Lo HANGUL SYLLABLE GGWEO\n\t\tcode === 0xAFF0 || // Lo HANGUL SYLLABLE GGWE\n\t\tcode === 0xB00C || // Lo HANGUL SYLLABLE GGWI\n\t\tcode === 0xB028 || // Lo HANGUL SYLLABLE GGYU\n\t\tcode === 0xB044 || // Lo HANGUL SYLLABLE GGEU\n\t\tcode === 0xB060 || // Lo HANGUL SYLLABLE GGYI\n\t\tcode === 0xB07C || // Lo HANGUL SYLLABLE GGI\n\t\tcode === 0xB098 || // Lo HANGUL SYLLABLE NA\n\t\tcode === 0xB0B4 || // Lo HANGUL SYLLABLE NAE\n\t\tcode === 0xB0D0 || // Lo HANGUL SYLLABLE NYA\n\t\tcode === 0xB0EC || // Lo HANGUL SYLLABLE NYAE\n\t\tcode === 0xB108 || // Lo HANGUL SYLLABLE NEO\n\t\tcode === 0xB124 || // Lo HANGUL SYLLABLE NE\n\t\tcode === 0xB140 || // Lo HANGUL SYLLABLE NYEO\n\t\tcode === 0xB15C || // Lo HANGUL SYLLABLE NYE\n\t\tcode === 0xB178 || // Lo HANGUL SYLLABLE NO\n\t\tcode === 0xB194 || // Lo HANGUL SYLLABLE NWA\n\t\tcode === 0xB1B0 || // Lo HANGUL SYLLABLE NWAE\n\t\tcode === 0xB1CC || // Lo HANGUL SYLLABLE NOE\n\t\tcode === 0xB1E8 || // Lo HANGUL SYLLABLE NYO\n\t\tcode === 0xB204 || // Lo HANGUL SYLLABLE NU\n\t\tcode === 0xB220 || // Lo HANGUL SYLLABLE NWEO\n\t\tcode === 0xB23C || // Lo HANGUL SYLLABLE NWE\n\t\tcode === 0xB258 || // Lo HANGUL SYLLABLE NWI\n\t\tcode === 0xB274 || // Lo HANGUL SYLLABLE NYU\n\t\tcode === 0xB290 || // Lo HANGUL SYLLABLE NEU\n\t\tcode === 0xB2AC || // Lo HANGUL SYLLABLE NYI\n\t\tcode === 0xB2C8 || // Lo HANGUL SYLLABLE NI\n\t\tcode === 0xB2E4 || // Lo HANGUL SYLLABLE DA\n\t\tcode === 0xB300 || // Lo HANGUL SYLLABLE DAE\n\t\tcode === 0xB31C || // Lo HANGUL SYLLABLE DYA\n\t\tcode === 0xB338 || // Lo HANGUL SYLLABLE DYAE\n\t\tcode === 0xB354 || // Lo HANGUL SYLLABLE DEO\n\t\tcode === 0xB370 || // Lo HANGUL SYLLABLE DE\n\t\tcode === 0xB38C || // Lo HANGUL SYLLABLE DYEO\n\t\tcode === 0xB3A8 || // Lo HANGUL SYLLABLE DYE\n\t\tcode === 0xB3C4 || // Lo HANGUL SYLLABLE DO\n\t\tcode === 0xB3E0 || // Lo HANGUL SYLLABLE DWA\n\t\tcode === 0xB3FC || // Lo HANGUL SYLLABLE DWAE\n\t\tcode === 0xB418 || // Lo HANGUL SYLLABLE DOE\n\t\tcode === 0xB434 || // Lo HANGUL SYLLABLE DYO\n\t\tcode === 0xB450 || // Lo HANGUL SYLLABLE DU\n\t\tcode === 0xB46C || // Lo HANGUL SYLLABLE DWEO\n\t\tcode === 0xB488 || // Lo HANGUL SYLLABLE DWE\n\t\tcode === 0xB4A4 || // Lo HANGUL SYLLABLE DWI\n\t\tcode === 0xB4C0 || // Lo HANGUL SYLLABLE DYU\n\t\tcode === 0xB4DC || // Lo HANGUL SYLLABLE DEU\n\t\tcode === 0xB4F8 || // Lo HANGUL SYLLABLE DYI\n\t\tcode === 0xB514 || // Lo HANGUL SYLLABLE DI\n\t\tcode === 0xB530 || // Lo HANGUL SYLLABLE DDA\n\t\tcode === 0xB54C || // Lo HANGUL SYLLABLE DDAE\n\t\tcode === 0xB568 || // Lo HANGUL SYLLABLE DDYA\n\t\tcode === 0xB584 || // Lo HANGUL SYLLABLE DDYAE\n\t\tcode === 0xB5A0 || // Lo HANGUL SYLLABLE DDEO\n\t\tcode === 0xB5BC || // Lo HANGUL SYLLABLE DDE\n\t\tcode === 0xB5D8 || // Lo HANGUL SYLLABLE DDYEO\n\t\tcode === 0xB5F4 || // Lo HANGUL SYLLABLE DDYE\n\t\tcode === 0xB610 || // Lo HANGUL SYLLABLE DDO\n\t\tcode === 0xB62C || // Lo HANGUL SYLLABLE DDWA\n\t\tcode === 0xB648 || // Lo HANGUL SYLLABLE DDWAE\n\t\tcode === 0xB664 || // Lo HANGUL SYLLABLE DDOE\n\t\tcode === 0xB680 || // Lo HANGUL SYLLABLE DDYO\n\t\tcode === 0xB69C || // Lo HANGUL SYLLABLE DDU\n\t\tcode === 0xB6B8 || // Lo HANGUL SYLLABLE DDWEO\n\t\tcode === 0xB6D4 || // Lo HANGUL SYLLABLE DDWE\n\t\tcode === 0xB6F0 || // Lo HANGUL SYLLABLE DDWI\n\t\tcode === 0xB70C || // Lo HANGUL SYLLABLE DDYU\n\t\tcode === 0xB728 || // Lo HANGUL SYLLABLE DDEU\n\t\tcode === 0xB744 || // Lo HANGUL SYLLABLE DDYI\n\t\tcode === 0xB760 || // Lo HANGUL SYLLABLE DDI\n\t\tcode === 0xB77C || // Lo HANGUL SYLLABLE RA\n\t\tcode === 0xB798 || // Lo HANGUL SYLLABLE RAE\n\t\tcode === 0xB7B4 || // Lo HANGUL SYLLABLE RYA\n\t\tcode === 0xB7D0 || // Lo HANGUL SYLLABLE RYAE\n\t\tcode === 0xB7EC || // Lo HANGUL SYLLABLE REO\n\t\tcode === 0xB808 || // Lo HANGUL SYLLABLE RE\n\t\tcode === 0xB824 || // Lo HANGUL SYLLABLE RYEO\n\t\tcode === 0xB840 || // Lo HANGUL SYLLABLE RYE\n\t\tcode === 0xB85C || // Lo HANGUL SYLLABLE RO\n\t\tcode === 0xB878 || // Lo HANGUL SYLLABLE RWA\n\t\tcode === 0xB894 || // Lo HANGUL SYLLABLE RWAE\n\t\tcode === 0xB8B0 || // Lo HANGUL SYLLABLE ROE\n\t\tcode === 0xB8CC || // Lo HANGUL SYLLABLE RYO\n\t\tcode === 0xB8E8 || // Lo HANGUL SYLLABLE RU\n\t\tcode === 0xB904 || // Lo HANGUL SYLLABLE RWEO\n\t\tcode === 0xB920 || // Lo HANGUL SYLLABLE RWE\n\t\tcode === 0xB93C || // Lo HANGUL SYLLABLE RWI\n\t\tcode === 0xB958 || // Lo HANGUL SYLLABLE RYU\n\t\tcode === 0xB974 || // Lo HANGUL SYLLABLE REU\n\t\tcode === 0xB990 || // Lo HANGUL SYLLABLE RYI\n\t\tcode === 0xB9AC || // Lo HANGUL SYLLABLE RI\n\t\tcode === 0xB9C8 || // Lo HANGUL SYLLABLE MA\n\t\tcode === 0xB9E4 || // Lo HANGUL SYLLABLE MAE\n\t\tcode === 0xBA00 || // Lo HANGUL SYLLABLE MYA\n\t\tcode === 0xBA1C || // Lo HANGUL SYLLABLE MYAE\n\t\tcode === 0xBA38 || // Lo HANGUL SYLLABLE MEO\n\t\tcode === 0xBA54 || // Lo HANGUL SYLLABLE ME\n\t\tcode === 0xBA70 || // Lo HANGUL SYLLABLE MYEO\n\t\tcode === 0xBA8C || // Lo HANGUL SYLLABLE MYE\n\t\tcode === 0xBAA8 || // Lo HANGUL SYLLABLE MO\n\t\tcode === 0xBAC4 || // Lo HANGUL SYLLABLE MWA\n\t\tcode === 0xBAE0 || // Lo HANGUL SYLLABLE MWAE\n\t\tcode === 0xBAFC || // Lo HANGUL SYLLABLE MOE\n\t\tcode === 0xBB18 || // Lo HANGUL SYLLABLE MYO\n\t\tcode === 0xBB34 || // Lo HANGUL SYLLABLE MU\n\t\tcode === 0xBB50 || // Lo HANGUL SYLLABLE MWEO\n\t\tcode === 0xBB6C || // Lo HANGUL SYLLABLE MWE\n\t\tcode === 0xBB88 || // Lo HANGUL SYLLABLE MWI\n\t\tcode === 0xBBA4 || // Lo HANGUL SYLLABLE MYU\n\t\tcode === 0xBBC0 || // Lo HANGUL SYLLABLE MEU\n\t\tcode === 0xBBDC || // Lo HANGUL SYLLABLE MYI\n\t\tcode === 0xBBF8 || // Lo HANGUL SYLLABLE MI\n\t\tcode === 0xBC14 || // Lo HANGUL SYLLABLE BA\n\t\tcode === 0xBC30 || // Lo HANGUL SYLLABLE BAE\n\t\tcode === 0xBC4C || // Lo HANGUL SYLLABLE BYA\n\t\tcode === 0xBC68 || // Lo HANGUL SYLLABLE BYAE\n\t\tcode === 0xBC84 || // Lo HANGUL SYLLABLE BEO\n\t\tcode === 0xBCA0 || // Lo HANGUL SYLLABLE BE\n\t\tcode === 0xBCBC || // Lo HANGUL SYLLABLE BYEO\n\t\tcode === 0xBCD8 || // Lo HANGUL SYLLABLE BYE\n\t\tcode === 0xBCF4 || // Lo HANGUL SYLLABLE BO\n\t\tcode === 0xBD10 || // Lo HANGUL SYLLABLE BWA\n\t\tcode === 0xBD2C || // Lo HANGUL SYLLABLE BWAE\n\t\tcode === 0xBD48 || // Lo HANGUL SYLLABLE BOE\n\t\tcode === 0xBD64 || // Lo HANGUL SYLLABLE BYO\n\t\tcode === 0xBD80 || // Lo HANGUL SYLLABLE BU\n\t\tcode === 0xBD9C || // Lo HANGUL SYLLABLE BWEO\n\t\tcode === 0xBDB8 || // Lo HANGUL SYLLABLE BWE\n\t\tcode === 0xBDD4 || // Lo HANGUL SYLLABLE BWI\n\t\tcode === 0xBDF0 || // Lo HANGUL SYLLABLE BYU\n\t\tcode === 0xBE0C || // Lo HANGUL SYLLABLE BEU\n\t\tcode === 0xBE28 || // Lo HANGUL SYLLABLE BYI\n\t\tcode === 0xBE44 || // Lo HANGUL SYLLABLE BI\n\t\tcode === 0xBE60 || // Lo HANGUL SYLLABLE BBA\n\t\tcode === 0xBE7C || // Lo HANGUL SYLLABLE BBAE\n\t\tcode === 0xBE98 || // Lo HANGUL SYLLABLE BBYA\n\t\tcode === 0xBEB4 || // Lo HANGUL SYLLABLE BBYAE\n\t\tcode === 0xBED0 || // Lo HANGUL SYLLABLE BBEO\n\t\tcode === 0xBEEC || // Lo HANGUL SYLLABLE BBE\n\t\tcode === 0xBF08 || // Lo HANGUL SYLLABLE BBYEO\n\t\tcode === 0xBF24 || // Lo HANGUL SYLLABLE BBYE\n\t\tcode === 0xBF40 || // Lo HANGUL SYLLABLE BBO\n\t\tcode === 0xBF5C || // Lo HANGUL SYLLABLE BBWA\n\t\tcode === 0xBF78 || // Lo HANGUL SYLLABLE BBWAE\n\t\tcode === 0xBF94 || // Lo HANGUL SYLLABLE BBOE\n\t\tcode === 0xBFB0 || // Lo HANGUL SYLLABLE BBYO\n\t\tcode === 0xBFCC || // Lo HANGUL SYLLABLE BBU\n\t\tcode === 0xBFE8 || // Lo HANGUL SYLLABLE BBWEO\n\t\tcode === 0xC004 || // Lo HANGUL SYLLABLE BBWE\n\t\tcode === 0xC020 || // Lo HANGUL SYLLABLE BBWI\n\t\tcode === 0xC03C || // Lo HANGUL SYLLABLE BBYU\n\t\tcode === 0xC058 || // Lo HANGUL SYLLABLE BBEU\n\t\tcode === 0xC074 || // Lo HANGUL SYLLABLE BBYI\n\t\tcode === 0xC090 || // Lo HANGUL SYLLABLE BBI\n\t\tcode === 0xC0AC || // Lo HANGUL SYLLABLE SA\n\t\tcode === 0xC0C8 || // Lo HANGUL SYLLABLE SAE\n\t\tcode === 0xC0E4 || // Lo HANGUL SYLLABLE SYA\n\t\tcode === 0xC100 || // Lo HANGUL SYLLABLE SYAE\n\t\tcode === 0xC11C || // Lo HANGUL SYLLABLE SEO\n\t\tcode === 0xC138 || // Lo HANGUL SYLLABLE SE\n\t\tcode === 0xC154 || // Lo HANGUL SYLLABLE SYEO\n\t\tcode === 0xC170 || // Lo HANGUL SYLLABLE SYE\n\t\tcode === 0xC18C || // Lo HANGUL SYLLABLE SO\n\t\tcode === 0xC1A8 || // Lo HANGUL SYLLABLE SWA\n\t\tcode === 0xC1C4 || // Lo HANGUL SYLLABLE SWAE\n\t\tcode === 0xC1E0 || // Lo HANGUL SYLLABLE SOE\n\t\tcode === 0xC1FC || // Lo HANGUL SYLLABLE SYO\n\t\tcode === 0xC218 || // Lo HANGUL SYLLABLE SU\n\t\tcode === 0xC234 || // Lo HANGUL SYLLABLE SWEO\n\t\tcode === 0xC250 || // Lo HANGUL SYLLABLE SWE\n\t\tcode === 0xC26C || // Lo HANGUL SYLLABLE SWI\n\t\tcode === 0xC288 || // Lo HANGUL SYLLABLE SYU\n\t\tcode === 0xC2A4 || // Lo HANGUL SYLLABLE SEU\n\t\tcode === 0xC2C0 || // Lo HANGUL SYLLABLE SYI\n\t\tcode === 0xC2DC || // Lo HANGUL SYLLABLE SI\n\t\tcode === 0xC2F8 || // Lo HANGUL SYLLABLE SSA\n\t\tcode === 0xC314 || // Lo HANGUL SYLLABLE SSAE\n\t\tcode === 0xC330 || // Lo HANGUL SYLLABLE SSYA\n\t\tcode === 0xC34C || // Lo HANGUL SYLLABLE SSYAE\n\t\tcode === 0xC368 || // Lo HANGUL SYLLABLE SSEO\n\t\tcode === 0xC384 || // Lo HANGUL SYLLABLE SSE\n\t\tcode === 0xC3A0 || // Lo HANGUL SYLLABLE SSYEO\n\t\tcode === 0xC3BC || // Lo HANGUL SYLLABLE SSYE\n\t\tcode === 0xC3D8 || // Lo HANGUL SYLLABLE SSO\n\t\tcode === 0xC3F4 || // Lo HANGUL SYLLABLE SSWA\n\t\tcode === 0xC410 || // Lo HANGUL SYLLABLE SSWAE\n\t\tcode === 0xC42C || // Lo HANGUL SYLLABLE SSOE\n\t\tcode === 0xC448 || // Lo HANGUL SYLLABLE SSYO\n\t\tcode === 0xC464 || // Lo HANGUL SYLLABLE SSU\n\t\tcode === 0xC480 || // Lo HANGUL SYLLABLE SSWEO\n\t\tcode === 0xC49C || // Lo HANGUL SYLLABLE SSWE\n\t\tcode === 0xC4B8 || // Lo HANGUL SYLLABLE SSWI\n\t\tcode === 0xC4D4 || // Lo HANGUL SYLLABLE SSYU\n\t\tcode === 0xC4F0 || // Lo HANGUL SYLLABLE SSEU\n\t\tcode === 0xC50C || // Lo HANGUL SYLLABLE SSYI\n\t\tcode === 0xC528 || // Lo HANGUL SYLLABLE SSI\n\t\tcode === 0xC544 || // Lo HANGUL SYLLABLE A\n\t\tcode === 0xC560 || // Lo HANGUL SYLLABLE AE\n\t\tcode === 0xC57C || // Lo HANGUL SYLLABLE YA\n\t\tcode === 0xC598 || // Lo HANGUL SYLLABLE YAE\n\t\tcode === 0xC5B4 || // Lo HANGUL SYLLABLE EO\n\t\tcode === 0xC5D0 || // Lo HANGUL SYLLABLE E\n\t\tcode === 0xC5EC || // Lo HANGUL SYLLABLE YEO\n\t\tcode === 0xC608 || // Lo HANGUL SYLLABLE YE\n\t\tcode === 0xC624 || // Lo HANGUL SYLLABLE O\n\t\tcode === 0xC640 || // Lo HANGUL SYLLABLE WA\n\t\tcode === 0xC65C || // Lo HANGUL SYLLABLE WAE\n\t\tcode === 0xC678 || // Lo HANGUL SYLLABLE OE\n\t\tcode === 0xC694 || // Lo HANGUL SYLLABLE YO\n\t\tcode === 0xC6B0 || // Lo HANGUL SYLLABLE U\n\t\tcode === 0xC6CC || // Lo HANGUL SYLLABLE WEO\n\t\tcode === 0xC6E8 || // Lo HANGUL SYLLABLE WE\n\t\tcode === 0xC704 || // Lo HANGUL SYLLABLE WI\n\t\tcode === 0xC720 || // Lo HANGUL SYLLABLE YU\n\t\tcode === 0xC73C || // Lo HANGUL SYLLABLE EU\n\t\tcode === 0xC758 || // Lo HANGUL SYLLABLE YI\n\t\tcode === 0xC774 || // Lo HANGUL SYLLABLE I\n\t\tcode === 0xC790 || // Lo HANGUL SYLLABLE JA\n\t\tcode === 0xC7AC || // Lo HANGUL SYLLABLE JAE\n\t\tcode === 0xC7C8 || // Lo HANGUL SYLLABLE JYA\n\t\tcode === 0xC7E4 || // Lo HANGUL SYLLABLE JYAE\n\t\tcode === 0xC800 || // Lo HANGUL SYLLABLE JEO\n\t\tcode === 0xC81C || // Lo HANGUL SYLLABLE JE\n\t\tcode === 0xC838 || // Lo HANGUL SYLLABLE JYEO\n\t\tcode === 0xC854 || // Lo HANGUL SYLLABLE JYE\n\t\tcode === 0xC870 || // Lo HANGUL SYLLABLE JO\n\t\tcode === 0xC88C || // Lo HANGUL SYLLABLE JWA\n\t\tcode === 0xC8A8 || // Lo HANGUL SYLLABLE JWAE\n\t\tcode === 0xC8C4 || // Lo HANGUL SYLLABLE JOE\n\t\tcode === 0xC8E0 || // Lo HANGUL SYLLABLE JYO\n\t\tcode === 0xC8FC || // Lo HANGUL SYLLABLE JU\n\t\tcode === 0xC918 || // Lo HANGUL SYLLABLE JWEO\n\t\tcode === 0xC934 || // Lo HANGUL SYLLABLE JWE\n\t\tcode === 0xC950 || // Lo HANGUL SYLLABLE JWI\n\t\tcode === 0xC96C || // Lo HANGUL SYLLABLE JYU\n\t\tcode === 0xC988 || // Lo HANGUL SYLLABLE JEU\n\t\tcode === 0xC9A4 || // Lo HANGUL SYLLABLE JYI\n\t\tcode === 0xC9C0 || // Lo HANGUL SYLLABLE JI\n\t\tcode === 0xC9DC || // Lo HANGUL SYLLABLE JJA\n\t\tcode === 0xC9F8 || // Lo HANGUL SYLLABLE JJAE\n\t\tcode === 0xCA14 || // Lo HANGUL SYLLABLE JJYA\n\t\tcode === 0xCA30 || // Lo HANGUL SYLLABLE JJYAE\n\t\tcode === 0xCA4C || // Lo HANGUL SYLLABLE JJEO\n\t\tcode === 0xCA68 || // Lo HANGUL SYLLABLE JJE\n\t\tcode === 0xCA84 || // Lo HANGUL SYLLABLE JJYEO\n\t\tcode === 0xCAA0 || // Lo HANGUL SYLLABLE JJYE\n\t\tcode === 0xCABC || // Lo HANGUL SYLLABLE JJO\n\t\tcode === 0xCAD8 || // Lo HANGUL SYLLABLE JJWA\n\t\tcode === 0xCAF4 || // Lo HANGUL SYLLABLE JJWAE\n\t\tcode === 0xCB10 || // Lo HANGUL SYLLABLE JJOE\n\t\tcode === 0xCB2C || // Lo HANGUL SYLLABLE JJYO\n\t\tcode === 0xCB48 || // Lo HANGUL SYLLABLE JJU\n\t\tcode === 0xCB64 || // Lo HANGUL SYLLABLE JJWEO\n\t\tcode === 0xCB80 || // Lo HANGUL SYLLABLE JJWE\n\t\tcode === 0xCB9C || // Lo HANGUL SYLLABLE JJWI\n\t\tcode === 0xCBB8 || // Lo HANGUL SYLLABLE JJYU\n\t\tcode === 0xCBD4 || // Lo HANGUL SYLLABLE JJEU\n\t\tcode === 0xCBF0 || // Lo HANGUL SYLLABLE JJYI\n\t\tcode === 0xCC0C || // Lo HANGUL SYLLABLE JJI\n\t\tcode === 0xCC28 || // Lo HANGUL SYLLABLE CA\n\t\tcode === 0xCC44 || // Lo HANGUL SYLLABLE CAE\n\t\tcode === 0xCC60 || // Lo HANGUL SYLLABLE CYA\n\t\tcode === 0xCC7C || // Lo HANGUL SYLLABLE CYAE\n\t\tcode === 0xCC98 || // Lo HANGUL SYLLABLE CEO\n\t\tcode === 0xCCB4 || // Lo HANGUL SYLLABLE CE\n\t\tcode === 0xCCD0 || // Lo HANGUL SYLLABLE CYEO\n\t\tcode === 0xCCEC || // Lo HANGUL SYLLABLE CYE\n\t\tcode === 0xCD08 || // Lo HANGUL SYLLABLE CO\n\t\tcode === 0xCD24 || // Lo HANGUL SYLLABLE CWA\n\t\tcode === 0xCD40 || // Lo HANGUL SYLLABLE CWAE\n\t\tcode === 0xCD5C || // Lo HANGUL SYLLABLE COE\n\t\tcode === 0xCD78 || // Lo HANGUL SYLLABLE CYO\n\t\tcode === 0xCD94 || // Lo HANGUL SYLLABLE CU\n\t\tcode === 0xCDB0 || // Lo HANGUL SYLLABLE CWEO\n\t\tcode === 0xCDCC || // Lo HANGUL SYLLABLE CWE\n\t\tcode === 0xCDE8 || // Lo HANGUL SYLLABLE CWI\n\t\tcode === 0xCE04 || // Lo HANGUL SYLLABLE CYU\n\t\tcode === 0xCE20 || // Lo HANGUL SYLLABLE CEU\n\t\tcode === 0xCE3C || // Lo HANGUL SYLLABLE CYI\n\t\tcode === 0xCE58 || // Lo HANGUL SYLLABLE CI\n\t\tcode === 0xCE74 || // Lo HANGUL SYLLABLE KA\n\t\tcode === 0xCE90 || // Lo HANGUL SYLLABLE KAE\n\t\tcode === 0xCEAC || // Lo HANGUL SYLLABLE KYA\n\t\tcode === 0xCEC8 || // Lo HANGUL SYLLABLE KYAE\n\t\tcode === 0xCEE4 || // Lo HANGUL SYLLABLE KEO\n\t\tcode === 0xCF00 || // Lo HANGUL SYLLABLE KE\n\t\tcode === 0xCF1C || // Lo HANGUL SYLLABLE KYEO\n\t\tcode === 0xCF38 || // Lo HANGUL SYLLABLE KYE\n\t\tcode === 0xCF54 || // Lo HANGUL SYLLABLE KO\n\t\tcode === 0xCF70 || // Lo HANGUL SYLLABLE KWA\n\t\tcode === 0xCF8C || // Lo HANGUL SYLLABLE KWAE\n\t\tcode === 0xCFA8 || // Lo HANGUL SYLLABLE KOE\n\t\tcode === 0xCFC4 || // Lo HANGUL SYLLABLE KYO\n\t\tcode === 0xCFE0 || // Lo HANGUL SYLLABLE KU\n\t\tcode === 0xCFFC || // Lo HANGUL SYLLABLE KWEO\n\t\tcode === 0xD018 || // Lo HANGUL SYLLABLE KWE\n\t\tcode === 0xD034 || // Lo HANGUL SYLLABLE KWI\n\t\tcode === 0xD050 || // Lo HANGUL SYLLABLE KYU\n\t\tcode === 0xD06C || // Lo HANGUL SYLLABLE KEU\n\t\tcode === 0xD088 || // Lo HANGUL SYLLABLE KYI\n\t\tcode === 0xD0A4 || // Lo HANGUL SYLLABLE KI\n\t\tcode === 0xD0C0 || // Lo HANGUL SYLLABLE TA\n\t\tcode === 0xD0DC || // Lo HANGUL SYLLABLE TAE\n\t\tcode === 0xD0F8 || // Lo HANGUL SYLLABLE TYA\n\t\tcode === 0xD114 || // Lo HANGUL SYLLABLE TYAE\n\t\tcode === 0xD130 || // Lo HANGUL SYLLABLE TEO\n\t\tcode === 0xD14C || // Lo HANGUL SYLLABLE TE\n\t\tcode === 0xD168 || // Lo HANGUL SYLLABLE TYEO\n\t\tcode === 0xD184 || // Lo HANGUL SYLLABLE TYE\n\t\tcode === 0xD1A0 || // Lo HANGUL SYLLABLE TO\n\t\tcode === 0xD1BC || // Lo HANGUL SYLLABLE TWA\n\t\tcode === 0xD1D8 || // Lo HANGUL SYLLABLE TWAE\n\t\tcode === 0xD1F4 || // Lo HANGUL SYLLABLE TOE\n\t\tcode === 0xD210 || // Lo HANGUL SYLLABLE TYO\n\t\tcode === 0xD22C || // Lo HANGUL SYLLABLE TU\n\t\tcode === 0xD248 || // Lo HANGUL SYLLABLE TWEO\n\t\tcode === 0xD264 || // Lo HANGUL SYLLABLE TWE\n\t\tcode === 0xD280 || // Lo HANGUL SYLLABLE TWI\n\t\tcode === 0xD29C || // Lo HANGUL SYLLABLE TYU\n\t\tcode === 0xD2B8 || // Lo HANGUL SYLLABLE TEU\n\t\tcode === 0xD2D4 || // Lo HANGUL SYLLABLE TYI\n\t\tcode === 0xD2F0 || // Lo HANGUL SYLLABLE TI\n\t\tcode === 0xD30C || // Lo HANGUL SYLLABLE PA\n\t\tcode === 0xD328 || // Lo HANGUL SYLLABLE PAE\n\t\tcode === 0xD344 || // Lo HANGUL SYLLABLE PYA\n\t\tcode === 0xD360 || // Lo HANGUL SYLLABLE PYAE\n\t\tcode === 0xD37C || // Lo HANGUL SYLLABLE PEO\n\t\tcode === 0xD398 || // Lo HANGUL SYLLABLE PE\n\t\tcode === 0xD3B4 || // Lo HANGUL SYLLABLE PYEO\n\t\tcode === 0xD3D0 || // Lo HANGUL SYLLABLE PYE\n\t\tcode === 0xD3EC || // Lo HANGUL SYLLABLE PO\n\t\tcode === 0xD408 || // Lo HANGUL SYLLABLE PWA\n\t\tcode === 0xD424 || // Lo HANGUL SYLLABLE PWAE\n\t\tcode === 0xD440 || // Lo HANGUL SYLLABLE POE\n\t\tcode === 0xD45C || // Lo HANGUL SYLLABLE PYO\n\t\tcode === 0xD478 || // Lo HANGUL SYLLABLE PU\n\t\tcode === 0xD494 || // Lo HANGUL SYLLABLE PWEO\n\t\tcode === 0xD4B0 || // Lo HANGUL SYLLABLE PWE\n\t\tcode === 0xD4CC || // Lo HANGUL SYLLABLE PWI\n\t\tcode === 0xD4E8 || // Lo HANGUL SYLLABLE PYU\n\t\tcode === 0xD504 || // Lo HANGUL SYLLABLE PEU\n\t\tcode === 0xD520 || // Lo HANGUL SYLLABLE PYI\n\t\tcode === 0xD53C || // Lo HANGUL SYLLABLE PI\n\t\tcode === 0xD558 || // Lo HANGUL SYLLABLE HA\n\t\tcode === 0xD574 || // Lo HANGUL SYLLABLE HAE\n\t\tcode === 0xD590 || // Lo HANGUL SYLLABLE HYA\n\t\tcode === 0xD5AC || // Lo HANGUL SYLLABLE HYAE\n\t\tcode === 0xD5C8 || // Lo HANGUL SYLLABLE HEO\n\t\tcode === 0xD5E4 || // Lo HANGUL SYLLABLE HE\n\t\tcode === 0xD600 || // Lo HANGUL SYLLABLE HYEO\n\t\tcode === 0xD61C || // Lo HANGUL SYLLABLE HYE\n\t\tcode === 0xD638 || // Lo HANGUL SYLLABLE HO\n\t\tcode === 0xD654 || // Lo HANGUL SYLLABLE HWA\n\t\tcode === 0xD670 || // Lo HANGUL SYLLABLE HWAE\n\t\tcode === 0xD68C || // Lo HANGUL SYLLABLE HOE\n\t\tcode === 0xD6A8 || // Lo HANGUL SYLLABLE HYO\n\t\tcode === 0xD6C4 || // Lo HANGUL SYLLABLE HU\n\t\tcode === 0xD6E0 || // Lo HANGUL SYLLABLE HWEO\n\t\tcode === 0xD6FC || // Lo HANGUL SYLLABLE HWE\n\t\tcode === 0xD718 || // Lo HANGUL SYLLABLE HWI\n\t\tcode === 0xD734 || // Lo HANGUL SYLLABLE HYU\n\t\tcode === 0xD750 || // Lo HANGUL SYLLABLE HEU\n\t\tcode === 0xD76C || // Lo HANGUL SYLLABLE HYI\n\t\tcode === 0xD788 // Lo HANGUL SYLLABLE HI\n\t) {\n\t\treturn constants.LV;\n\t}\n\tif (\n\t\t( 0xAC01 <= code && code <= 0xAC1B ) || // Lo [27] HANGUL SYLLABLE GAG..HANGUL SYLLABLE GAH\n\t\t( 0xAC1D <= code && code <= 0xAC37 ) || // Lo [27] HANGUL SYLLABLE GAEG..HANGUL SYLLABLE GAEH\n\t\t( 0xAC39 <= code && code <= 0xAC53 ) || // Lo [27] HANGUL SYLLABLE GYAG..HANGUL SYLLABLE GYAH\n\t\t( 0xAC55 <= code && code <= 0xAC6F ) || // Lo [27] HANGUL SYLLABLE GYAEG..HANGUL SYLLABLE GYAEH\n\t\t( 0xAC71 <= code && code <= 0xAC8B ) || // Lo [27] HANGUL SYLLABLE GEOG..HANGUL SYLLABLE GEOH\n\t\t( 0xAC8D <= code && code <= 0xACA7 ) || // Lo [27] HANGUL SYLLABLE GEG..HANGUL SYLLABLE GEH\n\t\t( 0xACA9 <= code && code <= 0xACC3 ) || // Lo [27] HANGUL SYLLABLE GYEOG..HANGUL SYLLABLE GYEOH\n\t\t( 0xACC5 <= code && code <= 0xACDF ) || // Lo [27] HANGUL SYLLABLE GYEG..HANGUL SYLLABLE GYEH\n\t\t( 0xACE1 <= code && code <= 0xACFB ) || // Lo [27] HANGUL SYLLABLE GOG..HANGUL SYLLABLE GOH\n\t\t( 0xACFD <= code && code <= 0xAD17 ) || // Lo [27] HANGUL SYLLABLE GWAG..HANGUL SYLLABLE GWAH\n\t\t( 0xAD19 <= code && code <= 0xAD33 ) || // Lo [27] HANGUL SYLLABLE GWAEG..HANGUL SYLLABLE GWAEH\n\t\t( 0xAD35 <= code && code <= 0xAD4F ) || // Lo [27] HANGUL SYLLABLE GOEG..HANGUL SYLLABLE GOEH\n\t\t( 0xAD51 <= code && code <= 0xAD6B ) || // Lo [27] HANGUL SYLLABLE GYOG..HANGUL SYLLABLE GYOH\n\t\t( 0xAD6D <= code && code <= 0xAD87 ) || // Lo [27] HANGUL SYLLABLE GUG..HANGUL SYLLABLE GUH\n\t\t( 0xAD89 <= code && code <= 0xADA3 ) || // Lo [27] HANGUL SYLLABLE GWEOG..HANGUL SYLLABLE GWEOH\n\t\t( 0xADA5 <= code && code <= 0xADBF ) || // Lo [27] HANGUL SYLLABLE GWEG..HANGUL SYLLABLE GWEH\n\t\t( 0xADC1 <= code && code <= 0xADDB ) || // Lo [27] HANGUL SYLLABLE GWIG..HANGUL SYLLABLE GWIH\n\t\t( 0xADDD <= code && code <= 0xADF7 ) || // Lo [27] HANGUL SYLLABLE GYUG..HANGUL SYLLABLE GYUH\n\t\t( 0xADF9 <= code && code <= 0xAE13 ) || // Lo [27] HANGUL SYLLABLE GEUG..HANGUL SYLLABLE GEUH\n\t\t( 0xAE15 <= code && code <= 0xAE2F ) || // Lo [27] HANGUL SYLLABLE GYIG..HANGUL SYLLABLE GYIH\n\t\t( 0xAE31 <= code && code <= 0xAE4B ) || // Lo [27] HANGUL SYLLABLE GIG..HANGUL SYLLABLE GIH\n\t\t( 0xAE4D <= code && code <= 0xAE67 ) || // Lo [27] HANGUL SYLLABLE GGAG..HANGUL SYLLABLE GGAH\n\t\t( 0xAE69 <= code && code <= 0xAE83 ) || // Lo [27] HANGUL SYLLABLE GGAEG..HANGUL SYLLABLE GGAEH\n\t\t( 0xAE85 <= code && code <= 0xAE9F ) || // Lo [27] HANGUL SYLLABLE GGYAG..HANGUL SYLLABLE GGYAH\n\t\t( 0xAEA1 <= code && code <= 0xAEBB ) || // Lo [27] HANGUL SYLLABLE GGYAEG..HANGUL SYLLABLE GGYAEH\n\t\t( 0xAEBD <= code && code <= 0xAED7 ) || // Lo [27] HANGUL SYLLABLE GGEOG..HANGUL SYLLABLE GGEOH\n\t\t( 0xAED9 <= code && code <= 0xAEF3 ) || // Lo [27] HANGUL SYLLABLE GGEG..HANGUL SYLLABLE GGEH\n\t\t( 0xAEF5 <= code && code <= 0xAF0F ) || // Lo [27] HANGUL SYLLABLE GGYEOG..HANGUL SYLLABLE GGYEOH\n\t\t( 0xAF11 <= code && code <= 0xAF2B ) || // Lo [27] HANGUL SYLLABLE GGYEG..HANGUL SYLLABLE GGYEH\n\t\t( 0xAF2D <= code && code <= 0xAF47 ) || // Lo [27] HANGUL SYLLABLE GGOG..HANGUL SYLLABLE GGOH\n\t\t( 0xAF49 <= code && code <= 0xAF63 ) || // Lo [27] HANGUL SYLLABLE GGWAG..HANGUL SYLLABLE GGWAH\n\t\t( 0xAF65 <= code && code <= 0xAF7F ) || // Lo [27] HANGUL SYLLABLE GGWAEG..HANGUL SYLLABLE GGWAEH\n\t\t( 0xAF81 <= code && code <= 0xAF9B ) || // Lo [27] HANGUL SYLLABLE GGOEG..HANGUL SYLLABLE GGOEH\n\t\t( 0xAF9D <= code && code <= 0xAFB7 ) || // Lo [27] HANGUL SYLLABLE GGYOG..HANGUL SYLLABLE GGYOH\n\t\t( 0xAFB9 <= code && code <= 0xAFD3 ) || // Lo [27] HANGUL SYLLABLE GGUG..HANGUL SYLLABLE GGUH\n\t\t( 0xAFD5 <= code && code <= 0xAFEF ) || // Lo [27] HANGUL SYLLABLE GGWEOG..HANGUL SYLLABLE GGWEOH\n\t\t( 0xAFF1 <= code && code <= 0xB00B ) || // Lo [27] HANGUL SYLLABLE GGWEG..HANGUL SYLLABLE GGWEH\n\t\t( 0xB00D <= code && code <= 0xB027 ) || // Lo [27] HANGUL SYLLABLE GGWIG..HANGUL SYLLABLE GGWIH\n\t\t( 0xB029 <= code && code <= 0xB043 ) || // Lo [27] HANGUL SYLLABLE GGYUG..HANGUL SYLLABLE GGYUH\n\t\t( 0xB045 <= code && code <= 0xB05F ) || // Lo [27] HANGUL SYLLABLE GGEUG..HANGUL SYLLABLE GGEUH\n\t\t( 0xB061 <= code && code <= 0xB07B ) || // Lo [27] HANGUL SYLLABLE GGYIG..HANGUL SYLLABLE GGYIH\n\t\t( 0xB07D <= code && code <= 0xB097 ) || // Lo [27] HANGUL SYLLABLE GGIG..HANGUL SYLLABLE GGIH\n\t\t( 0xB099 <= code && code <= 0xB0B3 ) || // Lo [27] HANGUL SYLLABLE NAG..HANGUL SYLLABLE NAH\n\t\t( 0xB0B5 <= code && code <= 0xB0CF ) || // Lo [27] HANGUL SYLLABLE NAEG..HANGUL SYLLABLE NAEH\n\t\t( 0xB0D1 <= code && code <= 0xB0EB ) || // Lo [27] HANGUL SYLLABLE NYAG..HANGUL SYLLABLE NYAH\n\t\t( 0xB0ED <= code && code <= 0xB107 ) || // Lo [27] HANGUL SYLLABLE NYAEG..HANGUL SYLLABLE NYAEH\n\t\t( 0xB109 <= code && code <= 0xB123 ) || // Lo [27] HANGUL SYLLABLE NEOG..HANGUL SYLLABLE NEOH\n\t\t( 0xB125 <= code && code <= 0xB13F ) || // Lo [27] HANGUL SYLLABLE NEG..HANGUL SYLLABLE NEH\n\t\t( 0xB141 <= code && code <= 0xB15B ) || // Lo [27] HANGUL SYLLABLE NYEOG..HANGUL SYLLABLE NYEOH\n\t\t( 0xB15D <= code && code <= 0xB177 ) || // Lo [27] HANGUL SYLLABLE NYEG..HANGUL SYLLABLE NYEH\n\t\t( 0xB179 <= code && code <= 0xB193 ) || // Lo [27] HANGUL SYLLABLE NOG..HANGUL SYLLABLE NOH\n\t\t( 0xB195 <= code && code <= 0xB1AF ) || // Lo [27] HANGUL SYLLABLE NWAG..HANGUL SYLLABLE NWAH\n\t\t( 0xB1B1 <= code && code <= 0xB1CB ) || // Lo [27] HANGUL SYLLABLE NWAEG..HANGUL SYLLABLE NWAEH\n\t\t( 0xB1CD <= code && code <= 0xB1E7 ) || // Lo [27] HANGUL SYLLABLE NOEG..HANGUL SYLLABLE NOEH\n\t\t( 0xB1E9 <= code && code <= 0xB203 ) || // Lo [27] HANGUL SYLLABLE NYOG..HANGUL SYLLABLE NYOH\n\t\t( 0xB205 <= code && code <= 0xB21F ) || // Lo [27] HANGUL SYLLABLE NUG..HANGUL SYLLABLE NUH\n\t\t( 0xB221 <= code && code <= 0xB23B ) || // Lo [27] HANGUL SYLLABLE NWEOG..HANGUL SYLLABLE NWEOH\n\t\t( 0xB23D <= code && code <= 0xB257 ) || // Lo [27] HANGUL SYLLABLE NWEG..HANGUL SYLLABLE NWEH\n\t\t( 0xB259 <= code && code <= 0xB273 ) || // Lo [27] HANGUL SYLLABLE NWIG..HANGUL SYLLABLE NWIH\n\t\t( 0xB275 <= code && code <= 0xB28F ) || // Lo [27] HANGUL SYLLABLE NYUG..HANGUL SYLLABLE NYUH\n\t\t( 0xB291 <= code && code <= 0xB2AB ) || // Lo [27] HANGUL SYLLABLE NEUG..HANGUL SYLLABLE NEUH\n\t\t( 0xB2AD <= code && code <= 0xB2C7 ) || // Lo [27] HANGUL SYLLABLE NYIG..HANGUL SYLLABLE NYIH\n\t\t( 0xB2C9 <= code && code <= 0xB2E3 ) || // Lo [27] HANGUL SYLLABLE NIG..HANGUL SYLLABLE NIH\n\t\t( 0xB2E5 <= code && code <= 0xB2FF ) || // Lo [27] HANGUL SYLLABLE DAG..HANGUL SYLLABLE DAH\n\t\t( 0xB301 <= code && code <= 0xB31B ) || // Lo [27] HANGUL SYLLABLE DAEG..HANGUL SYLLABLE DAEH\n\t\t( 0xB31D <= code && code <= 0xB337 ) || // Lo [27] HANGUL SYLLABLE DYAG..HANGUL SYLLABLE DYAH\n\t\t( 0xB339 <= code && code <= 0xB353 ) || // Lo [27] HANGUL SYLLABLE DYAEG..HANGUL SYLLABLE DYAEH\n\t\t( 0xB355 <= code && code <= 0xB36F ) || // Lo [27] HANGUL SYLLABLE DEOG..HANGUL SYLLABLE DEOH\n\t\t( 0xB371 <= code && code <= 0xB38B ) || // Lo [27] HANGUL SYLLABLE DEG..HANGUL SYLLABLE DEH\n\t\t( 0xB38D <= code && code <= 0xB3A7 ) || // Lo [27] HANGUL SYLLABLE DYEOG..HANGUL SYLLABLE DYEOH\n\t\t( 0xB3A9 <= code && code <= 0xB3C3 ) || // Lo [27] HANGUL SYLLABLE DYEG..HANGUL SYLLABLE DYEH\n\t\t( 0xB3C5 <= code && code <= 0xB3DF ) || // Lo [27] HANGUL SYLLABLE DOG..HANGUL SYLLABLE DOH\n\t\t( 0xB3E1 <= code && code <= 0xB3FB ) || // Lo [27] HANGUL SYLLABLE DWAG..HANGUL SYLLABLE DWAH\n\t\t( 0xB3FD <= code && code <= 0xB417 ) || // Lo [27] HANGUL SYLLABLE DWAEG..HANGUL SYLLABLE DWAEH\n\t\t( 0xB419 <= code && code <= 0xB433 ) || // Lo [27] HANGUL SYLLABLE DOEG..HANGUL SYLLABLE DOEH\n\t\t( 0xB435 <= code && code <= 0xB44F ) || // Lo [27] HANGUL SYLLABLE DYOG..HANGUL SYLLABLE DYOH\n\t\t( 0xB451 <= code && code <= 0xB46B ) || // Lo [27] HANGUL SYLLABLE DUG..HANGUL SYLLABLE DUH\n\t\t( 0xB46D <= code && code <= 0xB487 ) || // Lo [27] HANGUL SYLLABLE DWEOG..HANGUL SYLLABLE DWEOH\n\t\t( 0xB489 <= code && code <= 0xB4A3 ) || // Lo [27] HANGUL SYLLABLE DWEG..HANGUL SYLLABLE DWEH\n\t\t( 0xB4A5 <= code && code <= 0xB4BF ) || // Lo [27] HANGUL SYLLABLE DWIG..HANGUL SYLLABLE DWIH\n\t\t( 0xB4C1 <= code && code <= 0xB4DB ) || // Lo [27] HANGUL SYLLABLE DYUG..HANGUL SYLLABLE DYUH\n\t\t( 0xB4DD <= code && code <= 0xB4F7 ) || // Lo [27] HANGUL SYLLABLE DEUG..HANGUL SYLLABLE DEUH\n\t\t( 0xB4F9 <= code && code <= 0xB513 ) || // Lo [27] HANGUL SYLLABLE DYIG..HANGUL SYLLABLE DYIH\n\t\t( 0xB515 <= code && code <= 0xB52F ) || // Lo [27] HANGUL SYLLABLE DIG..HANGUL SYLLABLE DIH\n\t\t( 0xB531 <= code && code <= 0xB54B ) || // Lo [27] HANGUL SYLLABLE DDAG..HANGUL SYLLABLE DDAH\n\t\t( 0xB54D <= code && code <= 0xB567 ) || // Lo [27] HANGUL SYLLABLE DDAEG..HANGUL SYLLABLE DDAEH\n\t\t( 0xB569 <= code && code <= 0xB583 ) || // Lo [27] HANGUL SYLLABLE DDYAG..HANGUL SYLLABLE DDYAH\n\t\t( 0xB585 <= code && code <= 0xB59F ) || // Lo [27] HANGUL SYLLABLE DDYAEG..HANGUL SYLLABLE DDYAEH\n\t\t( 0xB5A1 <= code && code <= 0xB5BB ) || // Lo [27] HANGUL SYLLABLE DDEOG..HANGUL SYLLABLE DDEOH\n\t\t( 0xB5BD <= code && code <= 0xB5D7 ) || // Lo [27] HANGUL SYLLABLE DDEG..HANGUL SYLLABLE DDEH\n\t\t( 0xB5D9 <= code && code <= 0xB5F3 ) || // Lo [27] HANGUL SYLLABLE DDYEOG..HANGUL SYLLABLE DDYEOH\n\t\t( 0xB5F5 <= code && code <= 0xB60F ) || // Lo [27] HANGUL SYLLABLE DDYEG..HANGUL SYLLABLE DDYEH\n\t\t( 0xB611 <= code && code <= 0xB62B ) || // Lo [27] HANGUL SYLLABLE DDOG..HANGUL SYLLABLE DDOH\n\t\t( 0xB62D <= code && code <= 0xB647 ) || // Lo [27] HANGUL SYLLABLE DDWAG..HANGUL SYLLABLE DDWAH\n\t\t( 0xB649 <= code && code <= 0xB663 ) || // Lo [27] HANGUL SYLLABLE DDWAEG..HANGUL SYLLABLE DDWAEH\n\t\t( 0xB665 <= code && code <= 0xB67F ) || // Lo [27] HANGUL SYLLABLE DDOEG..HANGUL SYLLABLE DDOEH\n\t\t( 0xB681 <= code && code <= 0xB69B ) || // Lo [27] HANGUL SYLLABLE DDYOG..HANGUL SYLLABLE DDYOH\n\t\t( 0xB69D <= code && code <= 0xB6B7 ) || // Lo [27] HANGUL SYLLABLE DDUG..HANGUL SYLLABLE DDUH\n\t\t( 0xB6B9 <= code && code <= 0xB6D3 ) || // Lo [27] HANGUL SYLLABLE DDWEOG..HANGUL SYLLABLE DDWEOH\n\t\t( 0xB6D5 <= code && code <= 0xB6EF ) || // Lo [27] HANGUL SYLLABLE DDWEG..HANGUL SYLLABLE DDWEH\n\t\t( 0xB6F1 <= code && code <= 0xB70B ) || // Lo [27] HANGUL SYLLABLE DDWIG..HANGUL SYLLABLE DDWIH\n\t\t( 0xB70D <= code && code <= 0xB727 ) || // Lo [27] HANGUL SYLLABLE DDYUG..HANGUL SYLLABLE DDYUH\n\t\t( 0xB729 <= code && code <= 0xB743 ) || // Lo [27] HANGUL SYLLABLE DDEUG..HANGUL SYLLABLE DDEUH\n\t\t( 0xB745 <= code && code <= 0xB75F ) || // Lo [27] HANGUL SYLLABLE DDYIG..HANGUL SYLLABLE DDYIH\n\t\t( 0xB761 <= code && code <= 0xB77B ) || // Lo [27] HANGUL SYLLABLE DDIG..HANGUL SYLLABLE DDIH\n\t\t( 0xB77D <= code && code <= 0xB797 ) || // Lo [27] HANGUL SYLLABLE RAG..HANGUL SYLLABLE RAH\n\t\t( 0xB799 <= code && code <= 0xB7B3 ) || // Lo [27] HANGUL SYLLABLE RAEG..HANGUL SYLLABLE RAEH\n\t\t( 0xB7B5 <= code && code <= 0xB7CF ) || // Lo [27] HANGUL SYLLABLE RYAG..HANGUL SYLLABLE RYAH\n\t\t( 0xB7D1 <= code && code <= 0xB7EB ) || // Lo [27] HANGUL SYLLABLE RYAEG..HANGUL SYLLABLE RYAEH\n\t\t( 0xB7ED <= code && code <= 0xB807 ) || // Lo [27] HANGUL SYLLABLE REOG..HANGUL SYLLABLE REOH\n\t\t( 0xB809 <= code && code <= 0xB823 ) || // Lo [27] HANGUL SYLLABLE REG..HANGUL SYLLABLE REH\n\t\t( 0xB825 <= code && code <= 0xB83F ) || // Lo [27] HANGUL SYLLABLE RYEOG..HANGUL SYLLABLE RYEOH\n\t\t( 0xB841 <= code && code <= 0xB85B ) || // Lo [27] HANGUL SYLLABLE RYEG..HANGUL SYLLABLE RYEH\n\t\t( 0xB85D <= code && code <= 0xB877 ) || // Lo [27] HANGUL SYLLABLE ROG..HANGUL SYLLABLE ROH\n\t\t( 0xB879 <= code && code <= 0xB893 ) || // Lo [27] HANGUL SYLLABLE RWAG..HANGUL SYLLABLE RWAH\n\t\t( 0xB895 <= code && code <= 0xB8AF ) || // Lo [27] HANGUL SYLLABLE RWAEG..HANGUL SYLLABLE RWAEH\n\t\t( 0xB8B1 <= code && code <= 0xB8CB ) || // Lo [27] HANGUL SYLLABLE ROEG..HANGUL SYLLABLE ROEH\n\t\t( 0xB8CD <= code && code <= 0xB8E7 ) || // Lo [27] HANGUL SYLLABLE RYOG..HANGUL SYLLABLE RYOH\n\t\t( 0xB8E9 <= code && code <= 0xB903 ) || // Lo [27] HANGUL SYLLABLE RUG..HANGUL SYLLABLE RUH\n\t\t( 0xB905 <= code && code <= 0xB91F ) || // Lo [27] HANGUL SYLLABLE RWEOG..HANGUL SYLLABLE RWEOH\n\t\t( 0xB921 <= code && code <= 0xB93B ) || // Lo [27] HANGUL SYLLABLE RWEG..HANGUL SYLLABLE RWEH\n\t\t( 0xB93D <= code && code <= 0xB957 ) || // Lo [27] HANGUL SYLLABLE RWIG..HANGUL SYLLABLE RWIH\n\t\t( 0xB959 <= code && code <= 0xB973 ) || // Lo [27] HANGUL SYLLABLE RYUG..HANGUL SYLLABLE RYUH\n\t\t( 0xB975 <= code && code <= 0xB98F ) || // Lo [27] HANGUL SYLLABLE REUG..HANGUL SYLLABLE REUH\n\t\t( 0xB991 <= code && code <= 0xB9AB ) || // Lo [27] HANGUL SYLLABLE RYIG..HANGUL SYLLABLE RYIH\n\t\t( 0xB9AD <= code && code <= 0xB9C7 ) || // Lo [27] HANGUL SYLLABLE RIG..HANGUL SYLLABLE RIH\n\t\t( 0xB9C9 <= code && code <= 0xB9E3 ) || // Lo [27] HANGUL SYLLABLE MAG..HANGUL SYLLABLE MAH\n\t\t( 0xB9E5 <= code && code <= 0xB9FF ) || // Lo [27] HANGUL SYLLABLE MAEG..HANGUL SYLLABLE MAEH\n\t\t( 0xBA01 <= code && code <= 0xBA1B ) || // Lo [27] HANGUL SYLLABLE MYAG..HANGUL SYLLABLE MYAH\n\t\t( 0xBA1D <= code && code <= 0xBA37 ) || // Lo [27] HANGUL SYLLABLE MYAEG..HANGUL SYLLABLE MYAEH\n\t\t( 0xBA39 <= code && code <= 0xBA53 ) || // Lo [27] HANGUL SYLLABLE MEOG..HANGUL SYLLABLE MEOH\n\t\t( 0xBA55 <= code && code <= 0xBA6F ) || // Lo [27] HANGUL SYLLABLE MEG..HANGUL SYLLABLE MEH\n\t\t( 0xBA71 <= code && code <= 0xBA8B ) || // Lo [27] HANGUL SYLLABLE MYEOG..HANGUL SYLLABLE MYEOH\n\t\t( 0xBA8D <= code && code <= 0xBAA7 ) || // Lo [27] HANGUL SYLLABLE MYEG..HANGUL SYLLABLE MYEH\n\t\t( 0xBAA9 <= code && code <= 0xBAC3 ) || // Lo [27] HANGUL SYLLABLE MOG..HANGUL SYLLABLE MOH\n\t\t( 0xBAC5 <= code && code <= 0xBADF ) || // Lo [27] HANGUL SYLLABLE MWAG..HANGUL SYLLABLE MWAH\n\t\t( 0xBAE1 <= code && code <= 0xBAFB ) || // Lo [27] HANGUL SYLLABLE MWAEG..HANGUL SYLLABLE MWAEH\n\t\t( 0xBAFD <= code && code <= 0xBB17 ) || // Lo [27] HANGUL SYLLABLE MOEG..HANGUL SYLLABLE MOEH\n\t\t( 0xBB19 <= code && code <= 0xBB33 ) || // Lo [27] HANGUL SYLLABLE MYOG..HANGUL SYLLABLE MYOH\n\t\t( 0xBB35 <= code && code <= 0xBB4F ) || // Lo [27] HANGUL SYLLABLE MUG..HANGUL SYLLABLE MUH\n\t\t( 0xBB51 <= code && code <= 0xBB6B ) || // Lo [27] HANGUL SYLLABLE MWEOG..HANGUL SYLLABLE MWEOH\n\t\t( 0xBB6D <= code && code <= 0xBB87 ) || // Lo [27] HANGUL SYLLABLE MWEG..HANGUL SYLLABLE MWEH\n\t\t( 0xBB89 <= code && code <= 0xBBA3 ) || // Lo [27] HANGUL SYLLABLE MWIG..HANGUL SYLLABLE MWIH\n\t\t( 0xBBA5 <= code && code <= 0xBBBF ) || // Lo [27] HANGUL SYLLABLE MYUG..HANGUL SYLLABLE MYUH\n\t\t( 0xBBC1 <= code && code <= 0xBBDB ) || // Lo [27] HANGUL SYLLABLE MEUG..HANGUL SYLLABLE MEUH\n\t\t( 0xBBDD <= code && code <= 0xBBF7 ) || // Lo [27] HANGUL SYLLABLE MYIG..HANGUL SYLLABLE MYIH\n\t\t( 0xBBF9 <= code && code <= 0xBC13 ) || // Lo [27] HANGUL SYLLABLE MIG..HANGUL SYLLABLE MIH\n\t\t( 0xBC15 <= code && code <= 0xBC2F ) || // Lo [27] HANGUL SYLLABLE BAG..HANGUL SYLLABLE BAH\n\t\t( 0xBC31 <= code && code <= 0xBC4B ) || // Lo [27] HANGUL SYLLABLE BAEG..HANGUL SYLLABLE BAEH\n\t\t( 0xBC4D <= code && code <= 0xBC67 ) || // Lo [27] HANGUL SYLLABLE BYAG..HANGUL SYLLABLE BYAH\n\t\t( 0xBC69 <= code && code <= 0xBC83 ) || // Lo [27] HANGUL SYLLABLE BYAEG..HANGUL SYLLABLE BYAEH\n\t\t( 0xBC85 <= code && code <= 0xBC9F ) || // Lo [27] HANGUL SYLLABLE BEOG..HANGUL SYLLABLE BEOH\n\t\t( 0xBCA1 <= code && code <= 0xBCBB ) || // Lo [27] HANGUL SYLLABLE BEG..HANGUL SYLLABLE BEH\n\t\t( 0xBCBD <= code && code <= 0xBCD7 ) || // Lo [27] HANGUL SYLLABLE BYEOG..HANGUL SYLLABLE BYEOH\n\t\t( 0xBCD9 <= code && code <= 0xBCF3 ) || // Lo [27] HANGUL SYLLABLE BYEG..HANGUL SYLLABLE BYEH\n\t\t( 0xBCF5 <= code && code <= 0xBD0F ) || // Lo [27] HANGUL SYLLABLE BOG..HANGUL SYLLABLE BOH\n\t\t( 0xBD11 <= code && code <= 0xBD2B ) || // Lo [27] HANGUL SYLLABLE BWAG..HANGUL SYLLABLE BWAH\n\t\t( 0xBD2D <= code && code <= 0xBD47 ) || // Lo [27] HANGUL SYLLABLE BWAEG..HANGUL SYLLABLE BWAEH\n\t\t( 0xBD49 <= code && code <= 0xBD63 ) || // Lo [27] HANGUL SYLLABLE BOEG..HANGUL SYLLABLE BOEH\n\t\t( 0xBD65 <= code && code <= 0xBD7F ) || // Lo [27] HANGUL SYLLABLE BYOG..HANGUL SYLLABLE BYOH\n\t\t( 0xBD81 <= code && code <= 0xBD9B ) || // Lo [27] HANGUL SYLLABLE BUG..HANGUL SYLLABLE BUH\n\t\t( 0xBD9D <= code && code <= 0xBDB7 ) || // Lo [27] HANGUL SYLLABLE BWEOG..HANGUL SYLLABLE BWEOH\n\t\t( 0xBDB9 <= code && code <= 0xBDD3 ) || // Lo [27] HANGUL SYLLABLE BWEG..HANGUL SYLLABLE BWEH\n\t\t( 0xBDD5 <= code && code <= 0xBDEF ) || // Lo [27] HANGUL SYLLABLE BWIG..HANGUL SYLLABLE BWIH\n\t\t( 0xBDF1 <= code && code <= 0xBE0B ) || // Lo [27] HANGUL SYLLABLE BYUG..HANGUL SYLLABLE BYUH\n\t\t( 0xBE0D <= code && code <= 0xBE27 ) || // Lo [27] HANGUL SYLLABLE BEUG..HANGUL SYLLABLE BEUH\n\t\t( 0xBE29 <= code && code <= 0xBE43 ) || // Lo [27] HANGUL SYLLABLE BYIG..HANGUL SYLLABLE BYIH\n\t\t( 0xBE45 <= code && code <= 0xBE5F ) || // Lo [27] HANGUL SYLLABLE BIG..HANGUL SYLLABLE BIH\n\t\t( 0xBE61 <= code && code <= 0xBE7B ) || // Lo [27] HANGUL SYLLABLE BBAG..HANGUL SYLLABLE BBAH\n\t\t( 0xBE7D <= code && code <= 0xBE97 ) || // Lo [27] HANGUL SYLLABLE BBAEG..HANGUL SYLLABLE BBAEH\n\t\t( 0xBE99 <= code && code <= 0xBEB3 ) || // Lo [27] HANGUL SYLLABLE BBYAG..HANGUL SYLLABLE BBYAH\n\t\t( 0xBEB5 <= code && code <= 0xBECF ) || // Lo [27] HANGUL SYLLABLE BBYAEG..HANGUL SYLLABLE BBYAEH\n\t\t( 0xBED1 <= code && code <= 0xBEEB ) || // Lo [27] HANGUL SYLLABLE BBEOG..HANGUL SYLLABLE BBEOH\n\t\t( 0xBEED <= code && code <= 0xBF07 ) || // Lo [27] HANGUL SYLLABLE BBEG..HANGUL SYLLABLE BBEH\n\t\t( 0xBF09 <= code && code <= 0xBF23 ) || // Lo [27] HANGUL SYLLABLE BBYEOG..HANGUL SYLLABLE BBYEOH\n\t\t( 0xBF25 <= code && code <= 0xBF3F ) || // Lo [27] HANGUL SYLLABLE BBYEG..HANGUL SYLLABLE BBYEH\n\t\t( 0xBF41 <= code && code <= 0xBF5B ) || // Lo [27] HANGUL SYLLABLE BBOG..HANGUL SYLLABLE BBOH\n\t\t( 0xBF5D <= code && code <= 0xBF77 ) || // Lo [27] HANGUL SYLLABLE BBWAG..HANGUL SYLLABLE BBWAH\n\t\t( 0xBF79 <= code && code <= 0xBF93 ) || // Lo [27] HANGUL SYLLABLE BBWAEG..HANGUL SYLLABLE BBWAEH\n\t\t( 0xBF95 <= code && code <= 0xBFAF ) || // Lo [27] HANGUL SYLLABLE BBOEG..HANGUL SYLLABLE BBOEH\n\t\t( 0xBFB1 <= code && code <= 0xBFCB ) || // Lo [27] HANGUL SYLLABLE BBYOG..HANGUL SYLLABLE BBYOH\n\t\t( 0xBFCD <= code && code <= 0xBFE7 ) || // Lo [27] HANGUL SYLLABLE BBUG..HANGUL SYLLABLE BBUH\n\t\t( 0xBFE9 <= code && code <= 0xC003 ) || // Lo [27] HANGUL SYLLABLE BBWEOG..HANGUL SYLLABLE BBWEOH\n\t\t( 0xC005 <= code && code <= 0xC01F ) || // Lo [27] HANGUL SYLLABLE BBWEG..HANGUL SYLLABLE BBWEH\n\t\t( 0xC021 <= code && code <= 0xC03B ) || // Lo [27] HANGUL SYLLABLE BBWIG..HANGUL SYLLABLE BBWIH\n\t\t( 0xC03D <= code && code <= 0xC057 ) || // Lo [27] HANGUL SYLLABLE BBYUG..HANGUL SYLLABLE BBYUH\n\t\t( 0xC059 <= code && code <= 0xC073 ) || // Lo [27] HANGUL SYLLABLE BBEUG..HANGUL SYLLABLE BBEUH\n\t\t( 0xC075 <= code && code <= 0xC08F ) || // Lo [27] HANGUL SYLLABLE BBYIG..HANGUL SYLLABLE BBYIH\n\t\t( 0xC091 <= code && code <= 0xC0AB ) || // Lo [27] HANGUL SYLLABLE BBIG..HANGUL SYLLABLE BBIH\n\t\t( 0xC0AD <= code && code <= 0xC0C7 ) || // Lo [27] HANGUL SYLLABLE SAG..HANGUL SYLLABLE SAH\n\t\t( 0xC0C9 <= code && code <= 0xC0E3 ) || // Lo [27] HANGUL SYLLABLE SAEG..HANGUL SYLLABLE SAEH\n\t\t( 0xC0E5 <= code && code <= 0xC0FF ) || // Lo [27] HANGUL SYLLABLE SYAG..HANGUL SYLLABLE SYAH\n\t\t( 0xC101 <= code && code <= 0xC11B ) || // Lo [27] HANGUL SYLLABLE SYAEG..HANGUL SYLLABLE SYAEH\n\t\t( 0xC11D <= code && code <= 0xC137 ) || // Lo [27] HANGUL SYLLABLE SEOG..HANGUL SYLLABLE SEOH\n\t\t( 0xC139 <= code && code <= 0xC153 ) || // Lo [27] HANGUL SYLLABLE SEG..HANGUL SYLLABLE SEH\n\t\t( 0xC155 <= code && code <= 0xC16F ) || // Lo [27] HANGUL SYLLABLE SYEOG..HANGUL SYLLABLE SYEOH\n\t\t( 0xC171 <= code && code <= 0xC18B ) || // Lo [27] HANGUL SYLLABLE SYEG..HANGUL SYLLABLE SYEH\n\t\t( 0xC18D <= code && code <= 0xC1A7 ) || // Lo [27] HANGUL SYLLABLE SOG..HANGUL SYLLABLE SOH\n\t\t( 0xC1A9 <= code && code <= 0xC1C3 ) || // Lo [27] HANGUL SYLLABLE SWAG..HANGUL SYLLABLE SWAH\n\t\t( 0xC1C5 <= code && code <= 0xC1DF ) || // Lo [27] HANGUL SYLLABLE SWAEG..HANGUL SYLLABLE SWAEH\n\t\t( 0xC1E1 <= code && code <= 0xC1FB ) || // Lo [27] HANGUL SYLLABLE SOEG..HANGUL SYLLABLE SOEH\n\t\t( 0xC1FD <= code && code <= 0xC217 ) || // Lo [27] HANGUL SYLLABLE SYOG..HANGUL SYLLABLE SYOH\n\t\t( 0xC219 <= code && code <= 0xC233 ) || // Lo [27] HANGUL SYLLABLE SUG..HANGUL SYLLABLE SUH\n\t\t( 0xC235 <= code && code <= 0xC24F ) || // Lo [27] HANGUL SYLLABLE SWEOG..HANGUL SYLLABLE SWEOH\n\t\t( 0xC251 <= code && code <= 0xC26B ) || // Lo [27] HANGUL SYLLABLE SWEG..HANGUL SYLLABLE SWEH\n\t\t( 0xC26D <= code && code <= 0xC287 ) || // Lo [27] HANGUL SYLLABLE SWIG..HANGUL SYLLABLE SWIH\n\t\t( 0xC289 <= code && code <= 0xC2A3 ) || // Lo [27] HANGUL SYLLABLE SYUG..HANGUL SYLLABLE SYUH\n\t\t( 0xC2A5 <= code && code <= 0xC2BF ) || // Lo [27] HANGUL SYLLABLE SEUG..HANGUL SYLLABLE SEUH\n\t\t( 0xC2C1 <= code && code <= 0xC2DB ) || // Lo [27] HANGUL SYLLABLE SYIG..HANGUL SYLLABLE SYIH\n\t\t( 0xC2DD <= code && code <= 0xC2F7 ) || // Lo [27] HANGUL SYLLABLE SIG..HANGUL SYLLABLE SIH\n\t\t( 0xC2F9 <= code && code <= 0xC313 ) || // Lo [27] HANGUL SYLLABLE SSAG..HANGUL SYLLABLE SSAH\n\t\t( 0xC315 <= code && code <= 0xC32F ) || // Lo [27] HANGUL SYLLABLE SSAEG..HANGUL SYLLABLE SSAEH\n\t\t( 0xC331 <= code && code <= 0xC34B ) || // Lo [27] HANGUL SYLLABLE SSYAG..HANGUL SYLLABLE SSYAH\n\t\t( 0xC34D <= code && code <= 0xC367 ) || // Lo [27] HANGUL SYLLABLE SSYAEG..HANGUL SYLLABLE SSYAEH\n\t\t( 0xC369 <= code && code <= 0xC383 ) || // Lo [27] HANGUL SYLLABLE SSEOG..HANGUL SYLLABLE SSEOH\n\t\t( 0xC385 <= code && code <= 0xC39F ) || // Lo [27] HANGUL SYLLABLE SSEG..HANGUL SYLLABLE SSEH\n\t\t( 0xC3A1 <= code && code <= 0xC3BB ) || // Lo [27] HANGUL SYLLABLE SSYEOG..HANGUL SYLLABLE SSYEOH\n\t\t( 0xC3BD <= code && code <= 0xC3D7 ) || // Lo [27] HANGUL SYLLABLE SSYEG..HANGUL SYLLABLE SSYEH\n\t\t( 0xC3D9 <= code && code <= 0xC3F3 ) || // Lo [27] HANGUL SYLLABLE SSOG..HANGUL SYLLABLE SSOH\n\t\t( 0xC3F5 <= code && code <= 0xC40F ) || // Lo [27] HANGUL SYLLABLE SSWAG..HANGUL SYLLABLE SSWAH\n\t\t( 0xC411 <= code && code <= 0xC42B ) || // Lo [27] HANGUL SYLLABLE SSWAEG..HANGUL SYLLABLE SSWAEH\n\t\t( 0xC42D <= code && code <= 0xC447 ) || // Lo [27] HANGUL SYLLABLE SSOEG..HANGUL SYLLABLE SSOEH\n\t\t( 0xC449 <= code && code <= 0xC463 ) || // Lo [27] HANGUL SYLLABLE SSYOG..HANGUL SYLLABLE SSYOH\n\t\t( 0xC465 <= code && code <= 0xC47F ) || // Lo [27] HANGUL SYLLABLE SSUG..HANGUL SYLLABLE SSUH\n\t\t( 0xC481 <= code && code <= 0xC49B ) || // Lo [27] HANGUL SYLLABLE SSWEOG..HANGUL SYLLABLE SSWEOH\n\t\t( 0xC49D <= code && code <= 0xC4B7 ) || // Lo [27] HANGUL SYLLABLE SSWEG..HANGUL SYLLABLE SSWEH\n\t\t( 0xC4B9 <= code && code <= 0xC4D3 ) || // Lo [27] HANGUL SYLLABLE SSWIG..HANGUL SYLLABLE SSWIH\n\t\t( 0xC4D5 <= code && code <= 0xC4EF ) || // Lo [27] HANGUL SYLLABLE SSYUG..HANGUL SYLLABLE SSYUH\n\t\t( 0xC4F1 <= code && code <= 0xC50B ) || // Lo [27] HANGUL SYLLABLE SSEUG..HANGUL SYLLABLE SSEUH\n\t\t( 0xC50D <= code && code <= 0xC527 ) || // Lo [27] HANGUL SYLLABLE SSYIG..HANGUL SYLLABLE SSYIH\n\t\t( 0xC529 <= code && code <= 0xC543 ) || // Lo [27] HANGUL SYLLABLE SSIG..HANGUL SYLLABLE SSIH\n\t\t( 0xC545 <= code && code <= 0xC55F ) || // Lo [27] HANGUL SYLLABLE AG..HANGUL SYLLABLE AH\n\t\t( 0xC561 <= code && code <= 0xC57B ) || // Lo [27] HANGUL SYLLABLE AEG..HANGUL SYLLABLE AEH\n\t\t( 0xC57D <= code && code <= 0xC597 ) || // Lo [27] HANGUL SYLLABLE YAG..HANGUL SYLLABLE YAH\n\t\t( 0xC599 <= code && code <= 0xC5B3 ) || // Lo [27] HANGUL SYLLABLE YAEG..HANGUL SYLLABLE YAEH\n\t\t( 0xC5B5 <= code && code <= 0xC5CF ) || // Lo [27] HANGUL SYLLABLE EOG..HANGUL SYLLABLE EOH\n\t\t( 0xC5D1 <= code && code <= 0xC5EB ) || // Lo [27] HANGUL SYLLABLE EG..HANGUL SYLLABLE EH\n\t\t( 0xC5ED <= code && code <= 0xC607 ) || // Lo [27] HANGUL SYLLABLE YEOG..HANGUL SYLLABLE YEOH\n\t\t( 0xC609 <= code && code <= 0xC623 ) || // Lo [27] HANGUL SYLLABLE YEG..HANGUL SYLLABLE YEH\n\t\t( 0xC625 <= code && code <= 0xC63F ) || // Lo [27] HANGUL SYLLABLE OG..HANGUL SYLLABLE OH\n\t\t( 0xC641 <= code && code <= 0xC65B ) || // Lo [27] HANGUL SYLLABLE WAG..HANGUL SYLLABLE WAH\n\t\t( 0xC65D <= code && code <= 0xC677 ) || // Lo [27] HANGUL SYLLABLE WAEG..HANGUL SYLLABLE WAEH\n\t\t( 0xC679 <= code && code <= 0xC693 ) || // Lo [27] HANGUL SYLLABLE OEG..HANGUL SYLLABLE OEH\n\t\t( 0xC695 <= code && code <= 0xC6AF ) || // Lo [27] HANGUL SYLLABLE YOG..HANGUL SYLLABLE YOH\n\t\t( 0xC6B1 <= code && code <= 0xC6CB ) || // Lo [27] HANGUL SYLLABLE UG..HANGUL SYLLABLE UH\n\t\t( 0xC6CD <= code && code <= 0xC6E7 ) || // Lo [27] HANGUL SYLLABLE WEOG..HANGUL SYLLABLE WEOH\n\t\t( 0xC6E9 <= code && code <= 0xC703 ) || // Lo [27] HANGUL SYLLABLE WEG..HANGUL SYLLABLE WEH\n\t\t( 0xC705 <= code && code <= 0xC71F ) || // Lo [27] HANGUL SYLLABLE WIG..HANGUL SYLLABLE WIH\n\t\t( 0xC721 <= code && code <= 0xC73B ) || // Lo [27] HANGUL SYLLABLE YUG..HANGUL SYLLABLE YUH\n\t\t( 0xC73D <= code && code <= 0xC757 ) || // Lo [27] HANGUL SYLLABLE EUG..HANGUL SYLLABLE EUH\n\t\t( 0xC759 <= code && code <= 0xC773 ) || // Lo [27] HANGUL SYLLABLE YIG..HANGUL SYLLABLE YIH\n\t\t( 0xC775 <= code && code <= 0xC78F ) || // Lo [27] HANGUL SYLLABLE IG..HANGUL SYLLABLE IH\n\t\t( 0xC791 <= code && code <= 0xC7AB ) || // Lo [27] HANGUL SYLLABLE JAG..HANGUL SYLLABLE JAH\n\t\t( 0xC7AD <= code && code <= 0xC7C7 ) || // Lo [27] HANGUL SYLLABLE JAEG..HANGUL SYLLABLE JAEH\n\t\t( 0xC7C9 <= code && code <= 0xC7E3 ) || // Lo [27] HANGUL SYLLABLE JYAG..HANGUL SYLLABLE JYAH\n\t\t( 0xC7E5 <= code && code <= 0xC7FF ) || // Lo [27] HANGUL SYLLABLE JYAEG..HANGUL SYLLABLE JYAEH\n\t\t( 0xC801 <= code && code <= 0xC81B ) || // Lo [27] HANGUL SYLLABLE JEOG..HANGUL SYLLABLE JEOH\n\t\t( 0xC81D <= code && code <= 0xC837 ) || // Lo [27] HANGUL SYLLABLE JEG..HANGUL SYLLABLE JEH\n\t\t( 0xC839 <= code && code <= 0xC853 ) || // Lo [27] HANGUL SYLLABLE JYEOG..HANGUL SYLLABLE JYEOH\n\t\t( 0xC855 <= code && code <= 0xC86F ) || // Lo [27] HANGUL SYLLABLE JYEG..HANGUL SYLLABLE JYEH\n\t\t( 0xC871 <= code && code <= 0xC88B ) || // Lo [27] HANGUL SYLLABLE JOG..HANGUL SYLLABLE JOH\n\t\t( 0xC88D <= code && code <= 0xC8A7 ) || // Lo [27] HANGUL SYLLABLE JWAG..HANGUL SYLLABLE JWAH\n\t\t( 0xC8A9 <= code && code <= 0xC8C3 ) || // Lo [27] HANGUL SYLLABLE JWAEG..HANGUL SYLLABLE JWAEH\n\t\t( 0xC8C5 <= code && code <= 0xC8DF ) || // Lo [27] HANGUL SYLLABLE JOEG..HANGUL SYLLABLE JOEH\n\t\t( 0xC8E1 <= code && code <= 0xC8FB ) || // Lo [27] HANGUL SYLLABLE JYOG..HANGUL SYLLABLE JYOH\n\t\t( 0xC8FD <= code && code <= 0xC917 ) || // Lo [27] HANGUL SYLLABLE JUG..HANGUL SYLLABLE JUH\n\t\t( 0xC919 <= code && code <= 0xC933 ) || // Lo [27] HANGUL SYLLABLE JWEOG..HANGUL SYLLABLE JWEOH\n\t\t( 0xC935 <= code && code <= 0xC94F ) || // Lo [27] HANGUL SYLLABLE JWEG..HANGUL SYLLABLE JWEH\n\t\t( 0xC951 <= code && code <= 0xC96B ) || // Lo [27] HANGUL SYLLABLE JWIG..HANGUL SYLLABLE JWIH\n\t\t( 0xC96D <= code && code <= 0xC987 ) || // Lo [27] HANGUL SYLLABLE JYUG..HANGUL SYLLABLE JYUH\n\t\t( 0xC989 <= code && code <= 0xC9A3 ) || // Lo [27] HANGUL SYLLABLE JEUG..HANGUL SYLLABLE JEUH\n\t\t( 0xC9A5 <= code && code <= 0xC9BF ) || // Lo [27] HANGUL SYLLABLE JYIG..HANGUL SYLLABLE JYIH\n\t\t( 0xC9C1 <= code && code <= 0xC9DB ) || // Lo [27] HANGUL SYLLABLE JIG..HANGUL SYLLABLE JIH\n\t\t( 0xC9DD <= code && code <= 0xC9F7 ) || // Lo [27] HANGUL SYLLABLE JJAG..HANGUL SYLLABLE JJAH\n\t\t( 0xC9F9 <= code && code <= 0xCA13 ) || // Lo [27] HANGUL SYLLABLE JJAEG..HANGUL SYLLABLE JJAEH\n\t\t( 0xCA15 <= code && code <= 0xCA2F ) || // Lo [27] HANGUL SYLLABLE JJYAG..HANGUL SYLLABLE JJYAH\n\t\t( 0xCA31 <= code && code <= 0xCA4B ) || // Lo [27] HANGUL SYLLABLE JJYAEG..HANGUL SYLLABLE JJYAEH\n\t\t( 0xCA4D <= code && code <= 0xCA67 ) || // Lo [27] HANGUL SYLLABLE JJEOG..HANGUL SYLLABLE JJEOH\n\t\t( 0xCA69 <= code && code <= 0xCA83 ) || // Lo [27] HANGUL SYLLABLE JJEG..HANGUL SYLLABLE JJEH\n\t\t( 0xCA85 <= code && code <= 0xCA9F ) || // Lo [27] HANGUL SYLLABLE JJYEOG..HANGUL SYLLABLE JJYEOH\n\t\t( 0xCAA1 <= code && code <= 0xCABB ) || // Lo [27] HANGUL SYLLABLE JJYEG..HANGUL SYLLABLE JJYEH\n\t\t( 0xCABD <= code && code <= 0xCAD7 ) || // Lo [27] HANGUL SYLLABLE JJOG..HANGUL SYLLABLE JJOH\n\t\t( 0xCAD9 <= code && code <= 0xCAF3 ) || // Lo [27] HANGUL SYLLABLE JJWAG..HANGUL SYLLABLE JJWAH\n\t\t( 0xCAF5 <= code && code <= 0xCB0F ) || // Lo [27] HANGUL SYLLABLE JJWAEG..HANGUL SYLLABLE JJWAEH\n\t\t( 0xCB11 <= code && code <= 0xCB2B ) || // Lo [27] HANGUL SYLLABLE JJOEG..HANGUL SYLLABLE JJOEH\n\t\t( 0xCB2D <= code && code <= 0xCB47 ) || // Lo [27] HANGUL SYLLABLE JJYOG..HANGUL SYLLABLE JJYOH\n\t\t( 0xCB49 <= code && code <= 0xCB63 ) || // Lo [27] HANGUL SYLLABLE JJUG..HANGUL SYLLABLE JJUH\n\t\t( 0xCB65 <= code && code <= 0xCB7F ) || // Lo [27] HANGUL SYLLABLE JJWEOG..HANGUL SYLLABLE JJWEOH\n\t\t( 0xCB81 <= code && code <= 0xCB9B ) || // Lo [27] HANGUL SYLLABLE JJWEG..HANGUL SYLLABLE JJWEH\n\t\t( 0xCB9D <= code && code <= 0xCBB7 ) || // Lo [27] HANGUL SYLLABLE JJWIG..HANGUL SYLLABLE JJWIH\n\t\t( 0xCBB9 <= code && code <= 0xCBD3 ) || // Lo [27] HANGUL SYLLABLE JJYUG..HANGUL SYLLABLE JJYUH\n\t\t( 0xCBD5 <= code && code <= 0xCBEF ) || // Lo [27] HANGUL SYLLABLE JJEUG..HANGUL SYLLABLE JJEUH\n\t\t( 0xCBF1 <= code && code <= 0xCC0B ) || // Lo [27] HANGUL SYLLABLE JJYIG..HANGUL SYLLABLE JJYIH\n\t\t( 0xCC0D <= code && code <= 0xCC27 ) || // Lo [27] HANGUL SYLLABLE JJIG..HANGUL SYLLABLE JJIH\n\t\t( 0xCC29 <= code && code <= 0xCC43 ) || // Lo [27] HANGUL SYLLABLE CAG..HANGUL SYLLABLE CAH\n\t\t( 0xCC45 <= code && code <= 0xCC5F ) || // Lo [27] HANGUL SYLLABLE CAEG..HANGUL SYLLABLE CAEH\n\t\t( 0xCC61 <= code && code <= 0xCC7B ) || // Lo [27] HANGUL SYLLABLE CYAG..HANGUL SYLLABLE CYAH\n\t\t( 0xCC7D <= code && code <= 0xCC97 ) || // Lo [27] HANGUL SYLLABLE CYAEG..HANGUL SYLLABLE CYAEH\n\t\t( 0xCC99 <= code && code <= 0xCCB3 ) || // Lo [27] HANGUL SYLLABLE CEOG..HANGUL SYLLABLE CEOH\n\t\t( 0xCCB5 <= code && code <= 0xCCCF ) || // Lo [27] HANGUL SYLLABLE CEG..HANGUL SYLLABLE CEH\n\t\t( 0xCCD1 <= code && code <= 0xCCEB ) || // Lo [27] HANGUL SYLLABLE CYEOG..HANGUL SYLLABLE CYEOH\n\t\t( 0xCCED <= code && code <= 0xCD07 ) || // Lo [27] HANGUL SYLLABLE CYEG..HANGUL SYLLABLE CYEH\n\t\t( 0xCD09 <= code && code <= 0xCD23 ) || // Lo [27] HANGUL SYLLABLE COG..HANGUL SYLLABLE COH\n\t\t( 0xCD25 <= code && code <= 0xCD3F ) || // Lo [27] HANGUL SYLLABLE CWAG..HANGUL SYLLABLE CWAH\n\t\t( 0xCD41 <= code && code <= 0xCD5B ) || // Lo [27] HANGUL SYLLABLE CWAEG..HANGUL SYLLABLE CWAEH\n\t\t( 0xCD5D <= code && code <= 0xCD77 ) || // Lo [27] HANGUL SYLLABLE COEG..HANGUL SYLLABLE COEH\n\t\t( 0xCD79 <= code && code <= 0xCD93 ) || // Lo [27] HANGUL SYLLABLE CYOG..HANGUL SYLLABLE CYOH\n\t\t( 0xCD95 <= code && code <= 0xCDAF ) || // Lo [27] HANGUL SYLLABLE CUG..HANGUL SYLLABLE CUH\n\t\t( 0xCDB1 <= code && code <= 0xCDCB ) || // Lo [27] HANGUL SYLLABLE CWEOG..HANGUL SYLLABLE CWEOH\n\t\t( 0xCDCD <= code && code <= 0xCDE7 ) || // Lo [27] HANGUL SYLLABLE CWEG..HANGUL SYLLABLE CWEH\n\t\t( 0xCDE9 <= code && code <= 0xCE03 ) || // Lo [27] HANGUL SYLLABLE CWIG..HANGUL SYLLABLE CWIH\n\t\t( 0xCE05 <= code && code <= 0xCE1F ) || // Lo [27] HANGUL SYLLABLE CYUG..HANGUL SYLLABLE CYUH\n\t\t( 0xCE21 <= code && code <= 0xCE3B ) || // Lo [27] HANGUL SYLLABLE CEUG..HANGUL SYLLABLE CEUH\n\t\t( 0xCE3D <= code && code <= 0xCE57 ) || // Lo [27] HANGUL SYLLABLE CYIG..HANGUL SYLLABLE CYIH\n\t\t( 0xCE59 <= code && code <= 0xCE73 ) || // Lo [27] HANGUL SYLLABLE CIG..HANGUL SYLLABLE CIH\n\t\t( 0xCE75 <= code && code <= 0xCE8F ) || // Lo [27] HANGUL SYLLABLE KAG..HANGUL SYLLABLE KAH\n\t\t( 0xCE91 <= code && code <= 0xCEAB ) || // Lo [27] HANGUL SYLLABLE KAEG..HANGUL SYLLABLE KAEH\n\t\t( 0xCEAD <= code && code <= 0xCEC7 ) || // Lo [27] HANGUL SYLLABLE KYAG..HANGUL SYLLABLE KYAH\n\t\t( 0xCEC9 <= code && code <= 0xCEE3 ) || // Lo [27] HANGUL SYLLABLE KYAEG..HANGUL SYLLABLE KYAEH\n\t\t( 0xCEE5 <= code && code <= 0xCEFF ) || // Lo [27] HANGUL SYLLABLE KEOG..HANGUL SYLLABLE KEOH\n\t\t( 0xCF01 <= code && code <= 0xCF1B ) || // Lo [27] HANGUL SYLLABLE KEG..HANGUL SYLLABLE KEH\n\t\t( 0xCF1D <= code && code <= 0xCF37 ) || // Lo [27] HANGUL SYLLABLE KYEOG..HANGUL SYLLABLE KYEOH\n\t\t( 0xCF39 <= code && code <= 0xCF53 ) || // Lo [27] HANGUL SYLLABLE KYEG..HANGUL SYLLABLE KYEH\n\t\t( 0xCF55 <= code && code <= 0xCF6F ) || // Lo [27] HANGUL SYLLABLE KOG..HANGUL SYLLABLE KOH\n\t\t( 0xCF71 <= code && code <= 0xCF8B ) || // Lo [27] HANGUL SYLLABLE KWAG..HANGUL SYLLABLE KWAH\n\t\t( 0xCF8D <= code && code <= 0xCFA7 ) || // Lo [27] HANGUL SYLLABLE KWAEG..HANGUL SYLLABLE KWAEH\n\t\t( 0xCFA9 <= code && code <= 0xCFC3 ) || // Lo [27] HANGUL SYLLABLE KOEG..HANGUL SYLLABLE KOEH\n\t\t( 0xCFC5 <= code && code <= 0xCFDF ) || // Lo [27] HANGUL SYLLABLE KYOG..HANGUL SYLLABLE KYOH\n\t\t( 0xCFE1 <= code && code <= 0xCFFB ) || // Lo [27] HANGUL SYLLABLE KUG..HANGUL SYLLABLE KUH\n\t\t( 0xCFFD <= code && code <= 0xD017 ) || // Lo [27] HANGUL SYLLABLE KWEOG..HANGUL SYLLABLE KWEOH\n\t\t( 0xD019 <= code && code <= 0xD033 ) || // Lo [27] HANGUL SYLLABLE KWEG..HANGUL SYLLABLE KWEH\n\t\t( 0xD035 <= code && code <= 0xD04F ) || // Lo [27] HANGUL SYLLABLE KWIG..HANGUL SYLLABLE KWIH\n\t\t( 0xD051 <= code && code <= 0xD06B ) || // Lo [27] HANGUL SYLLABLE KYUG..HANGUL SYLLABLE KYUH\n\t\t( 0xD06D <= code && code <= 0xD087 ) || // Lo [27] HANGUL SYLLABLE KEUG..HANGUL SYLLABLE KEUH\n\t\t( 0xD089 <= code && code <= 0xD0A3 ) || // Lo [27] HANGUL SYLLABLE KYIG..HANGUL SYLLABLE KYIH\n\t\t( 0xD0A5 <= code && code <= 0xD0BF ) || // Lo [27] HANGUL SYLLABLE KIG..HANGUL SYLLABLE KIH\n\t\t( 0xD0C1 <= code && code <= 0xD0DB ) || // Lo [27] HANGUL SYLLABLE TAG..HANGUL SYLLABLE TAH\n\t\t( 0xD0DD <= code && code <= 0xD0F7 ) || // Lo [27] HANGUL SYLLABLE TAEG..HANGUL SYLLABLE TAEH\n\t\t( 0xD0F9 <= code && code <= 0xD113 ) || // Lo [27] HANGUL SYLLABLE TYAG..HANGUL SYLLABLE TYAH\n\t\t( 0xD115 <= code && code <= 0xD12F ) || // Lo [27] HANGUL SYLLABLE TYAEG..HANGUL SYLLABLE TYAEH\n\t\t( 0xD131 <= code && code <= 0xD14B ) || // Lo [27] HANGUL SYLLABLE TEOG..HANGUL SYLLABLE TEOH\n\t\t( 0xD14D <= code && code <= 0xD167 ) || // Lo [27] HANGUL SYLLABLE TEG..HANGUL SYLLABLE TEH\n\t\t( 0xD169 <= code && code <= 0xD183 ) || // Lo [27] HANGUL SYLLABLE TYEOG..HANGUL SYLLABLE TYEOH\n\t\t( 0xD185 <= code && code <= 0xD19F ) || // Lo [27] HANGUL SYLLABLE TYEG..HANGUL SYLLABLE TYEH\n\t\t( 0xD1A1 <= code && code <= 0xD1BB ) || // Lo [27] HANGUL SYLLABLE TOG..HANGUL SYLLABLE TOH\n\t\t( 0xD1BD <= code && code <= 0xD1D7 ) || // Lo [27] HANGUL SYLLABLE TWAG..HANGUL SYLLABLE TWAH\n\t\t( 0xD1D9 <= code && code <= 0xD1F3 ) || // Lo [27] HANGUL SYLLABLE TWAEG..HANGUL SYLLABLE TWAEH\n\t\t( 0xD1F5 <= code && code <= 0xD20F ) || // Lo [27] HANGUL SYLLABLE TOEG..HANGUL SYLLABLE TOEH\n\t\t( 0xD211 <= code && code <= 0xD22B ) || // Lo [27] HANGUL SYLLABLE TYOG..HANGUL SYLLABLE TYOH\n\t\t( 0xD22D <= code && code <= 0xD247 ) || // Lo [27] HANGUL SYLLABLE TUG..HANGUL SYLLABLE TUH\n\t\t( 0xD249 <= code && code <= 0xD263 ) || // Lo [27] HANGUL SYLLABLE TWEOG..HANGUL SYLLABLE TWEOH\n\t\t( 0xD265 <= code && code <= 0xD27F ) || // Lo [27] HANGUL SYLLABLE TWEG..HANGUL SYLLABLE TWEH\n\t\t( 0xD281 <= code && code <= 0xD29B ) || // Lo [27] HANGUL SYLLABLE TWIG..HANGUL SYLLABLE TWIH\n\t\t( 0xD29D <= code && code <= 0xD2B7 ) || // Lo [27] HANGUL SYLLABLE TYUG..HANGUL SYLLABLE TYUH\n\t\t( 0xD2B9 <= code && code <= 0xD2D3 ) || // Lo [27] HANGUL SYLLABLE TEUG..HANGUL SYLLABLE TEUH\n\t\t( 0xD2D5 <= code && code <= 0xD2EF ) || // Lo [27] HANGUL SYLLABLE TYIG..HANGUL SYLLABLE TYIH\n\t\t( 0xD2F1 <= code && code <= 0xD30B ) || // Lo [27] HANGUL SYLLABLE TIG..HANGUL SYLLABLE TIH\n\t\t( 0xD30D <= code && code <= 0xD327 ) || // Lo [27] HANGUL SYLLABLE PAG..HANGUL SYLLABLE PAH\n\t\t( 0xD329 <= code && code <= 0xD343 ) || // Lo [27] HANGUL SYLLABLE PAEG..HANGUL SYLLABLE PAEH\n\t\t( 0xD345 <= code && code <= 0xD35F ) || // Lo [27] HANGUL SYLLABLE PYAG..HANGUL SYLLABLE PYAH\n\t\t( 0xD361 <= code && code <= 0xD37B ) || // Lo [27] HANGUL SYLLABLE PYAEG..HANGUL SYLLABLE PYAEH\n\t\t( 0xD37D <= code && code <= 0xD397 ) || // Lo [27] HANGUL SYLLABLE PEOG..HANGUL SYLLABLE PEOH\n\t\t( 0xD399 <= code && code <= 0xD3B3 ) || // Lo [27] HANGUL SYLLABLE PEG..HANGUL SYLLABLE PEH\n\t\t( 0xD3B5 <= code && code <= 0xD3CF ) || // Lo [27] HANGUL SYLLABLE PYEOG..HANGUL SYLLABLE PYEOH\n\t\t( 0xD3D1 <= code && code <= 0xD3EB ) || // Lo [27] HANGUL SYLLABLE PYEG..HANGUL SYLLABLE PYEH\n\t\t( 0xD3ED <= code && code <= 0xD407 ) || // Lo [27] HANGUL SYLLABLE POG..HANGUL SYLLABLE POH\n\t\t( 0xD409 <= code && code <= 0xD423 ) || // Lo [27] HANGUL SYLLABLE PWAG..HANGUL SYLLABLE PWAH\n\t\t( 0xD425 <= code && code <= 0xD43F ) || // Lo [27] HANGUL SYLLABLE PWAEG..HANGUL SYLLABLE PWAEH\n\t\t( 0xD441 <= code && code <= 0xD45B ) || // Lo [27] HANGUL SYLLABLE POEG..HANGUL SYLLABLE POEH\n\t\t( 0xD45D <= code && code <= 0xD477 ) || // Lo [27] HANGUL SYLLABLE PYOG..HANGUL SYLLABLE PYOH\n\t\t( 0xD479 <= code && code <= 0xD493 ) || // Lo [27] HANGUL SYLLABLE PUG..HANGUL SYLLABLE PUH\n\t\t( 0xD495 <= code && code <= 0xD4AF ) || // Lo [27] HANGUL SYLLABLE PWEOG..HANGUL SYLLABLE PWEOH\n\t\t( 0xD4B1 <= code && code <= 0xD4CB ) || // Lo [27] HANGUL SYLLABLE PWEG..HANGUL SYLLABLE PWEH\n\t\t( 0xD4CD <= code && code <= 0xD4E7 ) || // Lo [27] HANGUL SYLLABLE PWIG..HANGUL SYLLABLE PWIH\n\t\t( 0xD4E9 <= code && code <= 0xD503 ) || // Lo [27] HANGUL SYLLABLE PYUG..HANGUL SYLLABLE PYUH\n\t\t( 0xD505 <= code && code <= 0xD51F ) || // Lo [27] HANGUL SYLLABLE PEUG..HANGUL SYLLABLE PEUH\n\t\t( 0xD521 <= code && code <= 0xD53B ) || // Lo [27] HANGUL SYLLABLE PYIG..HANGUL SYLLABLE PYIH\n\t\t( 0xD53D <= code && code <= 0xD557 ) || // Lo [27] HANGUL SYLLABLE PIG..HANGUL SYLLABLE PIH\n\t\t( 0xD559 <= code && code <= 0xD573 ) || // Lo [27] HANGUL SYLLABLE HAG..HANGUL SYLLABLE HAH\n\t\t( 0xD575 <= code && code <= 0xD58F ) || // Lo [27] HANGUL SYLLABLE HAEG..HANGUL SYLLABLE HAEH\n\t\t( 0xD591 <= code && code <= 0xD5AB ) || // Lo [27] HANGUL SYLLABLE HYAG..HANGUL SYLLABLE HYAH\n\t\t( 0xD5AD <= code && code <= 0xD5C7 ) || // Lo [27] HANGUL SYLLABLE HYAEG..HANGUL SYLLABLE HYAEH\n\t\t( 0xD5C9 <= code && code <= 0xD5E3 ) || // Lo [27] HANGUL SYLLABLE HEOG..HANGUL SYLLABLE HEOH\n\t\t( 0xD5E5 <= code && code <= 0xD5FF ) || // Lo [27] HANGUL SYLLABLE HEG..HANGUL SYLLABLE HEH\n\t\t( 0xD601 <= code && code <= 0xD61B ) || // Lo [27] HANGUL SYLLABLE HYEOG..HANGUL SYLLABLE HYEOH\n\t\t( 0xD61D <= code && code <= 0xD637 ) || // Lo [27] HANGUL SYLLABLE HYEG..HANGUL SYLLABLE HYEH\n\t\t( 0xD639 <= code && code <= 0xD653 ) || // Lo [27] HANGUL SYLLABLE HOG..HANGUL SYLLABLE HOH\n\t\t( 0xD655 <= code && code <= 0xD66F ) || // Lo [27] HANGUL SYLLABLE HWAG..HANGUL SYLLABLE HWAH\n\t\t( 0xD671 <= code && code <= 0xD68B ) || // Lo [27] HANGUL SYLLABLE HWAEG..HANGUL SYLLABLE HWAEH\n\t\t( 0xD68D <= code && code <= 0xD6A7 ) || // Lo [27] HANGUL SYLLABLE HOEG..HANGUL SYLLABLE HOEH\n\t\t( 0xD6A9 <= code && code <= 0xD6C3 ) || // Lo [27] HANGUL SYLLABLE HYOG..HANGUL SYLLABLE HYOH\n\t\t( 0xD6C5 <= code && code <= 0xD6DF ) || // Lo [27] HANGUL SYLLABLE HUG..HANGUL SYLLABLE HUH\n\t\t( 0xD6E1 <= code && code <= 0xD6FB ) || // Lo [27] HANGUL SYLLABLE HWEOG..HANGUL SYLLABLE HWEOH\n\t\t( 0xD6FD <= code && code <= 0xD717 ) || // Lo [27] HANGUL SYLLABLE HWEG..HANGUL SYLLABLE HWEH\n\t\t( 0xD719 <= code && code <= 0xD733 ) || // Lo [27] HANGUL SYLLABLE HWIG..HANGUL SYLLABLE HWIH\n\t\t( 0xD735 <= code && code <= 0xD74F ) || // Lo [27] HANGUL SYLLABLE HYUG..HANGUL SYLLABLE HYUH\n\t\t( 0xD751 <= code && code <= 0xD76B ) || // Lo [27] HANGUL SYLLABLE HEUG..HANGUL SYLLABLE HEUH\n\t\t( 0xD76D <= code && code <= 0xD787 ) || // Lo [27] HANGUL SYLLABLE HYIG..HANGUL SYLLABLE HYIH\n\t\t( 0xD789 <= code && code <= 0xD7A3 ) // Lo [27] HANGUL SYLLABLE HIG..HANGUL SYLLABLE HIH\n\t) {\n\t\treturn constants.LVT;\n\t}\n\tif (\n\t\tcode === 0x200D // Cf ZERO WIDTH JOINER\n\t) {\n\t\treturn constants.ZWJ;\n\t}\n\t// All unlisted characters have a grapheme break property of \"Other\":\n\treturn constants.Other;\n}\n\n\n// EXPORTS //\n\nexport default graphemeBreakProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport codePointAt from './../../code-point-at';\nimport hasUTF16SurrogatePairAt from '@stdlib/assert/has-utf16-surrogate-pair-at';\nimport grapheme from './../../tools/grapheme-cluster-break';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar breakType = grapheme.breakType;\nvar breakProperty = grapheme.breakProperty;\nvar emojiProperty = grapheme.emojiProperty;\n\n\n// MAIN //\n\n/**\n* Returns the next extended grapheme cluster break in a string after a specified position.\n*\n* @param {string} str - input string\n* @param {integer} [fromIndex=0] - position\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be an integer\n* @returns {NonNegativeInteger} next grapheme break position\n*\n* @example\n* var out = nextGraphemeClusterBreak( 'last man standing', 4 );\n* // returns 5\n*\n* @example\n* var out = nextGraphemeClusterBreak( 'presidential election', 8 );\n* // returns 9\n*\n* @example\n* var out = nextGraphemeClusterBreak( 'अनुच्छेद', 1 );\n* // returns 3\n*\n* @example\n* var out = nextGraphemeClusterBreak( '🌷' );\n* // returns -1\n*/\nfunction nextGraphemeClusterBreak( str, fromIndex ) {\n\tvar breaks;\n\tvar emoji;\n\tvar len;\n\tvar idx;\n\tvar cp;\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\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\tidx = fromIndex;\n\t} else {\n\t\tidx = 0;\n\t}\n\tlen = str.length;\n\tif ( idx < 0 ) {\n\t\tidx += len;\n\t\tif ( idx < 0 ) {\n\t\t\tidx = 0;\n\t\t}\n\t}\n\tif ( len === 0 || idx >= len ) {\n\t\treturn -1;\n\t}\n\t// Initialize caches for storing grapheme break and emoji properties:\n\tbreaks = [];\n\temoji = [];\n\n\t// Get the code point for the starting index:\n\tcp = codePointAt( str, idx );\n\n\t// Get the corresponding grapheme break and emoji properties:\n\tbreaks.push( breakProperty( cp ) );\n\temoji.push( emojiProperty( cp ) );\n\n\t// Begin searching for the next grapheme cluster break...\n\tfor ( i = idx+1; i < len; i++ ) {\n\t\t// If the current character is part of a surrogate pair, move along...\n\t\tif ( hasUTF16SurrogatePairAt( str, i-1 ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\t// Get the next code point:\n\t\tcp = codePointAt( str, i );\n\n\t\t// Get the corresponding grapheme break and emoji properties:\n\t\tbreaks.push( breakProperty( cp ) );\n\t\temoji.push( emojiProperty( cp ) );\n\n\t\t// Determine if we've encountered a grapheme cluster break...\n\t\tif ( breakType( breaks, emoji ) > 0 ) {\n\t\t\t// We've found a break!\n\t\t\treturn i;\n\t\t}\n\t}\n\t// Unable to find a grapheme cluster break:\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nexport default nextGraphemeClusterBreak;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\n\n\n// MAIN //\n\n/**\n* Returns the first `n` grapheme clusters (i.e., user-perceived characters) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of grapheme clusters to return\n* @returns {string} output string\n*\n* @example\n* var out = first( 'last man standing', 1 );\n* // returns 'l'\n*\n* @example\n* var out = first( 'presidential election', 1 );\n* // returns 'p'\n*\n* @example\n* var out = first( 'JavaScript', 1 );\n* // returns 'J'\n*\n* @example\n* var out = first( 'Hidden Treasures', 1 );\n* // returns 'H'\n*\n* @example\n* var out = first( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐶🐮'\n*\n* @example\n* var out = first( 'foo bar', 5 );\n* // returns 'foo b'\n*/\nfunction first( str, n ) {\n\tvar i = 0;\n\twhile ( n > 0 ) {\n\t\ti = nextGraphemeClusterBreak( str, i );\n\t\tn -= 1;\n\t}\n\t// Value of `i` will be -1 if and only if `str` is an empty string or `str` has only 1 extended grapheme cluster...\n\tif ( str === '' || i === -1 ) {\n\t\treturn str;\n\t}\n\treturn str.substring( 0, i );\n}\n\n\n// EXPORTS //\n\nexport default first;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Invokes a function for each UTF-16 code unit in a string.\n*\n* @param {string} str - input string\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEach( 'Hello', log );\n*/\nfunction forEach( str, clbk, thisArg ) {\n\tvar i;\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tclbk.call( thisArg, str[ i ], i, str );\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEach;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Invokes a function for each Unicode code point in a string.\n*\n* @param {string} str - input string\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEach( 'Hello', log );\n*/\nfunction forEach( str, clbk, thisArg ) {\n\tvar len;\n\tvar ch1;\n\tvar ch2;\n\tvar idx;\n\tvar ch;\n\tvar i;\n\n\tlen = str.length;\n\n\t// Process the string one Unicode code unit at a time and handle UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tch1 = str[ i ];\n\t\tidx = i;\n\t\tch = ch1;\n\n\t\t// Check for a UTF-16 surrogate pair...\n\t\tif ( i < len-1 && RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i+1 ];\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tch += ch2;\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Note: `ch` may be a lone surrogate (e.g., a low surrogate without a preceding high surrogate or a high surrogate at the end of the input string).\n\n\t\t// Invoke the callback with the code point:\n\t\tclbk.call( thisArg, ch, idx, str );\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEach;\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// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Invokes a function for each Unicode code point in a string, iterating from right to left.\n*\n* @param {string} str - input string\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEachRight( 'Hello', log );\n*/\nfunction forEachRight( str, clbk, thisArg ) {\n\tvar len;\n\tvar ch1;\n\tvar ch2;\n\tvar idx;\n\tvar ch;\n\tvar i;\n\n\tlen = str.length;\n\n\t// Process the string one Unicode code unit at a time and handle UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = len-1; i >= 0; i-- ) {\n\t\tch1 = str[ i ];\n\t\tidx = i;\n\t\tch = ch1;\n\n\t\t// Check for a UTF-16 surrogate pair...\n\t\tif ( i > 0 && RE_UTF16_LOW_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check whether the low surrogate is preceded by a high surrogate...\n\t\t\tch2 = str[ i-1 ];\n\t\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tch = ch2 + ch1;\n\t\t\t\ti -= 1; // decrement the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Note: `ch` may be a lone surrogate (e.g., a high surrogate without a following low surrogate or a low surrogate at the start of the input string).\n\n\t\t// Invoke the callback with the code point:\n\t\tclbk.call( thisArg, ch, idx, str );\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEachRight;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\n\n\n// MAIN //\n\n/**\n* Invokes a function for each grapheme cluster (i.e., user-perceived character) in a string.\n*\n* @param {string} str - input string\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEach( 'Hello', log );\n*/\nfunction forEach( str, clbk, thisArg ) {\n\tvar len;\n\tvar idx;\n\tvar brk;\n\n\tlen = str.length;\n\tidx = 0;\n\twhile ( idx < len ) {\n\t\tbrk = nextGraphemeClusterBreak( str, idx );\n\t\tif ( brk === -1 ) {\n\t\t\tbrk = len;\n\t\t}\n\t\tclbk.call( thisArg, str.substring( idx, brk ), idx, str );\n\t\tidx = brk;\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEach;\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 validate from './validate.js';\n\n\n// VARIABLES //\n\nvar REGEXP_STRING = '[\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]';\n\n\n// MAIN //\n\n/**\n* Returns a regular expression to match a white space character.\n*\n* @param {Options} [options] - function options\n* @param {string} [options.flags=''] - regular expression flags\n* @param {boolean} [options.capture=false] - boolean indicating whether to wrap a regular expression matching white space characters with a capture group\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_WHITESPACE = reWhitespace();\n*\n* var bool = RE_WHITESPACE.test( ' ' );\n* // returns true\n*\n* bool = RE_WHITESPACE.test( '\\t' );\n* // returns true\n*\n* @example\n* import replace from '@stdlib/string/replace';\n* var RE_WHITESPACE = reWhitespace({\n* 'capture': true\n* });\n*\n* var str = 'Duplicate capture';\n* var out = replace( str, RE_WHITESPACE, '$1$1' );\n* // returns 'Duplicate capture'\n*/\nfunction reWhitespace( options ) {\n\tvar opts;\n\tvar err;\n\tif ( arguments.length > 0 ) {\n\t\topts = {};\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tif ( opts.capture ) {\n\t\t\treturn new RegExp( '('+REGEXP_STRING+')', opts.flags );\n\t\t}\n\t\treturn new RegExp( REGEXP_STRING, opts.flags );\n\t}\n\treturn /[\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]/; // eslint-disable-line no-control-regex\n}\n\n\n// EXPORTS //\n\nexport default reWhitespace;\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 isObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {string} [options.flags] - regular expression flags\n* @param {boolean} [options.capture] - boolean indicating whether to wrap a regular expression matching white space characters with a capture group\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'flags': 'gm'\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'flags' ) ) {\n\t\topts.flags = options.flags;\n\t\tif ( !isString( opts.flags ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'flags', opts.flags ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'capture' ) ) {\n\t\topts.capture = options.capture;\n\t\tif ( !isBoolean( opts.capture ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'capture', opts.capture ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\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 reWhitespace from './main.js';\n\n\n// MAIN //\n\n/**\n* Matches a white space character.\n*\n* Regular expression: `/([\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF])/`\n*\n* - `()`\n* - create a capture group\n*\n* - `[]`\n* - match any one of the listed characters\n*\n* - `\\u0009`\n* - character tabulation (horizontal tab; `\\t`)\n*\n* - `\\u000A`\n* - line feed (LF; `\\n`)\n*\n* - `\\u000B`\n* - line tabulation (vertical tab; `\\v`)\n*\n* - `\\u000C`\n* - form feed (`\\f`)\n*\n* - `\\u000D`\n* - carriage return (CR; `\\r`)\n*\n* - `\\u0020`\n* - space (most common)\n*\n* - `\\u0085`\n* - next line (NEL)\n*\n* - `\\u00A0`\n* - non-breaking space\n*\n* - `\\u1680`\n* - Ogham space mark\n*\n* - `\\u2000`\n* - en quad\n*\n* - `\\u2001`\n* - em quad\n*\n* - `\\u2002`\n* - en space\n*\n* - `\\u2003`\n* - em space\n*\n* - `\\u2004`\n*\n* - three-per-em space (thick space)\n*\n* - `\\u2005`\n* - four-per-em space (mid space)\n*\n* - `\\u2006`\n* - six-per-em space\n*\n* - `\\u2007`\n* - figure space\n*\n* - `\\u2008`\n* - punctuation space\n*\n* - `\\u2009`\n* - thin space\n*\n* - `\\u200A`\n* - hair space\n*\n* - `\\u2028`\n* - line separator\n*\n* - `\\u2029`\n* - paragraph separator\n*\n* - `\\u202F`\n* - narrow no-break space\n*\n* - `\\u205F`\n* - medium mathematical space\n*\n* - `\\u3000`\n* - ideographic space\n*\n* - `\\uFEFF`\n* - zero width non-breaking space\n*\n* ## Notes\n*\n* - Matches the 25 characters defined as white space (\"WSpace=Y\",\"WS\") characters in the Unicode 9.0 character database.\n* - Matches one related white space character without the Unicode character property \"WSpace=Y\" (zero width non-breaking space which was deprecated as of Unicode 3.2).\n*\n* @constant\n* @type {RegExp}\n* @default /([\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF])/\n* @see [whitespace]{@link https://en.wikipedia.org/wiki/Whitespace_character}\n*/\nvar REGEXP_CAPTURE = reWhitespace({\n\t'capture': true\n});\n\n\n// EXPORTS //\n\nexport default REGEXP_CAPTURE;\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 reWhitespace from './main.js';\n\n\n// MAIN //\n\n/**\n* Matches a white space character.\n*\n* Regular expression: `/[\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]/`\n*\n* - `[]`\n* - match any one of the listed characters\n*\n* - `\\u0009`\n* - character tabulation (horizontal tab; `\\t`)\n*\n* - `\\u000A`\n* - line feed (LF; `\\n`)\n*\n* - `\\u000B`\n* - line tabulation (vertical tab; `\\v`)\n*\n* - `\\u000C`\n* - form feed (`\\f`)\n*\n* - `\\u000D`\n* - carriage return (CR; `\\r`)\n*\n* - `\\u0020`\n* - space (most common)\n*\n* - `\\u0085`\n* - next line (NEL)\n*\n* - `\\u00A0`\n* - non-breaking space\n*\n* - `\\u1680`\n* - Ogham space mark\n*\n* - `\\u2000`\n* - en quad\n*\n* - `\\u2001`\n* - em quad\n*\n* - `\\u2002`\n* - en space\n*\n* - `\\u2003`\n* - em space\n*\n* - `\\u2004`\n*\n* - three-per-em space (thick space)\n*\n* - `\\u2005`\n* - four-per-em space (mid space)\n*\n* - `\\u2006`\n* - six-per-em space\n*\n* - `\\u2007`\n* - figure space\n*\n* - `\\u2008`\n* - punctuation space\n*\n* - `\\u2009`\n* - thin space\n*\n* - `\\u200A`\n* - hair space\n*\n* - `\\u2028`\n* - line separator\n*\n* - `\\u2029`\n* - paragraph separator\n*\n* - `\\u202F`\n* - narrow no-break space\n*\n* - `\\u205F`\n* - medium mathematical space\n*\n* - `\\u3000`\n* - ideographic space\n*\n* - `\\uFEFF`\n* - zero width non-breaking space\n*\n* ## Notes\n*\n* - Matches the 25 characters defined as white space (\"WSpace=Y\",\"WS\") characters in the Unicode 9.0 character database.\n* - Matches one related white space character without the Unicode character property \"WSpace=Y\" (zero width non-breaking space which was deprecated as of Unicode 3.2).\n*\n* @constant\n* @type {RegExp}\n* @default /[\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]/\n* @see [whitespace]{@link https://en.wikipedia.org/wiki/Whitespace_character}\n*/\nvar REGEXP = reWhitespace();\n\n\n// EXPORTS //\n\nexport default REGEXP;\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 { REGEXP as reWhitespace } from '@stdlib/regexp/whitespace';\n\n\n// MAIN //\n\n/**\n* Capitalizes the first letter of each word in an input string.\n*\n* @param {string} str - string to convert\n* @returns {string} start case string\n*\n* @example\n* var str = startcase( 'beep boop foo bar' );\n* // returns 'Beep Boop Foo Bar'\n*/\nfunction startcase( str ) {\n\tvar cap;\n\tvar out;\n\tvar ch;\n\tvar i;\n\n\tcap = true;\n\tout = '';\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tch = str.charAt( i );\n\t\tif ( reWhitespace.test( ch ) ) {\n\t\t\tcap = true;\n\t\t} else if ( cap ) {\n\t\t\tch = ch.toUpperCase();\n\t\t\tcap = false;\n\t\t}\n\t\tout += ch;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default startcase;\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 regular expression to match a white space character.\n*\n* @module @stdlib/regexp/whitespace\n*\n* @example\n* import reWhitespace from '@stdlib/regexp/whitespace';\n*\n* var RE_WHITESPACE = reWhitespace();\n*\n* var bool = RE_WHITESPACE.test( ' ' );\n* // returns true\n*\n* @example\n* import reWhitespace from '@stdlib/regexp/whitespace';\n*\n* var RE_WHITESPACE = reWhitespace({\n* 'flags': 'gm'\n* });\n*\n* var bool = RE_WHITESPACE.test( '\\t' );\n* // returns true\n*\n* @example\n* import { REGEXP as RE_WHITESPACE } from '@stdlib/regexp/whitespace';\n*\n* var bool = RE_WHITESPACE.test( 'a' );\n* // returns false\n*\n* @example\n* import replace from '@stdlib/string/replace';\n* var RE_WHITESPACE = require( '@stdlib/regexp/whitespace' ).REGEXP_CAPTURE;\n*\n* var str = 'Duplicate capture';\n* var out = replace( str, RE_WHITESPACE, '$1$1' );\n* // returns 'Duplicate capture'\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport REGEXP_CAPTURE from './regexp_capture.js';\nimport REGEXP from './regexp.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'REGEXP', REGEXP );\nsetReadOnly( main, 'REGEXP_CAPTURE', REGEXP_CAPTURE );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport startcase from './../../../base/startcase';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// MAIN //\n\n/**\n* Converts a string to HTTP header case.\n*\n* @param {string} str - string to convert\n* @returns {string} HTTP header-cased string\n*\n* @example\n* var out = headercase( 'foo bar' );\n* // returns 'Foo-Bar'\n*\n* @example\n* var out = headercase( 'IS_MOBILE' );\n* // returns 'Is-Mobile'\n*\n* @example\n* var out = headercase( 'Hello World!' );\n* // returns 'Hello-World'\n*\n* @example\n* var out = headercase( '--foo-bar--' );\n* // returns 'Foo-Bar'\n*/\nfunction headercase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\tstr = lowercase( str );\n\tstr = startcase( str );\n\treturn replace( str, RE_WHITESPACE, '-' );\n}\n\n\n// EXPORTS //\n\nexport default headercase;\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 lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// MAIN //\n\n/**\n* Converts a string to kebab case.\n*\n* @param {string} str - string to convert\n* @returns {string} kebab-cased string\n*\n* @example\n* var str = kebabCase( 'Hello World!' );\n* // returns 'hello-world'\n*\n* @example\n* var str = kebabCase( 'foo bar' );\n* // returns 'foo-bar'\n*\n* @example\n* var str = kebabCase( 'I am a tiny little teapot' );\n* // returns 'i-am-a-tiny-little-teapot'\n*\n* @example\n* var str = kebabCase( 'BEEP boop' );\n* // returns 'beep-boop'\n*\n* @example\n* var str = kebabCase( 'isMobile' );\n* // returns 'is-mobile'\n*/\nfunction kebabCase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\tstr = replace( str, RE_WHITESPACE, '-' );\n\treturn lowercase( str );\n}\n\n\n// EXPORTS //\n\nexport default kebabCase;\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// MAIN //\n\n/**\n* Returns the last `n` UTF-16 code units of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of UTF-16 code units to return\n* @returns {string} output string\n*\n* @example\n* var s = last( 'hello world', 1 );\n* // returns 'd'\n*\n* @example\n* var s = last( 'this is stdlib', 1 );\n* // returns 'b'\n*\n* @example\n* var out = last( 'JavaScript', 6 );\n* // returns 'Script'\n*\n* @example\n* var out = last( 'New', 6 );\n* // returns 'New'\n*/\nfunction last( str, n ) {\n\tvar len = str.length;\n\treturn str.substring( len - n, len );\n}\n\n\n// EXPORTS //\n\nexport default last;\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 { REGEXP as RE_UTF16_SURROGATE_PAIR } from '@stdlib/regexp/utf16-surrogate-pair';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Returns the last `n` Unicode code points of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of Unicode code points to return\n* @returns {string} output string\n*\n* @example\n* var out = last( 'Hello World', 1 );\n* // returns 'd'\n*\n* @example\n* var out = last( 'ASCII', 2 );\n* // returns 'II'\n*\n* @example\n* var out = last( 'JavaScript', 6 );\n* // returns 'Script'\n*/\nfunction last( str, n ) {\n\tvar len;\n\tvar out;\n\tvar ch1;\n\tvar ch2;\n\tvar cnt;\n\tvar i;\n\tlen = str.length;\n\tout = '';\n\tcnt = 0;\n\tif ( str === '' || n === 0 ) {\n\t\treturn '';\n\t}\n\tif ( n === 1 ) {\n\t\tstr = str.substring( len-2, len );\n\t\tif ( RE_UTF16_SURROGATE_PAIR.test( str ) ) {\n\t\t\treturn str;\n\t\t}\n\t\treturn str[1];\n\t}\n\n\t// Process the string backwards one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = len-1; i >= 0; i-- ) {\n\t\tch1 = str[ i ];\n\t\tout = ch1 + out;\n\t\tcnt += 1;\n\n\t\t// Check for a low UTF-16 surrogate...\n\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check for an unpaired surrogate at the start of the input string...\n\t\t\tif ( i === 0 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the low surrogate is paired with a high surrogate...\n\t\t\tch2 = str[ i-1 ];\n\t\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tout = ch2 + out;\n\t\t\t\ti -= 1; // decrement the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Check whether we've found the desired number of code points...\n\t\tif ( cnt === n ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default last;\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 './../../is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a positive integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a positive integer value\n*\n* @example\n* var bool = isPositiveInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isPositiveInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue > 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\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 './../../is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a positive integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a positive integer value\n*\n* @example\n* var bool = isPositiveInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isPositiveInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() > 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\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 positive integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a positive integer\n*\n* @example\n* var bool = isPositiveInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( 0.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( null );\n* // returns false\n*/\nfunction isPositiveInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\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 positive integer.\n*\n* @module @stdlib/assert/is-positive-integer\n*\n* @example\n* import isPositiveInteger from '@stdlib/assert/is-positive-integer';\n*\n* var bool = isPositiveInteger( 5.0 );\n* // returns true\n*\n* bool = isPositiveInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isPositiveInteger( -5.0 );\n* // returns false\n*\n* bool = isPositiveInteger( 3.14 );\n* // returns false\n*\n* bool = isPositiveInteger( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isPositiveInteger } from '@stdlib/assert/is-positive-integer';\n*\n* var bool = isPositiveInteger( 3.0 );\n* // returns true\n*\n* bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* import { isObject as isPositiveInteger } from '@stdlib/assert/is-positive-integer';\n*\n* var bool = isPositiveInteger( 3.0 );\n* // returns false\n*\n* bool = isPositiveInteger( 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 double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/max\n* @type {number}\n*\n* @example\n* import FLOAT64_MAX from '@stdlib/constants/float64/max';\n* // returns 1.7976931348623157e+308\n*/\n\n\n// MAIN //\n\n/**\n* Maximum double-precision floating-point number.\n*\n* ## Notes\n*\n* The maximum is given by\n*\n* ```tex\n* 2^{1023} (2 - 2^{-52})\n* ```\n*\n* @constant\n* @type {number}\n* @default 1.7976931348623157e+308\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MAX = 1.7976931348623157e+308;\n\n\n// EXPORTS //\n\nexport default FLOAT64_MAX;\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 SETTERS = {\n\t'float64': setFloat64,\n\t'float32': setFloat32,\n\t'int32': setInt32,\n\t'int16': setInt16,\n\t'int8': setInt8,\n\t'uint32': setUint32,\n\t'uint16': setUint16,\n\t'uint8': setUint8,\n\t'uint8c': setUint8c,\n\t'generic': setGeneric,\n\t'default': setArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Sets an element in a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Float64Array from '@stdlib/array/float64';\n*\n* var arr = new Float64Array( 4 );\n*\n* setFloat64( arr, 2, 3.0 );\n*\n* var v = arr[ 2 ];\n* // returns 3.0\n*/\nfunction setFloat64( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Float32Array from '@stdlib/array/float32';\n*\n* var arr = new Float32Array( 4 );\n*\n* setFloat32( arr, 2, 3.0 );\n*\n* var v = arr[ 2 ];\n* // returns 3.0\n*/\nfunction setFloat32( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Int32Array from '@stdlib/array/int32';\n*\n* var arr = new Int32Array( 4 );\n*\n* setInt32( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setInt32( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Int16Array from '@stdlib/array/int16';\n*\n* var arr = new Int16Array( 4 );\n*\n* setInt16( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setInt16( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Int8Array from '@stdlib/array/int8';\n*\n* var arr = new Int8Array( 4 );\n*\n* setInt8( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setInt8( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Uint32Array from '@stdlib/array/uint32';\n*\n* var arr = new Uint32Array( 4 );\n*\n* setUint32( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setUint32( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Uint16Array from '@stdlib/array/uint16';\n*\n* var arr = new Uint16Array( 4 );\n*\n* setUint16( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setUint16( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Uint8Array from '@stdlib/array/uint8';\n*\n* var arr = new Uint8Array( 4 );\n*\n* setUint8( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setUint8( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Uint8ClampedArray from '@stdlib/array/uint8c';\n*\n* var arr = new Uint8ClampedArray( 4 );\n*\n* setUint8c( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setUint8c( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a generic `Array`.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {*} value - value to set\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* setGeneric( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setGeneric( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in an indexed array-like object.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {*} value - value to set\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* setArrayLike( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setArrayLike( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for setting an element in 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 set = setter( dtype( arr ) );\n* set( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setter( dtype ) {\n\tvar f = SETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn SETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default setter;\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 SETTERS = {\n\t'complex128': setComplex128,\n\t'complex64': setComplex64,\n\t'default': setArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Sets an element in a `Complex128Array`.\n*\n* @private\n* @param {Complex128Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n*\n* @example\n* import Complex128Array from '@stdlib/array/complex128';\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( [ 1, 2, 3, 4 ] );\n*\n* setComplex128( arr, 1, new Complex128( 10.0, 11.0 ) );\n* var v = arr.get( 1 );\n* // returns [ 10.0, 11.0 ]\n*/\nfunction setComplex128( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n/**\n* Sets an element in a `Complex64Array`.\n*\n* @private\n* @param {Complex64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n*\n* @example\n* import Complex64Array from '@stdlib/array/complex64';\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* setComplex64( arr, 1, new Complex64( 10.0, 11.0 ) );\n* var v = arr.get( 1 );\n* // returns [ 10.0, 11.0 ]\n*/\nfunction setComplex64( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n/**\n* Sets an element in 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* @param {(Collection|Complex|ComplexArray)} value - value(s)\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* setArrayLike( arr, 2, 10 );\n*\n* var v = arr[ 2 ];\n* // returns 10\n*/\nfunction setArrayLike( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for setting an element in 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 Complex64 from '@stdlib/complex/float32/ctor';\n* import dtype from '@stdlib/array/dtype';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var set = setter( dtype( arr ) );\n* set( arr, 1, new Complex64( 10.0, 11.0 ) );\n*\n* var v = arr.get( 1 );\n* // returns [ 10.0, 11.0 ]\n*/\nfunction setter( dtype ) {\n\tvar f = SETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn SETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default setter;\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 isAccessorArray from './../../../base/assert/is-accessor-array';\nimport getter from './../../../base/getter';\nimport setter from './../../../base/setter';\nimport accessorGetter from './../../../base/accessor-getter';\nimport accessorSetter from './../../../base/accessor-setter';\nimport dtype from './../../../dtype';\n\n\n// MAIN //\n\n/**\n* Converts an array-like to an object likely to have the same \"shape\".\n*\n* ## Notes\n*\n* - This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different \"hidden\" classes. If a function is provided many objects having different \"shapes\", some JavaScript VMs (e.g., V8) will consider the function \"megamorphic\" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the \"shape\" of the object holding array meta data to ensure that internal functions operating on arrays are provided consistent argument \"shapes\".\n*\n* - The returned object has the following properties:\n*\n* - **data**: reference to the input array.\n* - **dtype**: array data type.\n* - **accessorProtocol**: `boolean` indicating whether the input array uses accessors for getting and setting elements.\n* - **accessors**: a two-element array whose first element is an accessor for retrieving an array element and whose second element is an accessor for setting an array element.\n*\n* @param {Collection} x - array-like object\n* @returns {Object} object containing array meta data\n*\n* @example\n* var obj = arraylike2object( [ 1, 2, 3, 4 ] );\n* // returns {...}\n*/\nfunction arraylike2object( x ) {\n\tvar dt = dtype( x );\n\tif ( isAccessorArray( x ) ) {\n\t\treturn {\n\t\t\t'data': x,\n\t\t\t'dtype': dt,\n\t\t\t'accessorProtocol': true,\n\t\t\t'accessors': [\n\t\t\t\taccessorGetter( dt ),\n\t\t\t\taccessorSetter( dt )\n\t\t\t]\n\t\t};\n\t}\n\treturn {\n\t\t'data': x,\n\t\t'dtype': dt,\n\t\t'accessorProtocol': false,\n\t\t'accessors': [\n\t\t\tgetter( dt ),\n\t\t\tsetter( dt )\n\t\t]\n\t};\n}\n\n\n// EXPORTS //\n\nexport default arraylike2object;\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-restricted-syntax, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport isCollection from '@stdlib/assert/is-collection';\nimport { isPrimitive as isPositiveInteger } from '@stdlib/assert/is-positive-integer';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils/define-nonenumerable-read-only-accessor';\nimport iteratorSymbol from '@stdlib/symbol/iterator';\nimport MAX_ITERATIONS from '@stdlib/constants/float64/max';\nimport arraylike2object from '@stdlib/array/base/arraylike2object';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Circular buffer constructor.\n*\n* @constructor\n* @param {(PositiveInteger|Collection)} buffer - buffer size or an array-like object to use as the underlying buffer\n* @throws {TypeError} must provide either a valid buffer size or an array-like object\n* @returns {CircularBuffer} circular buffer instance\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Fill the buffer...\n* var v = b.push( 'foo' );\n* // returns undefined\n*\n* v = b.push( 'bar' );\n* // returns undefined\n*\n* v = b.push( 'beep' );\n* // returns undefined\n*\n* // Add another value to the buffer and return the removed element:\n* v = b.push( 'boop' );\n* // returns 'foo'\n*/\nfunction CircularBuffer( buffer ) {\n\tvar buf;\n\tvar i;\n\tif ( !(this instanceof CircularBuffer) ) {\n\t\treturn new CircularBuffer( buffer );\n\t}\n\tif ( isPositiveInteger( buffer ) ) {\n\t\tbuf = [];\n\t\tfor ( i = 0; i < buffer; i++ ) {\n\t\t\tbuf.push( 0.0 ); // initialize with zeros, but could be any value (we're just ensuring a contiguous block of memory)\n\t\t}\n\t} else if ( isCollection( buffer ) ) {\n\t\tbuf = buffer;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide either a valid buffer size (i.e., a positive integer) or an array-like object which can serve as the underlying buffer. Value: `%s`.', buffer ) );\n\t}\n\tthis._buffer = arraylike2object( buf );\n\tthis._length = buf.length;\n\tthis._count = 0;\n\tthis._i = -1;\n\treturn this;\n}\n\n/**\n* Clears the buffer.\n*\n* @name clear\n* @memberof CircularBuffer.prototype\n* @type {Function}\n* @returns {CircularBuffer} circular buffer instance\n*\n* @example\n* var b = new CircularBuffer( 2 );\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n* b.push( 'beep' );\n* b.push( 'boop' );\n*\n* // Get the number of elements currently in the buffer:\n* var n = b.count;\n* // returns 2\n*\n* // Clear the buffer:\n* b.clear();\n*\n* // Get the number of buffer values:\n* n = b.count;\n* // returns 0\n*/\nsetReadOnly( CircularBuffer.prototype, 'clear', function clear() {\n\tthis._count = 0;\n\tthis._i = -1; // this ensures that we always fill the buffer starting at index `0`.\n\treturn this;\n});\n\n/**\n* Number of elements currently in the buffer.\n*\n* @name count\n* @memberof CircularBuffer.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var b = new CircularBuffer( 4 );\n*\n* // Get the value count:\n* var n = b.count;\n* // returns 0\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n*\n* // Get the value count:\n* n = b.count;\n* // returns 2\n*/\nsetReadOnlyAccessor( CircularBuffer.prototype, 'count', function get() {\n\treturn this._count;\n});\n\n/**\n* Boolean indicating whether a circular buffer is full.\n*\n* @name full\n* @memberof CircularBuffer.prototype\n* @readonly\n* @type {boolean}\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Determine if the buffer is full:\n* var bool = b.full;\n* // returns false\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n* b.push( 'beep' );\n* b.push( 'boop' );\n*\n* // Determine if the buffer is full:\n* bool = b.full;\n* // returns true\n*/\nsetReadOnlyAccessor( CircularBuffer.prototype, 'full', function get() {\n\treturn this._count === this._length;\n});\n\n/**\n* Returns an iterator for iterating over a circular buffer.\n*\n* ## Notes\n*\n* - An iterator does not iterate over partially full buffers.\n*\n* @name iterator\n* @memberof CircularBuffer.prototype\n* @type {Function}\n* @param {NonNegativeInteger} [niters] - number of iterations\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {Iterator} iterator\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n* b.push( 'beep' );\n* b.push( 'boop' );\n*\n* // Create an iterator:\n* var it = b.iterator( b.length );\n*\n* // Iterate over the buffer...\n* var v = it.next().value;\n* // returns 'bar'\n*\n* v = it.next().value;\n* // returns 'beep'\n*\n* v = it.next().value;\n* // returns 'boop'\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( CircularBuffer.prototype, 'iterator', function iterator( niters ) {\n\tvar iter;\n\tvar self;\n\tvar FLG;\n\tvar N;\n\tvar n;\n\tvar i;\n\n\tif ( arguments.length ) {\n\t\tif ( !isNonNegativeInteger( niters ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', niters ) );\n\t\t}\n\t\tN = niters;\n\t} else {\n\t\tN = MAX_ITERATIONS;\n\t}\n\tself = this;\n\n\t// Initialize the iteration index and counter:\n\ti = this._i;\n\tn = 0;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\tif ( iteratorSymbol ) {\n\t\tsetReadOnly( iter, iteratorSymbol, 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\t/* eslint-disable no-underscore-dangle */\n\t\tn += 1;\n\t\tif ( FLG || n > N ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\t// If the buffer is only partially full, don't allow iteration over \"undefined\" elements (this ensures similar behavior with `toArray()`)...\n\t\tif ( self._count !== self._length ) {\n\t\t\tFLG = true;\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\ti = (i+1) % self._length;\n\t\treturn {\n\t\t\t'value': self._buffer.accessors[ 0 ]( self._buffer.data, i ),\n\t\t\t'done': false\n\t\t};\n\n\t\t/* eslint-enable no-underscore-dangle */\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.iterator( N );\n\t}\n});\n\n/**\n* Circular buffer length (i.e., capacity).\n*\n* @name length\n* @memberof CircularBuffer.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var b = new CircularBuffer( 4 );\n*\n* // Get the buffer capacity:\n* var len = b.length;\n* // returns 4\n*/\nsetReadOnlyAccessor( CircularBuffer.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Adds a value to the circular buffer.\n*\n* @name push\n* @memberof CircularBuffer.prototype\n* @type {Function}\n* @param {*} value - value to add\n* @returns {(*|void)} removed element or undefined\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Fill the buffer:\n* var v = b.push( 'foo' );\n* // returns undefined\n*\n* v = b.push( 'bar' );\n* // returns undefined\n*\n* v = b.push( 'beep' );\n* // returns undefined\n*\n* // Add another value to the buffer and return the removed element:\n* v = b.push( 'boop' );\n* // returns 'foo'\n*/\nsetReadOnly( CircularBuffer.prototype, 'push', function push( value ) {\n\tvar set;\n\tvar get;\n\tvar buf;\n\tvar v;\n\n\tbuf = this._buffer.data;\n\tget = this._buffer.accessors[ 0 ];\n\tset = this._buffer.accessors[ 1 ];\n\n\t// Compute the next buffer index:\n\tthis._i = (this._i+1) % this._length;\n\n\t// Check if we are still filling the buffer...\n\tif ( this._count < this._length ) {\n\t\tset( buf, this._i, value );\n\t\tthis._count += 1;\n\t\treturn;\n\t}\n\t// Replace an existing buffer element...\n\tv = get( buf, this._i );\n\tset( buf, this._i, value );\n\treturn v;\n});\n\n/**\n* Returns an array of circular buffer values.\n*\n* @name toArray\n* @memberof CircularBuffer.prototype\n* @type {Function}\n* @returns {Array} circular buffer values\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n* b.push( 'beep' );\n* b.push( 'boop' );\n*\n* // Get an array of buffer values:\n* var vals = b.toArray();\n* // returns [ 'bar', 'beep', 'boop' ]\n*/\nsetReadOnly( CircularBuffer.prototype, 'toArray', function toArray() {\n\tvar buf;\n\tvar get;\n\tvar out;\n\tvar k;\n\tvar i;\n\n\tbuf = this._buffer.data;\n\tget = this._buffer.accessors[ 0 ];\n\n\tout = [];\n\tfor ( i = 1; i <= this._count; i++ ) {\n\t\t// Note: in a full buffer, `count == length`; in a partially full buffer, we need to ensure we always start at index `0`\n\t\tk = (this._i+i) % this._count;\n\t\tout.push( get( buf, k ) );\n\t}\n\treturn out;\n});\n\n/**\n* Serializes a circular buffer as JSON.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `CircularBuffer` instance.\n*\n* @name toJSON\n* @memberof CircularBuffer.prototype\n* @type {Function}\n* @returns {Object} serialized circular buffer\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n* b.push( 'beep' );\n* b.push( 'boop' );\n*\n* // Serialize to JSON:\n* var o = b.toJSON();\n* // returns { 'type': 'circular-buffer', 'length': 3, 'data': [ 'bar', 'beep', 'boop' ] }\n*/\nsetReadOnly( CircularBuffer.prototype, 'toJSON', function toJSON() {\n\tvar out = {};\n\tout.type = 'circular-buffer';\n\tout.length = this._length;\n\tout.data = this.toArray();\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default CircularBuffer;\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 nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\nimport CircularBuffer from '@stdlib/dstructs/circular-buffer';\nimport zeros from '@stdlib/array/base/zeros';\n\n\n// MAIN //\n\n/**\n* Returns the last `n` grapheme clusters (i.e., user-perceived characters) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of grapheme clusters to return\n* @returns {string} output string\n*\n* @example\n* var out = last( 'Hello World', 1 );\n* // returns 'd'\n*\n* @example\n* var out = last( 'Evening', 3 );\n* // returns 'ing'\n*\n* @example\n* var out = last( 'JavaScript', 6 );\n* // returns 'Script'\n*\n* @example\n* var out = last( '六书/六書', 1 );\n* // returns '書'\n*\n* @example\n* var out = last( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐰🐸'\n*/\nfunction last( str, n ) {\n\tvar count;\n\tvar cbuf;\n\tvar buf;\n\tvar i;\n\n\tif ( n === 0 || str === '' ) {\n\t\treturn '';\n\t}\n\t// Resolve the first cluster break:\n\ti = nextGraphemeClusterBreak( str, 0 );\n\n\t// If we received a sentinel value, return the input string, as there are no more cluster breaks to iterate over...\n\tif ( i === -1 ) {\n\t\treturn str;\n\t}\n\t// Initialize a buffer for keeping track of cluster break indices:\n\tbuf = zeros( n );\n\n\t// Wrap the buffer to create a circular buffer serving as a FIFO stack where we can keep at most `n` indices as we iterate from left-to-right:\n\tcbuf = new CircularBuffer( buf );\n\n\t// Add the first character index:\n\tcbuf.push( 0 );\n\n\t// Add the index of the first grapheme cluster break to our buffer:\n\tcbuf.push( i );\n\n\t// Slide a window over the string from left-to-right...\n\tcount = 0;\n\twhile ( true ) {\n\t\tcount += 1;\n\t\ti = nextGraphemeClusterBreak( str, i );\n\t\tif ( i === -1 ) {\n\t\t\tbreak;\n\t\t}\n\t\tcbuf.push( i );\n\t}\n\t// Resolve the leftmost index:\n\ti = buf[ (count+1)%n ]; // count+1 as count%n corresponds to the index of the \"newest\" element in the circular buffer and count+1 is the next element to replace (i.e., the \"oldest\" index)\n\n\t// Return the last `n` grapheme clusters:\n\treturn str.substring( i );\n}\n\n\n// EXPORTS //\n\nexport default last;\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 filled \"generic\" array.\n*\n* @param {*} value - fill value\n* @param {NonNegativeInteger} len - array length\n* @returns {Array} filled array\n*\n* @example\n* var out = filled( 0.0, 3 );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = filled( 'beep', 3 );\n* // returns [ 'beep', 'beep', 'beep' ]\n*/\nfunction filled( value, len ) {\n\tvar arr;\n\tvar i;\n\n\t// Manually push elements in order to ensure \"fast\" elements...\n\tarr = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\tarr.push( value );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default filled;\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 filled from './../../../base/filled';\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled \"generic\" array.\n*\n* @param {NonNegativeInteger} len - array length\n* @returns {Array} output array\n*\n* @example\n* var out = zeros( 3 );\n* // returns [ 0.0, 0.0, 0.0 ]\n*/\nfunction zeros( len ) {\n\treturn filled( 0.0, len );\n}\n\n\n// EXPORTS //\n\nexport default zeros;\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 bool = ( typeof String.prototype.repeat !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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 repeat = String.prototype.repeat;\n\n\n// EXPORTS //\n\nexport default repeat;\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* Repeat a string a specified number of times and return the concatenated result.\n*\n* @module @stdlib/string/base/repeat\n*\n* @example\n* import replace from '@stdlib/string/base/repeat';\n*\n* var str = repeat( 'a', 5 );\n* // returns 'aaaaa'\n*\n* str = repeat( '', 100 );\n* // returns ''\n*\n* str = repeat( 'beep', 0 );\n* // returns ''\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar repeat;\nif ( HAS_BUILTIN ) {\n\trepeat = main;\n} else {\n\trepeat = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default repeat;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Repeats a string a specified number of times and returns the concatenated result.\n*\n* @param {string} str - string to repeat\n* @param {NonNegativeInteger} n - number of times to repeat the string\n* @returns {string} repeated string\n*\n* @example\n* var str = repeat( 'a', 5 );\n* // returns 'aaaaa'\n*\n* @example\n* var str = repeat( '', 100 );\n* // returns ''\n*\n* @example\n* var str = repeat( 'beep', 0 );\n* // returns ''\n*/\nfunction repeat( str, n ) {\n\treturn builtin.call( str, n );\n}\n\n\n// EXPORTS //\n\nexport default repeat;\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* Repeats a string a specified number of times and returns the concatenated result.\n*\n* ## Method\n*\n* The algorithmic trick used in the implementation is to treat string concatenation the same as binary addition (i.e., any natural number (nonnegative integer) can be expressed as a sum of powers of two).\n*\n* For example,\n*\n* ```text\n* n = 10 => 1010 => 2^3 + 2^0 + 2^1 + 2^0\n* ```\n*\n* We can produce a 10-repeat string by \"adding\" the results of a 8-repeat string and a 2-repeat string.\n*\n* The implementation is then as follows:\n*\n* 1. Let `s` be the string to be repeated and `o` be an output string.\n*\n* 2. Initialize an output string `o`.\n*\n* 3. Check the least significant bit to determine if the current `s` string should be \"added\" to the output \"total\".\n*\n* - if the bit is a one, add\n* - otherwise, move on\n*\n* 4. Double the string `s` by adding `s` to `s`.\n*\n* 5. Right-shift the bits of `n`.\n*\n* 6. Check if we have shifted off all bits.\n*\n* - if yes, done.\n* - otherwise, move on\n*\n* 7. Repeat 3-6.\n*\n* The result is that, as the string is repeated, we continually check to see if the doubled string is one which we want to add to our \"total\".\n*\n* The algorithm runs in `O(log_2(n))` compared to `O(n)`.\n*\n* @private\n* @param {string} str - string to repeat\n* @param {NonNegativeInteger} n - number of times to repeat the string\n* @returns {string} repeated string\n*\n* @example\n* var str = repeat( 'a', 5 );\n* // returns 'aaaaa'\n*\n* @example\n* var str = repeat( '', 100 );\n* // returns ''\n*\n* @example\n* var str = repeat( 'beep', 0 );\n* // returns ''\n*/\nfunction repeat( str, n ) {\n\tvar rpt;\n\tvar cnt;\n\tif ( str.length === 0 || n === 0 ) {\n\t\treturn '';\n\t}\n\trpt = '';\n\tcnt = n;\n\tfor ( ; ; ) {\n\t\t// If the count is odd, append the current concatenated string:\n\t\tif ( (cnt&1) === 1 ) {\n\t\t\trpt += str;\n\t\t}\n\t\t// Right-shift the bits:\n\t\tcnt >>>= 1;\n\t\tif ( cnt === 0 ) {\n\t\t\tbreak;\n\t\t}\n\t\t// Double the string:\n\t\tstr += str;\n\t}\n\treturn rpt;\n}\n\n\n// EXPORTS //\n\nexport default repeat;\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 positive infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = ceil( -4.2 );\n* // returns -4.0\n*\n* @example\n* var v = ceil( 9.99999 );\n* // returns 10.0\n*\n* @example\n* var v = ceil( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = ceil( NaN );\n* // returns NaN\n*/\nvar ceil = Math.ceil; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default ceil;\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 repeat from './../../../base/repeat';\nimport ceil from '@stdlib/math/base/special/ceil';\n\n\n// MAIN //\n\n/**\n* Left pads a string such that the padded string has a length of at least `len`.\n*\n* @param {string} str - string to pad\n* @param {NonNegativeInteger} len - minimum string length\n* @param {string} pad - string used to pad\n* @returns {string} padded string\n*\n* @example\n* var str = lpad( 'a', 5, ' ' );\n* // returns ' a'\n*\n* @example\n* var str = lpad( 'beep', 10, 'b' );\n* // returns 'bbbbbbbeep'\n*\n* @example\n* var str = lpad( 'boop', 12, 'beep' );\n* // returns 'beepbeepboop'\n*/\nfunction lpad( str, len, pad ) {\n\tvar n = ( len - str.length ) / pad.length;\n\tif ( n <= 0 ) {\n\t\treturn str;\n\t}\n\tn = ceil( n );\n\treturn repeat( pad, n ) + str;\n}\n\n\n// EXPORTS //\n\nexport default lpad;\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 bool = ( typeof String.prototype.trimLeft !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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 replace from './../../../base/replace';\n\n\n// VARIABLES //\n\n// The following regular expression should suffice to polyfill (most?) all environments.\nvar RE = /^[\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+/;\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning of a string.\n*\n* @private\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = ltrim( ' Whitespace ' );\n* // returns 'Whitespace '\n*\n* @example\n* var out = ltrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs\\t\\t\\t'\n*\n* @example\n* var out = ltrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines\\n\\n\\n'\n*/\nfunction ltrim( str ) {\n\treturn replace( str, RE, '' );\n}\n\n\n// EXPORTS //\n\nexport default ltrim;\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 ltrim = String.prototype.trimLeft;\n\n\n// EXPORTS //\n\nexport default ltrim;\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* Trim whitespace characters from the beginning of a string.\n*\n* @module @stdlib/string/base/left-trim\n*\n* @example\n* import ltrim from '@stdlib/string/base/left-trim';\n*\n* var out = ltrim( ' Whitespace ' );\n* // returns 'Whitespace '\n*\n* out = ltrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs\\t\\t\\t'\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar ltrim;\nif ( HAS_BUILTIN ) {\n\tltrim = main;\n} else {\n\tltrim = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ltrim;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning of a string.\n*\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = ltrim( ' Whitespace ' );\n* // returns 'Whitespace '\n*\n* @example\n* var out = ltrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs\\t\\t\\t'\n*\n* @example\n* var out = ltrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines\\n\\n\\n'\n*/\nfunction ltrim( str ) {\n\treturn builtin.call( str );\n}\n\n\n// EXPORTS //\n\nexport default ltrim;\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 capitalize from './../../../base/capitalize';\nimport lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_TO_PASCAL = /(?:\\s|^)([^\\s]+)(?=\\s|$)/g;\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Callback invoked upon a match.\n*\n* @private\n* @param {string} match - entire match\n* @param {string} p1 - first capture group\n* @returns {string} capitalized capture group\n*/\nfunction replacer( match, p1 ) {\n\treturn capitalize( lowercase( p1 ) );\n}\n\n\n// MAIN //\n\n/**\n* Converts a string to Pascal case.\n*\n* @param {string} str - string to convert\n* @returns {string} Pascal-cased string\n*\n* @example\n* var out = pascalcase( 'foo bar' );\n* // returns 'FooBar'\n*\n* @example\n* var out = pascalcase( 'IS_MOBILE' );\n* // returns 'IsMobile'\n*\n* @example\n* var out = pascalcase( 'Hello World!' );\n* // returns 'HelloWorld'\n*\n* @example\n* var out = pascalcase( '--foo-bar--' );\n* // returns 'FooBar'\n*/\nfunction pascalcase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_WHITESPACE, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\treturn replace( str, RE_TO_PASCAL, replacer );\n}\n\n\n// EXPORTS //\n\nexport default pascalcase;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// VARIABLES //\n\n// 2^6-1 = 63 => 0x3f => 00111111\nvar Ox3F = 63|0;\n\n// 2^7 = 128 => 0x80 => 10000000\nvar Ox80 = 128|0;\n\n// 192 => 0xc0 => 11000000\nvar OxC0 = 192|0;\n\n// 224 => 0xe0 => 11100000\nvar OxE0 = 224|0;\n\n// 240 => 0xf0 => 11110000\nvar OxF0 = 240|0;\n\n// 2^10-1 = 1023 => 0x3ff => 00000011 11111111\nvar Ox3FF = 1023|0;\n\n// 2^11 = 2048 => 0x800 => 00001000 00000000\nvar Ox800 = 2048|0;\n\n// 55296 => 11011000 00000000\nvar OxD800 = 55296|0;\n\n// 57344 => 11100000 00000000\nvar OxE000 = 57344|0;\n\n// 2^16 = 65536 => 00000000 00000001 00000000 00000000\nvar Ox10000 = 65536|0;\n\n\n// MAIN //\n\n/**\n* Converts a UTF-16 encoded string to an array of integers using UTF-8 encoding.\n*\n* ## Method\n*\n* - UTF-8 is defined to encode code points in one to four bytes, depending on the number of significant bits in the numerical value of the code point.\n*\n* - UTF-16 encoding uses one 16-bit unit for non-surrogates (U+0000 to U+D7FF and U+E000 to U+FFFF).\n*\n* - UTF-16 encoding uses two 16-bit units (surrogate pairs) for U+10000 to U+10FFFF and encodes U+10000-U+10FFFF by subtracting 0x10000 from the code point, expressing the result as a 20-bit binary, and splitting the 20 bits of 0x0-0xFFFFF as upper and lower 10-bits. The respective 10-bits are stored in two 16-bit words.\n*\n* - Let `N` be the number of significant bits.\n*\n* - If `N <= 7` (i.e., U+0000 to U+007F), a code point is encoded in a single byte.\n*\n* ```text\n* 0xxxxxxx\n* ```\n*\n* where an `x` refers to a code point bit.\n*\n* - If `N <= 11` (i.e., U+0080 to U+07FF; ASCII characters), a code point is encoded in two bytes (5+6 bits).\n*\n* ```text\n* 110xxxxx 10xxxxxx\n* ```\n*\n* - If `N <= 16` (i.e., U+0800 to U+FFFF), a code point is encoded in three bytes (4+6+6 bits).\n*\n* ```text\n* 1110xxxx 10xxxxxx 10xxxxxx\n* ```\n*\n* - If `N <= 21` (i.e., U+10000 to U+10FFFF), a code point is encoded in four bytes (3+6+6+6 bits).\n*\n* ```text\n* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n* ```\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {Array} array of integers\n* @see [UTF-8]{@link https://en.wikipedia.org/wiki/UTF-8}\n* @see [Stack Overflow]{@link https://stackoverflow.com/questions/6240055/manually-converting-unicode-codepoints-into-utf-8-and-utf-16}\n*\n* @example\n* var str = '☃';\n* var out = utf16ToUTF8Array( str );\n* // returns [ 226, 152, 131 ]\n*/\nfunction utf16ToUTF8Array( str ) {\n\tvar code;\n\tvar out;\n\tvar len;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tlen = str.length;\n\tout = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\tcode = str.charCodeAt( i );\n\n\t\t// ASCII...\n\t\tif ( code < Ox80 ) {\n\t\t\tout.push( code );\n\t\t}\n\t\t// UTF-16 non-surrogate pair...\n\t\telse if ( code < Ox800 ) {\n\t\t\tout.push( OxC0 | (code>>6) );\n\t\t\tout.push( Ox80 | (code & Ox3F) );\n\t\t}\n\t\telse if ( code < OxD800 || code >= OxE000 ) {\n\t\t\tout.push( OxE0 | (code>>12) );\n\t\t\tout.push( Ox80 | ((code>>6) & Ox3F) );\n\t\t\tout.push( Ox80 | (code & Ox3F) );\n\t\t}\n\t\t// UTF-16 surrogate pair...\n\t\telse {\n\t\t\ti += 1;\n\n\t\t\t// eslint-disable-next-line max-len\n\t\t\tcode = Ox10000 + (((code & Ox3FF)<<10) | (str.charCodeAt(i) & Ox3FF));\n\n\t\t\tout.push( OxF0 | (code>>18) );\n\t\t\tout.push( Ox80 | ((code>>12) & Ox3F) );\n\t\t\tout.push( Ox80 | ((code>>6) & Ox3F) );\n\t\t\tout.push( Ox80 | (code & Ox3F) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default utf16ToUTF8Array;\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 utf16ToUTF8Array from './../../../utf16-to-utf8-array';\n\n\n// VARIABLES //\n\n// Character codes:\nvar UNDERSCORE = 95|0;\nvar PERIOD = 46|0;\nvar HYPHEN = 45|0;\nvar TILDE = 126|0;\nvar ZERO = 48|0;\nvar NINE = 57|0;\nvar A = 65|0;\nvar Z = 90|0;\nvar a = 97|0;\nvar z = 122|0;\n\n\n// MAIN //\n\n/**\n* Percent-encodes a UTF-16 encoded string according to [RFC 3986][1].\n*\n* [1]: https://tools.ietf.org/html/rfc3986#section-2.1\n*\n* @param {string} str - string to percent-encode\n* @returns {string} percent-encoded string\n*\n* @example\n* var str1 = 'Ladies + Gentlemen';\n*\n* var str2 = percentEncode( str1 );\n* // returns 'Ladies%20%2B%20Gentlemen'\n*/\nfunction percentEncode( str ) {\n\tvar byte;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\n\t// Convert to an array of octets using UTF-8 encoding (see https://tools.ietf.org/html/rfc3986#section-2.5):\n\tbuf = utf16ToUTF8Array( str );\n\n\t// Encode the string...\n\tlen = buf.length;\n\tout = '';\n\tfor ( i = 0; i < len; i++ ) {\n\t\tbyte = buf[ i ];\n\t\tif (\n\t\t\t// ASCII Digits:\n\t\t\t( byte >= ZERO && byte <= NINE ) ||\n\n\t\t\t// ASCII uppercase letters:\n\t\t\t( byte >= A && byte <= Z ) ||\n\n\t\t\t// ASCII lowercase letters:\n\t\t\t( byte >= a && byte <= z ) ||\n\n\t\t\t// ASCII unreserved characters (see https://tools.ietf.org/html/rfc3986#section-2.3):\n\t\t\tbyte === HYPHEN ||\n\t\t\tbyte === PERIOD ||\n\t\t\tbyte === UNDERSCORE ||\n\t\t\tbyte === TILDE\n\t\t) {\n\t\t\tout += str.charAt( i );\n\t\t} else {\n\t\t\t// Convert an octet to hexadecimal and uppercase according to the RFC (see https://tools.ietf.org/html/rfc3986#section-2.1):\n\t\t\tout += '%' + byte.toString( 16 ).toUpperCase();\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default percentEncode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Removes the first `n` UTF-16 code units of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of UTF-16 code units to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeFirst( 'last man standing', 1 );\n* // returns 'ast man standing'\n*\n* @example\n* var out = removeFirst( 'presidential election', 1 );\n* // returns 'residential election'\n*\n* @example\n* var out = removeFirst( 'JavaScript', 1 );\n* // returns 'avaScript'\n*\n* @example\n* var out = removeFirst( 'Hidden Treasures', 1 );\n* // returns 'idden Treasures'\n*/\nfunction removeFirst( str, n ) {\n\treturn str.substring( n, str.length );\n}\n\n\n// EXPORTS //\n\nexport default removeFirst;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Removes the first `n` Unicode code points of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of Unicode code points to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeFirst( 'last man standing', 1 );\n* // returns 'ast man standing'\n*\n* @example\n* var out = removeFirst( 'presidential election', 1 );\n* // returns 'residential election'\n*\n* @example\n* var out = removeFirst( 'JavaScript', 1 );\n* // returns 'avaScript'\n*\n* @example\n* var out = removeFirst( 'Hidden Treasures', 1 );\n* // returns 'idden Treasures'\n*/\nfunction removeFirst( str, n ) {\n\tvar len;\n\tvar ch1;\n\tvar ch2;\n\tvar cnt;\n\tvar i;\n\tif ( n === 0 ) {\n\t\treturn str;\n\t}\n\tlen = str.length;\n\tcnt = 0;\n\n\t// Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tch1 = str[ i ];\n\t\tcnt += 1;\n\n\t\t// Check for a high UTF-16 surrogate...\n\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check for an unpaired surrogate at the end of the input string...\n\t\t\tif ( i === len-1 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i+1 ];\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Check whether we've found the desired number of code points...\n\t\tif ( cnt === n ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn str.substring( i + 1, str.length );\n}\n\n\n// EXPORTS //\n\nexport default removeFirst;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\n\n\n// MAIN //\n\n/**\n* Removes the first `n` grapheme clusters (i.e., user-perceived characters) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of grapheme clusters to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeFirst( 'last man standing', 1 );\n* // returns 'ast man standing'\n*\n* @example\n* var out = removeFirst( 'presidential election', 1 );\n* // returns 'residential election'\n*\n* @example\n* var out = removeFirst( 'JavaScript', 1 );\n* // returns 'avaScript'\n*\n* @example\n* var out = removeFirst( 'Hidden Treasures', 1 );\n* // returns 'idden Treasures'\n*\n* @example\n* var out = removeFirst( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐷🐰🐸'\n*\n* @example\n* var out = removeFirst( 'foo bar', 5 );\n* // returns 'ar'\n*/\nfunction removeFirst( str, n ) {\n\tvar i = 0;\n\twhile ( n > 0 ) {\n\t\ti = nextGraphemeClusterBreak( str, i );\n\t\tn -= 1;\n\t}\n\t// Value of `i` will be -1 if and only if `str` is an empty string or `str` has only 1 extended grapheme cluster...\n\tif ( str === '' || i === -1 ) {\n\t\treturn '';\n\t}\n\treturn str.substring( i, str.length );\n}\n\n\n// EXPORTS //\n\nexport default removeFirst;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Removes the last `n` UTF-16 code units of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of UTF-16 code units to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeLast( 'last man standing', 1 );\n* // returns 'last man standin'\n*\n* @example\n* var out = removeLast( 'presidential election', 1 );\n* // returns 'presidential electio'\n*\n* @example\n* var out = removeLast( 'JavaScript', 1 );\n* // returns 'JavaScrip'\n*\n* @example\n* var out = removeLast( 'Hidden Treasures', 1 );\n* // returns 'Hidden Treasure'\n*/\nfunction removeLast( str, n ) {\n\treturn str.substring( 0, str.length - n );\n}\n\n\n// EXPORTS //\n\nexport default removeLast;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Removes the last `n` Unicode code points of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of Unicode code points to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeLast( 'last man standing', 1 );\n* // returns 'last man standin'\n*\n* @example\n* var out = removeLast( 'presidential election', 1 );\n* // returns 'presidential electio'\n*\n* @example\n* var out = removeLast( 'JavaScript', 1 );\n* // returns 'JavaScrip'\n*\n* @example\n* var out = removeLast( 'Hidden Treasures', 1 );\n* // returns 'Hidden Treasure'\n*/\nfunction removeLast( str, n ) {\n\tvar len;\n\tvar ch1;\n\tvar ch2;\n\tvar cnt;\n\tvar i;\n\tif ( n === 0 ) {\n\t\treturn str;\n\t}\n\tlen = str.length;\n\tcnt = 0;\n\n\t// Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = len - 1; i >= 0; i-- ) {\n\t\tch1 = str[ i ];\n\t\tcnt += 1;\n\n\t\t// Check for a low UTF-16 surrogate...\n\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check for an unpaired surrogate at the end of the input string...\n\t\t\tif ( i === 0 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i-1 ];\n\t\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\ti -= 1; // bump the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Check whether we've found the desired number of code points...\n\t\tif ( cnt === n ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn str.substring( 0, i );\n}\n\n\n// EXPORTS //\n\nexport default removeLast;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport nextGraphemeClusterBreak from './../../next-grapheme-cluster-break';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns the number of grapheme clusters in a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {NonNegativeInteger} number of grapheme clusters\n*\n* @example\n* var out = numGraphemeClusters( 'last man standing' );\n* // returns 17\n*\n* @example\n* var out = numGraphemeClusters( 'presidential election' );\n* // returns 21\n*\n* @example\n* var out = numGraphemeClusters( 'अनुच्छेद' );\n* // returns 5\n*\n* @example\n* var out = numGraphemeClusters( '🌷' );\n* // returns 1\n*/\nfunction numGraphemeClusters( str ) {\n\tvar count;\n\tvar idx;\n\tvar brk;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tcount = 0;\n\tidx = 0;\n\n\tbrk = nextGraphemeClusterBreak( str, idx );\n\twhile ( brk !== -1 ) {\n\t\tcount += 1;\n\t\tidx = brk;\n\t\tbrk = nextGraphemeClusterBreak( str, idx );\n\t}\n\tif ( idx < str.length ) {\n\t\tcount += 1;\n\t}\n\treturn count;\n}\n\n\n// EXPORTS //\n\nexport default numGraphemeClusters;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\nimport numGraphemeClusters from './../../../num-grapheme-clusters';\n\n\n// MAIN //\n\n/**\n* Removes the last `n` grapheme clusters (i.e., user-perceived characters) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of grapheme clusters to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeLast( 'last man standing', 1 );\n* // returns 'last man standin'\n*\n* @example\n* var out = removeLast( 'presidential election', 1 );\n* // returns 'presidential electio'\n*\n* @example\n* var out = removeLast( 'JavaScript', 1 );\n* // returns 'JavaScrip'\n*\n* @example\n* var out = removeLast( 'Hidden Treasures', 1 );\n* // returns 'Hidden Treasure'\n*\n* @example\n* var out = removeLast( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐶🐮🐷'\n*\n* @example\n* var out = removeLast( 'foo bar', 5 );\n* // returns 'fo'\n*/\nfunction removeLast( str, n ) {\n\tvar total;\n\tvar num;\n\tvar i;\n\n\tif ( n === 0 ) {\n\t\treturn str;\n\t}\n\n\ttotal = numGraphemeClusters( str );\n\tif ( str === '' || total < n ) {\n\t\treturn '';\n\t}\n\n\ti = 0;\n\tnum = 0;\n\twhile ( num < total - n ) {\n\t\ti = nextGraphemeClusterBreak( str, i );\n\t\tnum += 1;\n\t}\n\treturn str.substring( 0, i );\n}\n\n\n// EXPORTS //\n\nexport default removeLast;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Replaces the substring before the first occurrence of a specified search string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {string} replacement - replacement string\n* @param {integer} fromIndex - index at which to start the search\n* @returns {string} string\n*\n* @example\n* var out = replaceBefore( 'beep boop', ' ', 'foo', 0 );\n* // returns 'foo boop'\n*\n* @example\n* var out = replaceBefore( 'beep boop', 'p', 'foo', 5 );\n* // returns 'foop'\n*\n* @example\n* var out = replaceBefore( 'Hello World!', '', 'foo', 0 );\n* // returns 'Hello World!'\n*\n* @example\n* var out = replaceBefore( 'Hello World!', 'xyz', 'foo', 0 );\n* // returns 'Hello World!'\n*/\nfunction replaceBefore( str, search, replacement, fromIndex ) {\n\tvar idx;\n\tif ( fromIndex < 0 ) {\n\t\tfromIndex += str.length;\n\t} else if ( fromIndex >= str.length ) {\n\t\treturn str;\n\t}\n\tidx = str.indexOf( search, fromIndex );\n\tif ( str === '' || search === '' || replacement === '' || idx < 0 ) {\n\t\treturn str;\n\t}\n\treturn replacement + str.substring( idx );\n}\n\n\n// EXPORTS //\n\nexport default replaceBefore;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Reverses the UTF-16 code units of a string.\n*\n* @param {string} str - input string\n* @returns {string} output string\n*\n* @example\n* var out = reverse( 'last man standing' );\n* // returns 'gnidnats nam tsal'\n*\n* @example\n* var out = reverse( 'presidential election' );\n* // returns 'noitcele laitnediserp'\n*\n* @example\n* var out = reverse( 'JavaScript' );\n* // returns 'tpircSavaJ'\n*\n* @example\n* var out = reverse( 'Hidden Treasures' );\n* // returns 'serusaerT neddiH'\n*/\nfunction reverse( str ) {\n\tvar out;\n\tvar i;\n\n\tout = '';\n\tfor ( i = str.length - 1; i >= 0; i-- ) {\n\t\tout += str[ i ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default reverse;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Reverses the Unicode code points of a string.\n*\n* @param {string} str - input string\n* @returns {string} output string\n*\n* @example\n* var out = reverse( 'last man standing' );\n* // returns 'gnidnats nam tsal'\n*\n* @example\n* var out = reverse( 'presidential election' );\n* // returns 'noitcele laitnediserp'\n*\n* @example\n* var out = reverse( 'JavaScript' );\n* // returns 'tpircSavaJ'\n*\n* @example\n* var out = reverse( 'Hidden Treasures' );\n* // returns 'serusaerT neddiH'\n*/\nfunction reverse( str ) {\n\tvar len;\n\tvar out;\n\tvar ch1;\n\tvar ch2;\n\tvar i;\n\n\tlen = str.length;\n\tout = '';\n\n\t// Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tch1 = str[ i ];\n\n\t\t// Check for a high UTF-16 surrogate...\n\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check for an unpaired surrogate at the end of the input string...\n\t\t\tif ( i === len-1 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tout = ch1 + out;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i+1 ];\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tout = ch1 + ch2 + out;\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t} else {\n\t\t\t\tout = ch1 + out;\n\t\t\t}\n\t\t} else {\n\t\t\tout = ch1 + out;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default reverse;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\n\n\n// MAIN //\n\n/**\n* Reverses the grapheme clusters (i.e., user-perceived characters) of a string.\n*\n* @param {string} str - input string\n* @returns {string} output string\n*\n* @example\n* var out = reverse( 'last man standing' );\n* // returns 'gnidnats nam tsal'\n*\n* @example\n* var out = reverse( 'presidential election' );\n* // returns 'noitcele laitnediserp'\n*\n* @example\n* var out = reverse( 'JavaScript' );\n* // returns 'tpircSavaJ'\n*\n* @example\n* var out = reverse( 'Hidden Treasures' );\n* // returns 'serusaerT neddiH'\n*\n* @example\n* var out = reverse( '🐶🐮🐷🐰🐸' );\n* // returns '🐸🐰🐷🐮🐶'\n*/\nfunction reverse( str ) {\n\tvar cluster;\n\tvar out;\n\tvar idx;\n\tvar brk;\n\tvar i;\n\n\tout = '';\n\tidx = 0;\n\twhile ( idx < str.length ) {\n\t\tbrk = nextGraphemeClusterBreak( str, idx );\n\t\tif ( brk === -1 ) {\n\t\t\tbrk = str.length;\n\t\t}\n\t\tcluster = '';\n\t\tfor ( i = idx; i < brk; i++ ) {\n\t\t\tcluster += str.charAt( i );\n\t\t}\n\t\tout = cluster + out;\n\t\tidx = brk;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default reverse;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport repeat from './../../../base/repeat';\nimport ceil from '@stdlib/math/base/special/ceil';\n\n\n// MAIN //\n\n/**\n* Right pads a string such that the padded string has a length of at least `len`.\n*\n* @param {string} str - string to pad\n* @param {NonNegativeInteger} len - minimum string length\n* @param {string} pad - string used to pad\n* @returns {string} padded string\n*\n* @example\n* var str = rpad( 'a', 5, ' ' );\n* // returns 'a '\n*\n* @example\n* var str = rpad( 'beep', 10, 'b' );\n* // returns 'beepbbbbbb'\n*\n* @example\n* var str = rpad( 'boop', 12, 'beep' );\n* // returns 'boopbeepbeep'\n*/\nfunction rpad( str, len, pad ) {\n\tvar n = ( len - str.length ) / pad.length;\n\tif ( n <= 0 ) {\n\t\treturn str;\n\t}\n\tn = ceil( n );\n\treturn str + repeat( pad, n );\n}\n\n\n// EXPORTS //\n\nexport default rpad;\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 bool = ( typeof String.prototype.trimRight !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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 replace from './../../../base/replace';\n\n\n// VARIABLES //\n\n// The following regular expression should suffice to polyfill (most?) all environments.\nvar RE = /[\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+$/;\n\n\n// MAIN //\n\n/**\n* Trims whitespace from the end of a string.\n*\n* @private\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = rtrim( ' Whitespace ' );\n* // returns ' Whitespace'\n*\n* @example\n* var out = rtrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns '\\t\\t\\tTabs'\n*\n* @example\n* var out = rtrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns '\\n\\n\\nNew Lines'\n*/\nfunction rtrim( str ) {\n\treturn replace( str, RE, '' );\n}\n\n\n// EXPORTS //\n\nexport default rtrim;\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 rtrim = String.prototype.trimRight;\n\n\n// EXPORTS //\n\nexport default rtrim;\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* Trim whitespace characters from the end of a string.\n*\n* @module @stdlib/string/base/right-trim\n*\n* @example\n* import rtrim from '@stdlib/string/base/right-trim';\n*\n* var out = rtrim( ' Whitespace ' );\n* // returns ' Whitespace'\n*\n* out = rtrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns '\\t\\t\\tTabs'\n*\n* out = rtrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns '\\n\\n\\nNew Lines'\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar rtrim;\nif ( HAS_BUILTIN ) {\n\trtrim = main;\n} else {\n\trtrim = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default rtrim;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Trims whitespace from the end of a string.\n*\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = rtrim( ' Whitespace ' );\n* // returns ' Whitespace'\n*\n* @example\n* var out = rtrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns '\\t\\t\\tTabs'\n*\n* @example\n* var out = rtrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns '\\n\\n\\nNew Lines'\n*/\nfunction rtrim( str ) {\n\treturn builtin.call( str );\n}\n\n\n// EXPORTS //\n\nexport default rtrim;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\n// Cache a reference to the built-in to prevent prototype mutation shenanigans:\nvar sliceString = String.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Slices UTF-16 code units from a string.\n*\n* @param {string} str - input string\n* @param {integer} start - slice start index (inclusive)\n* @param {integer} end - slice end index (exclusive)\n* @returns {string} input string\n*\n* @example\n* var out = slice( 'last man standing', 1, 17 );\n* // returns 'ast man standing'\n*\n* out = slice( 'Hidden Treasures', 0, 6 );\n* // returns 'Hidden'\n*/\nfunction slice( str, start, end ) {\n\treturn sliceString.call( str, start, end );\n}\n\n\n// EXPORTS //\n\nexport default slice;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Returns the number of code points in a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {NonNegativeInteger} number of code points\n*\n* @example\n* var out = numCodePoints( 'last man standing' );\n* // returns 17\n*\n* @example\n* var out = numCodePoints( 'presidential election' );\n* // returns 21\n*\n* @example\n* var out = numCodePoints( 'अनुच्छेद' );\n* // returns 8\n*/\nfunction numCodePoints( str ) {\n\tvar count;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tcount = 0;\n\n\t// Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\t// Check for a high UTF-16 surrogate...\n\t\tif ( RE_UTF16_HIGH_SURROGATE.test( str[ i ] ) ) {\n\t\t\t// Check for an unpaired surrogate at the end of the input string...\n\t\t\tif ( i === str.length-1 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tcount += 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( str[ i+1 ] ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t\tcount += 1;\n\t\t\t}\n\t\t} else {\n\t\t\tcount += 1;\n\t\t}\n\t}\n\treturn count;\n}\n\n\n// EXPORTS //\n\nexport default numCodePoints;\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 maximum value.\n*\n* @param {number} x - first number\n* @param {number} y - second number\n* @returns {number} maximum value\n*\n* @example\n* var v = max( 3.14, 4.2 );\n* // returns 4.2\n*\n* @example\n* var v = max( 3.14, NaN );\n* // returns NaN\n*\n* @example\n* var v = max( NaN, 3.14 );\n* // returns 3.14\n*\n* @example\n* var v = max( -0.0, +0.0 );\n* // returns +0.0\n*\n* @example\n* var v = max( +0.0, -0.0 );\n* // returns -0.0\n*/\nfunction max( x, y ) {\n\tif ( x > y ) {\n\t\treturn x;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default max;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport numCodePoints from './../../../num-code-points';\nimport max from '@stdlib/math/base/special/fast/max';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Slices a string based on Unicode code points.\n*\n* @param {string} str - input string\n* @param {integer} start - the `ith` Unicode code point to start a slice (inclusive)\n* @param {integer} end - the `jth` Unicode code point to end a slice (exclusive)\n* @returns {string} output string\n*\n* @example\n* var out = sliceCodePoints( 'Hello 👋 World', 1, 3 );\n* // returns 'el'\n*\n* out = sliceCodePoints( '👋👋👋', 1, 2 );\n* // returns '👋'\n*/\nfunction sliceCodePoints( str, start, end ) {\n\tvar totalCodePoints;\n\tvar codePoints;\n\tvar len;\n\tvar ch1;\n\tvar ch2;\n\tvar idx;\n\tvar ch;\n\tvar i;\n\n\tlen = str.length;\n\tif ( len === 0 ) {\n\t\treturn '';\n\t}\n\ttotalCodePoints = numCodePoints( str );\n\tif ( start < 0 ) {\n\t\tstart = max( totalCodePoints + start, 0 );\n\t}\n\tif ( end < 0 ) {\n\t\tend = max( totalCodePoints + end, 0 );\n\t} else if ( end > totalCodePoints ) {\n\t\tend = totalCodePoints;\n\t}\n\tif ( start >= totalCodePoints || end <= start ) {\n\t\treturn '';\n\t}\n\tcodePoints = '';\n\tidx = 0;\n\n\t// Process the string one Unicode code unit at a time and handle UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < len && idx < end; i++ ) {\n\t\tch1 = str[ i ];\n\t\tch = ch1;\n\n\t\t// Check for a UTF-16 surrogate pair...\n\t\tif ( i < len-1 && RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i+1 ];\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tch += ch2;\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Note: `ch` may be a lone surrogate (e.g., a low surrogate without a preceding high surrogate or a high surrogate at the end of the input string).\n\n\t\tif ( idx >= start && idx < end ) {\n\t\t\tcodePoints += ch;\n\t\t}\n\t\tidx += 1;\n\t}\n\treturn codePoints;\n}\n\n\n// EXPORTS //\n\nexport default sliceCodePoints;\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 lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[\\-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// MAIN //\n\n/**\n* Converts a string to snake case.\n*\n* @param {string} str - string to convert\n* @returns {string} snake-cased string\n*\n* @example\n* var str = snakecase( 'Hello World!' );\n* // returns 'hello_world'\n*\n* @example\n* var str = snakecase( 'foo bar' );\n* // returns 'foo_bar'\n*\n* @example\n* var str = snakecase( 'I am a tiny little teapot' );\n* // returns 'i_am_a_tiny_little_teapot'\n*\n* @example\n* var str = snakecase( 'BEEP boop' );\n* // returns 'beep_boop'\n*\n* @example\n* var str = snakecase( 'isMobile' );\n* // returns 'is_mobile'\n*/\nfunction snakecase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\tstr = replace( str, RE_WHITESPACE, '_' );\n\treturn lowercase( str );\n}\n\n\n// EXPORTS //\n\nexport default snakecase;\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 bool = ( typeof String.prototype.startsWith !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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 startsWith = String.prototype.startsWith;\n\n\n// EXPORTS //\n\nexport default startsWith;\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* Test if a string starts with the characters of another string.\n*\n* @module @stdlib/string/base/starts-with\n*\n* @example\n* import startsWith from '@stdlib/string/base/starts-with';\n*\n* var str = 'Fair is foul, and foul is fair, hover through fog and filthy air';\n* var bool = startsWith( str, 'Fair', 0 );\n* // returns true\n*\n* bool = startsWith( str, 'fair', 0 );\n* // returns false\n*\n* bool = startsWith( str, 'foul', 8 );\n* // returns true\n*\n* bool = startsWith( str, 'filthy', -10 );\n* // returns true\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar startsWith;\nif ( HAS_BUILTIN ) {\n\tstartsWith = main;\n} else {\n\tstartsWith = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default startsWith;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Tests if a string starts with the characters of another string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} position - position at which to start searching\n* @returns {boolean} boolean indicating if the input string starts with the search string\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember', 0 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember', 0 );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be', 0 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 0 );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 );\n* // returns true\n*/\nfunction startsWith( str, search, position ) {\n\tvar pos;\n\tif ( position < 0 ) {\n\t\tpos = str.length + position;\n\t} else {\n\t\tpos = position;\n\t}\n\tif ( search.length === 0 ) {\n\t\treturn true;\n\t}\n\tif (\n\t\tpos < 0 ||\n\t\tpos + search.length > str.length\n\t) {\n\t\treturn false;\n\t}\n\treturn builtin.call( str, search, pos );\n}\n\n\n// EXPORTS //\n\nexport default startsWith;\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* Tests if a string starts with the characters of another string.\n*\n* @private\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} position - position at which to start searching\n* @returns {boolean} boolean indicating if the input string starts with the search string\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember', 0 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember', 0 );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be', 0 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 0 );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 );\n* // returns true\n*/\nfunction startsWith( str, search, position ) {\n\tvar pos;\n\tvar i;\n\tif ( position < 0 ) {\n\t\tpos = str.length + position;\n\t} else {\n\t\tpos = position;\n\t}\n\tif ( search.length === 0 ) {\n\t\treturn true;\n\t}\n\tif (\n\t\tpos < 0 ||\n\t\tpos + search.length > str.length\n\t) {\n\t\treturn false;\n\t}\n\tfor ( i = 0; i < search.length; i++ ) {\n\t\tif ( str.charCodeAt( pos + i ) !== search.charCodeAt( i ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// EXPORTS //\n\nexport default startsWith;\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 './../../define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-write accessor.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Function} getter - get accessor\n* @param {Function} setter - set accessor\n*\n* @example\n* function getter() {\n* return name + ' foo';\n* }\n*\n* function setter( v ) {\n* name = v;\n* }\n*\n* var name = 'bar';\n* var obj = {};\n*\n* setNonEnumerableReadWriteAccessor( obj, 'foo', getter, setter );\n*\n* var v = obj.foo;\n* // returns 'bar foo'\n*\n* obj.foo = 'beep';\n*\n* v = obj.foo;\n* // returns 'beep foo'\n*/\nfunction setNonEnumerableReadWriteAccessor( obj, prop, getter, setter ) { // 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\t'set': setter\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadWriteAccessor;\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 './../../is-number';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a value which is a probability.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a value which is a probability\n*\n* @example\n* var bool = isProbability( 0.66 );\n* // returns true\n*\n* @example\n* var bool = isProbability( new Number( 0.66 ) );\n* // returns false\n*/\nfunction isProbability( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tvalue >= 0.0 &&\n\t\tvalue <= 1.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isProbability;\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 './../../is-number';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value which is a probability.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value which is a probability\n*\n* @example\n* var bool = isProbability( 0.5 );\n* // returns false\n*\n* @example\n* var bool = isProbability( new Number( 0.5 ) );\n* // returns true\n*/\nfunction isProbability( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tvalue.valueOf() >= 0.0 &&\n\t\tvalue.valueOf() <= 1.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isProbability;\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 probability.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a probability\n*\n* @example\n* var bool = isProbability( 0.5 );\n* // returns true\n*\n* @example\n* var bool = isProbability( new Number( 0.5 ) );\n* // returns true\n*\n* @example\n* var bool = isProbability( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isProbability( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isProbability( null );\n* // returns false\n*/\nfunction isProbability( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isProbability;\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* Creates a function which always returns the same value.\n*\n* @param {*} [value] - value to always return\n* @returns {Function} constant function\n*\n* @example\n* var fcn = wrap( 3.14 );\n*\n* var v = fcn();\n* // returns 3.14\n*\n* v = fcn();\n* // returns 3.14\n*\n* v = fcn();\n* // returns 3.14\n*/\nfunction wrap( value ) {\n\treturn constantFunction;\n\n\t/**\n\t* Constant function.\n\t*\n\t* @private\n\t* @returns {*} constant value\n\t*/\n\tfunction constantFunction() {\n\t\treturn value;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default wrap;\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* No operation.\n*\n* @example\n* noop();\n* // ...does nothing.\n*/\nfunction noop() {\n\t// Empty function...\n}\n\n\n// EXPORTS //\n\nexport default noop;\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 probability.\n*\n* @module @stdlib/assert/is-probability\n*\n* @example\n* import isProbability from '@stdlib/assert/is-probability';\n*\n* var bool = isProbability( 0.5 );\n* // returns true\n*\n* bool = isProbability( new Number( 0.5 ) );\n* // returns true\n*\n* bool = isProbability( 3.14 );\n* // returns false\n*\n* bool = isProbability( -5.0 );\n* // returns false\n*\n* bool = isProbability( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isProbability } from '@stdlib/assert/is-probability';\n*\n* var bool = isProbability( 0.3 );\n* // returns true\n*\n* bool = isProbability( new Number( 0.3 ) );\n* // returns false\n*\n* @example\n* import { isObject as isProbability } from '@stdlib/assert/is-probability';\n*\n* var bool = isProbability( 0.77 );\n* // returns false\n*\n* bool = isProbability( new Number( 0.77 ) );\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 safe double-precision floating-point integer.\n*\n* @module @stdlib/constants/float64/max-safe-integer\n* @type {number}\n*\n* @example\n* import FLOAT64_MAX_SAFE_INTEGER from '@stdlib/constants/float64/max-safe-integer';\n* // returns 9007199254740991\n*/\n\n\n// MAIN //\n\n/**\n* Maximum safe double-precision floating-point integer.\n*\n* ## Notes\n*\n* The integer has the value\n*\n* ```tex\n* 2^{53} - 1\n* ```\n*\n* @constant\n* @type {number}\n* @default 9007199254740991\n* @see [Safe Integers]{@link http://www.2ality.com/2013/10/safe-integers.html}\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MAX_SAFE_INTEGER = 9007199254740991;\n\n\n// EXPORTS //\n\nexport default FLOAT64_MAX_SAFE_INTEGER;\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 isPositiveZero from './../../../../base/assert/is-positive-zero';\nimport isnan from './../../../../base/assert/is-nan';\nimport PINF from '@stdlib/constants/float64/pinf';\n\n\n// MAIN //\n\n/**\n* Returns the maximum value.\n*\n* @param {number} x - first number\n* @param {number} y - second number\n* @returns {number} maximum value\n*\n* @example\n* var v = max( 3.14, 4.2 );\n* // returns 4.2\n*\n* @example\n* var v = max( 3.14, NaN );\n* // returns NaN\n*\n* @example\n* var v = max( +0.0, -0.0 );\n* // returns +0.0\n*/\nfunction max( x, y ) {\n\tif ( isnan( x ) || isnan( y ) ) {\n\t\treturn NaN;\n\t}\n\tif ( x === PINF || y === PINF ) {\n\t\treturn PINF;\n\t}\n\tif ( x === y && x === 0.0 ) {\n\t\tif ( isPositiveZero( x ) ) {\n\t\t\treturn x;\n\t\t}\n\t\treturn y;\n\t}\n\tif ( x > y ) {\n\t\treturn x;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default 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// MODULES //\n\nimport PINF from '@stdlib/constants/float64/pinf';\n\n\n// MAIN //\n\n/**\n* Tests if a double-precision floating-point numeric value is positive zero.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is positive zero\n*\n* @example\n* var bool = isPositiveZero( 0.0 );\n* // returns true\n*\n* @example\n* var bool = isPositiveZero( -0.0 );\n* // returns false\n*/\nfunction isPositiveZero( x ) {\n\treturn (x === 0.0 && 1.0/x === PINF);\n}\n\n\n// EXPORTS //\n\nexport default isPositiveZero;\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 imul = ( typeof Math.imul === 'function' ) ? Math.imul : null; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default imul;\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* Perform C-like multiplication of two signed 32-bit integers.\n*\n* @module @stdlib/number/int32/base/mul\n*\n* @example\n* import imul from '@stdlib/number/int32/base/mul';\n*\n* var v = imul( -10|0, 4|0 );\n* // returns -40\n*/\n\n// MODULES //\n\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( typeof builtin === 'function' ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\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// VARIABLES //\n\n// Define a mask for the least significant 16 bits (low word): 65535 => 0x0000ffff => 00000000000000001111111111111111\nvar LOW_WORD_MASK = 0x0000ffff>>>0; // asm type annotation\n\n\n// MAIN //\n\n/**\n* Performs C-like multiplication of two signed 32-bit integers.\n*\n* ## Method\n*\n* - To emulate C-like multiplication without the aid of 64-bit integers, we recognize that a 32-bit integer can be split into two 16-bit words\n*\n* ```tex\n* a = w_h*2^{16} + w_l\n* ```\n*\n* where \\\\( w_h \\\\) is the most significant 16 bits and \\\\( w_l \\\\) is the least significant 16 bits. For example, consider the maximum signed 32-bit integer \\\\( 2^{31}-1 \\\\)\n*\n* ```binarystring\n* 01111111111111111111111111111111\n* ```\n*\n* The 16-bit high word is then\n*\n* ```binarystring\n* 0111111111111111\n* ```\n*\n* and the 16-bit low word\n*\n* ```binarystring\n* 1111111111111111\n* ```\n*\n* If we cast the high word to 32-bit precision and multiply by \\\\( 2^{16} \\\\) (equivalent to a 16-bit left shift), then the bit sequence is\n*\n* ```binarystring\n* 01111111111111110000000000000000\n* ```\n*\n* Similarly, upon casting the low word to 32-bit precision, the bit sequence is\n*\n* ```binarystring\n* 00000000000000001111111111111111\n* ```\n*\n* From the rules of binary addition, we recognize that adding the two 32-bit values for the high and low words will return our original value \\\\( 2^{31}-1 \\\\).\n*\n* - Accordingly, the multiplication of two 32-bit integers can be expressed\n*\n* ```tex\n* \\begin{align*}\n* a \\cdot b &= ( a_h \\cdot 2^{16} + a_l) \\cdot ( b_h \\cdot 2^{16} + b_l) \\\\\n* &= a_l \\cdot b_l + a_h \\cdot b_l \\cdot 2^{16} + a_l \\cdot b_h \\cdot 2^{16} + (a_h \\cdot b_h) \\cdot 2^{32} \\\\\n* &= a_l \\cdot b_l + (a_h \\cdot b_l + a_l \\cdot b_h) \\cdot 2^{16} + (a_h \\cdot b_h) \\cdot 2^{32}\n* \\end{align*}\n* ```\n*\n* - We note that multiplying (dividing) an integer by \\\\( 2^n \\\\) is equivalent to performing a left (right) shift of \\\\( n \\\\) bits.\n*\n* - Further, as we want to return an integer of the same precision, for a 32-bit integer, the return value will be modulo \\\\( 2^{32} \\\\). Stated another way, we only care about the low word of a 64-bit result.\n*\n* - Accordingly, the last term, being evenly divisible by \\\\( 2^{32} \\\\), drops from the equation leaving the remaining two terms as the remainder.\n*\n* ```tex\n* a \\cdot b = a_l \\cdot b_l + (a_h \\cdot b_l + a_l \\cdot b_h) << 16\n* ```\n*\n* - Lastly, the second term in the above equation contributes to the middle bits and may cause the product to \"overflow\". However, we can disregard (`>>>0`) overflow bits due to modulo arithmetic, as discussed earlier with regard to the term involving the partial product of high words.\n*\n* @param {integer32} a - integer\n* @param {integer32} b - integer\n* @returns {integer32} product\n*\n* @example\n* var v = imul( -10|0, 4|0 );\n* // returns -40\n*/\nfunction imul( a, b ) {\n\tvar lbits;\n\tvar mbits;\n\tvar ha;\n\tvar hb;\n\tvar la;\n\tvar lb;\n\n\ta |= 0; // asm type annotation\n\tb |= 0; // asm type annotation\n\n\t// Isolate the most significant 16-bits:\n\tha = ( a>>>16 )>>>0; // asm type annotation\n\thb = ( b>>>16 )>>>0; // asm type annotation\n\n\t// Isolate the least significant 16-bits:\n\tla = ( a&LOW_WORD_MASK )>>>0; // asm type annotation\n\tlb = ( b&LOW_WORD_MASK )>>>0; // asm type annotation\n\n\t// Shift by zero (`>>>0`) sets the sign on the high part of the low word (i.e., \"mid-bits\"):\n\tlbits = ( la*lb )>>>0; // asm type annotation; no integer overflow possible\n\tmbits = ( ((ha*lb) + (la*hb))<<16 )>>>0; // asm type annotation; possible integer overflow\n\n\t// The final `|0` converts from an \"unsigned integer\" (possible integer overflow during sum) to a signed integer:\n\treturn ( lbits + mbits )|0; // asm type annotation\n}\n\n\n// EXPORTS //\n\nexport default imul;\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 imul from './../../../../int32/base/mul';\n\n\n// MAIN //\n\n/**\n* Performs C-like multiplication of two unsigned 32-bit integers.\n*\n* @param {uinteger32} a - integer\n* @param {uinteger32} b - integer\n* @returns {uinteger32} product\n*\n* @example\n* var v = mul( 10>>>0, 4>>>0 );\n* // returns 40\n*/\nfunction mul( a, b ) {\n\treturn imul( a, b ) >>> 0;\n}\n\n\n// EXPORTS //\n\nexport default mul;\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* Copies values from `x` into `y`.\n*\n* @private\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Object} x - input array object\n* @param {Collection} x.data - input array data\n* @param {Array} x.accessors - array element accessors\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting `x` index\n* @param {Object} y - output array object\n* @param {Collection} y.data - output array data\n* @param {Array} y.accessors - array element accessors\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting `y` index\n* @returns {Object} output array object\n*\n* @example\n* import Complex64Array from '@stdlib/array/complex64';\n* import Complex64 from '@stdlib/complex/float32/ctor';\n* import reinterpret64 from '@stdlib/strided/base/reinterpret-complex64';\n*\n* function setter( data, idx, value ) {\n* data.set( value, idx );\n* }\n*\n* function getter( data, idx ) {\n* return data.get( idx );\n* }\n*\n* var x = {\n* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ),\n* 'accessors': [ getter, setter ]\n* };\n*\n* var y = {\n* 'data': new Complex64Array( [ 5.0, 6.0, 7.0, 8.0 ] ),\n* 'accessors': [ getter, setter ]\n* };\n*\n* gcopy( x.data.length, x, 1, 0, y, 1, 0 );\n*\n* var view = reinterpret64( y.data, 0 );\n* // view => [ 1.0, 2.0, 3.0, 4.0 ]\n*/\nfunction gcopy( N, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar set;\n\tvar get;\n\tvar ix;\n\tvar iy;\n\tvar i;\n\n\t// Cache references to array data:\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache a reference to the element accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\tix = offsetX;\n\tiy = offsetY;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tset( ybuf, iy, get( xbuf, ix ) );\n\t\tix += strideX;\n\t\tiy += strideY;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default gcopy;\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 arraylike2object from '@stdlib/array/base/arraylike2object';\nimport accessors from './accessors.js';\n\n\n// VARIABLES //\n\nvar M = 8;\n\n\n// MAIN //\n\n/**\n* Copies values from `x` into `y`.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Collection} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {Collection} y - output array\n* @param {integer} strideY - `y` stride length\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];\n* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];\n*\n* gcopy( x.length, x, 1, y, 1 );\n* // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ]\n*/\nfunction gcopy( N, x, strideX, y, strideY ) {\n\tvar ix;\n\tvar iy;\n\tvar ox;\n\tvar oy;\n\tvar m;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tox = arraylike2object( x );\n\toy = arraylike2object( y );\n\tif ( ox.accessorProtocol || oy.accessorProtocol ) {\n\t\tif ( strideX < 0 ) {\n\t\t\tix = (1-N) * strideX;\n\t\t} else {\n\t\t\tix = 0;\n\t\t}\n\t\tif ( strideY < 0 ) {\n\t\t\tiy = (1-N) * strideY;\n\t\t} else {\n\t\t\tiy = 0;\n\t\t}\n\t\taccessors( N, ox, strideX, ix, oy, strideY, iy );\n\t\treturn oy.data;\n\t}\n\t// Use unrolled loops if both strides are equal to `1`...\n\tif ( strideX === 1 && strideY === 1 ) {\n\t\tm = N % M;\n\n\t\t// If we have a remainder, run a clean-up loop...\n\t\tif ( m > 0 ) {\n\t\t\tfor ( i = 0; i < m; i++ ) {\n\t\t\t\ty[ i ] = x[ i ];\n\t\t\t}\n\t\t}\n\t\tif ( N < M ) {\n\t\t\treturn y;\n\t\t}\n\t\tfor ( i = m; i < N; i += M ) {\n\t\t\ty[ i ] = x[ i ];\n\t\t\ty[ i+1 ] = x[ i+1 ];\n\t\t\ty[ i+2 ] = x[ i+2 ];\n\t\t\ty[ i+3 ] = x[ i+3 ];\n\t\t\ty[ i+4 ] = x[ i+4 ];\n\t\t\ty[ i+5 ] = x[ i+5 ];\n\t\t\ty[ i+6 ] = x[ i+6 ];\n\t\t\ty[ i+7 ] = x[ i+7 ];\n\t\t}\n\t\treturn y;\n\t}\n\tif ( strideX < 0 ) {\n\t\tix = (1-N) * strideX;\n\t} else {\n\t\tix = 0;\n\t}\n\tif ( strideY < 0 ) {\n\t\tiy = (1-N) * strideY;\n\t} else {\n\t\tiy = 0;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\ty[ iy ] = x[ ix ];\n\t\tix += strideX;\n\t\tiy += strideY;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default gcopy;\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* Dummy function.\n*\n* @private\n*/\nfunction foo() {\n\t// No-op...\n}\n\n\n// EXPORTS //\n\nexport default foo;\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* BLAS level 1 routine to copy values from `x` into `y`.\n*\n* @module @stdlib/blas/base/gcopy\n*\n* @example\n* import gcopy from '@stdlib/blas/base/gcopy';\n*\n* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];\n* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];\n*\n* gcopy( x.length, x, 1, y, 1 );\n* // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ]\n*\n* @example\n* import gcopy from '@stdlib/blas/base/gcopy';\n*\n* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];\n* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];\n*\n* gcopy.ndarray( x.length, x, 1, 0, y, 1, 0 );\n* // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport ndarray from './ndarray.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'ndarray', ndarray );\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 arraylike2object from '@stdlib/array/base/arraylike2object';\nimport accessors from './accessors.js';\n\n\n// VARIABLES //\n\nvar M = 8;\n\n\n// MAIN //\n\n/**\n* Copies values from `x` into `y`.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Collection} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting `x` index\n* @param {Collection} y - output array\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting `y` index\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];\n* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];\n*\n* gcopy( x.length, x, 1, 0, y, 1, 0 );\n* // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ]\n*/\nfunction gcopy( N, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar ix;\n\tvar iy;\n\tvar ox;\n\tvar oy;\n\tvar m;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tox = arraylike2object( x );\n\toy = arraylike2object( y );\n\tif ( ox.accessorProtocol || oy.accessorProtocol ) {\n\t\taccessors( N, ox, strideX, offsetX, oy, strideY, offsetY );\n\t\treturn oy.data;\n\t}\n\tix = offsetX;\n\tiy = offsetY;\n\n\t// Use unrolled loops if both strides are equal to `1`...\n\tif ( strideX === 1 && strideY === 1 ) {\n\t\tm = N % M;\n\n\t\t// If we have a remainder, run a clean-up loop...\n\t\tif ( m > 0 ) {\n\t\t\tfor ( i = 0; i < m; i++ ) {\n\t\t\t\ty[ iy ] = x[ ix ];\n\t\t\t\tix += strideX;\n\t\t\t\tiy += strideY;\n\t\t\t}\n\t\t}\n\t\tif ( N < M ) {\n\t\t\treturn y;\n\t\t}\n\t\tfor ( i = m; i < N; i += M ) {\n\t\t\ty[ iy ] = x[ ix ];\n\t\t\ty[ iy+1 ] = x[ ix+1 ];\n\t\t\ty[ iy+2 ] = x[ ix+2 ];\n\t\t\ty[ iy+3 ] = x[ ix+3 ];\n\t\t\ty[ iy+4 ] = x[ ix+4 ];\n\t\t\ty[ iy+5 ] = x[ ix+5 ];\n\t\t\ty[ iy+6 ] = x[ ix+6 ];\n\t\t\ty[ iy+7 ] = x[ ix+7 ];\n\t\t\tix += M;\n\t\t\tiy += M;\n\t\t}\n\t\treturn y;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\ty[ iy ] = x[ ix ];\n\t\tix += strideX;\n\t\tiy += strideY;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default gcopy;\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 isFunction from '@stdlib/assert/is-function';\nimport hasFunctionNameSupport from '@stdlib/assert/has-function-name-support';\nimport format from '@stdlib/string/format';\nimport { REGEXP as RE } from '@stdlib/regexp/function-name';\n\n\n// VARIABLES //\n\nvar isFunctionNameSupported = hasFunctionNameSupport();\n\n\n// MAIN //\n\n/**\n* Returns the name of a function.\n*\n* @param {Function} fcn - input function\n* @throws {TypeError} must provide a function\n* @returns {string} function name\n*\n* @example\n* var v = functionName( Math.sqrt );\n* // returns 'sqrt'\n*\n* @example\n* var v = functionName( function foo(){} );\n* // returns 'foo'\n*\n* @example\n* var v = functionName( function(){} );\n* // returns '' || 'anonymous'\n*\n* @example\n* var v = functionName( String );\n* // returns 'String'\n*/\nfunction functionName( fcn ) {\n\t// TODO: add support for generator functions?\n\tif ( isFunction( fcn ) === false ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( isFunctionNameSupported ) {\n\t\treturn fcn.name;\n\t}\n\treturn RE.exec( fcn.toString() )[ 1 ];\n}\n\n\n// EXPORTS //\n\nexport default functionName;\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 foo from './foo.js';\n\n\n// MAIN //\n\n/**\n* Tests for native function `name` support.\n*\n* @returns {boolean} boolean indicating if an environment has function `name` support\n*\n* @example\n* var bool = hasFunctionNameSupport();\n* // returns \n*/\nfunction hasFunctionNameSupport() {\n\treturn ( foo.name === 'foo' );\n}\n\n\n// EXPORTS //\n\nexport default hasFunctionNameSupport;\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* Half-precision floating-point positive infinity.\n*\n* @module @stdlib/constants/float16/pinf\n* @type {number}\n*\n* @example\n* import FLOAT16_PINF from '@stdlib/constants/float16/pinf';\n* // returns +infinity\n*/\n\n// MODULES //\n\nimport Number from '@stdlib/number/ctor';\n\n\n// MAIN //\n\n/**\n* Half-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Half-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111 0000000000\n* ```\n*\n* This bit sequence corresponds to the unsigned 16-bit integer `31744` and to the HEX value `0x7c00`.\n*\n* @constant\n* @type {number}\n* @default infinity\n* @see [half-precision floating-point format]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n*/\nvar FLOAT16_PINF = Number.POSITIVE_INFINITY; // TODO: if, and when, float16 is natively available, assign the true constant; otherwise, fall back to float64\n\n\n// EXPORTS //\n\nexport default FLOAT16_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar main = ( typeof Float16Array === 'function' ) ? Float16Array : null; // eslint-disable-line no-undef, 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// MODULES //\n\nimport defineProperty from './../../define-property';\n\n\n// MAIN //\n\n/**\n* Defines a read-write accessor.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Function} getter - get accessor\n* @param {Function} setter - set accessor\n*\n* @example\n* function getter() {\n* return name + ' foo';\n* }\n*\n* function setter( v ) {\n* name = v;\n* }\n*\n* var name = 'bar';\n* var obj = {};\n*\n* setReadWriteAccessor( obj, 'foo', getter, setter );\n*\n* var v = obj.foo;\n* // returns 'bar foo'\n*\n* obj.foo = 'beep';\n*\n* v = obj.foo;\n* // returns 'beep foo'\n*/\nfunction setReadWriteAccessor( obj, prop, getter, setter ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'get': getter,\n\t\t'set': setter\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setReadWriteAccessor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar f16round = ( typeof Math.f16round === 'function' ) ? Math.f16round : null; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default f16round;\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';\n\n\n// MAIN //\n\n/**\n* Tests if a double-precision floating-point numeric value is finite.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is finite\n*\n* @example\n* var bool = isfinite( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isfinite( -2.0e64 );\n* // returns true\n*\n* @example\n* var bool = isfinite( Infinity );\n* // returns false\n*\n* @example\n* var bool = isfinite( -Infinity );\n* // returns false\n*/\nfunction isfinite( x ) {\n\treturn (\n\t\t// NaN check (x !== x ):\n\t\tx === x &&\n\n\t\t// +-infinity check:\n\t\tx > NINF &&\n\t\tx < PINF\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isfinite;\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* Difference between one and the smallest value greater than one that can be represented as a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/eps\n* @type {number}\n*\n* @example\n* import FLOAT16_EPSILON from '@stdlib/constants/float16/eps';\n* // returns 0.0009765625\n*/\n\n\n// MAIN //\n\n/**\n* Difference between one and the smallest value greater than one that can be represented as a half-precision floating-point number.\n*\n* ## Notes\n*\n* The difference is equal to\n*\n* ```tex\n* \\frac{1}{2^{10}}\n* ```\n*\n* @constant\n* @type {number}\n* @default 0.0009765625\n* @see [Half-precision floating-point format]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n* @see [Machine Epsilon]{@link https://en.wikipedia.org/wiki/Machine_epsilon}\n*/\nvar FLOAT16_EPSILON = 0.0009765625; // In JavaScript, can only represent as a double-precision floating-point number (float64)\n\n\n// EXPORTS //\n\nexport default FLOAT16_EPSILON;\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* Smallest positive half-precision floating-point normal number.\n*\n* @module @stdlib/constants/float16/smallest-normal\n* @type {number}\n*\n* @example\n* import FLOAT16_SMALLEST_NORMAL from '@stdlib/constants/float16/smallest-normal';\n* // returns 6.103515625e-5\n*/\n\n\n// MAIN //\n\n/**\n* Smallest positive half-precision floating-point normal number.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* \\frac{1}{2^{15-1}}\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 00001 0000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default 6.103515625e-5\n* @see [Half-precision floating-point format]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n*/\nvar FLOAT16_SMALLEST_NORMAL = 6.103515625e-5;\n\n\n// EXPORTS //\n\nexport default FLOAT16_SMALLEST_NORMAL;\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* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFiniteNumber from '@stdlib/math/base/assert/is-finite';\nimport FLOAT16_EPSILON from '@stdlib/constants/float16/eps';\nimport FLOAT16_MAX from '@stdlib/constants/float16/max';\nimport FLOAT16_MIN from '@stdlib/constants/float16/smallest-normal';\nimport EPS from '@stdlib/constants/float64/eps';\nimport PINF from '@stdlib/constants/float64/pinf';\nimport abs from '@stdlib/math/base/special/abs';\n\n\n// VARIABLES //\n\nvar INVERSE_EPSILON = 1.0 / EPS;\n\n\n// FUNCTIONS //\n\n/**\n* Performs banker's rounding (round-half-to-even) via floating-point arithmetic.\n*\n* @private\n* @param {number} n - input value\n* @returns {number} rounded value\n*/\nfunction roundTiesToEven( n ) {\n\treturn ( n + INVERSE_EPSILON ) - INVERSE_EPSILON;\n}\n\n\n// MAIN //\n\n/**\n* Converts a double-precision floating-point number to the nearest half-precision floating-point number.\n*\n* @param {number} x - double-precision floating-point number\n* @returns {number} nearest half-precision floating-point number\n*\n* @example\n* var y = float64ToFloat16( 1.337 );\n* // returns 1.3369140625\n*/\nfunction float64ToFloat16( x ) {\n\tvar res;\n\tvar mod;\n\tvar a;\n\tvar s;\n\n\tif ( x === 0.0 || isNaN( x ) || !isFiniteNumber( x ) ) {\n\t\treturn x;\n\t}\n\tif ( x < 0.0 ) {\n\t\ts = -1.0;\n\t} else {\n\t\ts = 1.0;\n\t}\n\tmod = abs( x );\n\tif ( mod < FLOAT16_MIN ) {\n\t\treturn s * roundTiesToEven( mod/FLOAT16_MIN/FLOAT16_EPSILON ) * FLOAT16_MIN * FLOAT16_EPSILON; // eslint-disable-line max-len\n\t}\n\t// Leverage Veltkamp's algorithm for splitting a number into two numbers to generate an approximation to `x` which fits in a smaller number of bits:\n\ta = ( 1 + ( FLOAT16_EPSILON/EPS ) ) * mod;\n\tres = a - ( a - mod );\n\tif ( res > FLOAT16_MAX || isNaN( res ) ) {\n\t\treturn s * PINF;\n\t}\n\treturn s * res;\n}\n\n\n// EXPORTS //\n\nexport default float64ToFloat16;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Convert a double-precision floating-point number to the nearest half-precision floating-point number.\n*\n* @module @stdlib/number/float64/base/to-float16\n*\n* @example\n* import float64ToFloat16 from '@stdlib/number/float64/base/to-float16';\n*\n* var y = float64ToFloat16( 1.337 );\n* // returns 1.3369140625\n*/\n\n// MODULES //\n\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( typeof builtin === 'function' ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\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/**\n* Maximum half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/max\n* @type {number}\n*\n* @example\n* import FLOAT16_MAX from '@stdlib/constants/float16/max';\n* // returns 65504.0\n*/\n\n\n// MAIN //\n\n/**\n* The maximum half-precision floating-point number.\n*\n* ## Notes\n*\n* The maximum is given by\n*\n* ```tex\n* 2^{15} (2 - 2^{-10})\n* ```\n*\n* @constant\n* @type {number}\n* @default 65504.0\n* @see [half-precision floating-point form]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n*/\nvar FLOAT16_MAX = 65504.0;\n\n\n// EXPORTS //\n\nexport default FLOAT16_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/**\n* Half-precision floating-point negative infinity.\n*\n* @module @stdlib/constants/float16/ninf\n* @type {number}\n*\n* @example\n* import FLOAT16_NINF from '@stdlib/constants/float16/ninf';\n* // returns -Infinity\n*/\n\n// MODULES //\n\nimport Number from '@stdlib/number/ctor';\n\n\n// MAIN //\n\n/**\n* Half-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Half-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111 0000000000\n* ```\n*\n* This bit sequence corresponds to the unsigned 16-bit integer `64512` and to the HEX value `0xfc00`.\n*\n* @constant\n* @type {number}\n* @default -infinity\n* @see [half-precision floating-point format]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n*/\nvar FLOAT16_NINF = Number.NEGATIVE_INFINITY; // TODO: if, and when, float16 is natively available, assign the true constant; otherwise, fall back to float64\n\n\n// EXPORTS //\n\nexport default FLOAT16_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// MODULES //\n\nimport Float32Array from '@stdlib/array/float32';\nimport Uint32Array from '@stdlib/array/uint32';\n\n\n// VARIABLES //\n\nvar FLOAT32_VIEW = new Float32Array( 1.0 );\nvar UINT32_VIEW = new Uint32Array( FLOAT32_VIEW.buffer );\n\n\n// MAIN //\n\n/**\n* Returns an unsigned 32-bit integer corresponding to the IEEE 754 binary representation of a single-precision floating-point number.\n*\n* @param {number} x - single-precision floating-point number\n* @returns {unsigned32} unsigned 32-bit integer\n*\n* @example\n* import float64ToFloat32 from '@stdlib/number/float64/base/to-float32';\n*\n* var f32 = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*\n* var w = toWordf( f32 ); // => 0 01111111 01010110010001011010001\n* // returns 1068180177\n*/\nfunction toWordf( x ) {\n\tFLOAT32_VIEW[ 0 ] = x;\n\treturn UINT32_VIEW[ 0 ];\n}\n\n\n// EXPORTS //\n\nexport default toWordf;\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* The bias of a single-precision floating-point number's exponent.\n*\n* @module @stdlib/constants/float32/exponent-bias\n* @type {integer32}\n*\n* @example\n* import FLOAT32_EXPONENT_BIAS from '@stdlib/constants/float32/exponent-bias';\n* // returns 127\n*/\n\n\n// MAIN //\n\n/**\n* The bias of a single-precision floating-point number's exponent.\n*\n* ## Notes\n*\n* The bias can be computed via\n*\n* ```tex\n* \\mathrm{bias} = 2^{k-1} - 1\n* ```\n*\n* where \\\\(k\\\\) is the number of bits in the exponent; here, \\\\(k = 8\\\\).\n*\n* @constant\n* @type {integer32}\n* @default 127\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT32_EXPONENT_BIAS = 127|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT32_EXPONENT_BIAS;\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 getWord from './../../../../float32/base/to-word';\nimport BIAS from '@stdlib/constants/float32/exponent-bias';\n\n\n// VARIABLES //\n\n// Exponent mask: 0 11111111 00000000000000000000000\nvar EXP_MASK = 0x7f800000; // TODO: consider making an external constant\n\n\n// MAIN //\n\n/**\n* Returns an integer corresponding to the unbiased exponent of a single-precision floating-point number.\n*\n* @param {number} x - single-precision floating-point number\n* @returns {integer8} unbiased exponent\n*\n* @example\n* import toFloat32 from '@stdlib/number/float64/base/to-float32';\n*\n* var exp = exponentf( toFloat32( 3.14e34 ) ); // => 2**114 ~ 2.08e34\n* // returns 114\n*\n* @example\n* import toFloat32 from '@stdlib/number/float64/base/to-float32';\n*\n* var exp = exponentf( toFloat32( 3.14e-34 ) ); // => 2**-112 ~ 1.93e-34\n* // returns -112\n*\n* @example\n* import toFloat32 from '@stdlib/number/float64/base/to-float32';\n*\n* var exp = exponentf( toFloat32( -3.14 ) );\n* // returns 1\n*\n* @example\n* var exp = exponentf( 0.0 );\n* // returns -127\n*\n* @example\n* var exp = exponentf( NaN );\n* // returns 128\n*/\nfunction exponentf( x ) {\n\t// Convert `x` to an unsigned 32-bit integer corresponding to the IEEE 754 binary representation:\n\tvar w = getWord( x );\n\n\t// Apply a mask to isolate only the exponent bits and then shift off all bits which are part of the fraction:\n\tw = ( w & EXP_MASK ) >>> 23;\n\n\t// Remove the bias and return:\n\treturn w - BIAS;\n}\n\n\n// EXPORTS //\n\nexport default exponentf;\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* Single-precision floating-point negative infinity.\n*\n* @module @stdlib/constants/float32/ninf\n* @type {number}\n*\n* @example\n* import FLOAT32_NINF from '@stdlib/constants/float32/ninf';\n* // returns -Infinity\n*/\n\n// MODULES //\n\nimport Float32Array from '@stdlib/array/float32';\nimport Uint32Array from '@stdlib/array/uint32';\n\n\n// VARIABLES //\n\nvar FLOAT32_VIEW = new Float32Array( 1 );\nvar UINT32_VIEW = new Uint32Array( FLOAT32_VIEW.buffer );\nvar v;\n\n\n// MAIN //\n\n/**\n* Single-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Single-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111 00000000000000000000000\n* ```\n*\n* This bit sequence corresponds to the unsigned 32-bit integer `4286578688` and to the HEX value `0xff800000`.\n*\n* @constant\n* @type {number}\n* @default 0xff800000\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT32_NINF = 0xff800000;\n\n// Set the ArrayBuffer bit sequence:\nUINT32_VIEW[ 0 ] = FLOAT32_NINF;\n\nv = FLOAT32_VIEW[ 0 ];\n\n\n// EXPORTS //\n\nexport default v;\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* Mask for the significand of a single-precision floating-point number.\n*\n* @module @stdlib/constants/float32/significand-mask\n* @type {uinteger32}\n*\n* @example\n* import FLOAT32_SIGNIFICAND_MASK from '@stdlib/constants/float32/significand-mask';\n* // returns 8388607\n*/\n\n\n// MAIN //\n\n/**\n* Mask for the significand of a single-precision floating-point number.\n*\n* ## Notes\n*\n* The mask for the significand of a single-precision floating-point number is an unsigned 32-bit integer with the value \\\\( 8388607 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 00000000 11111111111111111111111\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 0x007fffff\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT32_SIGNIFICAND_MASK = 0x007fffff;\n\n\n// EXPORTS //\n\nexport default FLOAT32_SIGNIFICAND_MASK;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport NINF from '@stdlib/constants/float16/ninf';\nimport PINF from '@stdlib/constants/float16/pinf';\nimport isnanf from '@stdlib/math/base/assert/is-nanf';\nimport absf from '@stdlib/math/base/special/absf';\nimport exponent from './../../../../float32/base/exponent';\nimport isNegativeZerof from '@stdlib/math/base/assert/is-negative-zerof';\nimport FLOAT32_SIGNIFICAND_MASK from '@stdlib/constants/float32/significand-mask';\nimport toWordf from './../../../../float32/base/to-word';\n\n\n// VARIABLES //\n\nvar UINT16_NAN = 0x7E00; // 0x7E00 = 32256 => 0 11111 1000000000\nvar UINT16_PINF = 0x7C00; // 0x7C00 = 31744 => 0 11111 0000000000\nvar UINT16_NINF = 0xFC00; // 0xFC00 = 64512 => 1 11111 0000000000\nvar UINT16_POSITIVE_ZERO = 0x0000; // 0x0000 = 0 => 0 00000 0000000000\nvar UINT16_NEGATIVE_ZERO = 0x8000; // 0x8000 = 32768 => 1 00000 0000000000\nvar FLOAT32_IMPLICIT_BIT = 0x800000; // 0x800000 = 8388608 => 0 00000001 00000000000000000000000\nvar FLOAT32_SUBNORMAL_STICKY_MASK = 0x1FFF; // 0x1FFF = 8191 => 0 00000000 00000000001111111111111\nvar FLOAT32_STICKY_MASK = 0xFFF; // 0xFFF = 4095 => 0 00000000 00000000000111111111111\nvar MAX_MANTISSA = 0x3FF; // 0x3FF = 1023 => 0 00000 1111111111\n\n\n// MAIN //\n\n/**\n* Returns an unsigned 16-bit integer corresponding to the IEEE 754 binary representation of a half-precision floating-point number.\n*\n* @param {number} x - half-precision floating-point number\n* @returns {unsigned16} unsigned 16-bit integer\n*\n* @example\n* import float64ToFloat16 from '@stdlib/number/float64/base/to-float16';\n*\n* var f16 = float64ToFloat16( 1.05 );\n* // returns 1.0498046875\n*\n* var w = toWord( f16 ); // => 0 01111 0000110011\n* // returns 15411\n*/\nfunction toWord( x ) {\n\tvar f32Exponent;\n\tvar f16Exponent;\n\tvar stickyBits;\n\tvar mantissa;\n\tvar roundBit;\n\tvar shift;\n\tvar bits;\n\tvar mant;\n\tvar sign;\n\n\t// Handle special cases...\n\tif ( isnanf( x ) ) {\n\t\treturn UINT16_NAN;\n\t}\n\tif ( x === PINF ) {\n\t\treturn UINT16_PINF; // +Infinity\n\t}\n\tif ( x === NINF ) {\n\t\treturn UINT16_NINF; // -Infinity\n\t}\n\tif ( x === 0 ) {\n\t\tif ( isNegativeZerof( x ) ) {\n\t\t\treturn UINT16_NEGATIVE_ZERO;\n\t\t}\n\t\treturn UINT16_POSITIVE_ZERO;\n\t}\n\tif ( x < 0 ) {\n\t\tsign = 1;\n\t} else {\n\t\tsign = 0;\n\t}\n\tx = absf( x );\n\tbits = toWordf( x );\n\n\tmant = bits & FLOAT32_SIGNIFICAND_MASK; // 23-bit mantissa\n\n\t// Store unbiased exponent of a 32-bit floating-point number:\n\tf32Exponent = exponent( x );\n\n\t// Calculate exponent of a 16-bit floating-point number:\n\tf16Exponent = f32Exponent + 15;\n\n\t// Handle overflow (infinity in float16)...\n\tif ( f16Exponent >= 31 ) {\n\t\tif ( sign ) {\n\t\t\treturn UINT16_NINF; // -Infinity\n\t\t}\n\t\treturn UINT16_PINF; // +Infinity\n\t}\n\t// Handle underflow (subnormal or zero in float16)...\n\tif ( f16Exponent <= 0 ) {\n\t\t// Check if the value is too small to be represented even as a subnormal float16 number:\n\t\tif ( f16Exponent < -10 ) {\n\t\t\treturn sign << 15; // return zero with the appropriate sign bit\n\t\t}\n\t\t// Calculate the amount of right shift needed to denormalize the mantissa for subnormal representation:\n\t\tshift = 1 - f16Exponent;\n\n\t\t// Create an 11-bit mantissa by adding the implicit leading 1 bit and extracting the top 10 bits from mantissa:\n\t\tmantissa = ( FLOAT32_IMPLICIT_BIT | mant ) >>> 13;\n\n\t\t// Determine the round bit and sticky bits based on the shift amount to apply correct rounding...\n\t\tif ( shift < 11 ) {\n\t\t\t// Extract the round bit at the position that will be truncated after the shift:\n\t\t\troundBit = ( mantissa >>> ( shift - 1 ) ) & 1;\n\n\t\t\t// Check if any bits below the round bit position are set (sticky bits):\n\t\t\tstickyBits = ( mantissa & ( ( 1 << ( shift - 1 ) ) - 1 ) ) !== 0;\n\n\t\t\t// If no sticky bits found in the 11-bit mantissa, check the remaining bits from the original mantissa:\n\t\t\tif ( !stickyBits ) {\n\t\t\t\tstickyBits = ( mant & FLOAT32_SUBNORMAL_STICKY_MASK ) !== 0;\n\t\t\t}\n\t\t} else {\n\t\t\t// When the shift is 11 or greater, the round bit comes from original mantissa:\n\t\t\troundBit = ( mant >>> ( 13 - ( shift - 11 ) - 1 ) ) & 1;\n\n\t\t\t// Check if any bits below the round bit position in mantissa are set:\n\t\t\tstickyBits = ( mant & ( ( 1 << ( 13 - ( shift - 11 ) - 1 ) ) - 1 ) ) !== 0; // eslint-disable-line max-len\n\t\t}\n\t\t// Apply the denormalization shift to the mantissa:\n\t\tmantissa >>>= shift;\n\n\t\t// Round to nearest even:\n\t\tif ( roundBit && ( stickyBits || ( mantissa & 1 ) ) ) {\n\t\t\tmantissa += 1;\n\t\t}\n\t\treturn ( sign << 15 ) | mantissa;\n\t}\n\t// Extract the top 10 bits of the mantissa from 23 bits:\n\tmantissa = mant >>> 13;\n\n\t// Extract the round bit (the first bit that will be truncated):\n\troundBit = ( mant >>> 12 ) & 1;\n\n\t// Check sticky bits (all bits below bit 12):\n\tstickyBits = ( mant & FLOAT32_STICKY_MASK ) !== 0;\n\n\t// Round up if roundBit is 1 AND (sticky bits OR mantissa is odd):\n\tif ( roundBit && ( stickyBits || ( mantissa & 1 ) ) ) {\n\t\tmantissa += 1;\n\n\t\t// Check for mantissa overflow (carries into exponent)...\n\t\tif ( mantissa > MAX_MANTISSA ) {\n\t\t\tf16Exponent += 1;\n\t\t\tmantissa = 0;\n\n\t\t\t// Check for exponent overflow...\n\t\t\tif ( f16Exponent >= 31 ) {\n\t\t\t\tif ( sign ) {\n\t\t\t\t\treturn UINT16_NINF; // -Infinity\n\t\t\t\t}\n\t\t\t\treturn UINT16_PINF; // +Infinity\n\t\t\t}\n\t\t}\n\t}\n\t// Combine sign (1 bit), exponent (5 bits), and mantissa (10 bits):\n\treturn ( sign << 15 ) | ( f16Exponent << 10 ) | mantissa;\n}\n\n\n// EXPORTS //\n\nexport default toWord;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 if a single-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnanf( NaN );\n* // returns true\n*\n* @example\n* var bool = isnanf( 7.0 );\n* // returns false\n*/\nfunction isnanf( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nexport default isnanf;\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 NINF from '@stdlib/constants/float32/ninf';\n\n\n// MAIN //\n\n/**\n* Tests if a single-precision floating-point numeric value is negative zero.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is negative zero\n*\n* @example\n* var bool = isNegativeZerof( -0.0 );\n* // returns true\n*\n* @example\n* var bool = isNegativeZerof( 0.0 );\n* // returns false\n*/\nfunction isNegativeZerof( x ) {\n\treturn (x === 0.0 && 1.0/x === NINF);\n}\n\n\n// EXPORTS //\n\nexport default isNegativeZerof;\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* Computes the absolute value of a single-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = absf( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = absf( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = absf( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = absf( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = absf( NaN );\n* // returns NaN\n*/\nfunction absf( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default absf;\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* The maximum biased base 2 exponent for a double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/max-base2-exponent\n* @type {integer32}\n*\n* @example\n* import FLOAT64_MAX_BASE2_EXPONENT from '@stdlib/constants/float64/max-base2-exponent';\n* // returns 1023\n*/\n\n\n// MAIN //\n\n/**\n* The maximum biased base 2 exponent for a double-precision floating-point number.\n*\n* ```text\n* 11111111110 => 2046 - BIAS = 1023\n* ```\n*\n* where `BIAS = 1023`.\n*\n* @constant\n* @type {integer32}\n* @default 1023\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MAX_BASE2_EXPONENT = 1023|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT64_MAX_BASE2_EXPONENT;\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* The minimum biased base 2 exponent for a normal double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/min-base2-exponent\n* @type {integer32}\n*\n* @example\n* import FLOAT64_MIN_BASE2_EXPONENT from '@stdlib/constants/float64/min-base2-exponent';\n* // returns -1022\n*/\n\n\n// MAIN //\n\n/**\n* The minimum biased base 2 exponent for a normal double-precision floating-point number.\n*\n* ```text\n* 1 - BIAS = -1022\n* ```\n*\n* where `BIAS = 1023`.\n*\n* @constant\n* @type {integer32}\n* @default -1022\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MIN_BASE2_EXPONENT = -1022|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT64_MIN_BASE2_EXPONENT;\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* Rounds a numeric value to the nearest integer.\n*\n* @param {number} x - input value\n* @returns {number} function value\n*\n* @example\n* var v = round( -4.2 );\n* // returns -4.0\n*\n* @example\n* var v = round( -4.5 );\n* // returns -4.0\n*\n* @example\n* var v = round( -4.6 );\n* // returns -5.0\n*\n* @example\n* var v = round( 9.99999 );\n* // returns 10.0\n*\n* @example\n* var v = round( 9.5 );\n* // returns 10.0\n*\n* @example\n* var v = round( 9.2 );\n* // returns 9.0\n*\n* @example\n* var v = round( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = round( -0.0 );\n* // returns -0.0\n*\n* @example\n* var v = round( Infinity );\n* // returns Infinity\n*\n* @example\n* var v = round( -Infinity );\n* // returns -Infinity\n*\n* @example\n* var v = round( NaN );\n* // returns NaN\n*/\nvar round = Math.round; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default round;\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* The bias of a double-precision floating-point number's exponent.\n*\n* @module @stdlib/constants/float64/exponent-bias\n* @type {integer32}\n*\n* @example\n* import FLOAT64_EXPONENT_BIAS from '@stdlib/constants/float64/exponent-bias';\n* // returns 1023\n*/\n\n\n// MAIN //\n\n/**\n* Bias of a double-precision floating-point number's exponent.\n*\n* ## Notes\n*\n* The bias can be computed via\n*\n* ```tex\n* \\mathrm{bias} = 2^{k-1} - 1\n* ```\n*\n* where \\\\(k\\\\) is the number of bits in the exponent; here, \\\\(k = 11\\\\).\n*\n* @constant\n* @type {integer32}\n* @default 1023\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_EXPONENT_BIAS = 1023|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT64_EXPONENT_BIAS;\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* The maximum biased base 2 exponent for a subnormal double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/max-base2-exponent-subnormal\n* @type {integer32}\n*\n* @example\n* import FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL from '@stdlib/constants/float64/max-base2-exponent-subnormal';\n* // returns -1023\n*/\n\n\n// MAIN //\n\n/**\n* The maximum biased base 2 exponent for a subnormal double-precision floating-point number.\n*\n* ```text\n* 00000000000 => 0 - BIAS = -1023\n* ```\n*\n* where `BIAS = 1023`.\n*\n* @constant\n* @type {integer32}\n* @default -1023\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL = -1023|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL;\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* The minimum biased base 2 exponent for a subnormal double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/min-base2-exponent-subnormal\n* @type {integer32}\n*\n* @example\n* import FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL from '@stdlib/constants/float64/min-base2-exponent-subnormal';\n* // returns -1074\n*/\n\n\n// MAIN //\n\n/**\n* The minimum biased base 2 exponent for a subnormal double-precision floating-point number.\n*\n* ```text\n* -(BIAS+(52-1)) = -(1023+51) = -1074\n* ```\n*\n* where `BIAS = 1023` and `52` is the number of digits in the significand.\n*\n* @constant\n* @type {integer32}\n* @default -1074\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL = -1074|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL;\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';\n\n\n// MAIN //\n\n/**\n* Tests if a double-precision floating-point numeric value is infinite.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is infinite\n*\n* @example\n* var bool = isInfinite( Infinity );\n* // returns true\n*\n* @example\n* var bool = isInfinite( -Infinity );\n* // returns true\n*\n* @example\n* var bool = isInfinite( 5.0 );\n* // returns false\n*\n* @example\n* var bool = isInfinite( NaN );\n* // returns false\n*/\nfunction isInfinite( x ) {\n\treturn (x === PINF || x === NINF);\n}\n\n\n// EXPORTS //\n\nexport default isInfinite;\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* High word mask for the sign bit of a double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/high-word-sign-mask\n* @type {uinteger32}\n*\n* @example\n* import FLOAT64_HIGH_WORD_SIGN_MASK from '@stdlib/constants/float64/high-word-sign-mask';\n* // returns 2147483648\n*/\n\n\n// MAIN //\n\n/**\n* High word mask for the sign bit of a double-precision floating-point number.\n*\n* ## Notes\n*\n* The high word mask for the sign bit of a double-precision floating-point number is an unsigned 32-bit integer with the value \\\\( 2147483648 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 1 00000000000 00000000000000000000\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 0x80000000\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_HIGH_WORD_SIGN_MASK = 0x80000000>>>0; // eslint-disable-line id-length\n\n\n// EXPORTS //\n\nexport default FLOAT64_HIGH_WORD_SIGN_MASK;\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 ctors from './ctors.js';\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if an environment is little endian.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment is little endian\n*\n* @example\n* var bool = isLittleEndian();\n* // returns \n*/\nfunction isLittleEndian() {\n\tvar uint16view;\n\tvar uint8view;\n\n\tuint16view = new ctors[ 'uint16' ]( 1 );\n\n\t/*\n\t* Set the uint16 view to a value having distinguishable lower and higher order words.\n\t*\n\t* 4660 => 0x1234 => 0x12 0x34 => '00010010 00110100' => (0x12,0x34) == (18,52)\n\t*/\n\tuint16view[ 0 ] = 0x1234;\n\n\t// Create a uint8 view on top of the uint16 buffer:\n\tuint8view = new ctors[ 'uint8' ]( uint16view.buffer );\n\n\t// If little endian, the least significant byte will be first...\n\treturn ( uint8view[ 0 ] === 0x34 );\n}\n\n\n// MAIN //\n\n/**\n* Boolean indicating if an environment is little endian.\n*\n* @constant\n* @type {boolean}\n*/\nvar bool = isLittleEndian(); // eslint-disable-line vars-on-top\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// MODULES //\n\nimport isLittleEndian from '@stdlib/assert/is-little-endian';\n\n\n// MAIN //\n\nvar indices;\nvar HIGH;\nvar LOW;\n\nif ( isLittleEndian === true ) {\n\tHIGH = 1; // second index\n\tLOW = 0; // first index\n} else {\n\tHIGH = 0; // first index\n\tLOW = 1; // second index\n}\nindices = {\n\t'HIGH': HIGH,\n\t'LOW': LOW\n};\n\n\n// EXPORTS //\n\nexport default indices;\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* High word mask for excluding the sign bit of a double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/high-word-abs-mask\n* @type {uinteger32}\n*\n* @example\n* import FLOAT64_HIGH_WORD_ABS_MASK from '@stdlib/constants/float64/high-word-abs-mask';\n* // returns 2147483647\n*/\n\n\n// MAIN //\n\n/**\n* High word mask for excluding the sign bit of a double-precision floating-point number.\n*\n* ## Notes\n*\n* The high word mask for excluding the sign bit of a double-precision floating-point number is an unsigned 32-bit integer with the value \\\\( 2147483647 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 11111111111 11111111111111111111\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 0x7fffffff\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_HIGH_WORD_ABS_MASK = 0x7fffffff>>>0; // eslint-disable-line id-length\n\n\n// EXPORTS //\n\nexport default FLOAT64_HIGH_WORD_ABS_MASK;\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 Uint8Array from '@stdlib/array/uint8';\nimport Uint16Array from '@stdlib/array/uint16';\n\n\n// MAIN //\n\nvar ctors = {\n\t'uint16': Uint16Array,\n\t'uint8': Uint8Array\n};\n\n\n// EXPORTS //\n\nexport default ctors;\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 Uint32Array from '@stdlib/array/uint32';\nimport Float64Array from '@stdlib/array/float64';\nimport indices from './indices.js';\n\n\n// VARIABLES //\n\nvar FLOAT64_VIEW = new Float64Array( 1 );\nvar UINT32_VIEW = new Uint32Array( FLOAT64_VIEW.buffer );\n\nvar HIGH = indices.HIGH;\nvar LOW = indices.LOW;\n\n\n// MAIN //\n\n/**\n* Splits a double-precision floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).\n*\n* ## Notes\n*\n* ```text\n* float64 (64 bits)\n* f := fraction (significand/mantissa) (52 bits)\n* e := exponent (11 bits)\n* s := sign bit (1 bit)\n*\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Float64 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Uint32 | Uint32 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* ```\n*\n* If little endian (more significant bits last):\n*\n* ```text\n* <-- lower higher -->\n* | f7 f6 f5 f4 f3 f2 e2 | f1 |s| e1 |\n* ```\n*\n* If big endian (more significant bits first):\n*\n* ```text\n* <-- higher lower -->\n* |s| e1 e2 | f1 f2 f3 f4 f5 f6 f7 |\n* ```\n*\n* In which Uint32 can we find the higher order bits? If little endian, the second; if big endian, the first.\n*\n* ## References\n*\n* - [Open Group][1]\n*\n* [1]: http://pubs.opengroup.org/onlinepubs/9629399/chap14.htm\n*\n* @private\n* @param {number} x - input value\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import Uint32Array from '@stdlib/array/uint32';\n*\n* var out = new Uint32Array( 2 );\n*\n* var w = toWords( 3.14e201, out, 1, 0 );\n* // returns [ 1774486211, 2479577218 ]\n*\n* var bool = ( w === out );\n* // returns true\n*/\nfunction toWords( x, out, stride, offset ) {\n\tFLOAT64_VIEW[ 0 ] = x;\n\tout[ offset ] = UINT32_VIEW[ HIGH ];\n\tout[ offset + stride ] = UINT32_VIEW[ LOW ];\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toWords;\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 fcn from './assign.js';\n\n\n// MAIN //\n\n/**\n* Splits a double-precision floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).\n*\n* @param {number} x - input value\n* @returns {Array} output array\n*\n* @example\n* var w = toWords( 3.14e201 );\n* // returns [ 1774486211, 2479577218 ]\n*/\nfunction toWords( x ) {\n\treturn fcn( x, [ 0>>>0, 0>>>0 ], 1, 0 );\n}\n\n\n// EXPORTS //\n\nexport default toWords;\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* Split a double-precision floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).\n*\n* @module @stdlib/number/float64/base/to-words\n*\n* @example\n* import toWords from '@stdlib/number/float64/base/to-words';\n*\n* var w = toWords( 3.14e201 );\n* // returns [ 1774486211, 2479577218 ]\n*\n* @example\n* import Uint32Array from '@stdlib/array/uint32';\n* import toWords from '@stdlib/number/float64/base/to-words';\n*\n* var out = new Uint32Array( 2 );\n*\n* var w = toWords.assign( 3.14e201, out, 1, 0 );\n* // returns [ 1774486211, 2479577218 ]\n*\n* var bool = ( w === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\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 isLittleEndian from '@stdlib/assert/is-little-endian';\n\n\n// MAIN //\n\nvar HIGH;\nif ( isLittleEndian === true ) {\n\tHIGH = 1; // second index\n} else {\n\tHIGH = 0; // first index\n}\n\n\n// EXPORTS //\n\nexport default HIGH;\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 isLittleEndian from '@stdlib/assert/is-little-endian';\n\n\n// MAIN //\n\nvar indices;\nvar HIGH;\nvar LOW;\n\nif ( isLittleEndian === true ) {\n\tHIGH = 1; // second index\n\tLOW = 0; // first index\n} else {\n\tHIGH = 0; // first index\n\tLOW = 1; // second index\n}\nindices = {\n\t'HIGH': HIGH,\n\t'LOW': LOW\n};\n\n\n// EXPORTS //\n\nexport default indices;\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 Uint32Array from '@stdlib/array/uint32';\nimport Float64Array from '@stdlib/array/float64';\nimport HIGH from './high.js';\n\n\n// VARIABLES //\n\nvar FLOAT64_VIEW = new Float64Array( 1 );\nvar UINT32_VIEW = new Uint32Array( FLOAT64_VIEW.buffer );\n\n\n// MAIN //\n\n/**\n* Returns an unsigned 32-bit integer corresponding to the more significant 32 bits of a double-precision floating-point number.\n*\n* ## Notes\n*\n* ```text\n* float64 (64 bits)\n* f := fraction (significand/mantissa) (52 bits)\n* e := exponent (11 bits)\n* s := sign bit (1 bit)\n*\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Float64 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Uint32 | Uint32 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* ```\n*\n* If little endian (more significant bits last):\n*\n* ```text\n* <-- lower higher -->\n* | f7 f6 f5 f4 f3 f2 e2 | f1 |s| e1 |\n* ```\n*\n* If big endian (more significant bits first):\n*\n* ```text\n* <-- higher lower -->\n* |s| e1 e2 | f1 f2 f3 f4 f5 f6 f7 |\n* ```\n*\n* In which Uint32 can we find the higher order bits? If little endian, the second; if big endian, the first.\n*\n* ## References\n*\n* - [Open Group][1]\n*\n* [1]: http://pubs.opengroup.org/onlinepubs/9629399/chap14.htm\n*\n* @param {number} x - input value\n* @returns {uinteger32} higher order word\n*\n* @example\n* var w = getHighWord( 3.14e201 ); // => 01101001110001001000001011000011\n* // returns 1774486211\n*/\nfunction getHighWord( x ) {\n\tFLOAT64_VIEW[ 0 ] = x;\n\treturn UINT32_VIEW[ HIGH ];\n}\n\n\n// EXPORTS //\n\nexport default getHighWord;\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 Uint32Array from '@stdlib/array/uint32';\nimport Float64Array from '@stdlib/array/float64';\nimport indices from './indices.js';\n\n\n// VARIABLES //\n\nvar FLOAT64_VIEW = new Float64Array( 1 );\nvar UINT32_VIEW = new Uint32Array( FLOAT64_VIEW.buffer );\n\nvar HIGH = indices.HIGH;\nvar LOW = indices.LOW;\n\n\n// MAIN //\n\n/**\n* Creates a double-precision floating-point number from a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).\n*\n* ## Notes\n*\n* ```text\n* float64 (64 bits)\n* f := fraction (significand/mantissa) (52 bits)\n* e := exponent (11 bits)\n* s := sign bit (1 bit)\n*\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Float64 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Uint32 | Uint32 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* ```\n*\n* If little endian (more significant bits last):\n*\n* ```text\n* <-- lower higher -->\n* | f7 f6 f5 f4 f3 f2 e2 | f1 |s| e1 |\n* ```\n*\n* If big endian (more significant bits first):\n*\n* ```text\n* <-- higher lower -->\n* |s| e1 e2 | f1 f2 f3 f4 f5 f6 f7 |\n* ```\n*\n* In which Uint32 should we place the higher order bits? If little endian, the second; if big endian, the first.\n*\n* ## References\n*\n* - [Open Group][1]\n*\n* [1]: http://pubs.opengroup.org/onlinepubs/9629399/chap14.htm\n*\n* @param {uinteger32} high - higher order word (unsigned 32-bit integer)\n* @param {uinteger32} low - lower order word (unsigned 32-bit integer)\n* @returns {number} floating-point number\n*\n* @example\n* var v = fromWords( 1774486211, 2479577218 );\n* // returns 3.14e201\n*\n* @example\n* var v = fromWords( 3221823995, 1413754136 );\n* // returns -3.141592653589793\n*\n* @example\n* var v = fromWords( 0, 0 );\n* // returns 0.0\n*\n* @example\n* var v = fromWords( 2147483648, 0 );\n* // returns -0.0\n*\n* @example\n* var v = fromWords( 2146959360, 0 );\n* // returns NaN\n*\n* @example\n* var v = fromWords( 2146435072, 0 );\n* // returns Infinity\n*\n* @example\n* var v = fromWords( 4293918720, 0 );\n* // returns -Infinity\n*/\nfunction fromWords( high, low ) {\n\tUINT32_VIEW[ HIGH ] = high;\n\tUINT32_VIEW[ LOW ] = low;\n\treturn FLOAT64_VIEW[ 0 ];\n}\n\n\n// EXPORTS //\n\nexport default fromWords;\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 SIGN_MASK from '@stdlib/constants/float64/high-word-sign-mask';\nimport ABS_MASK from '@stdlib/constants/float64/high-word-abs-mask';\nimport toWords from '@stdlib/number/float64/base/to-words';\nimport getHighWord from '@stdlib/number/float64/base/get-high-word';\nimport fromWords from '@stdlib/number/float64/base/from-words';\n\n\n// VARIABLES //\n\n// High/low words workspace:\nvar WORDS = [ 0, 0 ];\n\n\n// MAIN //\n\n/**\n* Returns a double-precision floating-point number with the magnitude of `x` and the sign of `y`.\n*\n* @param {number} x - number from which to derive a magnitude\n* @param {number} y - number from which to derive a sign\n* @returns {number} a double-precision floating-point number\n*\n* @example\n* var z = copysign( -3.14, 10.0 );\n* // returns 3.14\n*\n* @example\n* var z = copysign( 3.14, -1.0 );\n* // returns -3.14\n*\n* @example\n* var z = copysign( 1.0, -0.0 );\n* // returns -1.0\n*\n* @example\n* var z = copysign( -3.14, -0.0 );\n* // returns -3.14\n*\n* @example\n* var z = copysign( -0.0, 1.0 );\n* // returns 0.0\n*/\nfunction copysign( x, y ) {\n\tvar hx;\n\tvar hy;\n\n\t// Split `x` into higher and lower order words:\n\ttoWords.assign( x, WORDS, 1, 0 );\n\thx = WORDS[ 0 ];\n\n\t// Turn off the sign bit of `x`:\n\thx &= ABS_MASK;\n\n\t// Extract the higher order word from `y`:\n\thy = getHighWord( y );\n\n\t// Leave only the sign bit of `y` turned on:\n\thy &= SIGN_MASK;\n\n\t// Copy the sign bit of `y` to `x`:\n\thx |= hy;\n\n\t// Return a new value having the same magnitude as `x`, but with the sign of `y`:\n\treturn fromWords( hx, WORDS[ 1 ] );\n}\n\n\n// EXPORTS //\n\nexport default copysign;\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* Smallest positive double-precision floating-point normal number.\n*\n* @module @stdlib/constants/float64/smallest-normal\n* @type {number}\n*\n* @example\n* import FLOAT64_SMALLEST_NORMAL from '@stdlib/constants/float64/smallest-normal';\n* // returns 2.2250738585072014e-308\n*/\n\n\n// MAIN //\n\n/**\n* The smallest positive double-precision floating-point normal number.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* \\frac{1}{2^{1023-1}}\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 00000000001 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default 2.2250738585072014e-308\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_SMALLEST_NORMAL = 2.2250738585072014e-308;\n\n\n// EXPORTS //\n\nexport default FLOAT64_SMALLEST_NORMAL;\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 FLOAT64_SMALLEST_NORMAL from '@stdlib/constants/float64/smallest-normal';\nimport isInfinite from '@stdlib/math/base/assert/is-infinite';\nimport isnan from '@stdlib/math/base/assert/is-nan';\nimport abs from '@stdlib/math/base/special/abs';\n\n\n// VARIABLES //\n\n// (1<<52)\nvar SCALAR = 4503599627370496;\n\n\n// MAIN //\n\n/**\n* Returns a normal number `y` and exponent `exp` satisfying \\\\(x = y \\cdot 2^\\mathrm{exp}\\\\) and assigns results to a provided output array.\n*\n* @param {number} x - input value\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import pow from '@stdlib/math/base/special/pow';\n*\n* var out = normalize( 3.14e-319, [ 0.0, 0 ], 1, 0 );\n* // returns [ 1.4141234400356668e-303, -52 ]\n*\n* var y = out[ 0 ];\n* var exp = out[ 1 ];\n*\n* var bool = ( y*pow(2.0,exp) === 3.14e-319 );\n* // returns true\n*\n* @example\n* var out = normalize( 0.0, [ 0.0, 0 ], 1, 0 );\n* // returns [ 0.0, 0 ];\n*\n* @example\n* import PINF from '@stdlib/constants/float64/pinf';\n*\n* var out = normalize( PINF, [ 0.0, 0 ], 1, 0 );\n* // returns [ Infinity, 0 ]\n*\n* @example\n* import NINF from '@stdlib/constants/float64/ninf';\n*\n* var out = normalize( NINF, [ 0.0, 0 ], 1, 0 );\n* // returns [ -Infinity, 0 ]\n*\n* @example\n* var out = normalize( NaN, [ 0.0, 0 ], 1, 0 );\n* // returns [ NaN, 0 ]\n*/\nfunction normalize( x, out, stride, offset ) {\n\tif ( isnan( x ) || isInfinite( x ) ) {\n\t\tout[ offset ] = x;\n\t\tout[ offset + stride ] = 0;\n\t\treturn out;\n\t}\n\tif ( x !== 0.0 && abs( x ) < FLOAT64_SMALLEST_NORMAL ) {\n\t\tout[ offset ] = x * SCALAR;\n\t\tout[ offset + stride ] = -52;\n\t\treturn out;\n\t}\n\tout[ offset ] = x;\n\tout[ offset + stride ] = 0;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default normalize;\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 normal number `y` and exponent `exp` satisfying \\\\(x = y \\cdot 2^\\mathrm{exp}\\\\).\n*\n* @module @stdlib/number/float64/base/normalize\n*\n* @example\n* import pow from '@stdlib/math/base/special/pow';\n* import normalize from '@stdlib/number/float64/base/normalize';\n*\n* var out = normalize( 3.14e-319 );\n* // returns [ 1.4141234400356668e-303, -52 ]\n*\n* var y = out[ 0 ];\n* var exp = out[ 1 ];\n*\n* var bool = ( y*pow(2.0, exp) === 3.14e-319 );\n* // returns true\n*\n* @example\n* import Float64Array from '@stdlib/array/float64';\n* import normalize from '@stdlib/number/float64/base/normalize';\n*\n* var out = new Float64Array( 2 );\n*\n* var v = normalize.assign( 3.14e-319, out, 1, 0 );\n* // returns [ 1.4141234400356668e-303, -52 ]\n*\n* var bool = ( v === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\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 fcn from './assign.js';\n\n\n// MAIN //\n\n/**\n* Returns a normal number `y` and exponent `exp` satisfying \\\\(x = y \\cdot 2^\\mathrm{exp}\\\\).\n*\n* @param {number} x - input value\n* @returns {NumberArray} output array\n*\n* @example\n* import pow from '@stdlib/math/base/special/pow';\n*\n* var out = normalize( 3.14e-319 );\n* // returns [ 1.4141234400356668e-303, -52 ]\n*\n* var y = out[ 0 ];\n* var exp = out[ 1 ];\n*\n* var bool = ( y*pow(2.0,exp) === 3.14e-319 );\n* // returns true\n*\n* @example\n* var out = normalize( 0.0 );\n* // returns [ 0.0, 0 ]\n*\n* @example\n* import PINF from '@stdlib/constants/float64/pinf';\n*\n* var out = normalize( PINF );\n* // returns [ Infinity, 0 ]\n*\n* @example\n* import NINF from '@stdlib/constants/float64/ninf';\n*\n* var out = normalize( NINF );\n* // returns [ -Infinity, 0 ]\n*\n* @example\n* var out = normalize( NaN );\n* // returns [ NaN, 0 ]\n*/\nfunction normalize( x ) {\n\treturn fcn( x, [ 0.0, 0 ], 1, 0 );\n}\n\n\n// EXPORTS //\n\nexport default normalize;\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* High word mask for the exponent of a double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/high-word-exponent-mask\n* @type {uinteger32}\n*\n* @example\n* import FLOAT64_HIGH_WORD_EXPONENT_MASK from '@stdlib/constants/float64/high-word-exponent-mask';\n* // returns 2146435072\n*/\n\n\n// MAIN //\n\n/**\n* High word mask for the exponent of a double-precision floating-point number.\n*\n* ## Notes\n*\n* The high word mask for the exponent of a double-precision floating-point number is an unsigned 32-bit integer with the value \\\\( 2146435072 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 0x7ff00000\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_HIGH_WORD_EXPONENT_MASK = 0x7ff00000;\n\n\n// EXPORTS //\n\nexport default FLOAT64_HIGH_WORD_EXPONENT_MASK;\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// NOTES //\n\n/*\n* => ldexp: load exponent (see [The Open Group]{@link http://pubs.opengroup.org/onlinepubs/9699919799/functions/ldexp.html} and [cppreference]{@link http://en.cppreference.com/w/c/numeric/math/ldexp}).\n*/\n\n\n// MODULES //\n\nimport PINF from '@stdlib/constants/float64/pinf';\nimport NINF from '@stdlib/constants/float64/ninf';\nimport BIAS from '@stdlib/constants/float64/exponent-bias';\nimport MAX_EXPONENT from '@stdlib/constants/float64/max-base2-exponent';\nimport MAX_SUBNORMAL_EXPONENT from '@stdlib/constants/float64/max-base2-exponent-subnormal';\nimport MIN_SUBNORMAL_EXPONENT from '@stdlib/constants/float64/min-base2-exponent-subnormal';\nimport isnan from './../../../../base/assert/is-nan';\nimport isInfinite from './../../../../base/assert/is-infinite';\nimport copysign from './../../../../base/special/copysign';\nimport { assign as normalize } from '@stdlib/number/float64/base/normalize';\nimport floatExp from '@stdlib/number/float64/base/exponent';\nimport toWords from '@stdlib/number/float64/base/to-words';\nimport fromWords from '@stdlib/number/float64/base/from-words';\n\n\n// VARIABLES //\n\n// 1/(1<<52) = 1/(2**52) = 1/4503599627370496\nvar TWO52_INV = 2.220446049250313e-16;\n\n// Exponent all 0s: 1 00000000000 11111111111111111111 => 2148532223\nvar CLEAR_EXP_MASK = 0x800fffff>>>0; // asm type annotation\n\n// Normalization workspace:\nvar FRAC = [ 0.0, 0.0 ];\n\n// High/low words workspace:\nvar WORDS = [ 0, 0 ];\n\n\n// MAIN //\n\n/**\n* Multiplies a double-precision floating-point number by an integer power of two.\n*\n* @param {number} frac - fraction\n* @param {integer} exp - exponent\n* @returns {number} double-precision floating-point number\n*\n* @example\n* var x = ldexp( 0.5, 3 ); // => 0.5 * 2^3 = 0.5 * 8\n* // returns 4.0\n*\n* @example\n* var x = ldexp( 4.0, -2 ); // => 4 * 2^(-2) = 4 * (1/4)\n* // returns 1.0\n*\n* @example\n* var x = ldexp( 0.0, 20 );\n* // returns 0.0\n*\n* @example\n* var x = ldexp( -0.0, 39 );\n* // returns -0.0\n*\n* @example\n* var x = ldexp( NaN, -101 );\n* // returns NaN\n*\n* @example\n* var x = ldexp( Infinity, 11 );\n* // returns Infinity\n*\n* @example\n* var x = ldexp( -Infinity, -118 );\n* // returns -Infinity\n*/\nfunction ldexp( frac, exp ) {\n\tvar high;\n\tvar m;\n\tif (\n\t\texp === 0 ||\n\t\tfrac === 0.0 || // handles +-0\n\t\tisnan( frac ) ||\n\t\tisInfinite( frac )\n\t) {\n\t\treturn frac;\n\t}\n\t// Normalize the input fraction:\n\tnormalize( frac, FRAC, 1, 0 );\n\tfrac = FRAC[ 0 ];\n\texp += FRAC[ 1 ];\n\n\t// Extract the exponent from `frac` and add it to `exp`:\n\texp += floatExp( frac );\n\n\t// Check for underflow/overflow...\n\tif ( exp < MIN_SUBNORMAL_EXPONENT ) {\n\t\treturn copysign( 0.0, frac );\n\t}\n\tif ( exp > MAX_EXPONENT ) {\n\t\tif ( frac < 0.0 ) {\n\t\t\treturn NINF;\n\t\t}\n\t\treturn PINF;\n\t}\n\t// Check for a subnormal and scale accordingly to retain precision...\n\tif ( exp <= MAX_SUBNORMAL_EXPONENT ) {\n\t\texp += 52;\n\t\tm = TWO52_INV;\n\t} else {\n\t\tm = 1.0;\n\t}\n\t// Split the fraction into higher and lower order words:\n\ttoWords.assign( frac, WORDS, 1, 0 );\n\thigh = WORDS[ 0 ];\n\n\t// Clear the exponent bits within the higher order word:\n\thigh &= CLEAR_EXP_MASK;\n\n\t// Set the exponent bits to the new exponent:\n\thigh |= ((exp+BIAS) << 20);\n\n\t// Create a new floating-point number:\n\treturn m * fromWords( high, WORDS[ 1 ] );\n}\n\n\n// EXPORTS //\n\nexport default ldexp;\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 getHighWord from './../../../../float64/base/get-high-word';\nimport EXP_MASK from '@stdlib/constants/float64/high-word-exponent-mask';\nimport BIAS from '@stdlib/constants/float64/exponent-bias';\n\n\n// MAIN //\n\n/**\n* Returns an integer corresponding to the unbiased exponent of a double-precision floating-point number.\n*\n* @param {number} x - input value\n* @returns {integer32} unbiased exponent\n*\n* @example\n* var exp = exponent( 3.14e-307 ); // => 2**-1019 ~ 1e-307\n* // returns -1019\n*\n* @example\n* var exp = exponent( -3.14 );\n* // returns 1\n*\n* @example\n* var exp = exponent( 0.0 );\n* // returns -1023\n*\n* @example\n* var exp = exponent( NaN );\n* // returns 1024\n*/\nfunction exponent( x ) {\n\t// Extract from the input value a higher order word (unsigned 32-bit integer) which contains the exponent:\n\tvar high = getHighWord( x );\n\n\t// Apply a mask to isolate only the exponent bits and then shift off all bits which are part of the fraction:\n\thigh = ( high & EXP_MASK ) >>> 20;\n\n\t// Remove the bias and return:\n\treturn (high - BIAS)|0; // asm type annotation\n}\n\n\n// EXPORTS //\n\nexport default exponent;\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* ## Notice\n*\n* The original C code, long comment, copyright, license, and constants are from [Cephes]{@link http://www.netlib.org/cephes}. The implementation follows the original, but has been modified for JavaScript.\n*\n* ```text\n* Copyright 1984, 1995, 2000 by Stephen L. Moshier\n*\n* Some software in this archive may be from the book _Methods and Programs for Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989) or from the Cephes Mathematical Library, a commercial product. In either event, it is copyrighted by the author. What you see here may be used freely but it comes with no support or guarantee.\n*\n* Stephen L. Moshier\n* moshier@na-net.ornl.gov\n* ```\n*/\n\n'use strict';\n\n// TODO: replace with TOMS (Openlibm) algo (updating license header and long comment)\n\n// MODULES //\n\nimport FLOAT64_MAX_BASE2_EXPONENT from '@stdlib/constants/float64/max-base2-exponent'; // eslint-disable-line id-length\nimport FLOAT64_MIN_BASE2_EXPONENT from '@stdlib/constants/float64/min-base2-exponent'; // eslint-disable-line id-length\nimport round from './../../../../base/special/round';\nimport ldexp from './../../../../base/special/ldexp';\nimport isnan from './../../../../base/assert/is-nan';\nimport PINF from '@stdlib/constants/float64/pinf';\nimport polyvalP from './polyval_p.js';\nimport polyvalQ from './polyval_q.js';\n\n\n// MAIN //\n\n/**\n* Evaluates the base `2` exponential function.\n*\n* ## Method\n*\n* - Range reduction is accomplished by separating the argument into an integer \\\\( k \\\\) and fraction \\\\( f \\\\) such that\n*\n* ```tex\n* 2^x = 2^k 2^f\n* ```\n*\n* - A Pade' approximate\n*\n* ```tex\n* 1 + 2x \\frac{\\mathrm{P}\\left(x^2\\right)}{\\mathrm{Q}\\left(x^2\\right) - x \\mathrm{P}\\left(x^2\\right)}\n* ```\n*\n* approximates \\\\( 2^x \\\\) in the basic range \\\\( \\[-0.5, 0.5] \\\\).\n*\n* ## Notes\n*\n* - Relative error:\n*\n* | arithmetic | domain | # trials | peak | rms |\n* |:----------:|:-----------:|:--------:|:-------:|:-------:|\n* | IEEE | -1022,+1024 | 30000 | 1.8e-16 | 5.4e-17 |\n*\n* @param {number} x - input value\n* @returns {number} function value\n*\n* @example\n* var v = exp2( 3.0 );\n* // returns 8.0\n*\n* @example\n* var v = exp2( -9.0 );\n* // returns ~0.002\n*\n* @example\n* var v = exp2( 0.0 );\n* // returns 1.0\n*\n* @example\n* var v = exp2( NaN );\n* // returns NaN\n*/\nfunction exp2( x ) {\n\tvar px;\n\tvar xx;\n\tvar n;\n\tif ( isnan( x ) ) {\n\t\treturn x;\n\t}\n\tif ( x > FLOAT64_MAX_BASE2_EXPONENT ) {\n\t\treturn PINF;\n\t}\n\tif ( x < FLOAT64_MIN_BASE2_EXPONENT ) {\n\t\treturn 0.0;\n\t}\n\t// Separate into integer and fractional parts...\n\tn = round( x );\n\tx -= n;\n\n\txx = x * x;\n\tpx = x * polyvalP( xx );\n\tx = px / ( polyvalQ( xx ) - px );\n\tx = 1.0 + ldexp( x, 1 );\n\n\t// Scale by power of 2:\n\treturn ldexp( x, n );\n}\n\n\n// EXPORTS //\n\nexport default exp2;\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/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 1513.906801156151;\n\t}\n\treturn 1513.906801156151 + (x * (20.202065669316532 + (x * 0.023093347705734523))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default evalpoly;\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/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 4368.211668792106;\n\t}\n\treturn 4368.211668792106 + (x * (233.1842117223149 + (x * 1.0)));\n}\n\n\n// EXPORTS //\n\nexport default evalpoly;\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* The bias of a half-precision floating-point number's exponent.\n*\n* @module @stdlib/constants/float16/exponent-bias\n* @type {integer32}\n*\n* @example\n* import FLOAT16_EXPONENT_BIAS from '@stdlib/constants/float16/exponent-bias';\n* // returns 15\n*/\n\n\n// MAIN //\n\n/**\n* The bias of a half-precision floating-point number's exponent.\n*\n* ## Notes\n*\n* The bias can be computed via\n*\n* ```tex\n* \\mathrm{bias} = 2^{k-1} - 1\n* ```\n*\n* where \\\\(k\\\\) is the number of bits in the exponent; here, \\\\(k = 5\\\\).\n*\n* @constant\n* @type {integer32}\n* @default 15\n* @see [Half-precision floating-point format]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n*/\nvar FLOAT16_EXPONENT_BIAS = 15|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT16_EXPONENT_BIAS;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport NINF from '@stdlib/constants/float16/ninf';\nimport PINF from '@stdlib/constants/float16/pinf';\nimport exp2 from '@stdlib/math/base/special/exp2';\nimport FLOAT16_EXPONENT_BIAS from '@stdlib/constants/float16/exponent-bias';\nimport FLOAT16_SIGN_MASK from '@stdlib/constants/float16/sign-mask';\nimport FLOAT16_EXPONENT_MASK from '@stdlib/constants/float16/exponent-mask';\nimport FLOAT16_SIGNIFICAND_MASK from '@stdlib/constants/float16/significand-mask';\nimport FLOAT16_NUM_SIGNIFICAND_BITS from '@stdlib/constants/float16/num-significand-bits'; // eslint-disable-line id-length\nimport FLOAT16_NUM_EXPONENT_BITS from '@stdlib/constants/float16/num-exponent-bits';\n\n\n// VARIABLES //\n\nvar MAX_EXPONENT = exp2( FLOAT16_NUM_EXPONENT_BITS ) - 1; // Maximum exponent value\nvar SUBNORMAL_EXPONENT = 1 - FLOAT16_EXPONENT_BIAS; // Minimum exponent for subnormal numbers\n\n\n// MAIN //\n\n/**\n* Creates a half-precision floating-point number from an unsigned integer corresponding to an IEEE 754 binary representation.\n*\n* @param {uinteger16} word - unsigned integer\n* @returns {number} half-precision floating-point number\n*\n* @example\n* var word = 15411; // => 0 01111 0000110011\n*\n* var f16 = fromWord( word ); // when printed, implicitly promoted to float64\n* // returns 1.0498046875\n*/\nfunction fromWord( word ) {\n\tvar mantissa;\n\tvar exponent;\n\tvar sign;\n\tvar f16;\n\n\t// Extract sign bit (bit 15):\n\tsign = ( word & FLOAT16_SIGN_MASK ) >>> 15;\n\n\t// Extract exponent (bits 14-10):\n\texponent = ( word & FLOAT16_EXPONENT_MASK ) >>> FLOAT16_NUM_SIGNIFICAND_BITS; // eslint-disable-line max-len\n\n\t// Extract mantissa (bits 9-0):\n\tmantissa = word & FLOAT16_SIGNIFICAND_MASK;\n\n\t// Handle special cases...\n\tif ( exponent === MAX_EXPONENT ) {\n\t\tif ( mantissa === 0 ) {\n\t\t\tif ( sign === 1 ) {\n\t\t\t\treturn NINF; // -Infinity\n\t\t\t}\n\t\t\treturn PINF; // +Infinity\n\t\t}\n\t\treturn NaN; // NaN\n\t}\n\t// Handle zero and subnormal numbers...\n\tif ( exponent === 0 ) {\n\t\tif ( mantissa === 0 ) {\n\t\t\tif ( sign === 1 ) {\n\t\t\t\treturn -0.0;\n\t\t\t}\n\t\t\treturn 0.0;\n\t\t}\n\t\t// Subnormal number: (-1)^sign × 2^(-14) × (0.mantissa)\n\t\tf16 = exp2( SUBNORMAL_EXPONENT ) * ( mantissa / 1024.0 );\n\t\tif ( sign ) {\n\t\t\treturn -f16;\n\t\t}\n\t\treturn f16;\n\t}\n\t// Normal number: (-1)^sign × 2^(exponent - 15) × (1.mantissa)\n\tf16 = exp2( exponent - FLOAT16_EXPONENT_BIAS ) * ( 1.0 + ( mantissa / 1024.0 ) ); // eslint-disable-line max-len\n\tif ( sign ) {\n\t\treturn -f16;\n\t}\n\treturn f16;\n}\n\n\n// EXPORTS //\n\nexport default fromWord;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Number of exponent bits for a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/num-exponent-bits\n* @type {integer16}\n*\n* @example\n* import FLOAT16_NUM_EXPONENT_BITS from '@stdlib/constants/float16/num-exponent-bits';\n* // returns 5\n*/\n\n\n// MAIN //\n\n/**\n* Number of exponent bits for a half-precision floating-point number.\n*\n* @constant\n* @type {integer16}\n* @default 5\n*/\nvar FLOAT16_NUM_EXPONENT_BITS = 5|0;\n\n\n// EXPORTS //\n\nexport default FLOAT16_NUM_EXPONENT_BITS;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Mask for the sign bit of a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/sign-mask\n* @type {uinteger16}\n*\n* @example\n* import FLOAT16_SIGN_MASK from '@stdlib/constants/float16/sign-mask';\n* // returns 32768\n*/\n\n\n// MAIN //\n\n/**\n* Mask for the sign bit of a half-precision floating-point number.\n*\n* ## Notes\n*\n* The mask for the sign bit of a half-precision floating-point number is an unsigned 16-bit integer with the value \\\\( 32768 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 1 00000 0000000000\n* ```\n*\n* @constant\n* @type {uinteger16}\n* @default 0x8000\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT16_SIGN_MASK = 0x8000>>>0;\n\n\n// EXPORTS //\n\nexport default FLOAT16_SIGN_MASK;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Mask for the significand of a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/significand-mask\n* @type {uinteger16}\n*\n* @example\n* import FLOAT16_SIGNIFICAND_MASK from '@stdlib/constants/float16/significand-mask';\n* // returns 1023\n*/\n\n\n// MAIN //\n\n/**\n* Mask for the significand of a half-precision floating-point number.\n*\n* ## Notes\n*\n* The mask for the significand of a half-precision floating-point number is an unsigned 16-bit integer with the value \\\\( 1023 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 00000 1111111111\n* ```\n*\n* @constant\n* @type {uinteger16}\n* @default 0x03ff\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT16_SIGNIFICAND_MASK = 0x03ff;\n\n\n// EXPORTS //\n\nexport default FLOAT16_SIGNIFICAND_MASK;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Mask for the exponent of a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/exponent-mask\n* @type {uinteger16}\n*\n* @example\n* import FLOAT16_EXPONENT_MASK from '@stdlib/constants/float16/exponent-mask';\n* // returns 31744\n*/\n\n\n// MAIN //\n\n/**\n* Mask for the exponent of a half-precision floating-point number.\n*\n* ## Notes\n*\n* The mask for the exponent of a half-precision floating-point number is an unsigned 16-bit integer with the value \\\\( 31744 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 11111 0000000000\n* ```\n*\n* @constant\n* @type {uinteger16}\n* @default 0x7c00\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT16_EXPONENT_MASK = 0x7c00;\n\n\n// EXPORTS //\n\nexport default FLOAT16_EXPONENT_MASK;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Number of significand bits for a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/num-significand-bits\n* @type {integer16}\n*\n* @example\n* import FLOAT16_NUM_SIGNIFICAND_BITS from '@stdlib/constants/float16/num-significand-bits';\n* // returns 10\n*/\n\n\n// MAIN //\n\n/**\n* Number of significand bits for a half-precision floating-point number.\n*\n* @constant\n* @type {integer16}\n* @default 10\n*/\nvar FLOAT16_NUM_SIGNIFICAND_BITS = 10|0;\n\n\n// EXPORTS //\n\nexport default FLOAT16_NUM_SIGNIFICAND_BITS;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 f16 from '@stdlib/number/float64/base/to-float16';\nimport toWord from '@stdlib/number/float16/base/to-word';\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( toWord( f16( 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) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY 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, stdlib/jsdoc-typedef-typos, max-lines */\n\n'use strict';\n\n// MODULES //\n\nimport hasIteratorSymbolSupport from '@stdlib/assert/has-iterator-symbol-support';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport isCollection from '@stdlib/assert/is-collection';\nimport isArrayBuffer from '@stdlib/assert/is-arraybuffer';\nimport isFunction from '@stdlib/assert/is-function';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isObject from '@stdlib/assert/is-object';\nimport isnan from '@stdlib/math/base/assert/is-nan';\nimport ITERATOR_SYMBOL from '@stdlib/symbol/iterator';\nimport setReadOnlyAccessor from '@stdlib/utils/define-nonenumerable-read-only-accessor';\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport setReadWriteAccessor from '@stdlib/utils/define-read-write-accessor';\nimport floor from '@stdlib/math/base/special/floor';\nimport format from '@stdlib/string/format';\nimport Uint16Array from './../../../uint16';\nimport f16 from '@stdlib/number/float64/base/to-float16';\nimport toWord from '@stdlib/number/float16/base/to-word';\nimport fromWord from '@stdlib/number/float16/base/from-word';\nimport gcopy from '@stdlib/blas/base/gcopy';\nimport fromArray from './from_array.js';\nimport fromIterator from './from_iterator.js';\nimport fromIteratorMap from './from_iterator_map.js';\n\n\n// VARIABLES //\n\nvar BYTES_PER_ELEMENT = Uint16Array.BYTES_PER_ELEMENT;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a `Float16Array`.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `Float16Array`\n*/\nfunction isFloat16Array( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'Float16Array' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a floating-point typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a floating-point typed array constructor\n*/\nfunction isFloatingPointArrayConstructor( value ) { // eslint-disable-line id-length\n\treturn ( value === Float16Array );\n}\n\n/**\n* Returns a getter.\n*\n* @private\n* @param {Float16Array} ctx - typed array instance\n* @param {NonNegativeInteger} idx - element index\n* @returns {Function} getter\n*/\nfunction getter( ctx, idx ) {\n\treturn get;\n\n\t/**\n\t* Returns an array element.\n\t*\n\t* @private\n\t* @returns {(number|void)} array element\n\t*/\n\tfunction get() {\n\t\treturn ctx._get( idx ); // eslint-disable-line no-underscore-dangle\n\t}\n}\n\n/**\n* Returns a setter.\n*\n* @private\n* @param {Float16Array} ctx - typed array instance\n* @param {NonNegativeInteger} idx - element index\n* @returns {Function} setter\n*/\nfunction setter( ctx, idx ) {\n\treturn set;\n\n\t/**\n\t* Sets an array element.\n\t*\n\t* @private\n\t* @param {number} value - value to set\n\t*/\n\tfunction set( value ) {\n\t\tctx.set( [ value ], idx );\n\t}\n}\n\n\n// MAIN //\n\n/**\n* 16-bit floating-point number 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 {RangeError} ArrayBuffer byte length must be a multiple of `2`\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} byte offset must be a multiple of `2`\n* @throws {TypeError} view length must be a positive multiple of `2`\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @returns {Float16Array} half-precision floating-point number array\n*\n* @example\n* var arr = new Float16Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new Float16Array( 5 );\n* // returns \n*\n* var len = arr.length;\n* // returns 5\n*\n* @example\n* var arr = new Float16Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 5\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float16Array( buf );\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( 16 );\n* var arr = new Float16Array( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 4\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Float16Array( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction Float16Array() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\tvar arg;\n\tvar i;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof Float16Array) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new Float16Array();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new Float16Array( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new Float16Array( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new Float16Array( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Uint16Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\targ = arguments[ 0 ];\n\t\tif ( isNonNegativeInteger( arg ) ) {\n\t\t\tbuf = new Uint16Array( arg );\n\t\t} else if ( isCollection( arg ) ) {\n\t\t\tif ( isFloat16Array( arg ) ) {\n\t\t\t\tbuf = new Uint16Array( arg.length );\n\t\t\t\tgcopy.ndarray( arg.length, new Uint16Array( arg.buffer, arg.byteOffset, arg.length ), 1, 0, buf, 1, 0 ); // eslint-disable-line max-len\n\t\t\t} else {\n\t\t\t\tbuf = fromArray( new Uint16Array( arg.length ), arg );\n\t\t\t}\n\t\t} else if ( isArrayBuffer( arg ) ) {\n\t\t\tif ( !isInteger( arg.byteLength/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.', BYTES_PER_ELEMENT, arg.byteLength ) );\n\t\t\t}\n\t\t\tbuf = new Uint16Array( 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 Uint16Array( 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 ( !isInteger( byteOffset/BYTES_PER_ELEMENT ) ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Byte offset must be a multiple of %u. Value: `%u`.', BYTES_PER_ELEMENT, byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t\tif ( !isInteger( len/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.', BYTES_PER_ELEMENT, len ) );\n\t\t\t}\n\t\t\tbuf = new Uint16Array( 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 Uint16Array( buf, byteOffset, len );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length );\n\tfor ( i = 0; i < buf.length; i++ ) {\n\t\tsetReadWriteAccessor( this, i, getter( this, i ), setter( this, i ) );\n\t}\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Float16Array\n* @readonly\n* @type {PositiveInteger}\n* @default 2\n*\n* @example\n* var nbytes = Float16Array.BYTES_PER_ELEMENT;\n* // returns 2\n*/\nsetReadOnly( Float16Array, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Float16Array\n* @readonly\n* @type {string}\n* @default 'Float16Array'\n*\n* @example\n* var str = Float16Array.name;\n* // returns 'Float16Array'\n*/\nsetReadOnly( Float16Array, 'name', 'Float16Array' );\n\n/**\n* Creates a new 16-bit floating-point number array from an array-like object or an iterable.\n*\n* @name from\n* @memberof Float16Array\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 floating-point 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 {Float16Array} half-precision floating-point number array\n*\n* @example\n* var arr = Float16Array.from( [ 1.0, 2.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* function clbk( v ) {\n* return v * 2.0;\n* }\n*\n* var arr = Float16Array.from( [ 1.0, 2.0 ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( Float16Array, 'from', function from( src ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar clbk;\n\tvar out;\n\tvar buf;\n\tvar tmp;\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 ( !isFloatingPointArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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\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 ] = toWord( f16( clbk.call( thisArg, 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\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\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 16-bit floating-point number array from a variable number of arguments.\n*\n* @name of\n* @memberof Float16Array\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Float16Array} half-precision floating-point number array\n*\n* @example\n* var arr = Float16Array.of( 1.0, 1.0, 1.0, 1.0 );\n* // returns \n*\n* var x = arr[ 0 ];\n* // returns 1.0\n*\n* var len = arr.length;\n* // returns 4\n*/\nsetReadOnly( Float16Array, '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 ( !isFloatingPointArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof Float16Array.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} must provide an integer\n* @returns {(number|void)} array element\n*\n* @example\n* var arr = new Float16Array( [ 10.0, 20.0, 30.0 ] );\n*\n* var v = arr.at( 0 );\n* // returns 10.0\n*\n* v = arr.at( -1 );\n* // returns 30.0\n*\n* v = arr.at( 100 );\n* // returns undefined\n*/\nsetReadOnly( Float16Array.prototype, 'at', function at( idx ) {\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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\tif ( idx < 0 ) {\n\t\tidx += this._length;\n\t}\n\tif ( idx < 0 || idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn fromWord( this._buffer[ idx ] );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof Float16Array.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new Float16Array( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( Float16Array.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 Float16Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Float16Array( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 20\n*/\nsetReadOnlyAccessor( Float16Array.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 Float16Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Float16Array( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( Float16Array.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 Float16Array.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 2\n*\n* @example\n* var arr = new Float16Array( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 2\n*/\nsetReadOnly( Float16Array.prototype, 'BYTES_PER_ELEMENT', Float16Array.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 Float16Array.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 floating-point array\n* @returns {Float16Array} modified array\n*\n* @example\n* var arr = new Float16Array( [ 1.0, 2.0, 3.0, 4.0 ] );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n*\n* var v = arr[ 2 ];\n* // returns 1.0\n*\n* v = arr[ 3 ];\n* // returns 2.0\n*/\nsetReadOnly( Float16Array.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Float16Array( [ 1.0, 2.0, 3.0 ] );\n*\n* var it = arr.entries();\n*\n* var v = it.next().value;\n* // returns [ 0, 1.0 ]\n*\n* v = it.next().value;\n* // returns [ 1, 2.0 ]\n*\n* v = it.next().value;\n* // returns [ 2, 3.0 ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( Float16Array.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 ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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, fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 === 0.0;\n* }\n*\n* var arr = new Float16Array( 3 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( Float16Array.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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, fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {number} 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 floating-point number array\n* @throws {TypeError} first argument must be a floating-point number\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n* @returns {Float16Array} modified array\n*\n* @example\n* var arr = new Float16Array( 3 );\n*\n* arr.fill( 1.0, 1 );\n*\n* var v = arr[ 0 ];\n* // returns 0.0\n*\n* v = arr[ 1 ];\n* // returns 1.0\n*\n* v = arr[ 2 ];\n* // returns 1.0\n*/\nsetReadOnly( Float16Array.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar i;\n\tvar v;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tif ( !isNumber( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a number. 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\tv = toWord( value );\n\tfor ( i = start; i < end; i++ ) {\n\t\tbuf[ i ] = v;\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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a function\n* @returns {Float16Array} floating-point number array\n*\n* @example\n* function predicate( v ) {\n* return ( v === 0.0 );\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 0.0 ] );\n*\n* var out = arr.filter( predicate );\n* // returns \n*\n* var len = out.length;\n* // returns 2\n*\n* var v = out[ 0 ];\n* // returns 0.0\n*\n* v = out[ 1 ];\n* // returns 0.0\n*/\nsetReadOnly( Float16Array.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 > 0.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 0.0 ] );\n*\n* var v = arr.find( predicate );\n* // returns 1.0\n*/\nsetReadOnly( Float16Array.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 > 0.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var v = arr.findIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Float16Array.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 > 0.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 0.0 ] );\n*\n* var v = arr.findLast( predicate );\n* // returns 1.0\n*/\nsetReadOnly( Float16Array.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 > 0.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 0.0 ] );\n*\n* var v = arr.findLastIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Float16Array.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a floating-point number 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 Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( Float16Array.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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, fromWord( buf[ i ] ), i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @private\n* @name _get\n* @memberof Float16Array.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(number|void)} array element\n*/\nsetReadOnly( Float16Array.prototype, '_get', function get( idx ) {\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 fromWord( this._buffer[ idx ] );\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof Float16Array.prototype\n* @type {Function}\n* @param {number} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a floating-point number\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 Float16Array( [ 0.0, 1.0, 2.0, 3.0, 4.0 ] );\n*\n* var bool = arr.includes( 1.0 );\n* // returns true\n*\n* bool = arr.includes( 1.0, 2 );\n* // returns false\n*\n* bool = arr.includes( 5.0 );\n* // returns false\n*/\nsetReadOnly( Float16Array.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\tvar v;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tif ( !isNumber( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a number. 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\tv = toWord( searchElement );\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tif ( v === 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 Float16Array.prototype\n* @type {Function}\n* @param {float16} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a floating-point number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0, 3.0, 4.0 ] );\n*\n* var idx = arr.indexOf( 2.0 );\n* // returns 2\n*\n* idx = arr.indexOf( 2.0, 3 );\n* // returns -1\n*\n* idx = arr.indexOf( 3.0, 3 );\n* // returns 3\n*/\nsetReadOnly( Float16Array.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\tvar v;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tif ( !isNumber( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a number. 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\tv = toWord( searchElement );\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tif ( v === 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 Float16Array.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var str = arr.join();\n* // returns '0,1,2'\n*\n* str = arr.join( '|' );\n* // returns '0|1|2'\n*/\nsetReadOnly( Float16Array.prototype, 'join', function join( separator ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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\tout.push( fromWord( buf[ i ] ) );\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 Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Float16Array( [ 1.0, 2.0 ] );\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( Float16Array.prototype, 'keys', function keys() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 Float16Array.prototype\n* @type {Function}\n* @param {number} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (inclusive)\n* @throws {TypeError} `this` must be a floating-point number\n* @throws {TypeError} first argument must be a numeric value\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0, 3.0, 2.0 ] );\n*\n* var idx = arr.lastIndexOf( 2.0 );\n* // returns 4\n*\n* idx = arr.lastIndexOf( 2.0, 3 );\n* // returns 2\n*\n* idx = arr.lastIndexOf( 4.0, 3 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( 1.0, -3 );\n* // returns 1\n*/\nsetReadOnly( Float16Array.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\tvar v;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tif ( !isNumber( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a number. 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\tv = toWord( searchElement );\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tif ( v === 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 Float16Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Float16Array( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( Float16Array.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 Float16Array.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a function\n* @returns {Float16Array} new floating-point number array\n*\n* @example\n* function scale( v ) {\n* return v * 2.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var out = arr.map( scale );\n* // returns \n*\n* var z = out[ 0 ];\n* // returns 0.0\n*\n* z = out[ 1 ];\n* // returns 2.0\n*\n* z = out[ 2 ];\n* // returns 4.0\n*/\nsetReadOnly( Float16Array.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 ] = toWord( fcn.call( thisArg, fromWord( buf[ i ] ), i, this ) ); // eslint-disable-line max-len\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 Float16Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a floating-point number 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 add( acc, v ) {\n* return acc + v;\n* }\n*\n* var arr = new Float16Array( [ 1.0, 2.0, 3.0 ] );\n*\n* var out = arr.reduce( add, 0 );\n* // returns 6.0\n*/\nsetReadOnly( Float16Array.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar len;\n\tvar acc;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( buf[ 0 ] );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tacc = reducer( acc, fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a floating-point number 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 add( acc, v ) {\n* return acc + v;\n* }\n*\n* var arr = new Float16Array( [ 1.0, 2.0, 3.0 ] );\n*\n* var out = arr.reduceRight( add, 0 );\n* // returns 6.0\n*/\nsetReadOnly( Float16Array.prototype, 'reduceRight', function reduceRight( reducer, initialValue ) {\n\tvar buf;\n\tvar len;\n\tvar acc;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( buf[ len-1 ] );\n\t\ti = len - 2;\n\t}\n\tfor ( ; i >= 0; i-- ) {\n\t\tacc = reducer( acc, fromWord( buf[ i ] ), i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Float16Array} reversed array\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var out = arr.reverse();\n* // returns \n*\n* var v = out[ 0 ];\n* // returns 2.0\n*\n* v = out[ 1 ];\n* // returns 1.0\n*\n* v = out[ 2 ];\n* // returns 0.0\n*/\nsetReadOnly( Float16Array.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 ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 one or more array elements.\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 Float16Array.prototype\n* @type {Function}\n* @param {(Collection|Float16Array)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a collection\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 Float16Array( 10 );\n*\n* var v = arr[ 0 ];\n* // returns 0.0\n*\n* arr.set( [ 1.0, 2.0 ], 0 );\n*\n* v = arr[ 0 ];\n* // returns 1.0\n*/\nsetReadOnly( Float16Array.prototype, 'set', function set( value ) {\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar flg;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tif ( !isCollection( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', value ) );\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\tN = value.length;\n\tif ( idx+N > this._length ) {\n\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t}\n\tif ( isFloat16Array( value ) ) {\n\t\tsbuf = value._buffer; // eslint-disable-line no-underscore-dangle\n\t\tflg = true;\n\t} else {\n\t\tsbuf = value;\n\t\tflg = false;\n\t}\n\t// Check for overlapping memory...\n\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\tif (\n\t\tsbuf.buffer === buf.buffer &&\n\t\t(\n\t\t\tsbuf.byteOffset < j &&\n\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t)\n\t) {\n\t\t// We need to copy source values...\n\t\ttmp = new Uint16Array( sbuf.length );\n\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t}\n\t\tsbuf = tmp;\n\t}\n\tif ( flg ) {\n\t\tfor ( i = 0; i < N; idx++, i++ ) {\n\t\t\tbuf[ idx ] = sbuf[ i ];\n\t\t}\n\t} else {\n\t\tfor ( i = 0; i < N; idx++, i++ ) {\n\t\t\tbuf[ idx ] = toWord( sbuf[ i ] );\n\t\t}\n\t}\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof Float16Array.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 floating-point number array\n* @throws {TypeError} first argument must be integer\n* @throws {TypeError} second argument must be integer\n* @returns {Float16Array} floating-point number array\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0, 3.0, 4.0 ] );\n*\n* var out = arr.slice();\n* // returns \n*\n* var len = out.length;\n* // returns 5\n*\n* var v = out[ 0 ];\n* // returns 0.0\n*\n* v = out[ len-1 ];\n* // returns 4.0\n*\n* out = arr.slice( 1, -2 );\n* // returns \n*\n* len = out.length;\n* // returns 2\n*\n* v = out[ 0 ];\n* // returns 1.0\n*\n* v = out[ len-1 ];\n* // returns 2.0\n*/\nsetReadOnly( Float16Array.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 ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 > 0.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( Float16Array.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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, fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} [compareFcn] - comparison function\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a function\n* @returns {Float16Array} sorted array\n*\n* @example\n* function compare( a, b ) {\n* if ( a < b ) {\n* return -1;\n* }\n* if ( a > b ) {\n* return 1;\n* }\n* return 0;\n* }\n*\n* var arr = new Float16Array( [ 1.0, 0.0, 2.0 ] );\n*\n* arr.sort( compare );\n*\n* var v = arr[ 0 ];\n* // returns 0.0\n*\n* v = arr[ 1 ];\n* // returns 1.0\n*\n* v = arr[ 2 ];\n* // returns 2.0\n*/\nsetReadOnly( Float16Array.prototype, 'sort', function sort( compareFcn ) {\n\tvar buf;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length === 0 ) {\n\t\tbuf.sort( defaultCompare );\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* Default comparison function for float16 values.\n\t*\n\t* @private\n\t* @param {unsigned16} a - unsigned 16-bit integer for comparison\n\t* @param {unsigned16} b - unsigned 16-bit integer for comparison\n\t* @returns {number} comparison result\n\t*/\n\tfunction defaultCompare( a, b ) { // eslint-disable-line stdlib/no-unnecessary-nested-functions\n\t\tvar x = fromWord( a );\n\t\tvar y = fromWord( b );\n\n\t\t// Handle NaN...\n\t\tif ( isnan( x ) && isnan( y ) ) {\n\t\t\treturn 0;\n\t\t}\n\t\tif ( isnan( x ) ) {\n\t\t\treturn 1;\n\t\t}\n\t\tif ( isnan( y ) ) {\n\t\t\treturn -1;\n\t\t}\n\t\t// Normal comparison\n\t\tif ( x < y ) {\n\t\t\treturn -1;\n\t\t}\n\t\tif ( x > y ) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn 0;\n\t}\n\n\t/**\n\t* Comparison function wrapper.\n\t*\n\t* @private\n\t* @param {unsigned16} a - unsigned 16-bit integer for comparison\n\t* @param {unsigned16} b - unsigned 16-bit integer for comparison\n\t* @returns {number} comparison result\n\t*/\n\tfunction compare( a, b ) {\n\t\treturn compareFcn( fromWord( a ), fromWord( 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 Float16Array.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 floating-point number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Float16Array} subarray\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0, 3.0, 4.0 ] );\n*\n* var subarr = arr.subarray();\n* // returns \n*\n* var len = subarr.length;\n* // returns 5\n*\n* var bool = subarr[ 0 ];\n* // returns 0.0\n*\n* bool = subarr[ len-1 ];\n* // returns 4.0\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns \n*\n* len = subarr.length;\n* // returns 2\n*\n* bool = subarr[ 0 ];\n* // returns 1.0\n*\n* bool = subarr[ len-1 ];\n* // returns 2.0\n*/\nsetReadOnly( Float16Array.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 Float16Array.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 floating-point number 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 Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var str = arr.toLocaleString();\n* // returns '0,1,2'\n*/\nsetReadOnly( Float16Array.prototype, 'toLocaleString', function toLocaleString( locales, options ) {\n\tvar opts;\n\tvar loc;\n\tvar out;\n\tvar buf;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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( fromWord( buf[ i ] ) );\n\t}\n\treturn out.toLocaleString( loc, opts );\n});\n\n/**\n* Returns a new typed array containing the elements in reversed order.\n*\n* @name toReversed\n* @memberof Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Float16Array} reversed array\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var out = arr.toReversed();\n* // returns \n*\n* var v = out[ 0 ];\n* // returns 2.0\n*\n* v = out[ 1 ];\n* // returns 1.0\n*\n* v = out[ 2 ];\n* // returns 0.0\n*/\nsetReadOnly( Float16Array.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} [compareFcn] - comparison function\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a function\n* @returns {Float16Array} sorted array\n*\n* @example\n* function compare( a, b ) {\n* if ( a > b ) {\n* return 1;\n* }\n* if ( a < b ) {\n* return -1;\n* }\n* return 0;\n* }\n*\n* var arr = new Float16Array( [ 2.0, 0.0, 1.0 ] );\n*\n* var out = arr.toSorted( compare );\n* // returns \n*\n* var v = out[ 0 ];\n* // returns 0.0\n*\n* v = out[ 1 ];\n* // returns 1.0\n*\n* v = out[ 2 ];\n* // returns 2.0\n*/\nsetReadOnly( Float16Array.prototype, 'toSorted', function toSorted( compareFcn ) {\n\tvar out;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tout = new this.constructor( this );\n\tif ( arguments.length === 0 ) {\n\t\treturn out.sort();\n\t}\n\treturn out.sort( compareFcn );\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {string} string representation\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var str = arr.toString();\n* // returns '0,1,2'\n*/\nsetReadOnly( Float16Array.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( fromWord( buf[ i ] ) );\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 Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0 ] );\n*\n* var iter = arr.values();\n*\n* var v = iter.next().value;\n* // returns 0.0\n*\n* v = iter.next().value;\n* // returns 1.0\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( Float16Array.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 ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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': fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {number} value - new value\n* @throws {TypeError} `this` must be a floating-point number 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 floating-point number\n* @returns {Float16Array} new typed array\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var out = arr.with( 0, 3.0 );\n* // returns \n*\n* var v = out[ 0 ];\n* // returns 3.0\n*/\nsetReadOnly( Float16Array.prototype, 'with', function copyWith( index, value ) {\n\tvar out;\n\tvar len;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 ( !isNumber( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a number. Value: `%s`.', value ) );\n\t}\n\tout = new this.constructor( this );\n\tout[ index ] = value;\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default Float16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 f16 from '@stdlib/number/float64/base/to-float16';\nimport toWord from '@stdlib/number/float16/base/to-word';\n\n\n// MAIN //\n\n/**\n* Fills an output array with unsigned 16-bit integers corresponding to the IEEE 754 binary representation of respective half-precision floating-point numbers.\n*\n* @private\n* @param {Uint16Array} buf - output array\n* @param {Array} arr - input array\n* @returns {Uint16Array} 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 ] = toWord( f16( 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) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 f16 from '@stdlib/number/float64/base/to-float16';\nimport toWord from '@stdlib/number/float16/base/to-word';\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( toWord( f16( clbk.call( thisArg, v.value, i ) ) ) );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIteratorMap;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 Float16Array === 'function' ) ? Float16Array : void 0; // eslint-disable-line no-undef, stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* 16-bit floating-point number array constructor.\n*\n* @module @stdlib/array/float16\n*\n* @example\n* import Float16Array from '@stdlib/array/float16';\n*\n* var arr = new Float16Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* import Float16Array from '@stdlib/array/float16';\n*\n* var arr = new Float16Array( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* import Float16Array from '@stdlib/array/float16';\n*\n* var arr = new Float16Array( [ 1.0, 2.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n* import Float16Array from '@stdlib/array/float16';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float16Array( buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 8\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n* import Float16Array from '@stdlib/array/float16';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float16Array( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 4\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n* import Float16Array from '@stdlib/array/float16';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Float16Array( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\n\n// MODULES //\n\nimport hasFloat16ArraySupport from '@stdlib/assert/has-float16array-support';\nimport polyfill from './polyfill';\nimport builtin from './main.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat16ArraySupport() ) {\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) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport PINF from '@stdlib/constants/float16/pinf';\nimport GlobalFloat16Array from './float16array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Float16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float16Array` support\n*\n* @example\n* var bool = hasFloat16ArraySupport();\n* // returns \n*/\nfunction hasFloat16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat16Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\ttypeof arr === 'object' &&\n\t\t\tarr !== null &&\n\t\t\tarr.constructor.name === 'Float16Array' &&\n\t\t\tarr.BYTES_PER_ELEMENT === 2 &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] !== 3.14 &&\n\t\t\tarr[ 2 ] !== -3.14 &&\n\t\t\tarr[ 3 ] === PINF &&\n\t\t\tarr.length === 4\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 hasFloat16ArraySupport;\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 Int8Array from '@stdlib/array/int8';\nimport Uint8Array from '@stdlib/array/uint8';\nimport Uint8ClampedArray from '@stdlib/array/uint8c';\nimport Int16Array from '@stdlib/array/int16';\nimport Uint16Array from '@stdlib/array/uint16';\nimport Int32Array from '@stdlib/array/int32';\nimport Uint32Array from '@stdlib/array/uint32';\nimport Float16Array from '@stdlib/array/float16';\nimport Float32Array from '@stdlib/array/float32';\nimport Float64Array from '@stdlib/array/float64';\n\n\n// MAIN //\n\nvar CTORS = [\n\tFloat64Array,\n\tFloat32Array,\n\tFloat16Array,\n\tInt32Array,\n\tUint32Array,\n\tInt16Array,\n\tUint16Array,\n\tInt8Array,\n\tUint8Array,\n\tUint8ClampedArray\n];\n\n\n// EXPORTS //\n\nexport default CTORS;\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';\nimport fcnName from '@stdlib/utils/function-name';\nimport getPrototypeOf from '@stdlib/utils/get-prototype-of';\nimport hasFloat64ArraySupport from './../../has-float64array-support';\nimport Float64Array from '@stdlib/array/float64';\nimport CTORS from './ctors.js';\nimport NAMES from './names.json';\n\n\n// VARIABLES //\n\n// Abstract `TypedArray` class:\nvar TypedArray = ( hasFloat64ArraySupport() ) ? getPrototypeOf( Float64Array ) : Dummy; // eslint-disable-line max-len\n\n// Ensure abstract typed array class has expected name:\nTypedArray = ( fcnName( TypedArray ) === 'TypedArray' ) ? TypedArray : Dummy;\n\n\n// FUNCTIONS //\n\n/**\n* Dummy constructor.\n*\n* @private\n*/\nfunction Dummy() {} // eslint-disable-line no-empty-function\n\n\n// MAIN //\n\n/**\n* Tests if a value is a built-in typed array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a built-in typed array\n*\n* @example\n* import Int8Array from '@stdlib/array/int8';\n*\n* var bool = isTypedArray( new Int8Array( 10 ) );\n* // returns true\n*/\nfunction isTypedArray( value ) {\n\tvar v;\n\tvar i;\n\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for the abstract class...\n\tif ( value instanceof TypedArray ) {\n\t\treturn true;\n\t}\n\t// Check for typed array objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tfor ( i = 0; i < CTORS.length; i++ ) {\n\t\tif ( value instanceof CTORS[ i ] ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\t// Walk the prototype tree until we find an object having a desired class...\n\twhile ( value ) {\n\t\tv = ctorName( value );\n\t\tfor ( i = 0; i < NAMES.length; i++ ) {\n\t\t\tif ( NAMES[ i ] === v ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isTypedArray;\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 Complex64Array from '@stdlib/array/complex64';\nimport Complex128Array from '@stdlib/array/complex128';\n\n\n// MAIN //\n\nvar CTORS = [\n\tComplex128Array,\n\tComplex64Array\n];\n\n\n// EXPORTS //\n\nexport default CTORS;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasOwnProp from './../../has-own-property';\nimport Symbol from '@stdlib/symbol/ctor';\n\n\n// MAIN //\n\n/**\n* Tests for native `Symbol.hasInstance` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol.hasInstance` support\n*\n* @example\n* var bool = hasHasInstanceSymbolSupport();\n* // returns \n*/\nfunction hasHasInstanceSymbolSupport() { // eslint-disable-line id-length\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol' &&\n\t\thasOwnProp( Symbol, 'hasInstance' ) &&\n\t\ttypeof Symbol.hasInstance === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasHasInstanceSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasHasInstanceSymbolSupport from '@stdlib/assert/has-has-instance-symbol-support'; // eslint-disable-line id-length\n\n\n// MAIN //\n\n/**\n* Has instance symbol.\n*\n* @name HasInstanceSymbol\n* @constant\n* @type {(symbol|null)}\n*\n* @example\n* import isArray from '@stdlib/assert/is-array';\n*\n* function ArrayLike() {\n* return {\n* 'length': 3,\n* '0': 1,\n* '1': 2,\n* '2': 3\n* };\n* };\n*\n* ArrayLike[ HasInstanceSymbol ] = isArray;\n*/\nvar HasInstanceSymbol = ( hasHasInstanceSymbolSupport() ) ? Symbol.hasInstance : null; // eslint-disable-line max-len\n\n\n// EXPORTS //\n\nexport default HasInstanceSymbol;\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 hasHasInstanceSymbolSupport from './../../has-has-instance-symbol-support'; // eslint-disable-line id-length\nimport HasInstanceSymbol from '@stdlib/symbol/has-instance';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar hasSupport = hasHasInstanceSymbolSupport();\n\n\n// MAIN //\n\n/**\n* Tests whether a value has in its prototype chain a specified constructor as a prototype property.\n*\n* @param {*} value - value to test\n* @param {Function} constructor - constructor to test against\n* @throws {TypeError} constructor must be callable\n* @returns {boolean} boolean indicating whether a value is an instance of a provided constructor\n*\n* @example\n* var bool = instanceOf( [], Array );\n* // returns true\n*\n* @example\n* var bool = instanceOf( {}, Object ); // exception\n* // returns true\n*\n* @example\n* var bool = instanceOf( 'beep', String );\n* // returns false\n*\n* @example\n* var bool = instanceOf( null, Object );\n* // returns false\n*\n* @example\n* var bool = instanceOf( 5, Object );\n* // returns false\n*/\nfunction instanceOf( value, constructor ) {\n\t// TODO: replace with `isCallable` check\n\tif (\n\t\ttypeof constructor !== 'function' &&\n\t\t!(\n\t\t\thasSupport &&\n\t\t\ttypeof constructor === 'object' &&\n\t\t\ttypeof constructor[ HasInstanceSymbol ] === 'function'\n\t\t)\n\t) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be callable. Value: `%s`.', constructor ) );\n\t}\n\treturn ( value instanceof constructor );\n}\n\n\n// EXPORTS //\n\nexport default instanceOf;\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 Int8Array from './../../int8';\nimport Uint8Array from './../../uint8';\nimport Uint8ClampedArray from './../../uint8c';\nimport Int16Array from './../../int16';\nimport Uint16Array from './../../uint16';\nimport Int32Array from './../../int32';\nimport Uint32Array from './../../uint32';\nimport Float32Array from './../../float32';\nimport Float64Array from './../../float64';\nimport Complex64Array from './../../complex64';\nimport Complex128Array from './../../complex128';\nimport BooleanArray from './../../bool';\n\n\n// MAIN //\n\nvar CTORS = [\n\t[ Float64Array, 'Float64Array' ],\n\t[ Float32Array, 'Float32Array' ],\n\t[ Int32Array, 'Int32Array' ],\n\t[ Uint32Array, 'Uint32Array' ],\n\t[ Int16Array, 'Int16Array' ],\n\t[ Uint16Array, 'Uint16Array' ],\n\t[ Int8Array, 'Int8Array' ],\n\t[ Uint8Array, 'Uint8Array' ],\n\t[ Uint8ClampedArray, 'Uint8ClampedArray' ],\n\t[ Complex64Array, 'Complex64Array' ],\n\t[ Complex128Array, 'Complex128Array' ],\n\t[ BooleanArray, 'BooleanArray' ]\n];\n\n\n// EXPORTS //\n\nexport default CTORS;\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 instanceOf from '@stdlib/assert/instance-of';\nimport ctorName from '@stdlib/utils/constructor-name';\nimport getPrototypeOf from '@stdlib/utils/get-prototype-of';\nimport CTORS from './ctors.js';\n\n\n// MAIN //\n\n/**\n* Returns the typed array type.\n*\n* @private\n* @param {TypedArray} arr - typed array\n* @returns {(string|void)} typed array type\n*\n* @example\n* import Float64Array from '@stdlib/array/float64';\n*\n* var arr = new Float64Array( 5 );\n* var str = typeName( arr );\n* // returns 'Float64Array'\n*/\nfunction typeName( arr ) {\n\tvar v;\n\tvar i;\n\n\t// Check for typed array objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tfor ( i = 0; i < CTORS.length; i++ ) {\n\t\tif ( instanceOf( arr, CTORS[ i ][ 0 ] ) ) {\n\t\t\treturn CTORS[ i ][ 1 ];\n\t\t}\n\t}\n\t// Walk the prototype tree until we find an object having a desired native class...\n\twhile ( arr ) {\n\t\tv = ctorName( arr );\n\t\tfor ( i = 0; i < CTORS.length; i++ ) {\n\t\t\tif ( v === CTORS[ i ][ 1 ] ) {\n\t\t\t\treturn CTORS[ i ][ 1 ];\n\t\t\t}\n\t\t}\n\t\tarr = getPrototypeOf( arr );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default typeName;\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 isTypedArray from '@stdlib/assert/is-typed-array';\nimport isComplexTypedArray from '@stdlib/assert/is-complex-typed-array';\nimport isBooleanArray from '@stdlib/assert/is-booleanarray';\nimport reinterpret64 from '@stdlib/strided/base/reinterpret-complex64';\nimport reinterpret128 from '@stdlib/strided/base/reinterpret-complex128';\nimport reinterpretBoolean from '@stdlib/strided/base/reinterpret-boolean';\nimport format from '@stdlib/string/format';\nimport typeName from './type.js';\n\n\n// MAIN //\n\n/**\n* Returns a JSON representation of a typed array.\n*\n* ## Notes\n*\n* - We build a JSON object representing a typed array similar to how Node.js `Buffer` objects are represented. See [Buffer][1].\n*\n* [1]: https://nodejs.org/api/buffer.html#buffer_buf_tojson\n*\n* @param {TypedArray} arr - typed array to serialize\n* @throws {TypeError} first argument must be a typed array\n* @returns {Object} JSON representation\n*\n* @example\n* import Float64Array from '@stdlib/array/float64';\n*\n* var arr = new Float64Array( [ 5.0, 3.0 ] );\n* var json = typedarray2json( arr );\n* // returns { 'type': 'Float64Array', 'data': [ 5.0, 3.0 ] }\n*/\nfunction typedarray2json( arr ) {\n\tvar data;\n\tvar out;\n\tvar i;\n\n\tif ( isTypedArray( arr ) ) {\n\t\tdata = arr;\n\t} else if ( isComplexTypedArray( arr ) ) {\n\t\tif ( arr.BYTES_PER_ELEMENT === 8 ) {\n\t\t\tdata = reinterpret64( arr, 0 );\n\t\t} else { // arr.BYTES_PER_ELEMENT === 16\n\t\t\tdata = reinterpret128( arr, 0 );\n\t\t}\n\t} else if ( isBooleanArray( arr ) ) {\n\t\tdata = reinterpretBoolean( arr, 0 );\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a typed array. Value: `%s`.', arr ) );\n\t}\n\tout = {\n\t\t'type': typeName( arr ),\n\t\t'data': []\n\t};\n\tfor ( i = 0; i < data.length; i++ ) {\n\t\tout.data.push( data[ i ] );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default typedarray2json;\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 Uint8Array from '@stdlib/array/uint8';\n\n\n// MAIN //\n\n/**\n* Reinterprets a `BooleanArray` as a `Uint8Array`.\n*\n* @param {BooleanArray} x - input array\n* @param {NonNegativeInteger} offset - starting index\n* @returns {Uint8Array} `Uint8Array` view\n*\n* @example\n* import BooleanArray from '@stdlib/array/bool';\n*\n* var x = new BooleanArray( 10 );\n*\n* var out = reinterpret( x, 0 );\n* // returns \n*\n* var bool = ( out.buffer === x.buffer );\n* // returns true\n*/\nfunction reinterpret( x, offset ) {\n\treturn new Uint8Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), x.length-offset ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default reinterpret;\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 BooleanArray from '@stdlib/array/bool';\nimport constructorName from '@stdlib/utils/constructor-name';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a BooleanArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is a BooleanArray\n*\n* @example\n* import BooleanArray from '@stdlib/array/bool';\n*\n* var bool = isBooleanArray( new BooleanArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isBooleanArray( [] );\n* // returns false\n*/\nfunction isBooleanArray( value ) {\n\treturn (\n\t\tvalue instanceof BooleanArray ||\n\t\tconstructorName( value ) === 'BooleanArray'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isBooleanArray;\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';\nimport getPrototypeOf from '@stdlib/utils/get-prototype-of';\nimport CTORS from './ctors.js';\nimport NAMES from './names.json';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a complex typed array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array\n*\n* @example\n* import Complex128Array from '@stdlib/array/complex128';\n*\n* var bool = isComplexTypedArray( new Complex128Array( 10 ) );\n* // returns true\n*/\nfunction isComplexTypedArray( value ) {\n\tvar v;\n\tvar i;\n\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for complex typed array objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tfor ( i = 0; i < CTORS.length; i++ ) {\n\t\tif ( value instanceof CTORS[ i ] ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\t// Walk the prototype tree until we find an object having a desired class...\n\twhile ( value ) {\n\t\tv = ctorName( value );\n\t\tfor ( i = 0; i < NAMES.length; i++ ) {\n\t\t\tif ( NAMES[ i ] === v ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isComplexTypedArray;\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 UINT32_MAX from '@stdlib/constants/uint32/max';\nimport floor from '@stdlib/math/base/special/floor';\n\n\n// VARIABLES //\n\nvar MAX = UINT32_MAX - 1;\n\n\n// MAIN //\n\n/**\n* Returns a pseudorandom integer on the interval \\\\( [1, 2^{32}-1) \\\\).\n*\n* @private\n* @returns {PositiveInteger} pseudorandom integer\n*\n* @example\n* var v = randuint32();\n* // returns \n*/\nfunction randuint32() {\n\tvar v = floor( 1.0 + (MAX*Math.random()) ); // eslint-disable-line stdlib/no-builtin-math\n\treturn v >>> 0; // asm type annotation\n}\n\n\n// EXPORTS //\n\nexport default randuint32;\n","/* eslint-disable max-lines, max-len */\n\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* ## Notice\n*\n* The original C code and copyright notice are from the [source implementation][mt19937]. The implementation has been modified for JavaScript.\n*\n* ```text\n* Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n* All rights reserved.\n*\n* Redistribution and use in source and binary forms, with or without\n* modification, are permitted provided that the following conditions\n* are met:\n*\n* 1. Redistributions of source code must retain the above copyright\n* notice, this list of conditions and the following disclaimer.\n*\n* 2. Redistributions in binary form must reproduce the above copyright\n* notice, this list of conditions and the following disclaimer in the\n* documentation and/or other materials provided with the distribution.\n*\n* 3. The names of its contributors may not be used to endorse or promote\n* products derived from this software without specific prior written\n* permission.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n* \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n* ```\n*\n* [mt19937]: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c\n*/\n\n'use strict';\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils/define-nonenumerable-read-only-accessor';\nimport setReadWriteAccessor from '@stdlib/utils/define-nonenumerable-read-write-accessor';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport isCollection from '@stdlib/assert/is-collection';\nimport isUint32Array from '@stdlib/assert/is-uint32array';\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport { isPrimitive as isPositiveInteger } from '@stdlib/assert/is-positive-integer';\nimport FLOAT64_MAX_SAFE_INTEGER from '@stdlib/constants/float64/max-safe-integer';\nimport UINT32_MAX from '@stdlib/constants/uint32/max';\nimport Uint32Array from '@stdlib/array/uint32';\nimport max from '@stdlib/math/base/special/max';\nimport umul from '@stdlib/number/uint32/base/mul';\nimport gcopy from '@stdlib/blas/base/gcopy';\nimport typedarray2json from '@stdlib/array/to-json';\nimport format from '@stdlib/string/format';\nimport randuint32 from './rand_uint32.js';\n\n\n// VARIABLES //\n\n// Define the size of the state array (see refs):\nvar N = 624;\n\n// Define a (magic) constant used for indexing into the state array:\nvar M = 397;\n\n// Define the maximum seed: 11111111111111111111111111111111\nvar MAX_SEED = UINT32_MAX >>> 0; // asm type annotation\n\n// For seed arrays, define an initial state (magic) constant: 19650218 => 00000001001010111101011010101010\nvar SEED_ARRAY_INIT_STATE = 19650218 >>> 0; // asm type annotation\n\n// Define a mask for the most significant `w-r` bits, where `w` is the word size (32 bits) and `r` is the separation point of one word (see refs): 2147483648 => 0x80000000 => 10000000000000000000000000000000\nvar UPPER_MASK = 0x80000000 >>> 0; // asm type annotation\n\n// Define a mask for the least significant `r` bits (see refs): 2147483647 => 0x7fffffff => 01111111111111111111111111111111\nvar LOWER_MASK = 0x7fffffff >>> 0; // asm type annotation\n\n// Define a multiplier (see Knuth TAOCP Vol2. 3rd Ed. P.106): 1812433253 => 01101100000001111000100101100101\nvar KNUTH_MULTIPLIER = 1812433253 >>> 0; // asm type annotation\n\n// Define a (magic) multiplier: 1664525 => 00000000000110010110011000001101\nvar MAGIC_MULTIPLIER_1 = 1664525 >>> 0; // asm type annotation\n\n// Define a (magic) multiplier: 1566083941 => 01011101010110001000101101100101\nvar MAGIC_MULTIPLIER_2 = 1566083941 >>> 0; // asm type annotation\n\n// Define a tempering coefficient: 2636928640 => 0x9d2c5680 => 10011101001011000101011010000000\nvar TEMPERING_COEFFICIENT_1 = 0x9d2c5680 >>> 0; // asm type annotation\n\n// Define a tempering coefficient: 4022730752 => 0xefc60000 => 11101111110001100000000000000000\nvar TEMPERING_COEFFICIENT_2 = 0xefc60000 >>> 0; // asm type annotation\n\n// Define a constant vector `a` (see refs): 2567483615 => 0x9908b0df => 10011001000010001011000011011111\nvar MATRIX_A = 0x9908b0df >>> 0; // asm type annotation\n\n// MAG01[x] = x * MATRIX_A; for x = {0,1}\nvar MAG01 = [ 0x0 >>> 0, MATRIX_A >>> 0 ]; // asm type annotation\n\n// Define a normalization constant when generating double-precision floating-point numbers: 2^53 => 9007199254740992\nvar FLOAT64_NORMALIZATION_CONSTANT = 1.0 / ( FLOAT64_MAX_SAFE_INTEGER+1.0 ); // eslint-disable-line id-length\n\n// 2^26: 67108864\nvar TWO_26 = 67108864 >>> 0; // asm type annotation\n\n// 2^32: 2147483648 => 0x80000000 => 10000000000000000000000000000000\nvar TWO_32 = 0x80000000 >>> 0; // asm type annotation\n\n// 1 (as a 32-bit unsigned integer): 1 => 0x1 => 00000000000000000000000000000001\nvar ONE = 0x1 >>> 0; // asm type annotation\n\n// Define the maximum normalized pseudorandom double-precision floating-point number: ( (((2^32-1)>>>5)*2^26)+( (2^32-1)>>>6) ) / 2^53\nvar MAX_NORMALIZED = FLOAT64_MAX_SAFE_INTEGER * FLOAT64_NORMALIZATION_CONSTANT;\n\n// Define the state array schema version:\nvar STATE_ARRAY_VERSION = 1; // NOTE: anytime the state array schema changes, this value should be incremented!!!\n\n// Define the number of sections in the state array:\nvar NUM_STATE_SECTIONS = 3; // state, other, seed\n\n// Define the index offset of the \"state\" section in the state array:\nvar STATE_SECTION_OFFSET = 2; // | version | num_sections | state_length | ...state | other_length | state_index | seed_length | ...seed |\n\n// Define the index offset of the \"other\" section in the state array:\nvar OTHER_SECTION_OFFSET = N + 3; // | version | num_sections | state_length | ...state | other_length | state_index | seed_length | ...seed |\n\n// Define the index offset of the seed section in the state array:\nvar SEED_SECTION_OFFSET = N + 5; // | version | num_sections | state_length | ...state | other_length | state_index | seed_length | ...seed |\n\n// Define the length of the \"fixed\" length portion of the state array:\nvar STATE_FIXED_LENGTH = N + 6; // 1 (version) + 1 (num_sections) + 1 (state_length) + N (state) + 1 (other_length) + 1 (state_index) + 1 (seed_length)\n\n\n// FUNCTIONS //\n\n/**\n* Verifies state array integrity.\n*\n* @private\n* @param {Uint32Array} state - state array\n* @param {boolean} FLG - flag indicating whether the state array was provided as an option (true) or an argument (false)\n* @returns {(Error|null)} an error or `null`\n*/\nfunction verifyState( state, FLG ) {\n\tvar s1;\n\tif ( FLG ) {\n\t\ts1 = 'option';\n\t} else {\n\t\ts1 = 'argument';\n\t}\n\t// The state array must have a minimum length...\n\tif ( state.length < STATE_FIXED_LENGTH+1 ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array has insufficient length.', s1 ) );\n\t}\n\t// The first element of the state array must equal the supported state array schema version...\n\tif ( state[ 0 ] !== STATE_ARRAY_VERSION ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array has an incompatible schema version. Expected: `%s`. Actual: `%s.`', s1, STATE_ARRAY_VERSION, state[ 0 ] ) );\n\t}\n\t// The second element of the state array must contain the number of sections...\n\tif ( state[ 1 ] !== NUM_STATE_SECTIONS ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array has an incompatible number of sections. Expected: `%s`. Actual: `%s`.', s1, NUM_STATE_SECTIONS, state[ 1 ] ) );\n\t}\n\t// The length of the \"state\" section must equal `N`...\n\tif ( state[ STATE_SECTION_OFFSET ] !== N ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array has an incompatible state length. Expected: `%u`. Actual: `%u`.', s1, N, state[ STATE_SECTION_OFFSET ] ) );\n\t}\n\t// The length of the \"other\" section must equal `1`...\n\tif ( state[ OTHER_SECTION_OFFSET ] !== 1 ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array has an incompatible section length. Expected: `%u`. Actual: `%u`.', s1, 1, state[ OTHER_SECTION_OFFSET ] ) );\n\t}\n\t// The length of the \"seed\" section much match the empirical length...\n\tif ( state[ SEED_SECTION_OFFSET ] !== state.length-STATE_FIXED_LENGTH ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array length is incompatible with seed section length. Expected: `%u`. Actual: `%u`.', s1, state.length-STATE_FIXED_LENGTH, state[ SEED_SECTION_OFFSET ] ) );\n\t}\n\treturn null;\n}\n\n/**\n* Returns an initial PRNG state.\n*\n* @private\n* @param {Uint32Array} state - state array\n* @param {PositiveInteger} N - state size\n* @param {uinteger32} s - seed\n* @returns {Uint32Array} state array\n*/\nfunction createState( state, N, s ) {\n\tvar i;\n\n\t// Set the first element of the state array to the provided seed:\n\tstate[ 0 ] = s >>> 0; // equivalent to `s & 0xffffffffUL` in original C implementation\n\n\t// Initialize the remaining state array elements:\n\tfor ( i = 1; i < N; i++ ) {\n\t\t/*\n\t\t* In the original C implementation (see `init_genrand()`),\n\t\t*\n\t\t* ```c\n\t\t* mt[i] = (KNUTH_MULTIPLIER * (mt[i-1] ^ (mt[i-1] >> 30)) + i)\n\t\t* ```\n\t\t*\n\t\t* In order to replicate this in JavaScript, we must emulate C-like multiplication of unsigned 32-bit integers.\n\t\t*/\n\t\ts = state[ i-1 ]>>>0; // asm type annotation\n\t\ts = ( s^(s>>>30) )>>>0; // asm type annotation\n\t\tstate[ i ] = ( umul( s, KNUTH_MULTIPLIER ) + i )>>>0; // asm type annotation\n\t}\n\treturn state;\n}\n\n/**\n* Initializes a PRNG state array according to a seed array.\n*\n* @private\n* @param {Uint32Array} state - state array\n* @param {NonNegativeInteger} N - state array length\n* @param {Collection} seed - seed array\n* @param {NonNegativeInteger} M - seed array length\n* @returns {Uint32Array} state array\n*/\nfunction initState( state, N, seed, M ) {\n\tvar s;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\ti = 1;\n\tj = 0;\n\tfor ( k = max( N, M ); k > 0; k-- ) {\n\t\t/*\n\t\t* In the original C implementation (see `init_by_array()`),\n\t\t*\n\t\t* ```c\n\t\t* mt[i] = (mt[i]^((mt[i-1]^(mt[i-1]>>30))*1664525UL)) + seed[j] + j;\n\t\t* ```\n\t\t*\n\t\t* In order to replicate this in JavaScript, we must emulate C-like multiplication of unsigned 32-bit integers.\n\t\t*/\n\t\ts = state[ i-1 ]>>>0; // asm type annotation\n\t\ts = ( s^(s>>>30) )>>>0; // asm type annotation\n\t\ts = ( umul( s, MAGIC_MULTIPLIER_1 ) )>>>0; // asm type annotation\n\t\tstate[ i ] = ( ((state[i]>>>0)^s) + seed[j] + j )>>>0; /* non-linear */ // asm type annotation\n\n\t\ti += 1;\n\t\tj += 1;\n\t\tif ( i >= N ) {\n\t\t\tstate[ 0 ] = state[ N-1 ];\n\t\t\ti = 1;\n\t\t}\n\t\tif ( j >= M ) {\n\t\t\tj = 0;\n\t\t}\n\t}\n\tfor ( k = N-1; k > 0; k-- ) {\n\t\t/*\n\t\t* In the original C implementation (see `init_by_array()`),\n\t\t*\n\t\t* ```c\n\t\t* mt[i] = (mt[i]^((mt[i-1]^(mt[i-1]>>30))*1566083941UL)) - i;\n\t\t* ```\n\t\t*\n\t\t* In order to replicate this in JavaScript, we must emulate C-like multiplication of unsigned 32-bit integers.\n\t\t*/\n\t\ts = state[ i-1 ]>>>0; // asm type annotation\n\t\ts = ( s^(s>>>30) )>>>0; // asm type annotation\n\t\ts = ( umul( s, MAGIC_MULTIPLIER_2 ) )>>>0; // asm type annotation\n\t\tstate[ i ] = ( ((state[i]>>>0)^s) - i )>>>0; /* non-linear */ // asm type annotation\n\n\t\ti += 1;\n\t\tif ( i >= N ) {\n\t\t\tstate[ 0 ] = state[ N-1 ];\n\t\t\ti = 1;\n\t\t}\n\t}\n\t// Ensure a non-zero initial state array:\n\tstate[ 0 ] = TWO_32; // MSB (most significant bit) is 1\n\n\treturn state;\n}\n\n/**\n* Updates a PRNG's internal state by generating the next `N` words.\n*\n* @private\n* @param {Uint32Array} state - state array\n* @returns {Uint32Array} state array\n*/\nfunction twist( state ) {\n\tvar w;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\tk = N - M;\n\tfor ( i = 0; i < k; i++ ) {\n\t\tw = ( state[i]&UPPER_MASK ) | ( state[i+1]&LOWER_MASK );\n\t\tstate[ i ] = state[ i+M ] ^ ( w>>>1 ) ^ MAG01[ w&ONE ];\n\t}\n\tj = N - 1;\n\tfor ( ; i < j; i++ ) {\n\t\tw = ( state[i]&UPPER_MASK ) | ( state[i+1]&LOWER_MASK );\n\t\tstate[ i ] = state[ i-k ] ^ ( w>>>1 ) ^ MAG01[ w&ONE ];\n\t}\n\tw = ( state[j]&UPPER_MASK ) | ( state[0]&LOWER_MASK );\n\tstate[ j ] = state[ M-1 ] ^ ( w>>>1 ) ^ MAG01[ w&ONE ];\n\treturn state;\n}\n\n\n// MAIN //\n\n/**\n* Returns a 32-bit Mersenne Twister pseudorandom number generator.\n*\n* ## Notes\n*\n* - In contrast to the original C implementation, array seeds of length `1` are considered integer seeds. This ensures that the seed `[ 1234 ]` generates the same output as the seed `1234`. In the original C implementation, the two seeds would yield different output, which is **not** obvious from a user perspective.\n*\n* @param {Options} [options] - options\n* @param {PRNGSeedMT19937} [options.seed] - pseudorandom number generator seed\n* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state\n* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} a seed must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integers less than or equal to the maximum unsigned 32-bit integer\n* @throws {RangeError} a numeric seed must be a positive integer less than or equal to the maximum unsigned 32-bit integer\n* @throws {TypeError} state must be a `Uint32Array`\n* @throws {Error} must provide a valid state\n* @throws {TypeError} `copy` option must be a boolean\n* @returns {PRNG} Mersenne Twister PRNG\n*\n* @example\n* var mt19937 = factory();\n*\n* var v = mt19937();\n* // returns \n*\n* @example\n* // Return a seeded Mersenne Twister PRNG:\n* var mt19937 = factory({\n* 'seed': 1234\n* });\n*\n* var v = mt19937();\n* // returns 822569775\n*/\nfunction factory( options ) {\n\tvar STATE;\n\tvar state;\n\tvar opts;\n\tvar seed;\n\tvar slen;\n\tvar err;\n\n\topts = {};\n\tif ( arguments.length ) {\n\t\tif ( !isObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t\tif ( hasOwnProp( options, 'copy' ) ) {\n\t\t\topts.copy = options.copy;\n\t\t\tif ( !isBoolean( options.copy ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'copy', options.copy ) );\n\t\t\t}\n\t\t}\n\t\tif ( hasOwnProp( options, 'state' ) ) {\n\t\t\tstate = options.state;\n\t\t\topts.state = true;\n\t\t\tif ( !isUint32Array( state ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a Uint32Array. Option: `%s`.', 'state', state ) );\n\t\t\t}\n\t\t\terr = verifyState( state, true );\n\t\t\tif ( err ) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tif ( opts.copy === false ) {\n\t\t\t\tSTATE = state;\n\t\t\t} else {\n\t\t\t\tSTATE = new Uint32Array( state.length );\n\t\t\t\tgcopy( state.length, state, 1, STATE, 1 );\n\t\t\t}\n\t\t\t// Create a state \"view\":\n\t\t\tstate = new Uint32Array( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), N );\n\n\t\t\t// Create a seed \"view\":\n\t\t\tseed = new Uint32Array( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), state[ SEED_SECTION_OFFSET ] );\n\t\t}\n\t\t// If provided a PRNG state, we ignore the `seed` option...\n\t\tif ( seed === void 0 ) {\n\t\t\tif ( hasOwnProp( options, 'seed' ) ) {\n\t\t\t\tseed = options.seed;\n\t\t\t\topts.seed = true;\n\t\t\t\tif ( isPositiveInteger( seed ) ) {\n\t\t\t\t\tif ( seed > MAX_SEED ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid option. `%s` option must be a positive integer less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.', 'seed', seed ) );\n\t\t\t\t\t}\n\t\t\t\t\tseed >>>= 0; // asm type annotation\n\t\t\t\t} else if ( isCollection( seed ) === false || seed.length < 1 ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.', 'seed', seed ) );\n\t\t\t\t} else if ( seed.length === 1 ) {\n\t\t\t\t\tseed = seed[ 0 ];\n\t\t\t\t\tif ( !isPositiveInteger( seed ) ) {\n\t\t\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.', 'seed', seed ) );\n\t\t\t\t\t}\n\t\t\t\t\tif ( seed > MAX_SEED ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.', 'seed', seed ) );\n\t\t\t\t\t}\n\t\t\t\t\tseed >>>= 0; // asm type annotation\n\t\t\t\t} else {\n\t\t\t\t\tslen = seed.length;\n\t\t\t\t\tSTATE = new Uint32Array( STATE_FIXED_LENGTH+slen );\n\n\t\t\t\t\t// Initialize sections:\n\t\t\t\t\tSTATE[ 0 ] = STATE_ARRAY_VERSION;\n\t\t\t\t\tSTATE[ 1 ] = NUM_STATE_SECTIONS;\n\t\t\t\t\tSTATE[ STATE_SECTION_OFFSET ] = N;\n\t\t\t\t\tSTATE[ OTHER_SECTION_OFFSET ] = 1;\n\t\t\t\t\tSTATE[ OTHER_SECTION_OFFSET+1 ] = N; // state index\n\t\t\t\t\tSTATE[ SEED_SECTION_OFFSET ] = slen;\n\n\t\t\t\t\t// Copy the provided seed array to prevent external mutation, as mutation would lead to an inability to reproduce PRNG values according to the PRNG's stated seed:\n\t\t\t\t\tgcopy.ndarray( slen, seed, 1, 0, STATE, 1, SEED_SECTION_OFFSET+1 );\n\n\t\t\t\t\t// Create a state \"view\":\n\t\t\t\t\tstate = new Uint32Array( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), N );\n\n\t\t\t\t\t// Create a seed \"view\":\n\t\t\t\t\tseed = new Uint32Array( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), slen );\n\n\t\t\t\t\t// Initialize the internal PRNG state:\n\t\t\t\t\tstate = createState( state, N, SEED_ARRAY_INIT_STATE );\n\t\t\t\t\tstate = initState( state, N, seed, slen );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tseed = randuint32() >>> 0; // asm type annotation\n\t\t\t}\n\t\t}\n\t} else {\n\t\tseed = randuint32() >>> 0; // asm type annotation\n\t}\n\tif ( state === void 0 ) {\n\t\tSTATE = new Uint32Array( STATE_FIXED_LENGTH+1 );\n\n\t\t// Initialize sections:\n\t\tSTATE[ 0 ] = STATE_ARRAY_VERSION;\n\t\tSTATE[ 1 ] = NUM_STATE_SECTIONS;\n\t\tSTATE[ STATE_SECTION_OFFSET ] = N;\n\t\tSTATE[ OTHER_SECTION_OFFSET ] = 1;\n\t\tSTATE[ OTHER_SECTION_OFFSET+1 ] = N; // state index\n\t\tSTATE[ SEED_SECTION_OFFSET ] = 1;\n\t\tSTATE[ SEED_SECTION_OFFSET+1 ] = seed;\n\n\t\t// Create a state \"view\":\n\t\tstate = new Uint32Array( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), N );\n\n\t\t// Create a seed \"view\":\n\t\tseed = new Uint32Array( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), 1 );\n\n\t\t// Initialize the internal PRNG state:\n\t\tstate = createState( state, N, seed );\n\t}\n\t// Note: property order matters in order to maintain consistency of PRNG \"shape\" (hidden classes).\n\tsetReadOnly( mt19937, 'NAME', 'mt19937' );\n\tsetReadOnlyAccessor( mt19937, 'seed', getSeed );\n\tsetReadOnlyAccessor( mt19937, 'seedLength', getSeedLength );\n\tsetReadWriteAccessor( mt19937, 'state', getState, setState );\n\tsetReadOnlyAccessor( mt19937, 'stateLength', getStateLength );\n\tsetReadOnlyAccessor( mt19937, 'byteLength', getStateSize );\n\tsetReadOnly( mt19937, 'toJSON', toJSON );\n\tsetReadOnly( mt19937, 'MIN', 0 );\n\tsetReadOnly( mt19937, 'MAX', UINT32_MAX );\n\tsetReadOnly( mt19937, 'normalized', normalized );\n\n\tsetReadOnly( normalized, 'NAME', mt19937.NAME );\n\tsetReadOnlyAccessor( normalized, 'seed', getSeed );\n\tsetReadOnlyAccessor( normalized, 'seedLength', getSeedLength );\n\tsetReadWriteAccessor( normalized, 'state', getState, setState );\n\tsetReadOnlyAccessor( normalized, 'stateLength', getStateLength );\n\tsetReadOnlyAccessor( normalized, 'byteLength', getStateSize );\n\tsetReadOnly( normalized, 'toJSON', toJSON );\n\tsetReadOnly( normalized, 'MIN', 0.0 );\n\tsetReadOnly( normalized, 'MAX', MAX_NORMALIZED );\n\n\treturn mt19937;\n\n\t/**\n\t* Returns the PRNG seed.\n\t*\n\t* @private\n\t* @returns {PRNGSeedMT19937} seed\n\t*/\n\tfunction getSeed() {\n\t\tvar len = STATE[ SEED_SECTION_OFFSET ];\n\t\treturn gcopy( len, seed, 1, new Uint32Array( len ), 1 );\n\t}\n\n\t/**\n\t* Returns the PRNG seed length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} seed length\n\t*/\n\tfunction getSeedLength() {\n\t\treturn STATE[ SEED_SECTION_OFFSET ];\n\t}\n\n\t/**\n\t* Returns the PRNG state length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state length\n\t*/\n\tfunction getStateLength() {\n\t\treturn STATE.length;\n\t}\n\n\t/**\n\t* Returns the PRNG state size (in bytes).\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state size (in bytes)\n\t*/\n\tfunction getStateSize() {\n\t\treturn STATE.byteLength;\n\t}\n\n\t/**\n\t* Returns the current PRNG state.\n\t*\n\t* ## Notes\n\t*\n\t* - The PRNG state array is comprised of a preamble followed by `3` sections:\n\t*\n\t* 0. preamble (version + number of sections)\n\t* 1. internal PRNG state\n\t* 2. auxiliary state information\n\t* 3. PRNG seed\n\t*\n\t* - The first element of the PRNG state array preamble is the state array schema version.\n\t*\n\t* - The second element of the PRNG state array preamble is the number of state array sections (i.e., `3`).\n\t*\n\t* - The first element of each section following the preamble specifies the section length. The remaining section elements comprise the section contents.\n\t*\n\t* @private\n\t* @returns {PRNGStateMT19937} current state\n\t*/\n\tfunction getState() {\n\t\tvar len = STATE.length;\n\t\treturn gcopy( len, STATE, 1, new Uint32Array( len ), 1 );\n\t}\n\n\t/**\n\t* Sets the PRNG state.\n\t*\n\t* ## Notes\n\t*\n\t* - If PRNG state is \"shared\" (meaning a state array was provided during PRNG creation and **not** copied) and one sets the generator state to a state array having a different length, the PRNG does **not** update the existing shared state and, instead, points to the newly provided state array. In order to synchronize PRNG output according to the new shared state array, the state array for **each** relevant PRNG must be **explicitly** set.\n\t* - If PRNG state is \"shared\" and one sets the generator state to a state array of the same length, the PRNG state is updated (along with the state of all other PRNGs sharing the PRNG's state array).\n\t*\n\t* @private\n\t* @param {PRNGStateMT19937} s - generator state\n\t* @throws {TypeError} must provide a `Uint32Array`\n\t* @throws {Error} must provide a valid state\n\t*/\n\tfunction setState( s ) {\n\t\tvar err;\n\t\tif ( !isUint32Array( s ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a Uint32Array. Value: `%s`.', s ) );\n\t\t}\n\t\terr = verifyState( s, false );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tif ( opts.copy === false ) {\n\t\t\tif ( opts.state && s.length === STATE.length ) {\n\t\t\t\tgcopy( s.length, s, 1, STATE, 1 ); // update current shared state\n\t\t\t} else {\n\t\t\t\tSTATE = s; // point to new shared state\n\t\t\t\topts.state = true; // setting this flag allows updating a shared state even if a state array was not provided at PRNG creation\n\t\t\t}\n\t\t} else {\n\t\t\t// Check if we can reuse allocated memory...\n\t\t\tif ( s.length !== STATE.length ) {\n\t\t\t\tSTATE = new Uint32Array( s.length ); // reallocate\n\t\t\t}\n\t\t\tgcopy( s.length, s, 1, STATE, 1 );\n\t\t}\n\t\t// Create a new state \"view\":\n\t\tstate = new Uint32Array( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), N );\n\n\t\t// Create a new seed \"view\":\n\t\tseed = new Uint32Array( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), STATE[ SEED_SECTION_OFFSET ] );\n\t}\n\n\t/**\n\t* Serializes the pseudorandom number generator as a JSON object.\n\t*\n\t* ## Notes\n\t*\n\t* - `JSON.stringify()` implicitly calls this method when stringifying a PRNG.\n\t*\n\t* @private\n\t* @returns {Object} JSON representation\n\t*/\n\tfunction toJSON() {\n\t\tvar out = {};\n\t\tout.type = 'PRNG';\n\t\tout.name = mt19937.NAME;\n\t\tout.state = typedarray2json( STATE );\n\t\tout.params = [];\n\t\treturn out;\n\t}\n\n\t/**\n\t* Generates a pseudorandom integer on the interval \\\\( [0, 2^{32}) \\\\).\n\t*\n\t* @private\n\t* @returns {uinteger32} pseudorandom integer\n\t*\n\t* @example\n\t* var r = mt19937();\n\t* // returns \n\t*/\n\tfunction mt19937() {\n\t\tvar r;\n\t\tvar i;\n\n\t\t// Retrieve the current state index:\n\t\ti = STATE[ OTHER_SECTION_OFFSET+1 ];\n\n\t\t// Determine whether we need to update the PRNG state:\n\t\tif ( i >= N ) {\n\t\t\tstate = twist( state );\n\t\t\ti = 0;\n\t\t}\n\t\t// Get the next word of \"raw\"/untempered state:\n\t\tr = state[ i ];\n\n\t\t// Update the state index:\n\t\tSTATE[ OTHER_SECTION_OFFSET+1 ] = i + 1;\n\n\t\t// Tempering transform to compensate for the reduced dimensionality of equidistribution:\n\t\tr ^= r >>> 11;\n\t\tr ^= ( r << 7 ) & TEMPERING_COEFFICIENT_1;\n\t\tr ^= ( r << 15 ) & TEMPERING_COEFFICIENT_2;\n\t\tr ^= r >>> 18;\n\n\t\treturn r >>> 0;\n\t}\n\n\t/**\n\t* Generates a pseudorandom number on the interval \\\\( [0, 1) \\\\).\n\t*\n\t* ## Notes\n\t*\n\t* - The original C implementation credits Isaku Wada for this algorithm (2002/01/09).\n\t*\n\t* @private\n\t* @returns {number} pseudorandom number\n\t*\n\t* @example\n\t* var r = normalized();\n\t* // returns \n\t*/\n\tfunction normalized() {\n\t\tvar x = mt19937() >>> 5;\n\t\tvar y = mt19937() >>> 6;\n\t\treturn ( (x*TWO_26)+y ) * FLOAT64_NORMALIZATION_CONSTANT;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default factory;\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 setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils/define-nonenumerable-read-only-accessor';\nimport setReadWriteAccessor from '@stdlib/utils/define-nonenumerable-read-write-accessor';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport { isPrimitive as isProbability } from '@stdlib/assert/is-probability';\nimport isFunction from '@stdlib/assert/is-function';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport constantFunction from '@stdlib/utils/constant-function';\nimport noop from '@stdlib/utils/noop';\nimport { factory as randu } from './../../../base/mt19937';\nimport isnan from '@stdlib/math/base/assert/is-nan';\nimport typedarray2json from '@stdlib/array/to-json';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Returns a pseudorandom number generator for generating Bernoulli distributed random numbers.\n*\n* @param {Probability} [p] - success probability\n* @param {Options} [options] - function options\n* @param {PRNG} [options.prng] - pseudorandom number generator which generates uniformly distributed pseudorandom numbers\n* @param {PRNGSeedMT19937} [options.seed] - pseudorandom number generator seed\n* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state\n* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state\n* @throws {TypeError} `p` must be a probability\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {Error} must provide a valid state\n* @returns {PRNG} pseudorandom number generator\n*\n* @example\n* var bernoulli = factory( 0.5 );\n* var v = bernoulli();\n* // returns \n*\n* @example\n* var bernoulli = factory( 0.8, {\n* 'seed': 297\n* });\n* var v = bernoulli();\n* // returns \n*\n* @example\n* var bernoulli = factory();\n* var v = bernoulli( 0.5 );\n* // returns \n*/\nfunction factory() {\n\tvar opts;\n\tvar rand;\n\tvar prng;\n\tvar p;\n\n\tif ( arguments.length === 0 ) {\n\t\trand = randu();\n\t} else if (\n\t\targuments.length === 1 &&\n\t\tisObject( arguments[ 0 ] )\n\t) {\n\t\topts = arguments[ 0 ];\n\t\tif ( hasOwnProp( opts, 'prng' ) ) {\n\t\t\tif ( !isFunction( opts.prng ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );\n\t\t\t}\n\t\t\trand = opts.prng;\n\t\t} else {\n\t\t\trand = randu( opts );\n\t\t}\n\t} else {\n\t\tp = arguments[ 0 ];\n\t\tif ( !isProbability( p ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a probability. Value: `%s`.', p ) );\n\t\t}\n\t\tif ( arguments.length > 1 ) {\n\t\t\topts = arguments[ 1 ];\n\t\t\tif ( !isObject( opts ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t\t}\n\t\t\tif ( hasOwnProp( opts, 'prng' ) ) {\n\t\t\t\tif ( !isFunction( opts.prng ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );\n\t\t\t\t}\n\t\t\t\trand = opts.prng;\n\t\t\t} else {\n\t\t\t\trand = randu( opts );\n\t\t\t}\n\t\t} else {\n\t\t\trand = randu();\n\t\t}\n\t}\n\tif ( p === void 0 ) {\n\t\tprng = bernoulli2;\n\t} else {\n\t\tprng = bernoulli1;\n\t}\n\tsetReadOnly( prng, 'NAME', 'bernoulli' );\n\n\t// If we are provided an \"external\" PRNG, we don't support getting or setting PRNG state, as we'd need to check for compatible state value types, etc, entailing considerable complexity.\n\tif ( opts && opts.prng ) {\n\t\tsetReadOnly( prng, 'seed', null );\n\t\tsetReadOnly( prng, 'seedLength', null );\n\t\tsetReadWriteAccessor( prng, 'state', constantFunction( null ), noop );\n\t\tsetReadOnly( prng, 'stateLength', null );\n\t\tsetReadOnly( prng, 'byteLength', null );\n\t\tsetReadOnly( prng, 'toJSON', constantFunction( null ) );\n\t\tsetReadOnly( prng, 'PRNG', rand );\n\t} else {\n\t\tsetReadOnlyAccessor( prng, 'seed', getSeed );\n\t\tsetReadOnlyAccessor( prng, 'seedLength', getSeedLength );\n\t\tsetReadWriteAccessor( prng, 'state', getState, setState );\n\t\tsetReadOnlyAccessor( prng, 'stateLength', getStateLength );\n\t\tsetReadOnlyAccessor( prng, 'byteLength', getStateSize );\n\t\tsetReadOnly( prng, 'toJSON', toJSON );\n\t\tsetReadOnly( prng, 'PRNG', rand );\n\t\trand = rand.normalized;\n\t}\n\treturn prng;\n\n\t/**\n\t* Returns the PRNG seed.\n\t*\n\t* @private\n\t* @returns {PRNGSeedMT19937} seed\n\t*/\n\tfunction getSeed() {\n\t\treturn rand.seed;\n\t}\n\n\t/**\n\t* Returns the PRNG seed length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} seed length\n\t*/\n\tfunction getSeedLength() {\n\t\treturn rand.seedLength;\n\t}\n\n\t/**\n\t* Returns the PRNG state length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state length\n\t*/\n\tfunction getStateLength() {\n\t\treturn rand.stateLength;\n\t}\n\n\t/**\n\t* Returns the PRNG state size (in bytes).\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state size (in bytes)\n\t*/\n\tfunction getStateSize() {\n\t\treturn rand.byteLength;\n\t}\n\n\t/**\n\t* Returns the current pseudorandom number generator state.\n\t*\n\t* @private\n\t* @returns {PRNGStateMT19937} current state\n\t*/\n\tfunction getState() {\n\t\treturn rand.state;\n\t}\n\n\t/**\n\t* Sets the pseudorandom number generator state.\n\t*\n\t* @private\n\t* @param {PRNGStateMT19937} s - generator state\n\t* @throws {Error} must provide a valid state\n\t*/\n\tfunction setState( s ) {\n\t\trand.state = s;\n\t}\n\n\t/**\n\t* Serializes the pseudorandom number generator as a JSON object.\n\t*\n\t* ## Notes\n\t*\n\t* - `JSON.stringify()` implicitly calls this method when stringifying a PRNG.\n\t*\n\t* @private\n\t* @returns {Object} JSON representation\n\t*/\n\tfunction toJSON() {\n\t\tvar out = {};\n\t\tout.type = 'PRNG';\n\t\tout.name = prng.NAME;\n\t\tout.state = typedarray2json( rand.state );\n\t\tif ( p === void 0 ) {\n\t\t\tout.params = [];\n\t\t} else {\n\t\t\tout.params = [ p ];\n\t\t}\n\t\treturn out;\n\t}\n\n\t/**\n\t* Returns a pseudorandom number drawn from a Bernoulli distribution with bound parameter `p`.\n\t*\n\t* @private\n\t* @returns {NonNegativeInteger} pseudorandom number\n\t*\n\t* @example\n\t* var v = bernoulli1();\n\t* // returns \n\t*/\n\tfunction bernoulli1() {\n\t\treturn ( rand() <= p ) ? 1 : 0;\n\t}\n\n\t/**\n\t* Returns a pseudorandom number drawn from a Bernoulli distribution with parameter `p`.\n\t*\n\t* @private\n\t* @param {Probability} p - success probability\n\t* @returns {NonNegativeInteger} pseudorandom number\n\t*\n\t* @example\n\t* var v = bernoulli2( 0.5 );\n\t* // returns \n\t*/\n\tfunction bernoulli2( p ) {\n\t\tif (\n\t\t\tisnan( p ) ||\n\t\t\tp < 0.0 ||\n\t\t\tp > 1.0\n\t\t) {\n\t\t\treturn NaN;\n\t\t}\n\t\treturn ( rand() <= p ) ? 1 : 0;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default factory;\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* A 32-bit Mersenne Twister pseudorandom number generator.\n*\n* @module @stdlib/random/base/mt19937\n*\n* @example\n* import mt19937 from '@stdlib/random/base/mt19937';\n*\n* var v = mt19937();\n* // returns \n*\n* @example\n* import { factory as factory } from '@stdlib/random/base/mt19937';\n*\n* var mt19937 = factory({\n* 'seed': 1234\n* });\n*\n* var v = mt19937();\n* // returns 822569775\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\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 factory from './factory.js';\nimport randuint32 from './rand_uint32.js';\n\n\n// MAIN //\n\n/**\n* Generates a pseudorandom integer on the interval \\\\( [0, 2^{32}) \\\\).\n*\n* ## Method\n*\n* - When generating normalized double-precision floating-point numbers, we first generate two pseudorandom integers \\\\( x \\\\) and \\\\( y \\\\) on the interval \\\\( [0, 2^{32}) \\\\) for a combined \\\\( 64 \\\\) random bits.\n*\n* - We would like \\\\( 53 \\\\) random bits to generate a 53-bit precision integer and, thus, want to discard \\\\( 11 \\\\) of the generated bits.\n*\n* - We do so by discarding \\\\( 5 \\\\) bits from \\\\( x \\\\) and \\\\( 6 \\\\) bits from \\\\( y \\\\).\n*\n* - Accordingly, \\\\( x \\\\) contains \\\\( 27 \\\\) random bits, which are subsequently shifted left \\\\( 26 \\\\) bits (multiplied by \\\\( 2^{26} \\\\), and \\\\( y \\\\) contains \\\\( 26 \\\\) random bits to fill in the lower \\\\( 26 \\\\) bits. When summed, they combine to comprise \\\\( 53 \\\\) random bits of a double-precision floating-point integer.\n*\n* - As an example, suppose, for the sake of argument, the 32-bit PRNG generates the maximum unsigned 32-bit integer \\\\( 2^{32}-1 \\\\) twice in a row. Then,\n*\n* ```javascript\n* x = 4294967295 >>> 5; // 00000111111111111111111111111111\n* y = 4294967295 >>> 6; // 00000011111111111111111111111111\n* ```\n*\n* Multiplying \\\\( x \\\\) by \\\\( 2^{26} \\\\) returns \\\\( 9007199187632128 \\\\), which, in binary, is\n*\n* ```binarystring\n* 0 10000110011 11111111111111111111 11111100000000000000000000000000\n* ```\n*\n* Adding \\\\( y \\\\) yields \\\\( 9007199254740991 \\\\) (the maximum \"safe\" double-precision floating-point integer value), which, in binary, is\n*\n* ```binarystring\n* 0 10000110011 11111111111111111111 11111111111111111111111111111111\n* ```\n*\n* - Similarly, suppose the 32-bit PRNG generates the following values\n*\n* ```javascript\n* x = 1 >>> 5; // 0 => 00000000000000000000000000000000\n* y = 64 >>> 6; // 1 => 00000000000000000000000000000001\n* ```\n*\n* Multiplying \\\\( x \\\\) by \\\\( 2^{26} \\\\) returns \\\\( 0 \\\\), which, in binary, is\n*\n* ```binarystring\n* 0 00000000000 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* Adding \\\\( y \\\\) yields \\\\( 1 \\\\), which, in binary, is\n*\n* ```binarystring\n* 0 01111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* - As different combinations of \\\\( x \\\\) and \\\\( y \\\\) are generated, different combinations of double-precision floating-point exponent and significand bits will be toggled, thus generating pseudorandom double-precision floating-point numbers.\n*\n* ## References\n*\n* - Matsumoto, Makoto, and Takuji Nishimura. 1998. \"Mersenne Twister: A 623-dimensionally Equidistributed Uniform Pseudo-random Number Generator.\" _ACM Transactions on Modeling and Computer Simulation_ 8 (1). New York, NY, USA: ACM: 3–30. doi:[10.1145/272991.272995][@matsumoto:1998a].\n* - Harase, Shin. 2017. \"Conversion of Mersenne Twister to double-precision floating-point numbers.\" _ArXiv_ abs/1708.06018 (September). .\n*\n* [@matsumoto:1998a]: https://doi.org/10.1145/272991.272995\n*\n* @function mt19937\n* @type {PRNG}\n* @returns {PositiveInteger} pseudorandom integer\n*\n* @example\n* var v = mt19937();\n* // returns \n*/\nvar mt19937 = factory({\n\t'seed': randuint32()\n});\n\n\n// EXPORTS //\n\nexport default mt19937;\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 factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Returns a pseudorandom random number drawn from a Bernoulli distribution with parameter `p`.\n*\n* @name bernoulli\n* @type {PRNG}\n* @param {Probability} p - success probability\n* @returns {NonNegativeInteger} pseudorandom number\n*\n* @example\n* var v = bernoulli( 0.5 );\n* // returns \n*\n* @example\n* var v = bernoulli( 3.14 );\n* // returns NaN\n*\n* @example\n* var v = bernoulli( -1.0 );\n* // returns NaN\n*\n* @example\n* var v = bernoulli( NaN );\n* // returns NaN\n*/\nvar bernoulli = factory();\n\n\n// EXPORTS //\n\nexport default bernoulli;\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* Uncapitalizes the first character of a string.\n*\n* @param {string} str - input string\n* @returns {string} input string with first character converted to lowercase\n*\n* @example\n* var out = uncapitalize( 'Last man standing' );\n* // returns 'last man standing'\n*\n* @example\n* var out = uncapitalize( 'Presidential election' );\n* // returns 'presidential election'\n*\n* @example\n* var out = uncapitalize( 'JavaScript' );\n* // returns 'javaScript'\n*\n* @example\n* var out = uncapitalize( 'Hidden Treasures' );\n* // returns 'hidden Treasures'\n*/\nfunction uncapitalize( str ) {\n\tif ( str === '' ) {\n\t\treturn '';\n\t}\n\treturn str.charAt( 0 ).toLowerCase() + str.slice( 1 );\n}\n\n\n// EXPORTS //\n\nexport default uncapitalize;\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* Bernoulli distributed pseudorandom numbers.\n*\n* @module @stdlib/random/base/bernoulli\n*\n* @example\n* import bernoulli from '@stdlib/random/base/bernoulli';\n*\n* var v = bernoulli( 0.5 );\n* // returns \n*\n* @example\n* import { factory as factory } from '@stdlib/random/base/bernoulli';\n*\n* var bernoulli = factory( 0.3, {\n* 'seed': 297\n* });\n*\n* var v = bernoulli();\n* // returns \n*\n* @example\n* import { factory as factory } from '@stdlib/random/base/bernoulli';\n*\n* var bernoulli = factory({\n* 'seed': 297\n* });\n*\n* var v = bernoulli( 0.5 );\n* // returns \n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\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* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace ns\n*/\nvar ns = {};\n\n/**\n* @name altcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/altcase}\n*/\nimport altcase from './../../base/altcase';\nsetReadOnly( ns, 'altcase', altcase );\n\n/**\n* @name atob\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/atob}\n*/\nimport atob from './../../base/atob';\nsetReadOnly( ns, 'atob', atob );\n\n/**\n* @name base64ToUint8Array\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/base64-to-uint8array}\n*/\nimport base64ToUint8Array from './../../base/base64-to-uint8array';\nsetReadOnly( ns, 'base64ToUint8Array', base64ToUint8Array );\n\n/**\n* @name camelcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/camelcase}\n*/\nimport camelcase from './../../base/camelcase';\nsetReadOnly( ns, 'camelcase', camelcase );\n\n/**\n* @name capitalize\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/capitalize}\n*/\nimport capitalize from './../../base/capitalize';\nsetReadOnly( ns, 'capitalize', capitalize );\n\n/**\n* @name codePointAt\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/code-point-at}\n*/\nimport codePointAt from './../../base/code-point-at';\nsetReadOnly( ns, 'codePointAt', codePointAt );\n\n/**\n* @name constantcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/constantcase}\n*/\nimport constantcase from './../../base/constantcase';\nsetReadOnly( ns, 'constantcase', constantcase );\n\n/**\n* @name distances\n* @memberof ns\n* @readonly\n* @type {Namespace}\n* @see {@link module:@stdlib/string/base/distances}\n*/\nimport distances from './../../base/distances';\nsetReadOnly( ns, 'distances', distances );\n\n/**\n* @name dotcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/dotcase}\n*/\nimport dotcase from './../../base/dotcase';\nsetReadOnly( ns, 'dotcase', dotcase );\n\n/**\n* @name endsWith\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/ends-with}\n*/\nimport endsWith from './../../base/ends-with';\nsetReadOnly( ns, 'endsWith', endsWith );\n\n/**\n* @name first\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/first}\n*/\nimport first from './../../base/first';\nsetReadOnly( ns, 'first', first );\n\n/**\n* @name firstCodePoint\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/first-code-point}\n*/\nimport firstCodePoint from './../../base/first-code-point';\nsetReadOnly( ns, 'firstCodePoint', firstCodePoint );\n\n/**\n* @name firstGraphemeCluster\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/first-grapheme-cluster}\n*/\nimport firstGraphemeCluster from './../../base/first-grapheme-cluster';\nsetReadOnly( ns, 'firstGraphemeCluster', firstGraphemeCluster );\n\n/**\n* @name forEach\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/for-each}\n*/\nimport forEach from './../../base/for-each';\nsetReadOnly( ns, 'forEach', forEach );\n\n/**\n* @name forEachCodePoint\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/for-each-code-point}\n*/\nimport forEachCodePoint from './../../base/for-each-code-point';\nsetReadOnly( ns, 'forEachCodePoint', forEachCodePoint );\n\n/**\n* @name forEachCodePointRight\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/for-each-code-point-right}\n*/\nimport forEachCodePointRight from './../../base/for-each-code-point-right';\nsetReadOnly( ns, 'forEachCodePointRight', forEachCodePointRight );\n\n/**\n* @name forEachGraphemeCluster\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/for-each-grapheme-cluster}\n*/\nimport forEachGraphemeCluster from './../../base/for-each-grapheme-cluster';\nsetReadOnly( ns, 'forEachGraphemeCluster', forEachGraphemeCluster );\n\n/**\n* @name forEachRight\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/for-each-right}\n*/\nimport forEachRight from './../../base/for-each-right';\nsetReadOnly( ns, 'forEachRight', forEachRight );\n\n/**\n* @name formatInterpolate\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/format-interpolate}\n*/\nimport formatInterpolate from './../../base/format-interpolate';\nsetReadOnly( ns, 'formatInterpolate', formatInterpolate );\n\n/**\n* @name formatTokenize\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/format-tokenize}\n*/\nimport formatTokenize from './../../base/format-tokenize';\nsetReadOnly( ns, 'formatTokenize', formatTokenize );\n\n/**\n* @name headercase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/headercase}\n*/\nimport headercase from './../../base/headercase';\nsetReadOnly( ns, 'headercase', headercase );\n\n/**\n* @name invcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/invcase}\n*/\nimport invcase from './../../base/invcase';\nsetReadOnly( ns, 'invcase', invcase );\n\n/**\n* @name kebabcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/kebabcase}\n*/\nimport kebabcase from './../../base/kebabcase';\nsetReadOnly( ns, 'kebabcase', kebabcase );\n\n/**\n* @name last\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/last}\n*/\nimport last from './../../base/last';\nsetReadOnly( ns, 'last', last );\n\n/**\n* @name lastCodePoint\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/last-code-point}\n*/\nimport lastCodePoint from './../../base/last-code-point';\nsetReadOnly( ns, 'lastCodePoint', lastCodePoint );\n\n/**\n* @name lastGraphemeCluster\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/last-grapheme-cluster}\n*/\nimport lastGraphemeCluster from './../../base/last-grapheme-cluster';\nsetReadOnly( ns, 'lastGraphemeCluster', lastGraphemeCluster );\n\n/**\n* @name lpad\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/left-pad}\n*/\nimport lpad from './../../base/left-pad';\nsetReadOnly( ns, 'lpad', lpad );\n\n/**\n* @name ltrim\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/left-trim}\n*/\nimport ltrim from './../../base/left-trim';\nsetReadOnly( ns, 'ltrim', ltrim );\n\n/**\n* @name lowercase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/lowercase}\n*/\nimport lowercase from './../../base/lowercase';\nsetReadOnly( ns, 'lowercase', lowercase );\n\n/**\n* @name pascalcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/pascalcase}\n*/\nimport pascalcase from './../../base/pascalcase';\nsetReadOnly( ns, 'pascalcase', pascalcase );\n\n/**\n* @name percentEncode\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/percent-encode}\n*/\nimport percentEncode from './../../base/percent-encode';\nsetReadOnly( ns, 'percentEncode', percentEncode );\n\n/**\n* @name removeFirst\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-first}\n*/\nimport removeFirst from './../../base/remove-first';\nsetReadOnly( ns, 'removeFirst', removeFirst );\n\n/**\n* @name removeFirstCodePoint\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-first-code-point}\n*/\nimport removeFirstCodePoint from './../../base/remove-first-code-point';\nsetReadOnly( ns, 'removeFirstCodePoint', removeFirstCodePoint );\n\n/**\n* @name removeFirstGraphemeCluster\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-first-grapheme-cluster}\n*/\nimport removeFirstGraphemeCluster from './../../base/remove-first-grapheme-cluster';\nsetReadOnly( ns, 'removeFirstGraphemeCluster', removeFirstGraphemeCluster );\n\n/**\n* @name removeLast\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-last}\n*/\nimport removeLast from './../../base/remove-last';\nsetReadOnly( ns, 'removeLast', removeLast );\n\n/**\n* @name removeLastCodePoint\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-last-code-point}\n*/\nimport removeLastCodePoint from './../../base/remove-last-code-point';\nsetReadOnly( ns, 'removeLastCodePoint', removeLastCodePoint );\n\n/**\n* @name removeLastGraphemeCluster\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-last-grapheme-cluster}\n*/\nimport removeLastGraphemeCluster from './../../base/remove-last-grapheme-cluster';\nsetReadOnly( ns, 'removeLastGraphemeCluster', removeLastGraphemeCluster );\n\n/**\n* @name repeat\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/repeat}\n*/\nimport repeat from './../../base/repeat';\nsetReadOnly( ns, 'repeat', repeat );\n\n/**\n* @name replace\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/replace}\n*/\nimport replace from './../../base/replace';\nsetReadOnly( ns, 'replace', replace );\n\n/**\n* @name replaceAfter\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/replace-after}\n*/\nimport replaceAfter from './../../base/replace-after';\nsetReadOnly( ns, 'replaceAfter', replaceAfter );\n\n/**\n* @name replaceAfterLast\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/replace-after-last}\n*/\nimport replaceAfterLast from './../../base/replace-after-last';\nsetReadOnly( ns, 'replaceAfterLast', replaceAfterLast );\n\n/**\n* @name replaceBefore\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/replace-before}\n*/\nimport replaceBefore from './../../base/replace-before';\nsetReadOnly( ns, 'replaceBefore', replaceBefore );\n\n/**\n* @name replaceBeforeLast\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/replace-before-last}\n*/\nimport replaceBeforeLast from './../../base/replace-before-last';\nsetReadOnly( ns, 'replaceBeforeLast', replaceBeforeLast );\n\n/**\n* @name reverse\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/reverse}\n*/\nimport reverse from './../../base/reverse';\nsetReadOnly( ns, 'reverse', reverse );\n\n/**\n* @name reverseCodePoints\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/reverse-code-points}\n*/\nimport reverseCodePoints from './../../base/reverse-code-points';\nsetReadOnly( ns, 'reverseCodePoints', reverseCodePoints );\n\n/**\n* @name reverseGraphemeClusters\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/reverse-grapheme-clusters}\n*/\nimport reverseGraphemeClusters from './../../base/reverse-grapheme-clusters';\nsetReadOnly( ns, 'reverseGraphemeClusters', reverseGraphemeClusters );\n\n/**\n* @name rpad\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/right-pad}\n*/\nimport rpad from './../../base/right-pad';\nsetReadOnly( ns, 'rpad', rpad );\n\n/**\n* @name rtrim\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/right-trim}\n*/\nimport rtrim from './../../base/right-trim';\nsetReadOnly( ns, 'rtrim', rtrim );\n\n/**\n* @name slice\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/slice}\n*/\nimport slice from './../../base/slice';\nsetReadOnly( ns, 'slice', slice );\n\n/**\n* @name sliceCodePoints\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/slice-code-points}\n*/\nimport sliceCodePoints from './../../base/slice-code-points';\nsetReadOnly( ns, 'sliceCodePoints', sliceCodePoints );\n\n/**\n* @name sliceGraphemeClusters\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/slice-grapheme-clusters}\n*/\nimport sliceGraphemeClusters from './../../base/slice-grapheme-clusters';\nsetReadOnly( ns, 'sliceGraphemeClusters', sliceGraphemeClusters );\n\n/**\n* @name snakecase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/snakecase}\n*/\nimport snakecase from './../../base/snakecase';\nsetReadOnly( ns, 'snakecase', snakecase );\n\n/**\n* @name startcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/startcase}\n*/\nimport startcase from './../../base/startcase';\nsetReadOnly( ns, 'startcase', startcase );\n\n/**\n* @name startsWith\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/starts-with}\n*/\nimport startsWith from './../../base/starts-with';\nsetReadOnly( ns, 'startsWith', startsWith );\n\n/**\n* @name stickycase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/stickycase}\n*/\nimport stickycase from './../../base/stickycase';\nsetReadOnly( ns, 'stickycase', stickycase );\n\n/**\n* @name trim\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/trim}\n*/\nimport trim from './../../base/trim';\nsetReadOnly( ns, 'trim', trim );\n\n/**\n* @name truncateMiddle\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/truncate-middle}\n*/\nimport truncateMiddle from './../../base/truncate-middle';\nsetReadOnly( ns, 'truncateMiddle', truncateMiddle );\n\n/**\n* @name uncapitalize\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/uncapitalize}\n*/\nimport uncapitalize from './../../base/uncapitalize';\nsetReadOnly( ns, 'uncapitalize', uncapitalize );\n\n/**\n* @name uppercase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/uppercase}\n*/\nimport uppercase from './../../base/uppercase';\nsetReadOnly( ns, 'uppercase', uppercase );\n\n\n// EXPORTS //\n\nexport default ns;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport lowercase from './../../../base/lowercase';\nimport uppercase from './../../../base/uppercase';\nimport isEven from '@stdlib/math/base/assert/is-even';\n\n\n// MAIN //\n\n/**\n* Converts a string to alternate case.\n*\n* @param {string} str - string to convert\n* @returns {string} alternate-cased string\n*\n* @example\n* var str = altcase( 'beep' );\n* // returns 'bEeP'\n*\n* @example\n* var str = altcase( 'beep boop' );\n* // returns 'bEeP BoOp'\n*\n* @example\n* var str = altcase( 'isMobile' );\n* // returns 'iSmObIlE'\n*\n* @example\n* var str = altcase( 'Hello World!' );\n* // returns 'hElLo wOrLd!'\n*/\nfunction altcase( str ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tif ( isEven( i ) ) {\n\t\t\tout += lowercase( str[i] );\n\t\t} else {\n\t\t\tout += uppercase( str[i] );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default altcase;\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 atob from './../../../base/atob'; // eslint-disable-line stdlib/no-redeclare\nimport Uint8Array from '@stdlib/array/uint8';\n\n\n// MAIN //\n\n/**\n* Converts a base64-encoded string to a Uint8Array.\n*\n* @param {string} str - base64-encoded string\n* @returns {(Uint8Array|null)} output array\n*\n* @example\n* import string2buffer from '@stdlib/buffer/from-string';\n*\n* var str = string2buffer( 'Hello World!' ).toString( 'base64' );\n* // returns 'SGVsbG8gV29ybGQh'\n*\n* var out = base64ToUint8Array( str );\n* // returns [ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ]\n*/\nfunction base64ToUint8Array( str ) {\n\tvar bytes;\n\tvar v;\n\tvar i;\n\n\tv = atob( str );\n\tif ( v === null ) {\n\t\treturn null;\n\t}\n\tbytes = new Uint8Array( v.length );\n\tfor ( i = 0; i < v.length; i++ ) {\n\t\tbytes[ i ] = v.charCodeAt( i );\n\t}\n\treturn bytes;\n}\n\n\n// EXPORTS //\n\nexport default base64ToUint8Array;\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// MAIN //\n\n/**\n* Invokes a function for each UTF-16 code unit in a string, iterating from right to left.\n*\n* @param {string} str - input string\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEachRight( 'Hello', log );\n*/\nfunction forEachRight( str, clbk, thisArg ) {\n\tvar i;\n\tfor ( i = str.length-1; i >= 0; i-- ) {\n\t\tclbk.call( thisArg, str[ i ], i, str );\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEachRight;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport uppercase from './../../../base/uppercase';\nimport lowercase from './../../../base/lowercase';\n\n\n// MAIN //\n\n/**\n* Converts a string to inverse case.\n*\n* @param {string} str - string to convert\n* @returns {string} inverse-cased string\n*\n* @example\n* var str = invcase( 'beep' );\n* // returns 'BEEP'\n*\n* @example\n* var str = invcase( 'beep BOOP' );\n* // returns 'BEEP boop'\n*\n* @example\n* var str = invcase( 'isMobile' );\n* // returns 'ISmOBILE'\n*\n* @example\n* var str = invcase( 'HeLlO wOrLd!' );\n* // returns 'hElLo WoRlD!'\n*/\nfunction invcase( str ) {\n\tvar out;\n\tvar ch;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tch = str[ i ];\n\t\ts = uppercase( ch );\n\t\tif ( s === ch ) {\n\t\t\ts = lowercase( ch );\n\t\t}\n\t\tout.push( s );\n\t}\n\treturn out.join( '' );\n}\n\n\n// EXPORTS //\n\nexport default invcase;\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// MAIN //\n\n/**\n* Replaces the substring after the first occurrence of a specified search string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {string} replacement - replacement string\n* @param {integer} fromIndex - index at which to start the search\n* @returns {string} output string\n*\n* @example\n* var out = replaceAfter( 'beep boop', ' ', 'foo', 0 );\n* // returns 'beep foo'\n*\n* @example\n* var out = replaceAfter( 'beep boop', 'p', 'foo', 5 );\n* // returns 'beep boopfoo'\n*\n* @example\n* var out = replaceAfter( 'Hello World!', '', 'foo', 0 );\n* // returns 'Hello World!'\n*\n* @example\n* var out = replaceAfter( 'Hello World!', 'xyz', 'foo', 0 );\n* // returns 'Hello World!'\n*\n* @example\n* var out = replaceAfter( 'beep boop', ' ', 'foo', 5 );\n* // returns 'beep boop'\n*\n* @example\n* var out = replaceAfter( 'beep boop beep baz', 'beep', 'foo', 5 );\n* // returns 'beep boop beepfoo'\n*/\nfunction replaceAfter( str, search, replacement, fromIndex ) {\n\tvar idx;\n\tif ( fromIndex < 0 ) {\n\t\tfromIndex += str.length;\n\t} else if ( fromIndex >= str.length ) {\n\t\treturn str;\n\t}\n\tidx = str.indexOf( search, fromIndex );\n\tif ( str === '' || search === '' || replacement === '' || idx < 0 ) {\n\t\treturn str;\n\t}\n\treturn str.substring( 0, idx + search.length ) + replacement;\n}\n\n\n// EXPORTS //\n\nexport default replaceAfter;\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// MAIN //\n\n/**\n* Replaces the substring after the last occurrence of a specified search string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {string} replacement - replacement string\n* @param {integer} fromIndex - index from which to start searching\n* @returns {string} string\n*\n* @example\n* var str = 'beep boop';\n* var out = replaceAfterLast( str, ' ', 'foo', str.length );\n* // returns 'beep foo'\n*\n* @example\n* var str = 'beep boop';\n* var out = replaceAfterLast( str, 'p', 'foo', str.length );\n* // returns 'beep boopfoo'\n*\n* @example\n* var str = 'Hello World!';\n* var out = replaceAfterLast( str, '', 'foo', str.length );\n* // returns 'Hello World!'\n*\n* @example\n* var str = 'Hello World!';\n* var out = replaceAfterLast( str, 'xyz', 'foo', str.length );\n* // returns 'Hello World!'\n*\n* @example\n* var str = 'beep boop baz';\n* var out = replaceAfterLast( str, 'p b', 'foo', str.length );\n* // returns 'beep boop bfoo'\n*\n* @example\n* var str = 'beep boop baz';\n* var out = replaceAfterLast( str, 'p b', 'foo', 6 );\n* // returns 'beep bfoo'\n*/\nfunction replaceAfterLast( str, search, replacement, fromIndex ) {\n\tvar idx;\n\tif ( fromIndex < 0 ) {\n\t\tfromIndex += str.length;\n\t\tif ( fromIndex < 0 ) {\n\t\t\treturn str;\n\t\t}\n\t}\n\tidx = str.lastIndexOf( search, fromIndex );\n\tif ( str === '' || search === '' || replacement === '' || idx < 0 ) {\n\t\treturn str;\n\t}\n\treturn str.substring( 0, idx + search.length ) + replacement;\n}\n\n\n// EXPORTS //\n\nexport default replaceAfterLast;\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// MAIN //\n\n/**\n* Replaces the substring before the last occurrence of a specified search string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {string} replacement - replacement string\n* @param {integer} fromIndex - index from which to start searching\n* @returns {string} string\n*\n* @example\n* var str = 'beep boop';\n* var out = replaceBeforeLast( str, ' ', 'foo', str.length );\n* // returns 'foo boop'\n*\n* @example\n* var str = 'beep boop';\n* var out = replaceBeforeLast( str, 'p', 'foo', str.length );\n* // returns 'foop'\n*\n* @example\n* var str = 'Hello World!';\n* var out = replaceBeforeLast( str, '', 'foo', str.length );\n* // returns 'Hello World!'\n*\n* @example\n* var str = 'Hello World!';\n* var out = replaceBeforeLast( str, 'xyz', 'foo', str.length );\n* // returns 'Hello World!'\n*\n* @example\n* var str = 'beep boop baz';\n* var out = replaceBeforeLast( str, 'p b', 'foo', str.length );\n* // returns 'foop baz'\n*\n* @example\n* var str = 'beep boop baz';\n* var out = replaceBeforeLast( str, 'p b', 'foo', 6 );\n* // returns 'foop boop baz'\n*/\nfunction replaceBeforeLast( str, search, replacement, fromIndex ) {\n\tvar idx;\n\tif ( fromIndex < 0 ) {\n\t\tfromIndex += str.length;\n\t\tif ( fromIndex < 0 ) {\n\t\t\treturn str;\n\t\t}\n\t}\n\tidx = str.lastIndexOf( search, fromIndex );\n\tif ( str === '' || search === '' || replacement === '' || idx < 0 ) {\n\t\treturn str;\n\t}\n\treturn replacement + str.substring( idx );\n}\n\n\n// EXPORTS //\n\nexport default replaceBeforeLast;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\nimport numGraphemeClusters from './../../../num-grapheme-clusters';\nimport max from '@stdlib/math/base/special/fast/max';\n\n\n// MAIN //\n\n/**\n* Slices a string based on grapheme cluster (i.e., user-perceived character) indices.\n*\n* @param {string} str - input string\n* @param {integer} start - the `ith` grapheme cluster to start a slice (inclusive)\n* @param {integer} end - the `jth` grapheme cluster to end a slice (exclusive)\n* @returns {string} output string\n*\n* @example\n* var out = sliceGraphemeClusters( 'Hello World', 0, 5 );\n* // returns 'Hello'\n*\n* out = sliceGraphemeClusters( '👋👋👋', 0, 2 );\n* // returns '👋👋'\n*\n* out = sliceGraphemeClusters( 'अनुच्छेद', 1, 3 );\n* // returns 'नुच्'\n*\n* out = sliceGraphemeClusters( 'Hello World', -5, -1 );\n* // returns 'Worl'\n*/\nfunction sliceGraphemeClusters( str, start, end ) {\n\tvar numClusters;\n\tvar result;\n\tvar idx;\n\tvar brk;\n\tvar i;\n\n\tif ( str === '' ) {\n\t\treturn '';\n\t}\n\tnumClusters = numGraphemeClusters( str );\n\tif ( start < 0 ) {\n\t\tstart = max( start + numClusters, 0 );\n\t}\n\tif ( end < 0 ) {\n\t\tend = max( end + numClusters, 0 );\n\t}\n\tif ( start >= numClusters || start >= end ) {\n\t\treturn '';\n\t}\n\tif ( end > numClusters ) {\n\t\tend = numClusters;\n\t}\n\tresult = '';\n\tidx = 0;\n\ti = 0;\n\twhile ( idx < str.length ) {\n\t\tbrk = nextGraphemeClusterBreak( str, idx );\n\t\tif ( brk === -1 ) {\n\t\t\tbrk = str.length;\n\t\t}\n\t\tif ( i >= start && i < end ) {\n\t\t\tresult += str.substring( idx, brk );\n\t\t}\n\t\tidx = brk;\n\t\ti += 1;\n\t\tif ( i >= end ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn result;\n}\n\n\n// EXPORTS //\n\nexport default sliceGraphemeClusters;\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 bernoulli from '@stdlib/random/base/bernoulli';\n\n\n// MAIN //\n\n/**\n* Converts a string to \"sticky caps\" case.\n*\n* @param {string} str - input string\n* @param {number} [p=0.5] - probability of capitalization (between 0 and 1)\n* @returns {string} converted string\n*\n* @example\n* var str = stickycase( 'hello world' );\n* // returns \n*\n* @example\n* var str = stickycase( 'hello world', 0.2 );\n* // returns \n*\n* @example\n* var str = stickycase( 'hello world', 0.8 );\n* // returns \n*\n* @example\n* var str = stickycase( 'hello world', '0.5' );\n* // returns \n*/\nfunction stickycase( str, p ) {\n\tvar result = '';\n\tvar char;\n\tvar i;\n\tp = ( typeof p === 'number' && p >= 0 && p <= 1 ) ? p : 0.5;\n\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tchar = str.charAt( i );\n\t\tif ( bernoulli( p ) ) {\n\t\t\tchar = char.toUpperCase();\n\t\t} else {\n\t\t\tchar = char.toLowerCase();\n\t\t}\n\t\tresult += char;\n\t}\n\treturn result;\n}\n\n\n// EXPORTS //\n\nexport default stickycase;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isOdd from '@stdlib/math/base/assert/is-odd';\nimport round from '@stdlib/math/base/special/round';\n\n\n// MAIN //\n\n/**\n* Truncates the middle UTF-16 code units of a string to return a string having a specified length.\n*\n* @param {string} str - input string\n* @param {integer} len - output string length (including sequence)\n* @param {string} seq - custom replacement sequence\n* @returns {string} truncated string\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 5, '...' );\n* // returns 'b...p'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 5, '>>>' );\n* // returns 'b>>>p'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 10, '...' );\n* // returns 'beep boop'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 0, '...' );\n* // returns ''\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 2, '...' );\n* // returns '..'\n*/\nfunction truncateMiddle( str, len, seq ) {\n\tvar finalLength;\n\tvar seqLength;\n\tvar strLength;\n\tvar seqStart;\n\tvar seqEnd;\n\n\tseqLength = seq.length;\n\tstrLength = str.length;\n\tif ( len > strLength ) {\n\t\treturn str;\n\t}\n\tfinalLength = len - seqLength;\n\tif ( finalLength < 0 ) {\n\t\treturn seq.slice( 0, len );\n\t}\n\n\tseqStart = round( finalLength / 2 );\n\tseqEnd = ( isOdd( finalLength ) ) ? seqStart-1 : seqStart;\n\tseqEnd = strLength - seqEnd;\n\n\treturn str.substring( 0, seqStart ) + seq + str.substring( seqEnd );\n}\n\n\n// EXPORTS //\n\nexport default truncateMiddle;\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 isEven from './../../../../base/assert/is-even';\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an odd number.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an odd number\n*\n* @example\n* var bool = isOdd( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isOdd( -2.0 );\n* // returns false\n*\n* @example\n* var bool = isOdd( 0.0 );\n* // returns false\n*\n* @example\n* var bool = isOdd( NaN );\n* // returns false\n*/\nfunction isOdd( x ) {\n\t// Check sign to prevent overflow...\n\tif ( x > 0.0 ) {\n\t\treturn isEven( x-1.0 );\n\t}\n\treturn isEven( x+1.0 );\n}\n\n\n// EXPORTS //\n\nexport default isOdd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport firstCodeUnit from './../../base/first';\nimport firstCodePoint from './../../base/first-code-point';\nimport firstGraphemeCluster from './../../base/first-grapheme-cluster';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': firstGraphemeCluster,\n\t'code_point': firstCodePoint,\n\t'code_unit': firstCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Returns the first character(s) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} [n=1] - number of characters to return\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" to return (must be either `grapheme`, `code_point`, or `code_unit`)\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} output string\n*\n* @example\n* var out = first( 'last man standing' );\n* // returns 'l'\n*\n* @example\n* var out = first( 'presidential election' );\n* // returns 'p'\n*\n* @example\n* var out = first( 'javaScript' );\n* // returns 'j'\n*\n* @example\n* var out = first( 'Hidden Treasures' );\n* // returns 'H'\n*\n* @example\n* var out = first( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐶🐮'\n*\n* @example\n* var out = first( 'foo bar', 5 );\n* // returns 'foo b'\n*/\nfunction first( str ) {\n\tvar options;\n\tvar nargs;\n\tvar opts;\n\tvar n;\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\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs === 1 ) {\n\t\tn = 1;\n\t} else if ( nargs === 2 ) {\n\t\tn = arguments[ 1 ];\n\t\tif ( isPlainObject( n ) ) {\n\t\t\toptions = n;\n\t\t\tn = 1;\n\t\t} else if ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t} else { // nargs > 2\n\t\tn = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t\toptions = arguments[ 2 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn FCNS[ opts.mode ]( str, n );\n}\n\n\n// EXPORTS //\n\nexport default first;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFunction from '@stdlib/assert/is-function';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport forEachCodeUnit from './../../base/for-each';\nimport forEachCodePoint from './../../base/for-each-code-point';\nimport forEachGraphemeCluster from './../../base/for-each-grapheme-cluster';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': forEachGraphemeCluster,\n\t'code_point': forEachCodePoint,\n\t'code_unit': forEachCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Invokes a function for each character in a string.\n*\n* @param {string} str - input string\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" over which to iterate (must be either `grapheme`, `code_point`, or `code_unit`)\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} callback argument must be a function\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEach( 'Hello', log );\n*/\nfunction forEach( str, options, clbk ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar opts;\n\tvar cb;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs === 2 ) {\n\t\tcb = options;\n\t\toptions = null;\n\t} else if ( nargs === 3 ) {\n\t\tif ( isPlainObject( options ) ) {\n\t\t\tcb = clbk;\n\t\t} else {\n\t\t\tcb = options;\n\t\t\toptions = null;\n\t\t\tthisArg = clbk;\n\t\t}\n\t} else { // nargs === 4\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t\tcb = clbk;\n\t\tthisArg = arguments[ 3 ];\n\t}\n\tif ( !isFunction( cb ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', cb ) );\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\tFCNS[ opts.mode ]( str, cb, thisArg );\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEach;\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 Unicode code point.\n*\n* @module @stdlib/constants/unicode/max\n* @type {integer32}\n*\n* @example\n* import UNICODE_MAX from '@stdlib/constants/unicode/max';\n* // returns 1114111\n*/\n\n\n// MAIN //\n\n/**\n* Maximum Unicode code point.\n*\n* @constant\n* @type {integer32}\n* @default 1114111\n* @see [Unicode]{@link https://en.wikipedia.org/wiki/Unicode}\n*/\nvar UNICODE_MAX = 0x10FFFF|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default UNICODE_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// MODULES //\n\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport isCollection from '@stdlib/assert/is-collection';\nimport format from './../../format';\nimport UNICODE_MAX from '@stdlib/constants/unicode/max';\nimport UNICODE_MAX_BMP from '@stdlib/constants/unicode/max-bmp';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\n\n// Factor to rescale a code point from a supplementary plane:\nvar Ox10000 = 0x10000|0; // 65536\n\n// Factor added to obtain a high surrogate:\nvar OxD800 = 0xD800|0; // 55296\n\n// Factor added to obtain a low surrogate:\nvar OxDC00 = 0xDC00|0; // 56320\n\n// 10-bit mask: 2^10-1 = 1023 => 0x3ff => 00000000 00000000 00000011 11111111\nvar Ox3FF = 1023|0;\n\n\n// MAIN //\n\n/**\n* Creates a string from a sequence of Unicode code points.\n*\n* ## Notes\n*\n* - UTF-16 encoding uses one 16-bit unit for non-surrogates (U+0000 to U+D7FF and U+E000 to U+FFFF).\n* - UTF-16 encoding uses two 16-bit units (surrogate pairs) for U+10000 to U+10FFFF and encodes U+10000-U+10FFFF by subtracting 0x10000 from the code point, expressing the result as a 20-bit binary, and splitting the 20 bits of 0x0-0xFFFFF as upper and lower 10-bits. The respective 10-bits are stored in two 16-bit words: a high and a low surrogate.\n*\n* @param {...NonNegativeInteger} args - sequence of code points\n* @throws {Error} must provide either an array-like object of code points or one or more code points as separate arguments\n* @throws {TypeError} a code point must be a nonnegative integer\n* @throws {RangeError} must provide a valid Unicode code point\n* @returns {string} created string\n*\n* @example\n* var str = fromCodePoint( 9731 );\n* // returns '☃'\n*/\nfunction fromCodePoint( args ) {\n\tvar len;\n\tvar str;\n\tvar arr;\n\tvar low;\n\tvar hi;\n\tvar pt;\n\tvar i;\n\n\tlen = arguments.length;\n\tif ( len === 1 && isCollection( args ) ) {\n\t\tarr = arguments[ 0 ];\n\t\tlen = arr.length;\n\t} else {\n\t\tarr = [];\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tarr.push( arguments[ i ] );\n\t\t}\n\t}\n\tif ( len === 0 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide either an array of code points or one or more code points as separate arguments.' );\n\t}\n\tstr = '';\n\tfor ( i = 0; i < len; i++ ) {\n\t\tpt = arr[ i ];\n\t\tif ( !isNonNegativeInteger( pt ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide valid code points (i.e., nonnegative integers). Value: `%s`.', pt ) );\n\t\t}\n\t\tif ( pt > UNICODE_MAX ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Must provide a valid code point (i.e., cannot exceed %u). Value: `%s`.', UNICODE_MAX, pt ) );\n\t\t}\n\t\tif ( pt <= UNICODE_MAX_BMP ) {\n\t\t\tstr += fromCharCode( pt );\n\t\t} else {\n\t\t\t// Code point from a supplementary plane. Split into two 16-bit code units (surrogate pair).\n\t\t\tpt -= Ox10000;\n\t\t\thi = (pt >> 10) + OxD800;\n\t\t\tlow = (pt & Ox3FF) + OxDC00;\n\t\t\tstr += fromCharCode( hi, low );\n\t\t}\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default fromCodePoint;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport lastCodeUnit from './../../base/last';\nimport lastCodePoint from './../../base/last-code-point';\nimport lastGraphemeCluster from './../../base/last-grapheme-cluster';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': lastGraphemeCluster,\n\t'code_point': lastCodePoint,\n\t'code_unit': lastCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Returns the last character(s) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} [n=1] - number of characters to return\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" to return (must be either `grapheme`, `code_point`, or `code_unit`)\n* @throws {TypeError} last argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} output string\n*\n* @example\n* var out = last( 'last man standing' );\n* // returns 'g'\n*\n* @example\n* var out = last( 'presidential election' );\n* // returns 'n'\n*\n* @example\n* var out = last( 'javaScript' );\n* // returns 't'\n*\n* @example\n* var out = last( 'Hidden Treasures' );\n* // returns 's'\n*\n* @example\n* var out = last( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐰🐸'\n*\n* @example\n* var out = last( 'foo bar', 3 );\n* // returns 'bar'\n*/\nfunction last( str ) {\n\tvar options;\n\tvar nargs;\n\tvar opts;\n\tvar n;\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\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs === 1 ) {\n\t\tn = 1;\n\t} else if ( nargs === 2 ) {\n\t\tn = arguments[ 1 ];\n\t\tif ( isPlainObject( n ) ) {\n\t\t\toptions = n;\n\t\t\tn = 1;\n\t\t} else if ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t} else { // nargs > 2\n\t\tn = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t\toptions = arguments[ 2 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn FCNS[ opts.mode ]( str, n );\n}\n\n\n// EXPORTS //\n\nexport default last;\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 isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport FLOAT64_MAX_SAFE_INTEGER from '@stdlib/constants/float64/max-safe-integer';\nimport base from './../../base/left-pad';\n\n\n// MAIN //\n\n/**\n* Left pads a string such that the padded string has a length of at least `len`.\n*\n* @param {string} str - string to pad\n* @param {NonNegativeInteger} len - minimum string length\n* @param {string} [pad=' '] - string used to pad\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string\n* @throws {RangeError} padding must have a length greater than `0`\n* @returns {string} padded string\n*\n* @example\n* var str = lpad( 'a', 5 );\n* // returns ' a'\n*\n* @example\n* var str = lpad( 'beep', 10, 'b' );\n* // returns 'bbbbbbbeep'\n*\n* @example\n* var str = lpad( 'boop', 12, 'beep' );\n* // returns 'beepbeepboop'\n*/\nfunction lpad( str, len, pad ) {\n\tvar p;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( len ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tp = pad;\n\t\tif ( !isString( p ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', p ) );\n\t\t}\n\t\tif ( p.length === 0 ) {\n\t\t\tthrow new RangeError( 'invalid argument. Third argument must not be an empty string.' );\n\t\t}\n\t} else {\n\t\tp = ' ';\n\t}\n\tif ( len > FLOAT64_MAX_SAFE_INTEGER ) {\n\t\tthrow new RangeError( format( 'invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.', len ) );\n\t}\n\treturn base( str, len, p );\n}\n\n\n// EXPORTS //\n\nexport default lpad;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport nextGraphemeClusterBreak from './../../next-grapheme-cluster-break';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Splits a string by its grapheme cluster breaks.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string primitive\n* @returns {StringArray} array of grapheme clusters\n*\n* @example\n* var out = splitGraphemeClusters( 'café' );\n* // returns [ 'c', 'a', 'f', 'é' ]\n*\n* @example\n* var out = splitGraphemeClusters( '🍕🍕🍕' );\n* // returns [ '🍕', '🍕', '🍕' ]\n*/\nfunction splitGraphemeClusters( str ) {\n\tvar idx;\n\tvar brk;\n\tvar out;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tidx = 0;\n\tout = [];\n\tif ( str.length === 0 ) {\n\t\treturn out;\n\t}\n\tbrk = nextGraphemeClusterBreak( str, idx );\n\twhile ( brk !== -1 ) {\n\t\tout.push( str.substring( idx, brk ) );\n\t\tidx = brk;\n\t\tbrk = nextGraphemeClusterBreak( str, idx );\n\t}\n\tout.push( str.substring( idx ) );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default splitGraphemeClusters;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Returns the position of the next Unicode code point in a string after a specified position.\n*\n* @param {string} str - input string\n* @param {integer} [fromIndex=0] - position\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} position of the next Unicode code point\n*\n* @example\n* var out = nextCodePointIndex( 'last man standing', 4 );\n* // returns 5\n*\n* @example\n* var out = nextCodePointIndex( 'presidential election', 8 );\n* // returns 9\n*\n* @example\n* var out = nextCodePointIndex( '𐒻𐓟𐒻𐓟', 0 );\n* // returns 2\n*\n* @example\n* var out = nextCodePointIndex( '🌷' );\n* // returns -1\n*/\nfunction nextCodePointIndex( str, fromIndex ) {\n\tvar lastIndex;\n\tvar len;\n\tvar idx;\n\tvar i;\n\tvar j;\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\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\tidx = fromIndex;\n\t} else {\n\t\tidx = 0;\n\t}\n\tlen = str.length;\n\tif ( idx < 0 ) {\n\t\tidx += len;\n\t\tif ( idx < 0 ) {\n\t\t\tidx = 0;\n\t\t}\n\t}\n\tlastIndex = len - 1;\n\tif ( idx >= lastIndex ) {\n\t\treturn -1;\n\t}\n\n\t// Check for a high UTF-16 surrogate...\n\ti = idx + 1;\n\tj = i + 1;\n\tif ( RE_UTF16_HIGH_SURROGATE.test( str[ idx ] ) ) {\n\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\tif ( RE_UTF16_LOW_SURROGATE.test( str[ i ] ) ) {\n\t\t\t// We found a surrogate pair:\n\t\t\treturn ( j >= lastIndex ) ? -1 : j;\n\t\t}\n\t\treturn i;\n\t}\n\treturn i;\n}\n\n\n// EXPORTS //\n\nexport default nextCodePointIndex;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable @cspell/spellchecker */\n\n'use strict';\n\n// MODULES //\n\nimport floor from '@stdlib/math/base/special/floor';\nimport endsWith from './../../base/ends-with';\nimport UNITS from './units.json';\n\n\n// VARIABLES //\n\nvar ONES = [ 'null', 'eins', 'zwei', 'drei', 'vier', 'fünf', 'sechs', 'sieben', 'acht', 'neun', 'zehn', 'elf', 'zwölf', 'dreizehn', 'vierzehn', 'fünfzehn', 'sechzehn', 'siebzehn', 'achtzehn', 'neunzehn' ];\nvar TENS = [ 'null', 'zehn', 'zwanzig', 'dreißig', 'vierzig', 'fünfzig', 'sechzig', 'siebzig', 'achtzig', 'neunzig' ];\n\n\n// FUNCTIONS //\n\n/**\n* Pluralizes a word by adding a 'n' or 'en' suffix.\n*\n* @private\n* @param {string} word - word to pluralize\n* @returns {string} pluralized word\n*/\nfunction pluralize( word ) {\n\tif ( endsWith( word, 'e' ) ) {\n\t\treturn word + 'n';\n\t}\n\treturn word + 'en';\n}\n\n\n// MAIN //\n\n/**\n* Converts a number to a word representation in German.\n*\n* @private\n* @param {number} num - number to convert\n* @param {string} out - output string\n* @returns {string} word representation\n*\n* @example\n* var words = int2wordsDE( 1243, '' );\n* // returns 'eintausendzweihundertdreiundvierzig'\n*\n* @example\n* var words = int2wordsDE( 387, '' );\n* // returns 'dreihundertsiebenundachtzig'\n*\n* @example\n* var words = int2wordsDE( 100, '' );\n* // returns 'einhundert'\n*\n* @example\n* var words = int2wordsDE( 1421, '' );\n* // returns 'eintausendvierhunderteinundzwanzig'\n*\n* @example\n* var words = int2wordsDE( 100381, '' );\n* // returns 'einhunderttausenddreihunderteinundachtzig'\n*\n* @example\n* var words = int2wordsDE( -13, '' );\n* // returns 'minus dreizehn'\n*/\nfunction int2wordsDE( num, out ) {\n\tvar word;\n\tvar rem;\n\tvar i;\n\tif ( num === 0 ) {\n\t\t// Case: We have reached the end of the number and the number is zero.\n\t\treturn out || 'null';\n\t}\n\tif ( num < 0 ) {\n\t\tout += 'minus ';\n\t\tnum *= -1;\n\t}\n\tif ( num < 20 ) {\n\t\trem = 0;\n\t\tif ( num === 1 && out.length === 0 ) {\n\t\t\tword = 'ein';\n\t\t} else {\n\t\t\tword = ONES[ num ];\n\t\t}\n\t}\n\telse if ( num < 100 ) {\n\t\trem = num % 10;\n\t\tword = TENS[ floor( num / 10 ) ];\n\t\tif ( rem ) {\n\t\t\tword = ( ( rem === 1 ) ? 'ein' : ONES[ rem ] ) + 'und' + word;\n\t\t\trem = 0;\n\t\t}\n\t}\n\telse if ( num < 1e3 ) {\n\t\trem = num % 100;\n\t\tword = int2wordsDE( floor( num / 100 ), '' ) + 'hundert';\n\t}\n\telse if ( num < 1e6 ) {\n\t\trem = num % 1e3;\n\t\tword = int2wordsDE( floor( num / 1e3 ), '' ) + 'tausend';\n\t}\n\telse {\n\t\tfor ( i = 5; i < UNITS.length; i++ ) {\n\t\t\tif ( num < UNITS[ i ].VAL ) {\n\t\t\t\trem = num % UNITS[ i-1 ].VAL;\n\t\t\t\tif ( floor( num / UNITS[ i-1 ].VAL ) === 1 ) {\n\t\t\t\t\tword = 'eine ' + UNITS[ i-1 ].DE;\n\t\t\t\t} else {\n\t\t\t\t\tword = int2wordsDE( floor( num / UNITS[ i-1 ].VAL ), '' ) + ' ' + pluralize( UNITS[ i-1 ].DE );\n\t\t\t\t}\n\t\t\t\tif ( rem ) {\n\t\t\t\t\tword += ' ';\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tout += word;\n\treturn int2wordsDE( rem, out );\n}\n\n\n// EXPORTS //\n\nexport default int2wordsDE;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport floor from '@stdlib/math/base/special/floor';\nimport UNITS from './units.json';\n\n\n// VARIABLES //\n\nvar ONES = [ 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen' ];\nvar TENS = [ 'zero', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety' ];\n\n\n// MAIN //\n\n/**\n* Converts a number to a word representation in English.\n*\n* @private\n* @param {number} num - number to convert\n* @param {string} out - output string\n* @returns {string} word representation\n*\n* @example\n* var words = int2wordsEN( 1234, '' );\n* // returns 'one thousand two hundred thirty-four'\n*\n* @example\n* var words = int2wordsEN( -129, '' );\n* // returns 'minus one hundred twenty-nine'\n*\n* @example\n* var words = int2wordsEN( 0, '' );\n* // returns 'zero'\n*/\nfunction int2wordsEN( num, out ) {\n\tvar word;\n\tvar rem;\n\tvar i;\n\tif ( num === 0 ) {\n\t\t// Case: We have reached the end of the number and the number is zero.\n\t\treturn out || 'zero';\n\t}\n\tif ( num < 0 ) {\n\t\tout += 'minus';\n\t\tnum *= -1;\n\t}\n\tif ( num < 20 ) {\n\t\trem = 0;\n\t\tword = ONES[ num ];\n\t}\n\telse if ( num < 100 ) {\n\t\trem = num % 10;\n\t\tword = TENS[ floor( num / 10 ) ];\n\t\tif ( rem > 0 ) {\n\t\t\tword += '-' + ONES[ rem ];\n\t\t\trem = 0;\n\t\t}\n\t}\n\telse {\n\t\tfor ( i = 3; i < UNITS.length - 1; i++ ) {\n\t\t\tif ( num < UNITS[ i ].VAL ) {\n\t\t\t\trem = num % UNITS[ i-1 ].VAL;\n\t\t\t\tword = int2wordsEN( floor( num / UNITS[ i-1 ].VAL ), '' ) + ' ' + UNITS[ i-1 ].EN;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ( i === UNITS.length - 1 ) {\n\t\t\trem = num % UNITS[ i-1 ].VAL;\n\t\t\tword = int2wordsEN( floor( num / UNITS[ i-1 ].VAL ), '' ) + ' ' + UNITS[ i-1 ].EN;\n\t\t}\n\t}\n\tif ( out.length > 0 ) {\n\t\tout += ' ';\n\t}\n\tout += word;\n\treturn int2wordsEN( rem, out );\n}\n\n\n// EXPORTS //\n\nexport default int2wordsEN;\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 './../../is-number';\nimport isNan from '@stdlib/math/base/assert/is-nan';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `NaN` number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `NaN` number primitive\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 './../../is-number';\nimport isNan from '@stdlib/math/base/assert/is-nan';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value of `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value of `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( null );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 `NaN`.\n*\n* @module @stdlib/assert/is-nan\n*\n* @example\n* import isnan from '@stdlib/assert/is-nan';\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isnan } from '@stdlib/assert/is-nan';\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns false\n*\n* @example\n* import { isObject as isnan } from '@stdlib/assert/is-nan';\n*\n* var bool = isnan( NaN );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\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) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport indexOf from '@stdlib/utils/index-of';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar LANGUAGE_CODES = [ 'en', 'de' ];\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.lang] - language code\n* @returns {(null|Error)} error object or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'lang': 'es'\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isPlainObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'lang' ) ) {\n\t\topts.lang = options.lang;\n\t\tif ( indexOf( LANGUAGE_CODES, opts.lang ) === -1 ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'lang', LANGUAGE_CODES.join( '\", \"' ), opts.lang ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\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 isnan from '@stdlib/assert/is-nan';\nimport isCollection from '@stdlib/assert/is-collection';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @param {ArrayLike} arr - array-like object\n* @param {*} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (if negative, the start index is determined relative to last element)\n* @throws {TypeError} must provide an array-like object\n* @throws {TypeError} third argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 5 );\n* // returns -1\n*\n* @example\n* // Using a `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* @example\n* // `fromIndex` which exceeds `array` length:\n* var arr = [ 1, 2, 3, 4, 2, 5 ];\n* var idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* @example\n* // Negative `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* var idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* @example\n* // Negative `fromIndex` exceeding input `array` length:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* @example\n* // Array-like objects:\n* var str = 'bebop';\n* var idx = indexOf( str, 'o' );\n* // returns 3\n*/\nfunction indexOf( arr, searchElement, fromIndex ) {\n\tvar len;\n\tvar i;\n\tif ( !isCollection( arr ) && !isString( arr ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', arr ) );\n\t}\n\tlen = arr.length;\n\tif ( len === 0 ) {\n\t\treturn -1;\n\t}\n\tif ( arguments.length === 3 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex >= 0 ) {\n\t\t\tif ( fromIndex >= len ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ti = fromIndex;\n\t\t} else {\n\t\t\ti = len + fromIndex;\n\t\t\tif ( i < 0 ) {\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\ti = 0;\n\t}\n\t// Check for `NaN`...\n\tif ( isnan( searchElement ) ) {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( isnan( arr[i] ) ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( arr[ i ] === searchElement ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nexport default indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Processes a string of decimal numbers and applies a function mapping decimal numbers to words to each character.\n*\n* @private\n* @param {string} x - string of decimal numbers\n* @param {Function} fcn - function mapping decimal numbers to words\n* @returns {string} string of words\n*/\nfunction decimals( x, fcn ) {\n\tvar out;\n\tvar len;\n\tvar i;\n\n\tlen = x.length;\n\tout = '';\n\tfor ( i = 0; i < len; i++ ) {\n\t\tout += fcn( x[ i ], '' );\n\t\tif ( i < len-1 ) {\n\t\t\tout += ' ';\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default decimals;\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 isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/repeat';\n\n\n// MAIN //\n\n/**\n* Repeats a string a specified number of times and returns the concatenated result.\n*\n* @param {string} str - string to repeat\n* @param {NonNegativeInteger} n - number of times to repeat the string\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} output string length must not exceed maximum allowed string length\n* @returns {string} repeated string\n*\n* @example\n* var str = repeat( 'a', 5 );\n* // returns 'aaaaa'\n*\n* @example\n* var str = repeat( '', 100 );\n* // returns ''\n*\n* @example\n* var str = repeat( 'beep', 0 );\n* // returns ''\n*/\nfunction repeat( str, 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\tif ( !isNonNegativeInteger( n ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t}\n\treturn base( str, n );\n}\n\n\n// EXPORTS //\n\nexport default repeat;\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 isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport FLOAT64_MAX_SAFE_INTEGER from '@stdlib/constants/float64/max-safe-integer';\nimport base from './../../base/right-pad';\n\n\n// MAIN //\n\n/**\n* Right pads a string such that the padded string has a length of at least `len`.\n*\n* @param {string} str - string to pad\n* @param {NonNegativeInteger} len - minimum string length\n* @param {string} [pad=' '] - string used to pad\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string\n* @throws {RangeError} padding must have a length greater than `0`\n* @returns {string} padded string\n*\n* @example\n* var str = rpad( 'a', 5 );\n* // returns 'a '\n*\n* @example\n* var str = rpad( 'beep', 10, 'p' );\n* // returns 'beeppppppp'\n*\n* @example\n* var str = rpad( 'beep', 12, 'boop' );\n* // returns 'beepboopboop'\n*/\nfunction rpad( str, len, pad ) {\n\tvar p;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( len ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tp = pad;\n\t\tif ( !isString( p ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', p ) );\n\t\t}\n\t\tif ( p.length === 0 ) {\n\t\t\tthrow new RangeError( 'invalid argument. Pad string must not be an empty string.' );\n\t\t}\n\t} else {\n\t\tp = ' ';\n\t}\n\tif ( len > FLOAT64_MAX_SAFE_INTEGER ) {\n\t\tthrow new RangeError( format( 'invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.', len ) );\n\t}\n\treturn base( str, len, p );\n}\n\n\n// EXPORTS //\n\nexport default rpad;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isInteger from '@stdlib/assert/is-integer';\nimport codePointAt from './../../code-point-at';\nimport hasUTF16SurrogatePairAt from '@stdlib/assert/has-utf16-surrogate-pair-at';\nimport grapheme from './../../tools/grapheme-cluster-break';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar breakType = grapheme.breakType;\nvar breakProperty = grapheme.breakProperty;\nvar emojiProperty = grapheme.emojiProperty;\n\n\n// MAIN //\n\n/**\n* Returns the previous extended grapheme cluster break in a string before a specified position.\n*\n* @param {string} str - input string\n* @param {integer} [fromIndex=str.length-1] - position\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be an integer\n* @returns {NonNegativeInteger} previous grapheme break position\n*\n* @example\n* var out = prevGraphemeClusterBreak( 'last man standing', 4 );\n* // returns 3\n*\n* @example\n* var out = prevGraphemeClusterBreak( 'presidential election', 8 );\n* // returns 7\n*\n* @example\n* var out = prevGraphemeClusterBreak( 'अनुच्छेद', 2 );\n* // returns 0\n*\n* @example\n* var out = prevGraphemeClusterBreak( '🌷', 1 );\n* // returns -1\n*/\nfunction prevGraphemeClusterBreak( str, fromIndex ) {\n\tvar breaks;\n\tvar emoji;\n\tvar ans;\n\tvar len;\n\tvar idx;\n\tvar cp;\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\tlen = str.length;\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\tidx = fromIndex;\n\t} else {\n\t\tidx = len - 1;\n\t}\n\tif ( len === 0 || idx <= 0 ) {\n\t\treturn -1;\n\t}\n\tif ( idx >= len ) {\n\t\tidx = len - 1;\n\t}\n\n\t// Initialize caches for storing grapheme break and emoji properties:\n\tbreaks = [];\n\temoji = [];\n\n\t// Get the code point for the starting index:\n\tcp = codePointAt( str, 0 );\n\n\t// Get the corresponding grapheme break and emoji properties:\n\tbreaks.push( breakProperty( cp ) );\n\temoji.push( emojiProperty( cp ) );\n\n\tans = -1;\n\tfor ( i = 1; i <= idx; i++ ) {\n\t\t// If the current character is part of a surrogate pair, move along...\n\t\tif ( hasUTF16SurrogatePairAt( str, i-1 ) ) {\n\t\t\tans = i-2;\n\t\t\tbreaks.length = 0;\n\t\t\temoji.length = 0;\n\t\t\tcontinue;\n\t\t}\n\t\tcp = codePointAt( str, i );\n\n\t\t// Get the corresponding grapheme break and emoji properties:\n\t\tbreaks.push( breakProperty( cp ) );\n\t\temoji.push( emojiProperty( cp ) );\n\n\t\t// Determine if we've encountered a grapheme cluster break...\n\t\tif ( breakType( breaks, emoji ) > 0 ) {\n\t\t\tans = i-1;\n\t\t\tbreaks.length = 0;\n\t\t\temoji.length = 0;\n\t\t\tcontinue;\n\t\t}\n\t}\n\treturn ans;\n}\n\n\n// EXPORTS //\n\nexport default prevGraphemeClusterBreak;\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 isString } from '@stdlib/assert/is-string';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport removeFirstCodeUnit from './../../base/remove-first';\nimport removeFirstCodePoint from './../../base/remove-first-code-point';\nimport removeFirstGraphemeCluster from './../../base/remove-first-grapheme-cluster'; // eslint-disable-line id-length\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': removeFirstGraphemeCluster,\n\t'code_point': removeFirstCodePoint,\n\t'code_unit': removeFirstCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Removes the first character(s) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} [n=1] - number of characters to remove\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" to return (must be either `grapheme`, `code_point`, or `code_unit`)\n* @throws {TypeError} must provide a string primitive\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} updated string\n*\n* @example\n* var out = removeFirst( 'last man standing' );\n* // returns 'ast man standing'\n*\n* @example\n* var out = removeFirst( 'presidential election' );\n* // returns 'residential election'\n*\n* @example\n* var out = removeFirst( 'JavaScript' );\n* // returns 'avaScript'\n*\n* @example\n* var out = removeFirst( 'Hidden Treasures' );\n* // returns 'idden Treasures'\n*\n* @example\n* var out = removeFirst( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐷🐰🐸'\n*\n* @example\n* var out = removeFirst( 'foo bar', 4 );\n* // returns 'bar'\n*/\nfunction removeFirst( str ) {\n\tvar options;\n\tvar nargs;\n\tvar opts;\n\tvar n;\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\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs === 1 ) {\n\t\tn = 1;\n\t} else if ( nargs === 2 ) {\n\t\tn = arguments[ 1 ];\n\t\tif ( isPlainObject( n ) ) {\n\t\t\toptions = n;\n\t\t\tn = 1;\n\t\t} else if ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t} else { // nargs > 2\n\t\tn = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t\toptions = arguments[ 2 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn FCNS[ opts.mode ]( str, n );\n}\n\n\n// EXPORTS //\n\nexport default removeFirst;\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 isString } from '@stdlib/assert/is-string';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport removeLastCodeUnit from './../../base/remove-last';\nimport removeLastCodePoint from './../../base/remove-last-code-point';\nimport removeLastGraphemeCluster from './../../base/remove-last-grapheme-cluster';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': removeLastGraphemeCluster,\n\t'code_point': removeLastCodePoint,\n\t'code_unit': removeLastCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Removes the last character(s) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} [n=1] - number of character to remove\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" to return (must be either `grapheme`, `code_point`, or `code_unit`)\n* @throws {TypeError} must provide a string primitive\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} updated string\n*\n* @example\n* var out = removeLast( 'last man standing' );\n* // returns 'last man standin'\n*\n* @example\n* var out = removeLast( 'presidential election' );\n* // returns 'presidential electio'\n*\n* @example\n* var out = removeLast( 'javaScript' );\n* // returns 'javaScrip'\n*\n* @example\n* var out = removeLast( 'Hidden Treasures' );\n* // returns 'Hidden Treasure'\n*\n* @example\n* var out = removeLast( 'leader', 2 );\n* // returns 'lead'\n*/\nfunction removeLast( str ) {\n\tvar options;\n\tvar nargs;\n\tvar opts;\n\tvar n;\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\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs === 1 ) {\n\t\tn = 1;\n\t} else if ( nargs === 2 ) {\n\t\tn = arguments[ 1 ];\n\t\tif ( isPlainObject( n ) ) {\n\t\t\toptions = n;\n\t\t\tn = 1;\n\t\t} else if ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t} else { // nargs > 2\n\t\tn = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t\toptions = arguments[ 2 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn FCNS[ opts.mode ]( str, n );\n}\n\n\n// EXPORTS //\n\nexport default removeLast;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Converts a string to uppercase.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} uppercase string\n*\n* @example\n* var str = uppercase( 'bEEp' );\n* // returns 'BEEP'\n*/\nfunction uppercase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn str.toUpperCase();\n}\n\n\n// EXPORTS //\n\nexport default uppercase;\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 isString } from '@stdlib/assert/is-string';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport reverseCodeUnit from './../../base/reverse';\nimport reverseCodePoints from './../../base/reverse-code-points';\nimport reverseGraphemeClusters from './../../base/reverse-grapheme-clusters';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': reverseGraphemeClusters,\n\t'code_point': reverseCodePoints,\n\t'code_unit': reverseCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Reverses a string.\n*\n* @param {string} str - input string\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" to return (must be either `grapheme`, `code_point`, or `code_unit`)\n* @throws {TypeError} must provide a string primitive\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} reversed string\n*\n* @example\n* var out = reverse( 'last man standing' );\n* // returns 'gnidnats nam tsal'\n*\n* @example\n* var out = reverse( 'presidential election' );\n* // returns 'noitcele laitnediserp'\n*\n* @example\n* var out = reverse( 'javaScript' );\n* // returns 'tpircSavaj'\n*\n* @example\n* var out = reverse( 'Hidden Treasures' );\n* // returns 'serusaerT neddiH'\n*/\nfunction reverse( str ) {\n\tvar options;\n\tvar nargs;\n\tvar opts;\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\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs > 1 ) {\n\t\toptions = arguments[ 1 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn FCNS[ opts.mode ]( str );\n}\n\n\n// EXPORTS //\n\nexport default reverse;\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// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/;\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/;\n\n\n// MAIN //\n\n/**\n* Tests if a string is a well-formed string.\n*\n* @param {string} str - input string\n* @returns {boolean} boolean indicating if a value is a well-formed string primitive\n*\n* @example\n* var bool = isWellFormed( '' );\n* // returns true\n*\n* @example\n* var bool = isWellFormed( new String( '\\uDC00' ) );\n* // returns false\n*/\nfunction isWellFormed( str ) {\n\tvar i;\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\t// Checking if a low surrogate is present at the beginning\n\t\tif ( i === 0 && RE_UTF16_LOW_SURROGATE.test(str[i]) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Checking if a high surrogate is present at the last position\n\t\tif ( i === str.length - 1 && RE_UTF16_HIGH_SURROGATE.test(str[i]) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Checking if there is no low surrogate after a high surrogate\n\t\tif ( i < str.length - 1 && RE_UTF16_HIGH_SURROGATE.test(str[i]) ) {\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test(str[i + 1]) ) {\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t// Checking if there is no high surrogate before a low surrogate\n\t\tif ( i > 0 && RE_UTF16_LOW_SURROGATE.test(str[i]) ) {\n\t\t\tif ( !RE_UTF16_HIGH_SURROGATE.test(str[i - 1]) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// EXPORTS //\n\nexport default isWellFormed;\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 isWellFormed from './iswellformed.js';\n\n\n// MAIN //\n\n/**\n* Tests if a string is a well-formed string primitive.\n*\n* @param {string} str - input string\n* @returns {boolean} boolean indicating if a string is a well-formed string primitive\n*\n* @example\n* var bool = isWellFormedString( '\\uDC00' );\n* // returns false\n*\n* @example\n* var bool = isWellFormedString( new String( '' ) );\n* // returns false\n*/\nfunction isWellFormedString( str ) {\n\treturn (\n\t\ttypeof str === 'string' && isWellFormed( str )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isWellFormedString;\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 isString from './../../is-string';\nimport isWellFormed from './iswellformed.js';\n\n\n// MAIN //\n\n/**\n* Tests if a string is a well-formed string object.\n*\n* @param {string} str - input string\n* @returns {boolean} boolean indicating if a string is a well-formed string object\n*\n* @example\n* var bool = isWellFormedString( '\\uDC00' );\n* // returns false\n*\n* @example\n* var bool = isWellFormedString( new String( '' ) );\n* // returns true\n*/\nfunction isWellFormedString( str ) {\n\treturn (\n\t\tisString.isObject( str ) &&\n\t\tisWellFormed( str.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isWellFormedString;\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 isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a string is well-formed.\n*\n* @param {string} str - input string\n* @returns {boolean} boolean indicating whether a string is well-formed\n*\n* @example\n* var bool = isWellFormedString( '' );\n* // returns true\n*\n* @example\n* var bool = isWellFormedString( new String( '' ) );\n* // returns true\n*\n* @example\n* var bool = isWellFormedString( '\\uDBFF' );\n* // returns false\n*\n* @example\n* var bool = isWellFormedString( '\\uDBFFFF\\uDBFF' );\n* // returns false\n*\n* @example\n* var bool = isWellFormedString( [] );\n* // returns false\n*\n* @example\n* var bool = isWellFormedString( '-5' );\n* // returns true\n*\n* @example\n* var bool = isWellFormedString( null );\n* // returns false\n*/\nfunction isWellFormedString( str ) {\n\treturn ( isPrimitive( str ) || isObject( str ) );\n}\n\n\n// EXPORTS //\n\nexport default isWellFormedString;\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* Test if a string is well-formed.\n*\n* @module @stdlib/assert/is-well-formed-string\n*\n* @example\n* import isWellFormedString from '@stdlib/assert/is-well-formed-string';\n*\n* var bool = isWellFormedString( '' );\n* // returns true\n*\n* bool = isWellFormedString( new String( '' ) );\n* // returns true\n*\n* bool = isWellFormedString( '\\uDBFF' );\n* // returns false\n*\n* bool = isWellFormedString( '\\uDBFFFF\\uDBFF' );\n* // returns false\n*\n* bool = isWellFormedString( [] );\n* // returns false\n*\n* bool = isWellFormedString( '-5' );\n* // returns true\n*\n* bool = isWellFormedString( null );\n* // returns false\n*\n* @example\n* // Use interface to check for well-formed string primitives...\n* import { isPrimitive as isWellFormedString } from '@stdlib/assert/is-well-formed-string';\n*\n* var bool = isWellFormedString( '\\uDC00' );\n* // returns false\n*\n* bool = isWellFormedString( new String( '' ) );\n* // returns false\n*\n* @example\n* // Use interface to check for well-formed string objects...\n* import { isObject as isWellFormedString } from '@stdlib/assert/is-well-formed-string';\n*\n* var bool = isWellFormedString( '\\uDC00' );\n* // returns false\n*\n* bool = isWellFormedString( new String( '' ) );\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) 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 isString from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport isWellFormed from '@stdlib/assert/is-well-formed-string';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/;\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/;\n\n\n// MAIN //\n\n/**\n* Replaces all lone surrogates in order to create a new string which is well formed.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} new string which does not contain any lone surrogates\n*\n* @example\n* var str = str2wellformed( 'ab\\uD800' );\n* // returns 'ab�'\n*/\nfunction str2wellformed( str ) {\n\tvar modifiedString;\n\tvar i;\n\tmodifiedString = '';\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tif ( isWellFormed( str ) ) {\n\t\tfor ( i = 0; i < str.length; i++ ) {\n\t\t\tmodifiedString += str[i];\n\t\t}\n\t\treturn modifiedString;\n\t}\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tif ( RE_UTF16_LOW_SURROGATE.test( str[ i ] ) || RE_UTF16_HIGH_SURROGATE.test( str[ i ] ) ) {\n\t\t\tmodifiedString += '\\uFFFD';\n\t\t}\n\t\telse {\n\t\t\tmodifiedString += str[ i ];\n\t\t}\n\t}\n\treturn modifiedString;\n}\n\n\n// EXPORTS //\n\nexport default str2wellformed;\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* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n/*\n* The following modules are intentionally not exported: tools\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace string\n*/\nvar string = {};\n\n/**\n* @name acronym\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/acronym}\n*/\nimport acronym from './../acronym';\nsetReadOnly( string, 'acronym', acronym );\n\n/**\n* @name base\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base}\n*/\nimport base from './../base';\nsetReadOnly( string, 'base', base );\n\n/**\n* @name camelcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/camelcase}\n*/\nimport camelcase from './../camelcase';\nsetReadOnly( string, 'camelcase', camelcase );\n\n/**\n* @name capitalize\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/capitalize}\n*/\nimport capitalize from './../capitalize';\nsetReadOnly( string, 'capitalize', capitalize );\n\n/**\n* @name codePointAt\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/code-point-at}\n*/\nimport codePointAt from './../code-point-at';\nsetReadOnly( string, 'codePointAt', codePointAt );\n\n/**\n* @name constantcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/constantcase}\n*/\nimport constantcase from './../constantcase';\nsetReadOnly( string, 'constantcase', constantcase );\n\n/**\n* @name dotcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/dotcase}\n*/\nimport dotcase from './../dotcase';\nsetReadOnly( string, 'dotcase', dotcase );\n\n/**\n* @name endsWith\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/ends-with}\n*/\nimport endsWith from './../ends-with';\nsetReadOnly( string, 'endsWith', endsWith );\n\n/**\n* @name first\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/first}\n*/\nimport first from './../first';\nsetReadOnly( string, 'first', first );\n\n/**\n* @name forEach\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/for-each}\n*/\nimport forEach from './../for-each';\nsetReadOnly( string, 'forEach', forEach );\n\n/**\n* @name format\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/format}\n*/\nimport format from './../format';\nsetReadOnly( string, 'format', format );\n\n/**\n* @name fromCodePoint\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/from-code-point}\n*/\nimport fromCodePoint from './../from-code-point';\nsetReadOnly( string, 'fromCodePoint', fromCodePoint );\n\n/**\n* @name headercase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/headercase}\n*/\nimport headercase from './../headercase';\nsetReadOnly( string, 'headercase', headercase );\n\n/**\n* @name kebabcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/kebabcase}\n*/\nimport kebabcase from './../kebabcase';\nsetReadOnly( string, 'kebabcase', kebabcase );\n\n/**\n* @name last\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/last}\n*/\nimport last from './../last';\nsetReadOnly( string, 'last', last );\n\n/**\n* @name lpad\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/left-pad}\n*/\nimport lpad from './../left-pad';\nsetReadOnly( string, 'lpad', lpad );\n\n/**\n* @name ltrim\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/left-trim}\n*/\nimport ltrim from './../left-trim';\nsetReadOnly( string, 'ltrim', ltrim );\n\n/**\n* @name ltrimN\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/left-trim-n}\n*/\nimport ltrimN from './../left-trim-n';\nsetReadOnly( string, 'ltrimN', ltrimN );\n\n/**\n* @name lowercase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/lowercase}\n*/\nimport lowercase from './../lowercase';\nsetReadOnly( string, 'lowercase', lowercase );\n\n/**\n* @name nextCodePointIndex\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/next-code-point-index}\n*/\nimport nextCodePointIndex from './../next-code-point-index';\nsetReadOnly( string, 'nextCodePointIndex', nextCodePointIndex );\n\n/**\n* @name nextGraphemeClusterBreak\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/next-grapheme-cluster-break}\n*/\nimport nextGraphemeClusterBreak from './../next-grapheme-cluster-break';\nsetReadOnly( string, 'nextGraphemeClusterBreak', nextGraphemeClusterBreak );\n\n/**\n* @name numCodePoints\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/num-code-points}\n*/\nimport numCodePoints from './../num-code-points';\nsetReadOnly( string, 'numCodePoints', numCodePoints );\n\n/**\n* @name numGraphemeClusters\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/num-grapheme-clusters}\n*/\nimport numGraphemeClusters from './../num-grapheme-clusters';\nsetReadOnly( string, 'numGraphemeClusters', numGraphemeClusters );\n\n/**\n* @name num2words\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/num2words}\n*/\nimport num2words from './../num2words';\nsetReadOnly( string, 'num2words', num2words );\n\n/**\n* @name pad\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/pad}\n*/\nimport pad from './../pad';\nsetReadOnly( string, 'pad', pad );\n\n/**\n* @name pascalcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/pascalcase}\n*/\nimport pascalcase from './../pascalcase';\nsetReadOnly( string, 'pascalcase', pascalcase );\n\n/**\n* @name percentEncode\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/percent-encode}\n*/\nimport percentEncode from './../percent-encode';\nsetReadOnly( string, 'percentEncode', percentEncode );\n\n/**\n* @name prevGraphemeClusterBreak\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/prev-grapheme-cluster-break}\n*/\nimport prevGraphemeClusterBreak from './../prev-grapheme-cluster-break';\nsetReadOnly( string, 'prevGraphemeClusterBreak', prevGraphemeClusterBreak );\n\n/**\n* @name removeFirst\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/remove-first}\n*/\nimport removeFirst from './../remove-first';\nsetReadOnly( string, 'removeFirst', removeFirst );\n\n/**\n* @name removeLast\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/remove-last}\n*/\nimport removeLast from './../remove-last';\nsetReadOnly( string, 'removeLast', removeLast );\n\n/**\n* @name removePunctuation\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/remove-punctuation}\n*/\nimport removePunctuation from './../remove-punctuation';\nsetReadOnly( string, 'removePunctuation', removePunctuation );\n\n/**\n* @name removeUTF8BOM\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/remove-utf8-bom}\n*/\nimport removeUTF8BOM from './../remove-utf8-bom';\nsetReadOnly( string, 'removeUTF8BOM', removeUTF8BOM );\n\n/**\n* @name removeWords\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/remove-words}\n*/\nimport removeWords from './../remove-words';\nsetReadOnly( string, 'removeWords', removeWords );\n\n/**\n* @name repeat\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/repeat}\n*/\nimport repeat from './../repeat';\nsetReadOnly( string, 'repeat', repeat );\n\n/**\n* @name replace\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/replace}\n*/\nimport replace from './../replace';\nsetReadOnly( string, 'replace', replace );\n\n/**\n* @name replaceBefore\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/replace-before}\n*/\nimport replaceBefore from './../replace-before';\nsetReadOnly( string, 'replaceBefore', replaceBefore );\n\n/**\n* @name reverse\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/reverse}\n*/\nimport reverse from './../reverse';\nsetReadOnly( string, 'reverse', reverse );\n\n/**\n* @name rpad\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/right-pad}\n*/\nimport rpad from './../right-pad';\nsetReadOnly( string, 'rpad', rpad );\n\n/**\n* @name rtrim\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/right-trim}\n*/\nimport rtrim from './../right-trim';\nsetReadOnly( string, 'rtrim', rtrim );\n\n/**\n* @name rtrimN\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/right-trim-n}\n*/\nimport rtrimN from './../right-trim-n';\nsetReadOnly( string, 'rtrimN', rtrimN );\n\n/**\n* @name snakecase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/snakecase}\n*/\nimport snakecase from './../snakecase';\nsetReadOnly( string, 'snakecase', snakecase );\n\n/**\n* @name splitGraphemeClusters\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/split-grapheme-clusters}\n*/\nimport splitGraphemeClusters from './../split-grapheme-clusters';\nsetReadOnly( string, 'splitGraphemeClusters', splitGraphemeClusters );\n\n/**\n* @name startcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/startcase}\n*/\nimport startcase from './../startcase';\nsetReadOnly( string, 'startcase', startcase );\n\n/**\n* @name startsWith\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/starts-with}\n*/\nimport startsWith from './../starts-with';\nsetReadOnly( string, 'startsWith', startsWith );\n\n/**\n* @name substringAfter\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/substring-after}\n*/\nimport substringAfter from './../substring-after';\nsetReadOnly( string, 'substringAfter', substringAfter );\n\n/**\n* @name substringAfterLast\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/substring-after-last}\n*/\nimport substringAfterLast from './../substring-after-last';\nsetReadOnly( string, 'substringAfterLast', substringAfterLast );\n\n/**\n* @name substringBefore\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/substring-before}\n*/\nimport substringBefore from './../substring-before';\nsetReadOnly( string, 'substringBefore', substringBefore );\n\n/**\n* @name substringBeforeLast\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/substring-before-last}\n*/\nimport substringBeforeLast from './../substring-before-last';\nsetReadOnly( string, 'substringBeforeLast', substringBeforeLast );\n\n/**\n* @name graphemeClusters2iterator\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/to-grapheme-cluster-iterator}\n*/\nimport graphemeClusters2iterator from './../to-grapheme-cluster-iterator';\nsetReadOnly( string, 'graphemeClusters2iterator', graphemeClusters2iterator );\n\n/**\n* @name graphemeClusters2iteratorRight\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/to-grapheme-cluster-iterator-right}\n*/\nimport graphemeClusters2iteratorRight from './../to-grapheme-cluster-iterator-right';\nsetReadOnly( string, 'graphemeClusters2iteratorRight', graphemeClusters2iteratorRight );\n\n/**\n* @name toWellFormed\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/to-well-formed}\n*/\nimport toWellFormed from './../to-well-formed';\nsetReadOnly( string, 'toWellFormed', toWellFormed );\n\n/**\n* @name trim\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/trim}\n*/\nimport trim from './../trim';\nsetReadOnly( string, 'trim', trim );\n\n/**\n* @name truncate\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/truncate}\n*/\nimport truncate from './../truncate';\nsetReadOnly( string, 'truncate', truncate );\n\n/**\n* @name truncateMiddle\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/truncate-middle}\n*/\nimport truncateMiddle from './../truncate-middle';\nsetReadOnly( string, 'truncateMiddle', truncateMiddle );\n\n/**\n* @name uncapitalize\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/uncapitalize}\n*/\nimport uncapitalize from './../uncapitalize';\nsetReadOnly( string, 'uncapitalize', uncapitalize );\n\n/**\n* @name uppercase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/uppercase}\n*/\nimport uppercase from './../uppercase';\nsetReadOnly( string, 'uppercase', uppercase );\n\n/**\n* @name utf16ToUTF8Array\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/utf16-to-utf8-array}\n*/\nimport utf16ToUTF8Array from './../utf16-to-utf8-array';\nsetReadOnly( string, 'utf16ToUTF8Array', utf16ToUTF8Array );\n\n\n// EXPORTS //\n\nexport default string;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/camelcase';\n\n\n// MAIN //\n\n/**\n* Converts a string to camel case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} camel-cased string\n*\n* @example\n* var out = camelcase( 'foo bar' );\n* // returns 'fooBar'\n*\n* @example\n* var out = camelcase( 'IS_MOBILE' );\n* // returns 'isMobile'\n*\n* @example\n* var out = camelcase( 'Hello World!' );\n* // returns 'helloWorld'\n*\n* @example\n* var out = camelcase( '--foo-bar--' );\n* // returns 'fooBar'\n*/\nfunction camelcase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default camelcase;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/capitalize';\n\n\n// MAIN //\n\n/**\n* Capitalizes the first character in a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {string} capitalized string\n*\n* @example\n* var out = capitalize( 'last man standing' );\n* // returns 'Last man standing'\n*\n* @example\n* var out = capitalize( 'presidential election' );\n* // returns 'Presidential election'\n*\n* @example\n* var out = capitalize( 'javaScript' );\n* // returns 'JavaScript'\n*\n* @example\n* var out = capitalize( 'Hidden Treasures' );\n* // returns 'Hidden Treasures'\n*/\nfunction capitalize( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default capitalize;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/constantcase';\n\n\n// MAIN //\n\n/**\n* Converts a string to constant case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} constant-cased string\n*\n* @example\n* var str = constantcase( 'beep' );\n* // returns 'BEEP'\n*\n* @example\n* var str = constantcase( 'beep boop' );\n* // returns 'BEEP_BOOP'\n*\n* @example\n* var str = constantcase( 'isMobile' );\n* // returns 'IS_MOBILE'\n*\n* @example\n* var str = constantcase( 'Hello World!' );\n* // returns 'HELLO_WORLD'\n*/\nfunction constantcase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default constantcase;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/dotcase';\n\n\n// MAIN //\n\n/**\n* Converts a string to dot case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} dot-cased string\n*\n* @example\n* var out = dotcase( 'foo bar' );\n* // returns 'foo.bar'\n*\n* @example\n* var out = dotcase( 'IS_MOBILE' );\n* // returns 'is.mobile'\n*\n* @example\n* var out = dotcase( 'Hello World!' );\n* // returns 'hello.world'\n*\n* @example\n* var out = dotcase( '--foo-bar--' );\n* // returns 'foo.bar'\n*/\nfunction dotcase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default dotcase;\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';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/ends-with';\n\n\n// MAIN //\n\n/**\n* Test if a string ends with the characters of another string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} [len=str.length] - substring length\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} third argument must be an integer\n* @returns {boolean} boolean indicating if the input string ends with the search string\n*\n* @example\n* var bool = endsWith( 'Remember the story I used to tell you when you were a boy?', 'boy?' );\n* // returns true\n*\n* @example\n* var bool = endsWith( 'Remember the story I used to tell you when you were a boy?', 'Boy?' );\n* // returns false\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be' );\n* // returns false\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 );\n* // returns true\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 );\n* // returns true\n*/\nfunction endsWith( str, search, len ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isInteger( len ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', len ) );\n\t\t}\n\t} else {\n\t\tlen = str.length;\n\t}\n\treturn base( str, search, len );\n}\n\n\n// EXPORTS //\n\nexport default endsWith;\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 Unicode code point in the Basic Multilingual Plane (BMP).\n*\n* @module @stdlib/constants/unicode/max-bmp\n* @type {integer32}\n*\n* @example\n* import UNICODE_MAX_BMP from '@stdlib/constants/unicode/max-bmp';\n* // returns 65535\n*/\n\n\n// MAIN //\n\n/**\n* Maximum Unicode code point in the Basic Multilingual Plane (BMP).\n*\n* @constant\n* @type {integer32}\n* @default 65535\n* @see [Unicode]{@link https://en.wikipedia.org/wiki/Unicode}\n*/\nvar UNICODE_MAX_BMP = 0xFFFF|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default UNICODE_MAX_BMP;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/headercase';\n\n\n// MAIN //\n\n/**\n* Converts a string to HTTP header case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} HTTP header-cased string\n*\n* @example\n* var out = headercase( 'foo bar' );\n* // returns 'Foo-Bar'\n*\n* @example\n* var out = headercase( 'IS_MOBILE' );\n* // returns 'Is-Mobile'\n*\n* @example\n* var out = headercase( 'Hello World!' );\n* // returns 'Hello-World'\n*\n* @example\n* var out = headercase( '--foo-bar--' );\n* // returns 'Foo-Bar'\n*/\nfunction headercase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default headercase;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/kebabcase';\n\n\n// MAIN //\n\n/**\n* Converts a string to kebab case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} kebab-cased string\n*\n* @example\n* var str = kebabCase( 'Hello World!' );\n* // returns 'hello-world'\n*\n* @example\n* var str = kebabCase( 'foo bar' );\n* // returns 'foo-bar'\n*\n* @example\n* var str = kebabCase( 'I am a tiny little teapot' );\n* // returns 'i-am-a-tiny-little-teapot'\n*\n* @example\n* var str = kebabCase( 'BEEP boop' );\n* // returns 'beep-boop'\n*\n* @example\n* var str = kebabCase( 'isMobile' );\n* // returns 'is-mobile'\n*/\nfunction kebabCase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default kebabCase;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/left-trim';\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning of a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {string} trimmed string\n*\n* @example\n* var out = ltrim( ' Whitespace ' );\n* // returns 'Whitespace '\n*\n* @example\n* var out = ltrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs\\t\\t\\t'\n*\n* @example\n* var out = ltrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines\\n\\n\\n'\n*/\nfunction ltrim( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default ltrim;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport splitGraphemeClusters from './../../split-grapheme-clusters';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport replace from './../../replace';\nimport rescape from '@stdlib/utils/escape-regexp-string';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar WHITESPACE_CHARS = '\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff';\n\n\n// MAIN //\n\n/**\n* Trims `n` characters from the beginning of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of characters to trim\n* @param {(string|StringArray)} [chars] - characters to trim (defaults to whitespace characters)\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string or an array of strings\n* @returns {string} trimmed string\n*\n* @example\n* var str = ' abc ';\n* var out = ltrimN( str, 2 );\n* // returns ' abc '\n*\n* @example\n* var str = ' abc ';\n* var out = ltrimN( str, str.length );\n* // returns 'abc '\n*\n* @example\n* var str = '~~abc!~~';\n* var out = ltrimN( str, str.length, [ '~', '!' ] );\n* // returns 'abc!~~'\n*\n* @example\n* var str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨';\n* var out = ltrimN( str, str.length, '👨🏼‍🎨🤖' );\n* // returns ''\n*/\nfunction ltrimN( str, n, chars ) {\n\tvar nElems;\n\tvar reStr;\n\tvar isStr;\n\tvar RE;\n\tvar i;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( n ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tisStr = isString( chars );\n\t\tif ( !isStr && !isStringArray( chars ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string or an array of strings. Value: `%s`.', chars ) );\n\t\t}\n\t\tif ( isStr ) {\n\t\t\tchars = splitGraphemeClusters( chars );\n\t\t}\n\t\tnElems = chars.length - 1;\n\t\treStr = '';\n\t\tfor ( i = 0; i < nElems; i++ ) {\n\t\t\treStr += rescape( chars[ i ] );\n\t\t\treStr += '|';\n\t\t}\n\t\treStr += rescape( chars[ nElems ] );\n\n\t\t// Case: Trim a specific set of characters from the beginning of a string..\n\t\tRE = new RegExp( '^(?:' + reStr + '){0,'+n+'}' );\n\t} else {\n\t\t// Case: Trim `n` whitespace characters from the beginning of a string...\n\t\tRE = new RegExp( '^[' + WHITESPACE_CHARS + ']{0,'+n+'}' );\n\t}\n\treturn replace( str, RE, '' );\n}\n\n\n// EXPORTS //\n\nexport default ltrimN;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/lowercase';\n\n\n// MAIN //\n\n/**\n* Converts a string to lowercase.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} lowercase string\n*\n* @example\n* var str = lowercase( 'bEEp' );\n* // returns 'beep'\n*/\nfunction lowercase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default lowercase;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport isfinite from '@stdlib/math/base/assert/is-finite';\nimport format from './../../format';\nimport int2wordsDE from './int2words_de.js';\nimport int2wordsEN from './int2words_en.js';\nimport validate from './validate.js';\nimport decimals from './decimals.js';\n\n\n// MAIN //\n\n/**\n* Converts a number to a word representation.\n*\n* @param {number} num - number to convert\n* @param {Object} [options] - options\n* @param {string} [options.lang='en'] - language code\n* @throws {TypeError} must provide valid options\n* @returns {string} word representation of number\n*\n* @example\n* var out = num2words( 12 );\n* // returns 'twelve'\n*\n* @example\n* var out = num2words( 21.8 );\n* // returns 'twenty-one point eight'\n*\n* @example\n* var out = num2words( 1234 );\n* // returns 'one thousand two hundred thirty-four'\n*\n* @example\n* var out = num2words( 100381 );\n* // returns 'one hundred thousand three hundred eighty-one'\n*/\nfunction num2words( num, options ) {\n\tvar parts;\n\tvar opts;\n\tvar err;\n\n\tif ( !isNumber( num ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a number. Value: `%s`.', num ) );\n\t}\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tif ( isInteger( num ) ) {\n\t\tswitch ( opts.lang ) {\n\t\tcase 'de':\n\t\t\treturn int2wordsDE( num, '' );\n\t\tcase 'en':\n\t\tdefault:\n\t\t\treturn int2wordsEN( num, '' );\n\t\t}\n\t}\n\tif ( !isfinite( num ) ) {\n\t\tswitch ( opts.lang ) {\n\t\tcase 'de':\n\t\t\treturn ( num < 0 ) ? 'minus unendlich' : 'unendlich';\n\t\tcase 'en':\n\t\tdefault:\n\t\t\treturn ( num < 0 ) ? 'negative infinity' : 'infinity';\n\t\t}\n\t}\n\tparts = num.toString().split( '.' );\n\tswitch ( opts.lang ) {\n\tcase 'de':\n\t\treturn int2wordsDE( parts[ 0 ], '' ) + ' Komma ' + decimals( parts[ 1 ], int2wordsDE );\n\tcase 'en':\n\tdefault:\n\t\treturn int2wordsEN( parts[ 0 ], '' ) + ' point ' + decimals( parts[ 1 ], int2wordsEN );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default num2words;\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 isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport repeat from './../../repeat';\nimport format from './../../format';\nimport floor from '@stdlib/math/base/special/floor';\nimport ceil from '@stdlib/math/base/special/ceil';\nimport lpad from './../../left-pad';\nimport rpad from './../../right-pad';\nimport abs from '@stdlib/math/base/special/abs';\nimport FLOAT64_MAX_SAFE_INTEGER from '@stdlib/constants/float64/max-safe-integer';\nimport validate from './validate.js';\n\n\n// MAIN //\n\n/**\n* Pads a string such that the padded string has a length of `len`.\n*\n* @param {string} str - string to pad\n* @param {NonNegativeInteger} len - string length\n* @param {Options} [options] - function options\n* @param {string} [options.lpad=''] - string used to left pad\n* @param {string} [options.rpad=' '] - string used to right pad\n* @param {boolean} [options.centerRight=false] - boolean indicating whether to center right in the event of a tie\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {RangeError} at least one padding must have a length greater than `0`\n* @returns {string} padded string\n*\n* @example\n* var str = pad( 'a', 5 );\n* // returns 'a '\n*\n* @example\n* var str = pad( 'a', 10, {\n* 'lpad': 'b'\n* });\n* // returns 'bbbbbbbbba'\n*\n* @example\n* var str = pad( 'a', 12, {\n* 'rpad': 'b'\n* });\n* // returns 'abbbbbbbbbbb'\n*\n* @example\n* var opts = {\n* 'lpad': 'a',\n* 'rpad': 'c'\n* };\n* var str = pad( 'b', 10, opts );\n* // returns 'aaaabccccc'\n*\n* @example\n* var opts = {\n* 'lpad': 'a',\n* 'rpad': 'c',\n* 'centerRight': true\n* };\n* var str = pad( 'b', 10, opts );\n* // returns 'aaaaabcccc'\n*/\nfunction pad( str, len, options ) {\n\tvar nright;\n\tvar nleft;\n\tvar isodd;\n\tvar right;\n\tvar left;\n\tvar opts;\n\tvar err;\n\tvar tmp;\n\tvar 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\tif ( !isNonNegativeInteger( len ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );\n\t}\n\tif ( len > FLOAT64_MAX_SAFE_INTEGER ) {\n\t\tthrow new RangeError( format( 'invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.', len ) );\n\t}\n\topts = {};\n\tif ( arguments.length > 2 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tif ( opts.lpad && opts.rpad ) {\n\t\tn = ( len-str.length ) / 2;\n\t\tif ( n === 0 ) {\n\t\t\treturn str;\n\t\t}\n\t\ttmp = floor( n );\n\t\tif ( tmp !== n ) {\n\t\t\tisodd = true;\n\t\t}\n\t\tif ( n < 0 ) {\n\t\t\tn = floor( abs( n ) );\n\t\t\tnleft = n;\n\t\t\tnright = str.length - n;\n\n\t\t\t// If |len-str.length| is an odd number, take away an additional character from one side...\n\t\t\tif ( isodd ) {\n\t\t\t\tif ( opts.centerRight ) {\n\t\t\t\t\tnright -= 1;\n\t\t\t\t} else {\n\t\t\t\t\tnleft += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn str.substring( nleft, nright );\n\t\t}\n\t\tnleft = ceil( n / opts.lpad.length );\n\t\tleft = repeat( opts.lpad, nleft );\n\n\t\tnright = ceil( n / opts.rpad.length );\n\t\tright = repeat( opts.rpad, nright );\n\n\t\t// If (len-str.length) is an odd number, give one side one extra character...\n\t\tn = tmp;\n\t\tnleft = n;\n\t\tnright = n;\n\t\tif ( isodd ) {\n\t\t\tif ( opts.centerRight ) {\n\t\t\t\tnleft += 1;\n\t\t\t} else {\n\t\t\t\tnright += 1;\n\t\t\t}\n\t\t}\n\t\tleft = left.substring( 0, nleft );\n\t\tright = right.substring( 0, nright );\n\t\treturn left + str + right;\n\t}\n\tif ( opts.lpad ) {\n\t\ttmp = lpad( str, len, opts.lpad );\n\t\treturn tmp.substring( tmp.length-len );\n\t}\n\tif ( opts.rpad ) {\n\t\treturn ( rpad( str, len, opts.rpad ) ).substring( 0, len );\n\t}\n\tif ( opts.rpad === void 0 ) {\n\t\treturn ( rpad( str, len, ' ' ) ).substring( 0, len );\n\t}\n\tthrow new RangeError( format( 'invalid argument. At least one padding option must have a length greater than 0. Left padding: `%s`. Right padding: `%s`.', opts.lpad, opts.rpad ) );\n}\n\n\n// EXPORTS //\n\nexport default pad;\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 isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.lpad] - string used to left pad\n* @param {string} [options.rpad] - string used to right pad\n* @param {boolean} [options.centerRight] - boolean indicating whether to center right in the event of a tie\n* @returns {(null|Error)} error object or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'lpad': 'a',\n* 'rpad': 'b'\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isPlainObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'lpad' ) ) {\n\t\topts.lpad = options.lpad;\n\t\tif ( !isString( opts.lpad ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'lpad', opts.lpad ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'rpad' ) ) {\n\t\topts.rpad = options.rpad;\n\t\tif ( !isString( opts.rpad ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'rpad', opts.rpad ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'centerRight' ) ) {\n\t\topts.centerRight = options.centerRight;\n\t\tif ( !isBoolean( opts.centerRight ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'centerRight', opts.centerRight ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/pascalcase';\n\n\n// MAIN //\n\n/**\n* Converts a string to Pascal case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} Pascal-cased string\n*\n* @example\n* var out = pascalcase( 'foo bar' );\n* // returns 'FooBar'\n*\n* @example\n* var out = pascalcase( 'IS_MOBILE' );\n* // returns 'IsMobile'\n*\n* @example\n* var out = pascalcase( 'Hello World!' );\n* // returns 'HelloWorld'\n*\n* @example\n* var out = pascalcase( '--foo-bar--' );\n* // returns 'FooBar'\n*/\nfunction pascalcase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default pascalcase;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/percent-encode';\n\n\n// MAIN //\n\n/**\n* Percent-encodes a UTF-16 encoded string according to [RFC 3986][1].\n*\n* [1]: https://tools.ietf.org/html/rfc3986#section-2.1\n*\n* @param {string} str - string to percent-encode\n* @throws {TypeError} must provide a string\n* @returns {string} percent-encoded string\n*\n* @example\n* var str1 = 'Ladies + Gentlemen';\n*\n* var str2 = percentEncode( str1 );\n* // returns 'Ladies%20%2B%20Gentlemen'\n*/\nfunction percentEncode( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default percentEncode;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// VARIABLES //\n\n// '\\ufeff' => 1111111011111111 => 0xFEFF => 65279\nvar BOM = 65279;\n\n\n// MAIN //\n\n/**\n* Removes a UTF-8 byte order mark (BOM) from the beginning of a string.\n*\n* ## Notes\n*\n* - A UTF-8 byte order mark ([BOM][1]) is the byte sequence `0xEF,0xBB,0xBF`.\n* - To convert a UTF-8 encoded `Buffer` to a `string`, the `Buffer` must be converted to [UTF-16][2]. The BOM thus gets converted to the single 16-bit code point `'\\ufeff'` (UTF-16 BOM).\n*\n* [1]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8\n* [2]: http://es5.github.io/#x4.3.16\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string primitive\n* @returns {string} string with BOM removed\n*\n* @example\n* var str = removeUTF8BOM( '\\ufeffbeep' );\n* // returns 'beep'\n*/\nfunction removeUTF8BOM( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tif ( str.charCodeAt( 0 ) === BOM ) {\n\t\treturn str.slice( 1 );\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default removeUTF8BOM;\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 isStringArray from '@stdlib/assert/is-string-array';\nimport uppercase from './../../uppercase';\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport tokenize from '@stdlib/nlp/tokenize';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Removes a list of words from a string.\n*\n* @param {string} str - input string\n* @param {StringArray} words - array of words to be removed\n* @param {boolean} [ignoreCase=false] - boolean indicating whether to perform a case-insensitive operation\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be an array of strings\n* @throws {TypeError} third argument must be a boolean\n* @returns {string} output string\n*\n* @example\n* var str = 'beep boop Foo bar';\n* var out = removeWords( str, [ 'boop', 'foo' ] );\n* // returns 'beep Foo bar'\n*\n* @example\n* var str = 'beep boop Foo bar';\n* var out = removeWords( str, [ 'boop', 'foo' ], true );\n* // returns 'beep bar'\n*/\nfunction removeWords( str, words, ignoreCase ) {\n\tvar tokens;\n\tvar token;\n\tvar list;\n\tvar flg;\n\tvar out;\n\tvar N;\n\tvar i;\n\tvar j;\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\tif ( !isStringArray( words ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an array of strings. Value: `%s`.', words ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isBoolean( ignoreCase ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a boolean. Value: `%s`.', ignoreCase ) );\n\t\t}\n\t}\n\ttokens = tokenize( str, true );\n\tN = words.length;\n\tout = [];\n\tif ( ignoreCase ) {\n\t\tlist = words.slice();\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tlist[ i ] = uppercase( list[ i ] );\n\t\t}\n\t\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\t\tflg = true;\n\t\t\ttoken = uppercase( tokens[ i ] );\n\t\t\tfor ( j = 0; j < N; j++ ) {\n\t\t\t\tif ( list[ j ] === token ) {\n\t\t\t\t\tflg = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( flg ) {\n\t\t\t\tout.push( tokens[ i ] );\n\t\t\t}\n\t\t}\n\t\treturn out.join( '' );\n\t}\n\t// Case: case-sensitive\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tflg = true;\n\t\tfor ( j = 0; j < N; j++ ) {\n\t\t\tif ( words[ j ] === token ) {\n\t\t\t\tflg = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ( flg ) {\n\t\t\tout.push( token );\n\t\t}\n\t}\n\treturn out.join( '' );\n}\n\n\n// EXPORTS //\n\nexport default removeWords;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/replace-before';\n\n\n// MAIN //\n\n/**\n* Replaces the substring before the first occurrence of a specified search string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {string} replacement - replacement string\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} third argument must be a string\n* @returns {string} output string\n*\n* @example\n* var out = replaceBefore( 'beep boop', ' ', 'foo' );\n* // returns 'foo boop'\n*\n* @example\n* var out = replaceBefore( 'beep boop', 'p', 'foo' );\n* // returns 'foop boop'\n*\n* @example\n* var out = replaceBefore( 'Hello World!', '', 'foo' );\n* // returns 'Hello World!'\n*\n* @example\n* var out = replaceBefore( 'Hello World!', 'xyz', 'foo' );\n* // returns 'Hello World!'\n*/\nfunction replaceBefore( str, search, replacement ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tif ( !isString( replacement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', replacement ) );\n\t}\n\treturn base( str, search, replacement, 0 );\n}\n\n\n// EXPORTS //\n\nexport default replaceBefore;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/right-trim';\n\n\n// MAIN //\n\n/**\n* Trims whitespace from the end of a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {string} trimmed string\n*\n* @example\n* var out = rtrim( ' Whitespace ' );\n* // returns ' Whitespace'\n*\n* @example\n* var out = rtrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns '\\t\\t\\tTabs'\n*\n* @example\n* var out = rtrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns '\\n\\n\\nNew Lines'\n*/\nfunction rtrim( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default rtrim;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport splitGraphemeClusters from './../../split-grapheme-clusters';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport replace from './../../replace';\nimport rescape from '@stdlib/utils/escape-regexp-string';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar WHITESPACE_CHARS = '\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff';\n\n\n// MAIN //\n\n/**\n* Trims `n` characters from the end of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of characters to trim\n* @param {(string|StringArray)} [chars] - characters to trim (defaults to whitespace characters)\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string or an array of strings\n* @returns {string} trimmed string\n*\n* @example\n* var str = ' abc ';\n* var out = rtrimN( str, 2 );\n* // returns ' abc '\n*\n* @example\n* var str = ' abc ';\n* var out = rtrimN( str, str.length );\n* // returns ' abc'\n*\n* @example\n* var str = '~~abc!~~';\n* var out = rtrimN( str, str.length, [ '~', '!' ] );\n* // returns '~~abc'\n*\n* @example\n* var str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨';\n* var out = rtrimN( str, str.length, '👨🏼‍🎨🤖' );\n* // returns ''\n*/\nfunction rtrimN( str, n, chars ) {\n\tvar nElems;\n\tvar reStr;\n\tvar isStr;\n\tvar RE;\n\tvar i;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( n ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', n ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tisStr = isString( chars );\n\t\tif ( !isStr && !isStringArray( chars ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a string or an array of strings. Value: `%s`.', chars ) );\n\t\t}\n\t\tif ( isStr ) {\n\t\t\tchars = splitGraphemeClusters( chars );\n\t\t}\n\t\tnElems = chars.length - 1;\n\t\treStr = '';\n\t\tfor ( i = 0; i < nElems; i++ ) {\n\t\t\treStr += rescape( chars[ i ] );\n\t\t\treStr += '|';\n\t\t}\n\t\treStr += rescape( chars[ nElems ] );\n\n\t\t// Case: Trim a specific set of characters from the end of a string..\n\t\tRE = new RegExp( '(?:' + reStr + '){0,'+n+'}$' );\n\t} else {\n\t\t// Case: Trim `n` whitespace characters from the end of a string...\n\t\tRE = new RegExp( '[' + WHITESPACE_CHARS + ']{0,'+n+'}$' );\n\t}\n\treturn replace( str, RE, '' );\n}\n\n\n// EXPORTS //\n\nexport default rtrimN;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/snakecase';\n\n\n// MAIN //\n\n/**\n* Converts a string to snake case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} snake-cased string\n*\n* @example\n* var str = snakecase( 'Hello World!' );\n* // returns 'hello_world'\n*\n* @example\n* var str = snakecase( 'foo bar' );\n* // returns 'foo_bar'\n*\n* @example\n* var str = snakecase( 'I am a tiny little teapot' );\n* // returns 'i_am_a_tiny_little_teapot'\n*\n* @example\n* var str = snakecase( 'BEEP boop' );\n* // returns 'beep_boop'\n*\n* @example\n* var str = snakecase( 'isMobile' );\n* // returns 'is_mobile'\n*/\nfunction snakecase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default snakecase;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/startcase';\n\n\n// MAIN //\n\n/**\n* Capitalizes the first letter of each word in an input string.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} start case string\n*\n* @example\n* var str = startcase( 'beep boop foo bar' );\n* // returns 'Beep Boop Foo Bar'\n*/\nfunction startcase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default startcase;\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';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/starts-with';\n\n\n// MAIN //\n\n/**\n* Tests if a string starts with the characters of another string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} [position=0] - position at which to start searching\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} third argument must be an integer\n* @returns {boolean} boolean indicating if the input string starts with the search string\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember' );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember' );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be' );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be' );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 );\n* // returns true\n*/\nfunction startsWith( str, search, position ) {\n\tvar pos;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isInteger( position ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', position ) );\n\t\t}\n\t\tpos = position;\n\t} else {\n\t\tpos = 0;\n\t}\n\treturn base( str, search, pos );\n}\n\n\n// EXPORTS //\n\nexport default startsWith;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns the part of a string after a specified substring.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} [fromIndex=0] - index at which to start the search\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} third argument must be an integer\n* @returns {string} substring\n*\n* @example\n* var out = substringAfter( 'Hello, world!', ', ' );\n* // returns 'world!'\n*\n* @example\n* var out = substringAfter( 'beep boop', 'beep' );\n* // returns ' boop'\n*\n* @example\n* var out = substringAfter( 'beep boop', 'boop' );\n* // returns ''\n*\n* @example\n* var out = substringAfter( 'beep boop', 'xyz' );\n* // returns ''\n*\n* @example\n* var out = substringAfter( 'beep boop', 'beep', 5 );\n* // returns ''\n*\n* @example\n* var out = substringAfter( 'beep boop beep baz', 'beep', 5 );\n* // returns ' baz'\n*/\nfunction substringAfter( str, search, fromIndex ) {\n\tvar idx;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tidx = str.indexOf( search, fromIndex );\n\t} else {\n\t\tidx = str.indexOf( search );\n\t}\n\tif ( idx === -1 ) {\n\t\treturn '';\n\t}\n\treturn str.substring( idx+search.length );\n}\n\n\n// EXPORTS //\n\nexport default substringAfter;\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 { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns the part of a string after the last occurrence of a specified substring.\n*\n* @param {string} str - input string\n* @param {string} search - search value\n* @param {integer} [fromIndex=str.length] - index of last character to be considered beginning of a match\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} third argument must be an integer\n* @returns {string} substring\n*\n* @example\n* var out = substringAfterLast( 'beep boop', 'b' );\n* // returns 'oop'\n*\n* @example\n* var out = substringAfterLast( 'beep boop', 'o' );\n* // returns 'p'\n*\n* @example\n* var out = substringAfterLast( 'Hello World', 'o' );\n* // returns 'rld'\n*\n* @example\n* var out = substringAfterLast( 'Hello World', '!' );\n* // returns ''\n*\n* @example\n* var out = substringAfterLast( 'Hello World', '' );\n* // returns ''\n*\n* @example\n* var out = substringAfterLast( 'beep boop baz', 'p b', 6 );\n* // returns 'oop baz'\n*/\nfunction substringAfterLast( str, search, fromIndex ) {\n\tvar idx;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tidx = str.lastIndexOf( search, fromIndex );\n\t} else {\n\t\tidx = str.lastIndexOf( search );\n\t}\n\tif ( idx === -1 ) {\n\t\treturn '';\n\t}\n\treturn str.substring( idx+search.length );\n}\n\n\n// EXPORTS //\n\nexport default substringAfterLast;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns the part of a string before a specified substring.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @returns {string} substring\n*\n* @example\n* var out = substringBefore( 'beep boop', ' ' );\n* // returns 'beep'\n*\n* @example\n* var out = substringBefore( 'beep boop', 'p' );\n* // returns 'bee'\n*\n* @example\n* var out = substringBefore( 'Hello World!', '' );\n* // returns ''\n*\n* @example\n* var out = substringBefore( 'Hello World!', 'XYZ' );\n* // returns 'Hello World!'\n*/\nfunction substringBefore( str, search ) {\n\tvar idx;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tidx = str.indexOf( search );\n\tif ( idx === -1 ) {\n\t\treturn str;\n\t}\n\treturn str.substring( 0, idx );\n}\n\n\n// EXPORTS //\n\nexport default substringBefore;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns the part of a string before the last occurrence of a specified substring.\n*\n* @param {string} str - input string\n* @param {string} search - search value\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @returns {string} substring\n*\n* @example\n* var out = substringBeforeLast( 'abcba', 'b' );\n* // returns 'abc'\n*\n* @example\n* var out = substringBeforeLast( 'Hello World, my friend!', ' ' );\n* // returns 'Hello World, my'\n*\n* @example\n* var out = substringBeforeLast( 'abcba', ' ' );\n* // returns 'abcba'\n*\n* @example\n* var out = substringBeforeLast( 'abcba', '' );\n* // returns 'abcba'\n*/\nfunction substringBeforeLast( str, search ) {\n\tvar idx;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tidx = str.lastIndexOf( search );\n\tif ( idx === -1 ) {\n\t\treturn str;\n\t}\n\treturn str.substring( 0, idx );\n}\n\n\n// EXPORTS //\n\nexport default substringBeforeLast;\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 setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport isFunction from '@stdlib/assert/is-function';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport iteratorSymbol from '@stdlib/symbol/iterator';\nimport nextGraphemeClusterBreak from './../../next-grapheme-cluster-break';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns an iterator which iterates over each grapheme cluster in a string.\n*\n* @param {string} src - input value\n* @param {Function} [mapFcn] - function to invoke for each iterated value\n* @param {*} [thisArg] - execution context\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a function\n* @returns {Iterator} iterator\n*\n* @example\n* var iter = graphemeClusters2iterator( '🌷🍕' );\n*\n* var v = iter.next().value;\n* // returns '🌷'\n*\n* v = iter.next().value;\n* // returns '🍕'\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nfunction graphemeClusters2iterator( src ) {\n\tvar thisArg;\n\tvar iter;\n\tvar FLG;\n\tvar fcn;\n\tvar i;\n\tif ( !isString( src ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', src ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tfcn = arguments[ 1 ];\n\t\tif ( !isFunction( fcn ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) );\n\t\t}\n\t\tthisArg = arguments[ 2 ];\n\t}\n\ti = 0;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tif ( fcn ) {\n\t\tsetReadOnly( iter, 'next', next1 );\n\t} else {\n\t\tsetReadOnly( iter, 'next', next2 );\n\t}\n\tsetReadOnly( iter, 'return', end );\n\n\t// If an environment supports `Symbol.iterator`, make the iterator iterable:\n\tif ( iteratorSymbol ) {\n\t\tsetReadOnly( iter, iteratorSymbol, 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 next1() {\n\t\tvar v;\n\t\tvar j;\n\t\tif ( FLG ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj = nextGraphemeClusterBreak( src, i );\n\t\tif ( j === -1 ) {\n\t\t\tFLG = true;\n\t\t\tif ( src.length ) {\n\t\t\t\treturn {\n\t\t\t\t\t'value': fcn.call( thisArg, src.substring( i ), i, src ),\n\t\t\t\t\t'done': false\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tv = fcn.call( thisArg, src.substring( i, j ), i, src );\n\t\ti = j;\n\t\treturn {\n\t\t\t'value': v,\n\t\t\t'done': false\n\t\t};\n\t}\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 next2() {\n\t\tvar v;\n\t\tvar j;\n\t\tif ( FLG ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj = nextGraphemeClusterBreak( src, i );\n\t\tif ( j === -1 ) {\n\t\t\tFLG = true;\n\t\t\tif ( src.length ) {\n\t\t\t\treturn {\n\t\t\t\t\t'value': src.substring( i ),\n\t\t\t\t\t'done': false\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tv = src.substring( i, j );\n\t\ti = j;\n\t\treturn {\n\t\t\t'value': v,\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\tif ( fcn ) {\n\t\t\treturn graphemeClusters2iterator( src, fcn, thisArg );\n\t\t}\n\t\treturn graphemeClusters2iterator( src );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default graphemeClusters2iterator;\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 setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport isFunction from '@stdlib/assert/is-function';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport iteratorSymbol from '@stdlib/symbol/iterator';\nimport prevGraphemeClusterBreak from './../../prev-grapheme-cluster-break';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns an iterator which iterates from right to left over each grapheme cluster in a string.\n*\n* @param {string} src - input value\n* @param {Function} [mapFcn] - function to invoke for each iterated value\n* @param {*} [thisArg] - execution context\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a function\n* @returns {Iterator} iterator\n*\n* @example\n* var iter = graphemeClusters2iteratorRight( '🌷🍕' );\n*\n* var v = iter.next().value;\n* // returns '🍕'\n*\n* v = iter.next().value;\n* // returns '🌷'\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nfunction graphemeClusters2iteratorRight( src ) { // eslint-disable-line id-length\n\tvar thisArg;\n\tvar iter;\n\tvar FLG;\n\tvar fcn;\n\tvar i;\n\tif ( !isString( src ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', src ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tfcn = arguments[ 1 ];\n\t\tif ( !isFunction( fcn ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) );\n\t\t}\n\t\tthisArg = arguments[ 2 ];\n\t}\n\ti = src.length - 1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tif ( fcn ) {\n\t\tsetReadOnly( iter, 'next', next1 );\n\t} else {\n\t\tsetReadOnly( iter, 'next', next2 );\n\t}\n\tsetReadOnly( iter, 'return', end );\n\n\t// If an environment supports `Symbol.iterator`, make the iterator iterable:\n\tif ( iteratorSymbol ) {\n\t\tsetReadOnly( iter, iteratorSymbol, 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 next1() {\n\t\tvar v;\n\t\tvar j;\n\t\tif ( FLG ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj = prevGraphemeClusterBreak( src, i );\n\t\tif ( j === -1 ) {\n\t\t\tFLG = true;\n\t\t\tif ( src.length ) {\n\t\t\t\treturn {\n\t\t\t\t\t'value': fcn.call( thisArg, src.substring( j+1, i+1 ), j+1, src ),\n\t\t\t\t\t'done': false\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tv = fcn.call( thisArg, src.substring( j+1, i+1 ), j+1, src );\n\t\ti = j;\n\t\treturn {\n\t\t\t'value': v,\n\t\t\t'done': false\n\t\t};\n\t}\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 next2() {\n\t\tvar v;\n\t\tvar j;\n\t\tif ( FLG ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj = prevGraphemeClusterBreak( src, i );\n\t\tif ( j === -1 ) {\n\t\t\tFLG = true;\n\t\t\tif ( src.length ) {\n\t\t\t\treturn {\n\t\t\t\t\t'value': src.substring( j+1, i+1 ),\n\t\t\t\t\t'done': false\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tv = src.substring( j+1, i+1 );\n\t\ti = j;\n\t\treturn {\n\t\t\t'value': v,\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\tif ( fcn ) {\n\t\t\treturn graphemeClusters2iteratorRight( src, fcn, thisArg );\n\t\t}\n\t\treturn graphemeClusters2iteratorRight( src );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default graphemeClusters2iteratorRight;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/trim';\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning and end of a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {string} trimmed string\n*\n* @example\n* var out = trim( ' Whitespace ' );\n* // returns 'Whitespace'\n*\n* @example\n* var out = trim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs'\n*\n* @example\n* var out = trim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines'\n*/\nfunction trim( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default trim;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport numGraphemeClusters from './../../num-grapheme-clusters';\nimport nextGraphemeClusterBreak from './../../next-grapheme-cluster-break';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Truncates a string to a specified length.\n*\n* @param {string} str - input string\n* @param {integer} len - output string length (including ending)\n* @param {string} [ending='...'] - custom ending\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string\n* @returns {string} truncated string\n*\n* @example\n* var str = 'beep boop';\n* var out = truncate( str, 7 );\n* // returns 'beep...'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncate( str, 5, '>>>' );\n* // returns 'be>>>'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncate( str, 10 );\n* // returns 'beep boop'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncate( str, 0 );\n* // returns ''\n*\n* @example\n* var str = 'beep boop';\n* var out = truncate( str, 2 );\n* // returns '..'\n*\n* @example\n* var str = '🐺 Wolf Brothers 🐺';\n* var out = truncate( str, 6 );\n* // returns '🐺 W...'\n*/\nfunction truncate( str, len, ending ) {\n\tvar endingLength;\n\tvar fromIndex;\n\tvar nVisual;\n\tvar idx;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( len ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isString( ending ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', ending ) );\n\t\t}\n\t}\n\tending = ending || '...';\n\tendingLength = numGraphemeClusters( ending );\n\tfromIndex = 0;\n\tif ( len >= numGraphemeClusters( str ) ) {\n\t\treturn str;\n\t}\n\tif ( len - endingLength <= 0 ) {\n\t\treturn ending.slice( 0, len );\n\t}\n\tnVisual = 0;\n\twhile ( nVisual < len - endingLength ) {\n\t\tidx = nextGraphemeClusterBreak( str, fromIndex );\n\t\tfromIndex = idx;\n\t\tnVisual += 1;\n\t}\n\treturn str.substring( 0, idx ) + ending;\n}\n\n\n// EXPORTS //\n\nexport default truncate;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport numGraphemeClusters from './../../num-grapheme-clusters';\nimport nextGraphemeClusterBreak from './../../next-grapheme-cluster-break';\nimport format from './../../format';\nimport round from '@stdlib/math/base/special/round';\nimport floor from '@stdlib/math/base/special/floor';\n\n\n// MAIN //\n\n/**\n* Truncates a string in the middle to a specified length.\n*\n* @param {string} str - input string\n* @param {integer} len - output string length (including sequence)\n* @param {string} [seq='...'] - custom replacement sequence\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string\n* @returns {string} truncated string\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 5 );\n* // returns 'b...p'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 5, '>>>' );\n* // returns 'b>>>p'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 10 );\n* // returns 'beep boop'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 0 );\n* // returns ''\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 2 );\n* // returns '..'\n*\n* @example\n* var str = '🐺 Wolf Brothers 🐺';\n* var out = truncateMiddle( str, 7 );\n* // returns '🐺 ... 🐺'\n*/\nfunction truncateMiddle( str, len, seq ) {\n\tvar seqLength;\n\tvar fromIndex;\n\tvar strLength;\n\tvar seqStart;\n\tvar nVisual;\n\tvar seqEnd;\n\tvar idx2;\n\tvar idx1;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( len ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isString( seq ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', seq ) );\n\t\t}\n\t}\n\tseq = seq || '...';\n\tseqLength = numGraphemeClusters( seq );\n\tstrLength = numGraphemeClusters( str );\n\tfromIndex = 0;\n\tif ( len > strLength ) {\n\t\treturn str;\n\t}\n\tif ( len - seqLength < 0 ) {\n\t\treturn seq.slice( 0, len );\n\t}\n\tseqStart = round( ( len - seqLength ) / 2 );\n\tseqEnd = strLength - floor( ( len - seqLength ) / 2 );\n\tnVisual = 0;\n\twhile ( nVisual < seqStart ) {\n\t\tidx1 = nextGraphemeClusterBreak( str, fromIndex );\n\t\tfromIndex = idx1;\n\t\tnVisual += 1;\n\t}\n\tidx2 = idx1;\n\twhile ( idx2 > 0 ) {\n\t\tidx2 = nextGraphemeClusterBreak( str, fromIndex );\n\t\tif ( idx2 >= seqEnd + fromIndex - nVisual ) {\n\t\t\tbreak;\n\t\t}\n\t\tfromIndex = idx2;\n\t\tnVisual += 1;\n\t}\n\treturn str.substring( 0, idx1 ) + seq + str.substring( idx2 );\n}\n\n\n// EXPORTS //\n\nexport default truncateMiddle;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/uncapitalize';\n\n\n// MAIN //\n\n/**\n* Uncapitalizes the first character of a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {string} input string with first character converted to lowercase\n*\n* @example\n* var out = uncapitalize( 'Last man standing' );\n* // returns 'last man standing'\n*\n* @example\n* var out = uncapitalize( 'Presidential election' );\n* // returns 'presidential election'\n*\n* @example\n* var out = uncapitalize( 'JavaScript' );\n* // returns 'javaScript'\n*\n* @example\n* var out = uncapitalize( 'Hidden Treasures' );\n* // returns 'hidden Treasures'\n*/\nfunction uncapitalize( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default uncapitalize;\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","spacePad","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","setReadOnly","configurable","enumerable","writable","setNonEnumerableReadOnly","isString","FLG","Symbol","hasToStringTagSupport","toStringTag","has","hasOwnProperty","hasOwnProp","property","Sym","toStrTag","hasToStringTag","v","isOwn","tag","nativeClass","valueOf","test","isPrimitive","isObject","RE_CHARS","rescape","s","isBoolean","Bool","Boolean","self","window","globalThis","root","codegen","Function","GlobalThis","Self","Win","getGlobal","nodeList","document","childNodes","typedarray","Int8Array","reFunctionName","RE_FUNCTION_NAME","REGEXP","main$f","arrayfcn","predicate","len","isObjectLike","isBuffer","_isBuffer","constructor","constructorName","name","ctor","arrayfun","ctorName","type","isFunction","typeOf","RegExp","isRegExp","search","newval","removePunctuation","REGEXP_PREFIXES","REGEXP_SUFFIXES","extend","arr","ext","tokenizeSubstring","done","res","prefixes","suffixes","EMOJIS","ABBRS","CONTRACT","split","unshift","pop","keepWhitespace","subtkns","substrs","cache","TYPE","isAccessorArray","GETTERS","complex128","idx","complex64","default","getter","dtype","float64","float32","int32","int16","int8","uint32","uint16","uint8","uint8c","generic","ctor2dtypes","Float32Array","Float64Array","Int16Array","Int32Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","Complex64Array","Complex128Array","BooleanArray","hasFloat64Array","hasFloat64ArraySupport","bool","GlobalFloat64Array","NaN","Float64Array$1","hasFloat32Array","FLOAT64_PINF","Number","POSITIVE_INFINITY","GlobalFloat32Array","PINF","hasFloat32ArraySupport","Float32Array$1","hasUint32Array","isUint32Array","UINT32_MAX","GlobalUint32Array","hasUint32ArraySupport","Uint32Array$1","hasInt32Array","GlobalInt32Array","INT32_MAX","hasInt32ArraySupport","Int32Array$1","hasUint16Array","GlobalUint16Array","UINT16_MAX","hasUint16ArraySupport","Uint16Array$1","hasInt16Array","GlobalInt16Array","INT16_MAX","hasInt16ArraySupport","Int16Array$1","hasUint8Array","GlobalUint8Array","UINT8_MAX","hasUint8ArraySupport","Uint8Array$1","hasUint8ClampedArray","GlobalUint8ClampedArray","hasUint8ClampedArraySupport","Uint8ClampedArray$1","hasInt8Array","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","Int8Array$1","main$4","FLOAT64_NINF","NEGATIVE_INFINITY","floor","isInteger","x","NINF","isInt","isNonNegativeInteger","MAX_ARRAY_LENGTH","isArrayLikeObject","MAX_LENGTH","MAX_TYPED_ARRAY_LENGTH","isCollection","hasArrayBuffer","ArrayBuffer","isArrayBuffer","isPrimitiveArray","isObjectArray","isStringArray","Complex128","real","imag","this","setEnumerableReadOnly","re","im","fround","FLOAT32_VIEW","float64ToFloat32$1","Complex64","float64ToFloat32","isComplexLike","isEven","BYTES_PER_ELEMENT","isComplex64Array","isComplex128Array","hasIteratorSymbolSupport","iterator","IteratorSymbol","setNonEnumerableReadOnlyAccessor","z","reinterpret","offset","buffer","byteOffset","fromIterator","it","next","realf","imagf","HAS_ITERATOR_SYMBOL","isComplexArray","_length","_buffer","isComplexArrayConstructor","getComplex64","buf","nargs","fromArray","RangeError","reinterpret64","reinterpret128","byteLength","ITERATOR_SYMBOL","src","thisArg","clbk","tmp","flg","accessorGetter","fromIteratorMap","target","start","copyWithin","iter","entries","end","fcn","searchElement","fromIndex","separator","sep","join","keys","outbuf","reducer","initialValue","acc","N","sbuf","outlen","compareFcn","sort","begin","locales","options","opts","loc","toLocaleString","values","index","getComplex128","isBooleanArray","isBooleanArrayConstructor","val","a","b","CTORS","DTYPES","NTYPES","ctor2dtype","factory","dt","getProto","Obj","getPrototypeOf","proto","getProto$1","objectPrototype","isPlainObject","isPrototypeOf","key","ownProps","validate","stopwords","RE_HYPHEN","globalAtob","atob","capitalize","trim","base$4","HAS_BUILTIN","RE_WHITESPACE","RE_SPECIAL","RE_TO_CAMEL","RE_CAMEL","replacer","p1","camelcase","Ox10000","Ox400","OxD800","OxDBFF","OxDC00","OxDFFF","codePointAt","backward","code","low","hi","charCodeAt","constantcase","min","y","isNegativeZero","ns","s1","s2","temp","row","pre","m","k","dotcase","endsWith","endsWith$2","first","reUtf16SurrogatePair","RE_UTF16_SURROGATE_PAIR","RE_UTF16_LOW_SURROGATE","RE_UTF16_HIGH_SURROGATE","ch1","ch2","cnt","hasUTF16SurrogatePairAt","consts","CR","LF","Control","Extend","RegionalIndicator","SpacingMark","L","V","T","LV","LVT","Other","Prepend","ZWJ","NotBreak","BreakStart","Break","BreakLastRegional","BreakPenultimateRegional","ExtendedPictographic","every","lastIndexOf","constants","breaks","emoji","nextEmoji","M","count","breakType","grapheme","breakProperty","emojiProperty","nextGraphemeClusterBreak","cp","forEach","ch","brk","REGEXP_STRING","reWhitespace","capture","REGEXP_CAPTURE","startcase","cap","headercase","kebabCase","last","isPositiveInteger","SETTERS","setter","arraylike2object","data","accessorProtocol","accessors","accessorSetter","CircularBuffer","_count","_i","cbuf","filled","niters","iteratorSymbol","toArray","repeat","base$3","rpt","ceil","lpad","trimLeft","ltrim","base$2","RE_TO_PASCAL","pascalcase","Ox3F","Ox80","OxC0","OxE0","OxF0","Ox3FF","Ox800","OxE000","utf16ToUTF8Array","UNDERSCORE","PERIOD","HYPHEN","TILDE","ZERO","NINE","A","Z","percentEncode","byte","removeFirst","removeLast","numGraphemeClusters","total","replaceBefore","replacement","reverse","cluster","rpad","trimRight","rtrim","base$1","sliceString","numCodePoints","max","snakecase","startsWith","position","setNonEnumerableReadWriteAccessor","isProbability","wrap","noop","FLOAT64_MAX_SAFE_INTEGER","isPositiveZero","imul","la","lb","mul","gcopy","strideX","offsetX","strideY","offsetY","xbuf","ybuf","ix","iy","ox","oy","foo","isFunctionNameSupported","FLOAT16_PINF","Float16Array","setReadWriteAccessor","f16round","isfinite","FLOAT16_EPSILON","FLOAT16_SMALLEST_NORMAL","INVERSE_EPSILON","mod","isNaN","isFiniteNumber","FLOAT16_MIN","f16","FLOAT16_NINF","UINT32_VIEW","toWordf","FLOAT32_EXPONENT_BIAS","EXP_MASK","FLOAT32_SIGNIFICAND_MASK","UINT16_NAN","UINT16_PINF","UINT16_NINF","UINT16_POSITIVE_ZERO","UINT16_NEGATIVE_ZERO","FLOAT32_IMPLICIT_BIT","FLOAT32_SUBNORMAL_STICKY_MASK","FLOAT32_STICKY_MASK","MAX_MANTISSA","toWord","f32Exponent","f16Exponent","stickyBits","mantissa","roundBit","shift","mant","isnanf","isNegativeZerof","absf","w","getWord","BIAS","exponent","FLOAT64_MAX_BASE2_EXPONENT","FLOAT64_MIN_BASE2_EXPONENT","round","FLOAT64_EXPONENT_BIAS","FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL","FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL","isInfinite","uint16view","HIGH","LOW","FLOAT64_HIGH_WORD_SIGN_MASK","FLOAT64_HIGH_WORD_ABS_MASK","ctors","isLittleEndian","indices$3","FLOAT64_VIEW","indices","toWords","stride","assign","HIGH$3","getHighWord","indices$1","fromWords","high","WORDS","FLOAT64_SMALLEST_NORMAL","SCALAR","normalize","FLOAT64_HIGH_WORD_EXPONENT_MASK","TWO52_INV","CLEAR_EXP_MASK","FRAC","ldexp","frac","exp","hx","hy","floatExp","MIN_SUBNORMAL_EXPONENT","ABS_MASK","SIGN_MASK","MAX_EXPONENT","MAX_SUBNORMAL_EXPONENT","exp2","px","xx","polyvalP","polyvalQ","fromWord","word","isFloat16Array","isFloatingPointArrayConstructor","ctx","_get","ndarray","GlobalFloat16Array","hasFloat16ArraySupport","polyfill","TypedArray","Dummy","fcnName","hasHasInstanceSymbolSupport","hasInstance","HasInstanceSymbol","hasSupport","instanceOf","typeName","typedarray2json","NAMES","isTypedArray","isComplexTypedArray","MAX","randuint32","random","MAX_SEED","SEED_ARRAY_INIT_STATE","UPPER_MASK","LOWER_MASK","KNUTH_MULTIPLIER","MAGIC_MULTIPLIER_1","MAGIC_MULTIPLIER_2","TEMPERING_COEFFICIENT_1","TEMPERING_COEFFICIENT_2","MAG01","MATRIX_A","FLOAT64_NORMALIZATION_CONSTANT","TWO_26","TWO_32","ONE","MAX_NORMALIZED","STATE_ARRAY_VERSION","NUM_STATE_SECTIONS","STATE_SECTION_OFFSET","OTHER_SECTION_OFFSET","SEED_SECTION_OFFSET","STATE_FIXED_LENGTH","verifyState","state","createState","umul","STATE","seed","slen","copy","initState","mt19937","setReadOnlyAccessor","getSeed","getSeedLength","getState","setState","getStateLength","getStateSize","toJSON","normalized","NAME","params","r","twist","rand","prng","p","randu","constantFunction","seedLength","stateLength","bernoulli","uncapitalize","bytes","distances","firstCodePoint","firstGraphemeCluster","forEachCodePoint","forEachGraphemeCluster","kebabcase","lastCodePoint","lastGraphemeCluster","removeFirstCodePoint","removeFirstGraphemeCluster","removeLastCodePoint","removeLastGraphemeCluster","reverseCodePoints","reverseGraphemeClusters","totalCodePoints","codePoints","numClusters","result","char","seq","finalLength","seqLength","strLength","seqStart","seqEnd","MODES","FCNS","code_point","code_unit","firstCodeUnit","isMode","contains","forEachCodeUnit","UNICODE_MAX","lastCodeUnit","splitGraphemeClusters","ONES","TENS","pluralize","int2wordsDE","rem","UNITS","VAL","DE","int2wordsEN","EN","isNan","LANGUAGE_CODES","lang","decimals","prevGraphemeClusterBreak","ans","removeFirstCodeUnit","removeLastCodeUnit","reverseCodeUnit","isWellFormed","isWellFormedString","string","isStopWord","words","STOPWORDS","mode","cb","pt","chars","nElems","reStr","isStr","parts","nright","nleft","isodd","left","centerRight","ignoreCase","list","graphemeClusters2iterator","graphemeClusters2iteratorRight","modifiedString","ending","endingLength","nVisual","idx2","idx1"],"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,I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E,OAAWA,GAAQA,GAAQ,OAC3B,OAAWA,GAAQA,GAAQ,OACpB,QAATA,GACS,OAATA,GACS,QAATA,GACE,OAAWA,GAAQA,GAAQ,OAC3B,OAAWA,GAAQA,GAAQ,OACpB,QAATA,GACS,QAATA,GACE,OAAWA,GAAQA,GAAQ,OACpB,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACE,OAAWA,GAAQA,GAAQ,OAC3B,OAAWA,GAAQA,GAAQ,OACpB,QAATA,GACE,OAAWA,GAAQA,GAAQ,OAC3B,OAAWA,GAAQA,GAAQ,OAC3B,OAAWA,GAAQA,GAAQ,OACpB,SAATA,GACS,SAATA,EAEOmD,GAAUjB,YAGf,MAAUlC,GAAQA,GAAQ,MAC1B,OAAUA,GAAQA,GAAQ,MAErBmD,GAAUhB,EAGf,MAAUnC,GAAQA,GAAQ,MAC1B,OAAUA,GAAQA,GAAQ,MAErBmD,GAAUf,EAGf,MAAUpC,GAAQA,GAAQ,MAC1B,OAAUA,GAAQA,GAAQ,MAErBmD,GAAUd,EAGR,QAATrC,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,OAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,OAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,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,IAOlG,GAHAE,EAAYzO,GADZuO,EAAMA,GAAO,OAGbra,EAAY,EACPtM,GAFL8mB,EAAY1O,GAAqBliB,IAGhC,OAAOA,EAER,GAAK8J,EAAM6mB,EAAY,EACtB,OAAOF,EAAI9rB,MAAO,EAAGmF,GAKtB,IAHA+mB,EAAWvJ,IAASxd,EAAM6mB,GAAc,GACxCG,EAASF,EAAYrf,IAASzH,EAAM6mB,GAAc,GAClD4D,EAAU,EACFA,EAAU1D,GAEjBza,EADAqe,EAAOpW,GAA0Bre,EAAKoW,GAEtCme,GAAW,EAGZ,IADAC,EAAOC,EACCD,EAAO,MACdA,EAAOnW,GAA0Bre,EAAKoW,KACzB0a,EAAS1a,EAAYme,IAGlCne,EAAYoe,EACZD,GAAW,EAEZ,OAAOv0B,EAAImE,UAAW,EAAGswB,GAAShE,EAAMzwB,EAAImE,UAAWqwB,EACxD,IjCodA9tB,EAAaqsB,GAAQ,gBkC1hBrB,SAAuB/yB,GACtB,IAAM+G,EAAU/G,GACf,MAAM,IAAI6D,UAAWiB,GAAQ,kEAAmE9E,IAEjG,OAAOgB,GAAMhB,EACd,IlC+hBA0G,EAAaqsB,GAAQ,YAAanyB,IAUlC8F,EAAaqsB,GAAQ,mBAAoB1R","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,78,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,218,232,233,234,245,246,247,250,262,263,264,265,267,272,273,274,275,276,277,278,279,280,282,283,289,318,326,327,328,329,330,331,332,333,334,335,336,337,338,339,340,341,342,343,344,345,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,431,443,446,454,455,456,457,459,468,469,470,471,472,480]} \ No newline at end of file diff --git a/camelcase/README.md b/camelcase/README.md deleted file mode 100644 index c30009b5..00000000 --- a/camelcase/README.md +++ /dev/null @@ -1,200 +0,0 @@ - - -# camelcase - -> Convert a string to camel case. - - - -
- -## Usage - -```javascript -var camelcase = require( '@stdlib/string/camelcase' ); -``` - -#### camelcase( str ) - -Converts a string to camel case. - -```javascript -var out = camelcase( 'foo bar' ); -// returns 'fooBar' - -out = camelcase( 'IS_MOBILE' ); -// returns 'isMobile' - -out = camelcase( 'Hello World!' ); -// returns 'helloWorld' - -out = camelcase( '--foo-bar--' ); -// returns 'fooBar' -``` - -
- - - - - -
- -## Examples - -```javascript -var camelcase = require( '@stdlib/string/camelcase' ); - -var str = 'Hello World!'; -var out = camelcase( str ); -// returns 'helloWorld' - -str = 'HELLO WORLD!'; -out = camelcase( str ); -// returns 'helloWorld' - -str = 'To be, or not to be: that is the question.'; -out = camelcase( str ); -// returns 'toBeOrNotToBeThatIsTheQuestion' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: camelcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nfoo_bar' | camelcase --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nfoo_bar' | camelcase --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ camelcase 'hello world!' -helloWorld -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beEp booP' | camelcase -beEpBooP -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tfoo_bar' | camelcase --split '\t' -beep -fooBar -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/camelcase/benchmark/benchmark.js b/camelcase/benchmark/benchmark.js deleted file mode 100644 index 094bac17..00000000 --- a/camelcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var camelcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = camelcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/camelcase/bin/cli b/camelcase/bin/cli deleted file mode 100755 index 4c44fea6..00000000 --- a/camelcase/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var camelcase = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( camelcase( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( camelcase( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/camelcase/docs/repl.txt b/camelcase/docs/repl.txt deleted file mode 100644 index 3d18f446..00000000 --- a/camelcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to camel case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Camel-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'helloWorld' - > out = {{alias}}( 'beep boop' ) - 'beepBoop' - - See Also - -------- diff --git a/camelcase/docs/types/index.d.ts b/camelcase/docs/types/index.d.ts deleted file mode 100644 index 66388500..00000000 --- a/camelcase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to camel case. -* -* @param str - string to convert -* @returns camel-cased string -* -* @example -* var str = camelcase( 'Hello World!' ); -* // returns 'helloWorld' -* -* @example -* var str = camelcase( 'foo_bar' ); -* // returns 'fooBar' -* -* @example -* var str = camelcase( 'foo-bar' ); -* // returns 'fooBar' -*/ -declare function camelcase( str: string ): string; - - -// EXPORTS // - -export = camelcase; diff --git a/camelcase/docs/types/test.ts b/camelcase/docs/types/test.ts deleted file mode 100644 index 92ad563f..00000000 --- a/camelcase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import camelcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - camelcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - camelcase( true ); // $ExpectError - camelcase( false ); // $ExpectError - camelcase( null ); // $ExpectError - camelcase( undefined ); // $ExpectError - camelcase( 5 ); // $ExpectError - camelcase( [] ); // $ExpectError - camelcase( {} ); // $ExpectError - camelcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - camelcase(); // $ExpectError -} diff --git a/camelcase/docs/usage.txt b/camelcase/docs/usage.txt deleted file mode 100644 index 28876a90..00000000 --- a/camelcase/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: camelcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/camelcase/etc/cli_opts.json b/camelcase/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/camelcase/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/camelcase/examples/index.js b/camelcase/examples/index.js deleted file mode 100644 index 3d7f1742..00000000 --- a/camelcase/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 camelcase = require( './../lib' ); - -var str = 'Hello World!'; -var out = camelcase( str ); -console.log( out ); -// => 'helloWorld' - -str = 'HELLO WORLD!'; -out = camelcase( str ); -console.log( out ); -// => 'helloWorld' - -str = 'To be, or not to be: that is the question.'; -out = camelcase( str ); -console.log( out ); -// => 'toBeOrNotToBeThatIsTheQuestion' diff --git a/camelcase/lib/index.js b/camelcase/lib/index.js deleted file mode 100644 index 438cd828..00000000 --- a/camelcase/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to camel case. -* -* @module @stdlib/string/camelcase -* -* @example -* var camelcase = require( '@stdlib/string/camelcase' ); -* -* var str = camelcase( 'foo bar' ); -* // returns 'fooBar' -* -* str = camelcase( '--foo-bar--' ); -* // returns 'fooBar' -* -* str = camelcase( 'Hello World!' ); -* // returns 'helloWorld' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/camelcase/lib/main.js b/camelcase/lib/main.js deleted file mode 100644 index ed424b00..00000000 --- a/camelcase/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/camelcase' ); - - -// MAIN // - -/** -* Converts a string to camel case. -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {string} camel-cased string -* -* @example -* var out = camelcase( 'foo bar' ); -* // returns 'fooBar' -* -* @example -* var out = camelcase( 'IS_MOBILE' ); -* // returns 'isMobile' -* -* @example -* var out = camelcase( 'Hello World!' ); -* // returns 'helloWorld' -* -* @example -* var out = camelcase( '--foo-bar--' ); -* // returns 'fooBar' -*/ -function camelcase( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = camelcase; diff --git a/camelcase/package.json b/camelcase/package.json deleted file mode 100644 index 3c786be7..00000000 --- a/camelcase/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/camelcase", - "version": "0.0.0", - "description": "Convert a string to camel case.", - "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" - } - ], - "bin": { - "camelcase": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "case", - "convert", - "camelcase", - "camel", - "snakecase" - ], - "__stdlib__": {} -} diff --git a/camelcase/test/fixtures/stdin_error.js.txt b/camelcase/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/camelcase/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/camelcase/test/test.cli.js b/camelcase/test/test.cli.js deleted file mode 100644 index dbff0904..00000000 --- a/camelcase/test/test.cli.js +++ /dev/null @@ -1,263 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a string argument to camel case', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'HelloWorld!\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'helloWorld\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nis-mobile"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beepBoop\nisMobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'BEEP_BOOP\tis_mobile\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beepBoop\nisMobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'BEEP_BOOP\tis_mobile\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beepBoop\nisMobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/camelcase/test/test.js b/camelcase/test/test.js deleted file mode 100644 index fbcd9546..00000000 --- a/camelcase/test/test.js +++ /dev/null @@ -1,203 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 camelcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof camelcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - camelcase( value ); - }; - } -}); - -tape( 'the function converts a string to camel case', function test( t ) { - var expected; - var actual; - - expected = 'fooBar'; - actual = camelcase( 'foo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'fooBar'; - actual = camelcase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'fooBar'; - actual = camelcase( 'foo.bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'helloWorld'; - actual = camelcase( 'Hello World!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'bEepBOop'; - actual = camelcase( 'bEep bOOP' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to camelcase', function test( t ) { - var expected; - var actual; - - expected = 'fóoBar'; - actual = camelcase( 'fóo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'fóoBar'; - actual = camelcase( 'fóo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'fóoBar'; - actual = camelcase( 'fóo.bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'hélloWórld'; - actual = camelcase( 'héllo Wórld!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in constant case to camel case', function test( t ) { - var expected; - var actual; - - expected = 'fooBar'; - actual = camelcase( 'FOO_BAR' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMostlyCamelCase'; - actual = camelcase( 'IS_MOSTLY_CAMEL_CASE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMobile'; - actual = camelcase( 'IS_MOBILE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isNodeRepl'; - actual = camelcase( 'IS_NODE_REPL' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in kebab case to camel case', function test( t ) { - var expected; - var actual; - - expected = 'fooBar'; - actual = camelcase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMostlyCamelCase'; - actual = camelcase( 'is-mostly-camel-case' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMobile'; - actual = camelcase( 'is-mobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isNodeRepl'; - actual = camelcase( 'is-node-repl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in pascal case to camel case', function test( t ) { - var expected; - var actual; - - expected = 'fooBar'; - actual = camelcase( 'FooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMostlyCamelCase'; - actual = camelcase( 'IsMostlyCamelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMobile'; - actual = camelcase( 'IsMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isNodeRepl'; - actual = camelcase( 'IsNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function leaves a string that is already in camel case unchanged', function test( t ) { - var expected; - var actual; - - expected = 'fooBar'; - actual = camelcase( 'fooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMostlyCamelCase'; - actual = camelcase( 'isMostlyCamelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isMobile'; - actual = camelcase( 'isMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'isNodeRepl'; - actual = camelcase( 'isNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/capitalize/README.md b/capitalize/README.md deleted file mode 100644 index e129c090..00000000 --- a/capitalize/README.md +++ /dev/null @@ -1,186 +0,0 @@ - - -# capitalize - -> Capitalize the first character in a string. - -
- -## Usage - -```javascript -var capitalize = require( '@stdlib/string/capitalize' ); -``` - -#### capitalize( str ) - -Capitalizes the first character in a string. - -```javascript -var out = capitalize( 'last man standing' ); -// returns 'Last man standing' - -out = capitalize( 'Hidden Treasures' ); -// returns 'Hidden Treasures' -``` - -
- - - -
- -## Examples - - - -```javascript -var capitalize = require( '@stdlib/string/capitalize' ); - -var str = capitalize( 'last man standing' ); -// returns 'Last man standing' - -str = capitalize( 'presidential election' ); -// returns 'Presidential election' - -str = capitalize( 'javaScript' ); -// returns 'JavaScript' - -str = capitalize( 'Hidden Treasures' ); -// returns 'Hidden Treasures' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: capitalize [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nboop' | capitalize --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nboop' | capitalize --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ capitalize beep -Beep -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beEp' | capitalize -BeEp -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tbOOP' | capitalize --split '\t' -Beep -BOOP -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/capitalize/benchmark/benchmark.js b/capitalize/benchmark/benchmark.js deleted file mode 100644 index da454827..00000000 --- a/capitalize/benchmark/benchmark.js +++ /dev/null @@ -1,55 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var capitalize = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz xyz' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = capitalize( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/capitalize/bin/cli b/capitalize/bin/cli deleted file mode 100755 index 57723d3f..00000000 --- a/capitalize/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var capitalize = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( capitalize( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( capitalize( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/capitalize/docs/repl.txt b/capitalize/docs/repl.txt deleted file mode 100644 index 5775d98b..00000000 --- a/capitalize/docs/repl.txt +++ /dev/null @@ -1,24 +0,0 @@ - -{{alias}}( str ) - Capitalizes the first character in a string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Capitalized string. - - Examples - -------- - > var out = {{alias}}( 'beep' ) - 'Beep' - > out = {{alias}}( 'Boop' ) - 'Boop' - - See Also - -------- - diff --git a/capitalize/docs/types/index.d.ts b/capitalize/docs/types/index.d.ts deleted file mode 100644 index 60c2849f..00000000 --- a/capitalize/docs/types/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -type Capitalize = S extends `${infer F}${infer R}` ? `${Uppercase}${R}` : S; - -/** -* Capitalizes the first character in a string. -* -* @param str - input string -* @returns capitalized string -* -* @example -* var out = capitalize( 'last man standing' ); -* // returns 'Last man standing' -* -* @example -* var out = capitalize( 'presidential election' ); -* // returns 'Presidential election' -* -* @example -* var out = capitalize( 'javaScript' ); -* // returns 'JavaScript' -* -* @example -* var out = capitalize( 'Hidden Treasures' ); -* // returns 'Hidden Treasures' -*/ -declare function capitalize( str: S ): Capitalize; - - -// EXPORTS // - -export = capitalize; diff --git a/capitalize/docs/types/test.ts b/capitalize/docs/types/test.ts deleted file mode 100644 index 621a6c85..00000000 --- a/capitalize/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import capitalize = require( './index' ); - - -// TESTS // - -// The function returns a capitalized string... -{ - capitalize( 'abc' ); // $ExpectType "Abc" - capitalize( 'beep boop' ); // $ExpectType "Beep boop" - capitalize( 'a' ); // $ExpectType "A" - capitalize( 'A' ); // $ExpectType "A" - capitalize( 'abc' as string ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - capitalize( true ); // $ExpectError - capitalize( false ); // $ExpectError - capitalize( null ); // $ExpectError - capitalize( undefined ); // $ExpectError - capitalize( 5 ); // $ExpectError - capitalize( [] ); // $ExpectError - capitalize( {} ); // $ExpectError - capitalize( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - capitalize(); // $ExpectError -} diff --git a/capitalize/docs/usage.txt b/capitalize/docs/usage.txt deleted file mode 100644 index 4276f258..00000000 --- a/capitalize/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: capitalize [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/capitalize/etc/cli_opts.json b/capitalize/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/capitalize/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/capitalize/examples/index.js b/capitalize/examples/index.js deleted file mode 100644 index cfb94cfb..00000000 --- a/capitalize/examples/index.js +++ /dev/null @@ -1,33 +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'; - -var capitalize = require( './../lib' ); - -console.log( capitalize( 'last man standing' ) ); -// => 'Last man standing' - -console.log( capitalize( 'presidential election' ) ); -// => 'Presidential election' - -console.log( capitalize( 'javaScript' ) ); -// => 'JavaScript' - -console.log( capitalize( 'Hidden Treasures' ) ); -// => 'Hidden Treasures' diff --git a/capitalize/lib/index.js b/capitalize/lib/index.js deleted file mode 100644 index f20f2e7d..00000000 --- a/capitalize/lib/index.js +++ /dev/null @@ -1,43 +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'; - -/** -* Capitalize the first character in a string. -* -* @module @stdlib/string/capitalize -* -* @example -* var capitalize = require( '@stdlib/string/capitalize' ); -* -* var out = capitalize( 'last man standing' ); -* // returns 'Last man standing' -* -* out = capitalize( 'Hidden Treasures' ); -* // returns 'Hidden Treasures' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/capitalize/lib/main.js b/capitalize/lib/main.js deleted file mode 100644 index c8f2ec88..00000000 --- a/capitalize/lib/main.js +++ /dev/null @@ -1,63 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/capitalize' ); - - -// MAIN // - -/** -* Capitalizes the first character in a string. -* -* @param {string} str - input string -* @throws {TypeError} must provide a string -* @returns {string} capitalized string -* -* @example -* var out = capitalize( 'last man standing' ); -* // returns 'Last man standing' -* -* @example -* var out = capitalize( 'presidential election' ); -* // returns 'Presidential election' -* -* @example -* var out = capitalize( 'javaScript' ); -* // returns 'JavaScript' -* -* @example -* var out = capitalize( 'Hidden Treasures' ); -* // returns 'Hidden Treasures' -*/ -function capitalize( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = capitalize; diff --git a/capitalize/package.json b/capitalize/package.json deleted file mode 100644 index 2f9984d3..00000000 --- a/capitalize/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/capitalize", - "version": "0.0.0", - "description": "Capitalize the first character in a string.", - "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" - } - ], - "bin": { - "capitalize": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "capitalize", - "uppercase", - "upper", - "case" - ], - "__stdlib__": {} -} diff --git a/capitalize/test/fixtures/stdin_error.js.txt b/capitalize/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/capitalize/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/capitalize/test/test.cli.js b/capitalize/test/test.cli.js deleted file mode 100644 index 2efadb35..00000000 --- a/capitalize/test/test.cli.js +++ /dev/null @@ -1,263 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface capitalizes a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beEp\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'BeEp\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beEp\nboop"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'BeEp\nBoop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'Beep\nIsMobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'Beep\nIsMobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/capitalize/test/test.js b/capitalize/test/test.js deleted file mode 100644 index ee90106b..00000000 --- a/capitalize/test/test.js +++ /dev/null @@ -1,80 +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 capitalize = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof capitalize, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - capitalize( value ); - }; - } -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( capitalize( '' ), '', 'returns empty string' ); - t.end(); -}); - -tape( 'the function capitalizes the first character in a provided string', function test( t ) { - var out; - - out = capitalize( 'hello world' ); - t.strictEqual( out, 'Hello world', 'capitalizes first character' ); - - out = capitalize( '!!!' ); - t.strictEqual( out, '!!!', 'does not change non-alphabetical characters' ); - - out = capitalize( 'Hello World' ); - t.strictEqual( out, 'Hello World', 'leaves uppercase letters in uppercase' ); - - t.end(); -}); diff --git a/code-point-at/README.md b/code-point-at/README.md deleted file mode 100644 index 51e6dcbb..00000000 --- a/code-point-at/README.md +++ /dev/null @@ -1,219 +0,0 @@ - - -# codePointAt - -> Return a Unicode [code point][code-point] from a string at a specified position. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var codePointAt = require( '@stdlib/string/code-point-at' ); -``` - -#### codePointAt( string, position\[, backward] ) - -Returns a Unicode [code point][code-point] from a string at a specified position. - -```javascript -var out = codePointAt( 'last man standing', 4 ); -// returns 32 -``` - -The function supports providing a `backward` argument for performing backward iteration for low surrogates. - -```javascript -var out = codePointAt( '🌷', 1, true ); -// returns 127799 -``` - -The function supports providing a negative `position`. - -```javascript -var out = codePointAt( 'last man standing', -13 ); -// returns 32 -``` - -
- - - - - -
- -## Notes - -This function differs from [`String.prototype.codePointAt`][mdn-string-codepointat] in the following ways: - -- The function supports providing a negative `position`. If provided a negative `position`, the function determines the string position relative to the end of the string. -- The function supports providing a `backward` argument for performing backward iteration for low surrogates. [`String.prototype.codePointAt`][mdn-string-codepointat] simply returns the low surrogate value if no [UTF-16][utf-16] surrogate pair begins at the specified position. If invoked with `backward` set to `true`, this function will return the code point after aggregating with the preceding high surrogate, if the specified position does not mark the start of a surrogate pair. -- The function raises an exception if provided a `position` which exceeds the bounds of the input string. - -
- - - - - -
- -## Examples - - - -```javascript -var codePointAt = require( '@stdlib/string/code-point-at' ); - -var v = codePointAt( 'last man standing', 4 ); -// returns 32 - -v = codePointAt( 'presidential election', 8, true ); -// returns 116 - -v = codePointAt( 'अनुच्छेद', 2 ); -// returns 2369 - -v = codePointAt( '🌷', 1, true ); -// returns 127799 -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: code-point-at [options] --pos= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - -b, --backward Backward iteration for low surrogates. - --pos index Position in string. -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```bash -$ code-point-at --pos=2 अनुच्छेद -2369 -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'अनुच्छेद' | code-point-at --pos=2 -2369 -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/code-point-at/benchmark/benchmark.js b/code-point-at/benchmark/benchmark.js deleted file mode 100644 index 1d4cbef7..00000000 --- a/code-point-at/benchmark/benchmark.js +++ /dev/null @@ -1,89 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var fromCodePoint = require( './../../from-code-point' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var UNICODE_MAX = require( '@stdlib/constants/unicode/max' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var codePointAt = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( typeof String.prototype.codePointAt !== 'function' ) -}; -var VALUES = [ - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ), - fromCodePoint( discreteUniform( 0, UNICODE_MAX ) ) -]; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = codePointAt( VALUES[ i%VALUES.length ], 0 ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( out ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::built-in', pkg ), opts, function benchmark( b ) { - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = VALUES[ i%VALUES.length ].codePointAt( 0 ); - if ( typeof out !== 'number' ) { - b.fail( 'should return a number' ); - } - } - b.toc(); - if ( !isNonNegativeInteger( out ) ) { - b.fail( 'should return a nonnegative integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/code-point-at/bin/cli b/code-point-at/bin/cli deleted file mode 100755 index ac8bdf35..00000000 --- a/code-point-at/bin/cli +++ /dev/null @@ -1,88 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var codePointAt = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var cli; - var pos; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - pos = parseInt( flags.pos, 10 ); - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( stdinStream.isTTY ) { - return console.log( codePointAt( args[ 0 ], pos, flags.backward ) ); // eslint-disable-line no-console - } - return stdin( onRead ); - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - if ( error ) { - return cli.error( error ); - } - console.log( codePointAt( data.toString(), pos, flags.backward ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/code-point-at/docs/repl.txt b/code-point-at/docs/repl.txt deleted file mode 100644 index befd1705..00000000 --- a/code-point-at/docs/repl.txt +++ /dev/null @@ -1,34 +0,0 @@ - -{{alias}}( str, idx[, backward] ) - Returns a Unicode code point from a string at a specified position. - - Parameters - ---------- - str: string - Input string. - - idx: integer - Position. If less than `0`, the string position is determined relative - to the end of the input string. - - backward: boolean (optional) - Backward iteration for low surrogates. Default: false. - - Returns - ------- - out: integer - Unicode code point. - - Examples - -------- - > var out = {{alias}}( 'last man standing', 4 ) - 32 - > out = {{alias}}( 'presidential election', 8, true ) - 116 - > out = {{alias}}( 'अनुच्छेद', 2 ) - 2369 - > out = {{alias}}( '🌷', 1, true ) - 127799 - - See Also - -------- diff --git a/code-point-at/docs/types/index.d.ts b/code-point-at/docs/types/index.d.ts deleted file mode 100644 index 8aa34809..00000000 --- a/code-point-at/docs/types/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns a Unicode code point from a string at specified position. -* -* @param str - input string -* @param idx - position -* @param backward - backward iteration for low surrogates (default: false) -* @throws second argument must be an integer -* @throws second argument must be a valid index -* @returns code point -* -* @example -* var str = codePointAt( 'अनुच्छेद', 2 ); -* // returns 2369 -* -* str = codePointAt( '🌷', 1, true ); -* // returns 127799 -*/ -declare function codePointAt( str: string, idx: number, backward?: boolean ): number; - - -// EXPORTS // - -export = codePointAt; diff --git a/code-point-at/docs/types/test.ts b/code-point-at/docs/types/test.ts deleted file mode 100644 index cb4b1caf..00000000 --- a/code-point-at/docs/types/test.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import codePointAt = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - codePointAt( 'last man standing', 4 ); // $ExpectType number - codePointAt( 'presidential election', 8, true ); // $ExpectType number - codePointAt( 'अनुच्छेद', 2 ); // $ExpectType number - codePointAt( '🌷', 1, true ); // $ExpectType number -} - -// The compiler throws an error if the function is provided incorrect arguments... -{ - codePointAt( false, 3 ); // $ExpectError - codePointAt( {}, 3 ); // $ExpectError - codePointAt( ( x: number ): number => x, 3 ); // $ExpectError - - codePointAt( 'string', true ); // $ExpectError - codePointAt( 'string', false ); // $ExpectError - codePointAt( 'string', {} ); // $ExpectError - codePointAt( 'string', ( x: number ): number => x ); // $ExpectError - - codePointAt( 'string', 2, {} ); // $ExpectError - codePointAt( 'string', 2, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - codePointAt(); // $ExpectError - codePointAt( 'abc' ); // $ExpectError -} diff --git a/code-point-at/docs/usage.txt b/code-point-at/docs/usage.txt deleted file mode 100644 index 7c431f1e..00000000 --- a/code-point-at/docs/usage.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Usage: code-point-at [options] --pos= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - -b, --backward Backward iteration for low surrogates. - --pos index Position in string. diff --git a/code-point-at/etc/cli_opts.json b/code-point-at/etc/cli_opts.json deleted file mode 100644 index 755174f8..00000000 --- a/code-point-at/etc/cli_opts.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "string": [ - "pos" - ], - "boolean": [ - "help", - "version", - "backward" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ], - "backward": [ - "b" - ] - } -} diff --git a/code-point-at/examples/index.js b/code-point-at/examples/index.js deleted file mode 100644 index 787f5c00..00000000 --- a/code-point-at/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 codePointAt = require( './../lib' ); - -console.log( codePointAt( 'last man standing', 4 ) ); -// => 32 - -console.log( codePointAt( 'presidential election', 8, true ) ); -// => 116 - -console.log( codePointAt( 'अनुच्छेद', 2 ) ); -// => 2369 - -console.log( codePointAt( '🌷', 1, true ) ); -// => 127799 diff --git a/code-point-at/lib/index.js b/code-point-at/lib/index.js deleted file mode 100644 index 3e165bc5..00000000 --- a/code-point-at/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return a Unicode code point from a string at a specified position. -* -* @module @stdlib/string/code-point-at -* -* @example -* var codePointAt = require( '@stdlib/string/code-point-at' ); -* -* var out = codePointAt( 'अनुच्छेद', 2 ); -* // returns 2369 -* -* out = codePointAt( '🌷', 1, true ); -* // returns 127799 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/code-point-at/lib/main.js b/code-point-at/lib/main.js deleted file mode 100644 index 30c4e1e4..00000000 --- a/code-point-at/lib/main.js +++ /dev/null @@ -1,89 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/code-point-at' ); - - -// MAIN // - -/** -* Returns a Unicode code point from a string at a specified position. -* -* @param {string} str - input string -* @param {integer} idx - position -* @param {boolean} [backward=false] - backward iteration for low surrogates -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be an integer -* @throws {TypeError} third argument must be a boolean -* @throws {RangeError} position must be a valid index in string -* @returns {NonNegativeInteger} code point -* -* @example -* var out = codePointAt( 'last man standing', 4 ); -* // returns 32 -* -* @example -* var out = codePointAt( 'presidential election', 8, true ); -* // returns 116 -* -* @example -* var out = codePointAt( 'अनुच्छेद', 2 ); -* // returns 2369 -* -* @example -* var out = codePointAt( '🌷', 1, true ); -* // returns 127799 -*/ -function codePointAt( str, idx, backward ) { - var FLG; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isInteger( idx ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', idx ) ); - } - if ( idx < 0 ) { - idx += str.length; - } - if ( idx < 0 || idx >= str.length ) { - throw new RangeError( format( 'invalid argument. Second argument must be a valid position (i.e., be within string bounds). Value: `%d`.', idx ) ); - } - if ( arguments.length > 2 ) { - if ( !isBoolean( backward ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be a boolean. Value: `%s`.', backward ) ); - } - FLG = backward; - } else { - FLG = false; - } - return base( str, idx, FLG ); -} - - -// EXPORTS // - -module.exports = codePointAt; diff --git a/code-point-at/package.json b/code-point-at/package.json deleted file mode 100644 index 30aa0182..00000000 --- a/code-point-at/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@stdlib/string/code-point-at", - "version": "0.0.0", - "description": "Return a Unicode code point from a string at a specified position.", - "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" - } - ], - "bin": { - "from-code-point": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "code", - "point", - "pt", - "unicode", - "utf-16", - "utf16", - "surrogate", - "astral" - ] -} diff --git a/code-point-at/test/fixtures/stdin_error.js.txt b/code-point-at/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 103efa25..00000000 --- a/code-point-at/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/code-point-at/test/test.cli.js b/code-point-at/test/test.cli.js deleted file mode 100644 index a2ae56ff..00000000 --- a/code-point-at/test/test.cli.js +++ /dev/null @@ -1,260 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface returns the code point at a specified string position', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--pos=4\'; process.argv[ 3 ] = \'last man standing\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '32\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports backward iteration for low surrogates when invoked with the `--backward` flag', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--pos=1\'; process.argv[ 3 ] = \'--backward\'; process.argv[ 4 ] = \'🌷\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '127799\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports backward iteration for low surrogates when invoked with the `-b` flag', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--pos=1\'; process.argv[ 3 ] = \'--backward\'; process.argv[ 4 ] = \'🌷\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '127799\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf \'अनुच्छेद\'', - '|', - EXEC_PATH, - fpath, - '--pos=2' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '2369\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/code-point-at/test/test.js b/code-point-at/test/test.js deleted file mode 100644 index 93eabba5..00000000 --- a/code-point-at/test/test.js +++ /dev/null @@ -1,181 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 codePointAt = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof codePointAt, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if the first argument is not a string', function test( t ) { - var values; - var i; - - values = [ - -5, - 3.14, - -1.0, - NaN, - true, - false, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - codePointAt( value, 0 ); - }; - } -}); - -tape( 'the function throws an error if the second argument is not an integer', function test( t ) { - var values; - var i; - - values = [ - 'bar', - 3.14, - -3.14, - NaN, - true, - false, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - codePointAt( 'foo', value ); - }; - } -}); - -tape( 'the function throws an error if the third argument is not a boolean', function test( t ) { - var values; - var i; - - values = [ - 'bar', - -5, - 3.14, - -1.0, - NaN, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - codePointAt( 'foo', 0, value ); - }; - } -}); - -tape( 'the function throws an error if a provided position is not a valid index in the provided string', function test( t ) { - var values; - var i; - - values = [ - [ 'bar', 3 ], - [ 'bar', -4 ], - [ 'string', 7 ], - [ 'string', -8 ], - [ '', 0 ] - ]; - 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() { - codePointAt( value[ 0 ], value[ 1 ] ); - }; - } -}); - -tape( 'the arity of the function is 3', function test( t ) { - t.strictEqual( codePointAt.length, 3, 'has length 3' ); - t.end(); -}); - -tape( 'the function returns the code point at a specified string position', function test( t ) { - var out; - - out = codePointAt( 'last man standing', 4 ); - t.strictEqual( out, 0x20, 'returns expected value' ); - - out = codePointAt( 'last man standing', -13 ); - t.strictEqual( out, 0x20, 'returns expected value' ); - - out = codePointAt( 'presidential election', 8, true ); - t.strictEqual( out, 0x74, 'returns expected value' ); - - out = codePointAt( 'presidential election', -13, true ); - t.strictEqual( out, 0x74, 'returns expected value' ); - - out = codePointAt( 'अनुच्छेद', 2 ); - t.strictEqual( out, 0x941, 'returns expected value' ); - - out = codePointAt( 'अनुच्छेद', -6 ); - t.strictEqual( out, 0x941, 'returns expected value' ); - - out = codePointAt( '🌷', 0, true ); - t.strictEqual( out, 0x1F337, 'returns expected value' ); - - out = codePointAt( '🌷', -2, true ); - t.strictEqual( out, 0x1F337, 'returns expected value' ); - - t.end(); -}); diff --git a/constantcase/README.md b/constantcase/README.md deleted file mode 100644 index 69de2685..00000000 --- a/constantcase/README.md +++ /dev/null @@ -1,205 +0,0 @@ - - -# constantcase - -> Convert a string to constant case. - - - -
- -## Usage - -```javascript -var constantcase = require( '@stdlib/string/constantcase' ); -``` - -#### constantcase( str ) - -Converts a string to constant case. - -```javascript -var str = constantcase( 'foo bar' ); -// returns 'FOO_BAR' - -str = constantcase( 'foo bar baz' ); -// returns 'FOO_BAR_BAZ' - -str = constantcase( 'foo_bar' ); -// returns 'FOO_BAR' -``` - -
- - - - - -
- -## Examples - -```javascript -var constantcase = require( '@stdlib/string/constantcase' ); - -var str = 'Hello World!'; -var out = constantcase( str ); -// returns 'HELLO_WORLD' - -str = 'I am a tiny little teapot'; -out = constantcase( str ); -// returns 'I_AM_A_TINY_LITTLE_TEAPOT' - -str = 'with big problems'; -out = constantcase( str ); -// returns 'WITH_BIG_PROBLEMS' - -str = 'To be, or not to be: that is the question.'; -out = constantcase( str ); -// returns 'TO_BE_OR_NOT_TO_BE_THAT_IS_THE_QUESTION' - -str = 'isMobile'; -out = constantcase( str ); -// returns 'IS_MOBILE' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: constantcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beEp booP\nisMobile' | constantcase --split /\r?\n/ - - # Escaped... - $ echo -n $'beEp booP\nisMobile' | constantcase --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ constantcase 'hello world' -HELLO_WORLD -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beEp booP' | constantcase -BEEP_BOOP -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep_boop\tisMobile' | constantcase --split '\t' -BEEP_BOOP -IS_MOBILE -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/constantcase/benchmark/benchmark.js b/constantcase/benchmark/benchmark.js deleted file mode 100644 index 075bcb56..00000000 --- a/constantcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var constantcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = constantcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/constantcase/bin/cli b/constantcase/bin/cli deleted file mode 100755 index d1f83f8d..00000000 --- a/constantcase/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var constantcase = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( constantcase( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( constantcase( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/constantcase/docs/repl.txt b/constantcase/docs/repl.txt deleted file mode 100644 index 6e510074..00000000 --- a/constantcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to constant case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Constant-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'HELLO_WORLD' - > out = {{alias}}( 'I am a tiny little teapot' ) - 'I_AM_A_TINY_LITTLE_TEAPOT' - - See Also - -------- diff --git a/constantcase/docs/types/index.d.ts b/constantcase/docs/types/index.d.ts deleted file mode 100644 index 50911f67..00000000 --- a/constantcase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to constant case. -* -* @param str - string to convert -* @returns constant-cased string -* -* @example -* var str = constantcase( 'beep' ); -* // returns 'BEEP' -* -* @example -* var str = constantcase( 'beep boop' ); -* // returns 'BEEP_BOOP' -* -* @example -* var str = constantcase( 'Hello World!' ); -* // returns 'HELLO_WORLD' -*/ -declare function constantcase( str: string ): string; - - -// EXPORTS // - -export = constantcase; diff --git a/constantcase/docs/types/test.ts b/constantcase/docs/types/test.ts deleted file mode 100644 index 60936a7e..00000000 --- a/constantcase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import constantcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - constantcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - constantcase( true ); // $ExpectError - constantcase( false ); // $ExpectError - constantcase( null ); // $ExpectError - constantcase( undefined ); // $ExpectError - constantcase( 5 ); // $ExpectError - constantcase( [] ); // $ExpectError - constantcase( {} ); // $ExpectError - constantcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - constantcase(); // $ExpectError -} diff --git a/constantcase/docs/usage.txt b/constantcase/docs/usage.txt deleted file mode 100644 index 3f379074..00000000 --- a/constantcase/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: constantcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/constantcase/etc/cli_opts.json b/constantcase/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/constantcase/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/constantcase/examples/index.js b/constantcase/examples/index.js deleted file mode 100644 index b803ba0c..00000000 --- a/constantcase/examples/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 constantcase = require( './../lib' ); - -var str = 'Hello World!'; -var out = constantcase( str ); -console.log( out ); -// => 'HELLO_WORLD' - -str = 'I am a tiny little teapot'; -out = constantcase( str ); -console.log( out ); -// => 'I_AM_A_TINY_LITTLE_TEAPOT' - -str = 'with big problems'; -out = constantcase( str ); -console.log( out ); -// => 'WITH_BIG_PROBLEMS' - -str = 'To be, or not to be: that is the question.'; -out = constantcase( str ); -console.log( out ); -// => 'TO_BE_OR_NOT_TO_BE_THAT_IS_THE_QUESTION' - -str = 'isMobile'; -out = constantcase( str ); -console.log( out ); -// => 'IS_MOBILE' diff --git a/constantcase/lib/index.js b/constantcase/lib/index.js deleted file mode 100644 index 51d5bdcd..00000000 --- a/constantcase/lib/index.js +++ /dev/null @@ -1,47 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to constant case. -* -* @module @stdlib/string/constantcase -* -* @example -* var constantcase = require( '@stdlib/string/constantcase' ); -* -* var str = constantcase( 'aBcDeF' ); -* // returns 'ABCDEF' -* -* str = constantcase( 'Hello World!' ); -* // returns 'HELLO_WORLD' -* -* str = constantcase( 'I am a robot' ); -* // returns 'I_AM_A_ROBOT' -*/ - - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/constantcase/lib/main.js b/constantcase/lib/main.js deleted file mode 100644 index 83311a64..00000000 --- a/constantcase/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/constantcase' ); - - -// MAIN // - -/** -* Converts a string to constant case. -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {string} constant-cased string -* -* @example -* var str = constantcase( 'beep' ); -* // returns 'BEEP' -* -* @example -* var str = constantcase( 'beep boop' ); -* // returns 'BEEP_BOOP' -* -* @example -* var str = constantcase( 'isMobile' ); -* // returns 'IS_MOBILE' -* -* @example -* var str = constantcase( 'Hello World!' ); -* // returns 'HELLO_WORLD' -*/ -function constantcase( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = constantcase; diff --git a/constantcase/package.json b/constantcase/package.json deleted file mode 100644 index ce320da3..00000000 --- a/constantcase/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/constantcase", - "version": "0.0.0", - "description": "Convert a string to constant case.", - "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" - } - ], - "bin": { - "constantcase": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "case", - "constant", - "convert" - ], - "__stdlib__": {} -} diff --git a/constantcase/test/fixtures/stdin_error.js.txt b/constantcase/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/constantcase/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/constantcase/test/test.cli.js b/constantcase/test/test.cli.js deleted file mode 100644 index 6220cbab..00000000 --- a/constantcase/test/test.cli.js +++ /dev/null @@ -1,263 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a string argument to constant case', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'Hello World!\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'HELLO_WORLD\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nisMobile"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'BEEP_BOOP\nIS_MOBILE\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'BEEP_BOOP\nIS_MOBILE\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'BEEP_BOOP\nIS_MOBILE\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/constantcase/test/test.js b/constantcase/test/test.js deleted file mode 100644 index b62a1f9a..00000000 --- a/constantcase/test/test.js +++ /dev/null @@ -1,150 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 constantcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof constantcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - constantcase( value ); - }; - } -}); - -tape( 'the function converts a camel case string to a constant case string', function test( t ) { - var expected; - var actual; - - expected = 'CAMEL_CASE'; - actual = constantcase( 'camelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IS_MOBILE'; - actual = constantcase( 'isMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function converts a string to constant case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'Hello World', - 'I am tiny little tea pot', - 'Big problems', - 'The quick brown fox jumps over the lazy dog' - ]; - - expected = [ - 'HELLO_WORLD', - 'I_AM_TINY_LITTLE_TEA_POT', - 'BIG_PROBLEMS', - 'THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( constantcase( values[i] ), expected[i], 'returns expected value.' ); - } - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to constant case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'Привет мир', - 'Я маленькая лошадка', - 'Большие проблемы', - 'Быстрый коричневый фонд', - 'Café esuna bella' - ]; - - expected = [ - 'ПРИВЕТ_МИР', - 'Я_МАЛЕНЬКАЯ_ЛОШАДКА', - 'БОЛЬШИЕ_ПРОБЛЕМЫ', - 'БЫСТРЫЙ_КОРИЧНЕВЫЙ_ФОНД', - 'CAFÉ_ESUNA_BELLA' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( constantcase( values[i] ), expected[i], 'returns expected value.' ); - } - t.end(); -}); - -tape( 'the function leaves a string that is already in constant case unchanged', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'CAMEL_CASE', - 'IS_MOBILE', - 'THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG' - ]; - - expected = [ - 'CAMEL_CASE', - 'IS_MOBILE', - 'THE_QUICK_BROWN_FOX_JUMPS_OVER_THE_LAZY_DOG' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( constantcase( values[i] ), expected[i], 'returns expected value.' ); - } - t.end(); -}); diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts deleted file mode 100644 index d90b5601..00000000 --- a/docs/types/index.d.ts +++ /dev/null @@ -1,1456 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/* eslint-disable max-lines */ - -import acronym = require( './../../acronym' ); -import base = require( './../../base' ); -import camelcase = require( './../../camelcase' ); -import capitalize = require( './../../capitalize' ); -import codePointAt = require( './../../code-point-at' ); -import constantcase = require( './../../constantcase' ); -import dotcase = require( './../../dotcase' ); -import endsWith = require( './../../ends-with' ); -import first = require( './../../first' ); -import forEach = require( './../../for-each' ); -import format = require( './../../format' ); -import fromCodePoint = require( './../../from-code-point' ); -import headercase = require( './../../headercase' ); -import kebabcase = require( './../../kebabcase' ); -import last = require( './../../last' ); -import lpad = require( './../../left-pad' ); -import ltrim = require( './../../left-trim' ); -import ltrimN = require( './../../left-trim-n' ); -import lowercase = require( './../../lowercase' ); -import nextCodePointIndex = require( './../../next-code-point-index' ); -import nextGraphemeClusterBreak = require( './../../next-grapheme-cluster-break' ); -import numCodePoints = require( './../../num-code-points' ); -import numGraphemeClusters = require( './../../num-grapheme-clusters' ); -import num2words = require( './../../num2words' ); -import pad = require( './../../pad' ); -import pascalcase = require( './../../pascalcase' ); -import percentEncode = require( './../../percent-encode' ); -import prevGraphemeClusterBreak = require( './../../prev-grapheme-cluster-break' ); -import removeFirst = require( './../../remove-first' ); -import removeLast = require( './../../remove-last' ); -import removePunctuation = require( './../../remove-punctuation' ); -import removeUTF8BOM = require( './../../remove-utf8-bom' ); -import removeWords = require( './../../remove-words' ); -import repeat = require( './../../repeat' ); -import replace = require( './../../replace' ); -import replaceBefore = require( './../../replace-before' ); -import reverse = require( './../../reverse' ); -import rpad = require( './../../right-pad' ); -import rtrim = require( './../../right-trim' ); -import rtrimN = require( './../../right-trim-n' ); -import snakecase = require( './../../snakecase' ); -import splitGraphemeClusters = require( './../../split-grapheme-clusters' ); -import startcase = require( './../../startcase' ); -import startsWith = require( './../../starts-with' ); -import substringAfter = require( './../../substring-after' ); -import substringAfterLast = require( './../../substring-after-last' ); -import substringBefore = require( './../../substring-before' ); -import substringBeforeLast = require( './../../substring-before-last' ); -import graphemeClusters2iterator = require( './../../to-grapheme-cluster-iterator' ); -import graphemeClusters2iteratorRight = require( './../../to-grapheme-cluster-iterator-right' ); -import toWellFormed = require( './../../to-well-formed' ); -import trim = require( './../../trim' ); -import truncate = require( './../../truncate' ); -import truncateMiddle = require( './../../truncate-middle' ); -import uncapitalize = require( './../../uncapitalize' ); -import uppercase = require( './../../uppercase' ); -import utf16ToUTF8Array = require( './../../utf16-to-utf8-array' ); - -/** -* Interface describing the `string` namespace. -*/ -interface Namespace { - /** - * Generates an acronym for a given string. - * - * @param str - input string - * @param options - function options - * @param options.stopwords - custom stop words - * @returns generated acronym - * - * @example - * var out = ns.acronym( 'the quick brown fox' ); - * // returns 'QBF' - * - * @example - * var out = ns.acronym( 'Hard-boiled eggs' ); - * // returns 'HBE' - * - * @example - * var out = ns.acronym( 'National Association of Securities Dealers Automated Quotation' ); - * // returns 'NASDAQ' - */ - acronym: typeof acronym; - - /** - * Base (i.e., lower-level) string functions. - */ - base: typeof base; - - /** - * Converts a string to camel case. - * - * @param str - string to convert - * @returns camel-cased string - * - * @example - * var str = ns.camelcase( 'Hello World!' ); - * // returns 'helloWorld' - * - * @example - * var str = ns.camelcase( 'foo_bar' ); - * // returns 'fooBar' - * - * @example - * var str = ns.camelcase( 'foo-bar' ); - * // returns 'fooBar' - */ - camelcase: typeof camelcase; - - /** - * Capitalizes the first character in a string. - * - * @param str - input string - * @returns capitalized string - * - * @example - * var out = ns.capitalize( 'last man standing' ); - * // returns 'Last man standing' - * - * @example - * var out = ns.capitalize( 'presidential election' ); - * // returns 'Presidential election' - * - * @example - * var out = ns.capitalize( 'javaScript' ); - * // returns 'JavaScript' - * - * @example - * var out = ns.capitalize( 'Hidden Treasures' ); - * // returns 'Hidden Treasures' - */ - capitalize: typeof capitalize; - - /** - * Returns a Unicode code point from a string at specified position. - * - * @param str - input string - * @param idx - position - * @param backward - backward iteration for low surrogates (default: false) - * @throws second argument must be an integer - * @throws second argument must be a valid index - * @returns code point - * - * @example - * var str = ns.codePointAt( 'अनुच्छेद', 2 ); - * // returns 2369 - * - * str = ns.codePointAt( '🌷', 1, true ); - * // returns 127799 - */ - codePointAt: typeof codePointAt; - - /** - * Converts a string to constant case. - * - * @param str - string to convert - * @returns constant-cased string - * - * @example - * var str = ns.constantcase( 'beep' ); - * // returns 'BEEP' - * - * @example - * var str = ns.constantcase( 'beep boop' ); - * // returns 'BEEP_BOOP' - * - * @example - * var str = ns.constantcase( 'Hello World!' ); - * // returns 'HELLO_WORLD' - */ - constantcase: typeof constantcase; - - /** - * Converts a string to dot case. - * - * @param str - string to convert - * @returns dot-cased string - * - * @example - * var str = ns.dotcase( 'Hello World!' ); - * // returns 'hello.world' - * - * @example - * var str = ns.dotcase( 'foo_bar' ); - * // returns 'foo.bar' - * - * @example - * var str = ns.dotcase( 'foo-bar' ); - * // returns 'foo.bar' - */ - dotcase: typeof dotcase; - - /** - * Tests if a string ends with the characters of another string. - * - * ## Notes - * - * - The last parameter restricts the search to a substring within the input string beginning from the leftmost character. If provided a negative value, `len` indicates to ignore the last `len` characters, returning the same output as `str.length + len`. - * - * @param str - input string - * @param search - search string - * @param len - substring length (default: str.length) - * @returns boolean indicating if the input string ends with the search string - * - * @example - * var bool = ns.endsWith( 'Remember the story I used to tell you when you were a boy?', 'boy?' ); - * // returns true - * - * @example - * var bool = ns.endsWith( 'Remember the story I used to tell you when you were a boy?', 'Boy?' ); - * // returns false - * - * @example - * var bool = ns.endsWith( 'To be, or not to be, that is the question.', 'to be' ); - * // returns false - * - * @example - * var bool = ns.endsWith( 'To be, or not to be, that is the question.', 'to be', 19 ); - * // returns true - * - * @example - * var bool = ns.endsWith( 'To be, or not to be, that is the question.', 'to be', -23 ); - * // returns true - */ - endsWith: typeof endsWith; - - /** - * Returns the first character(s) of a string. - * - * @param str - input string - * @param n - number of characters to return (default: 1) - * @returns output string - * - * @example - * var out = ns.first( 'last man standing' ); - * // returns 'l' - * - * @example - * var out = ns.first( 'presidential election' ); - * // returns 'p' - * - * @example - * var out = ns.first( 'javaScript' ); - * // returns 'j' - * - * @example - * var out = ns.first( 'Hidden Treasures' ); - * // returns 'H' - * - * @example - * var out = ns.first( '🐶🐮🐷🐰🐸', 2 ); - * // returns '🐶🐮' - * - * @example - * var out = ns.first( 'foo bar', 5 ); - * // returns 'foo b' - */ - first: typeof first; - - /** - * Invokes a function for each character in a string. - * - * ## Notes - * - * - When invoked, the provided function is provided three arguments: - * - * - **value**: character. - * - **index**: starting character index. - * - **str**: input string. - * - * @param str - input string - * @param options - options - * @param clbk - function to invoke - * @param thisArg - execution context - * @returns input string - * - * @example - * function log( value, index ) { - * console.log( '%d: %s', index, value ); - * } - * - * var opts = { - * 'mode': 'code_point' - * }; - * ns.forEach( 'Hello, World!', opts, log ); - */ - forEach: typeof forEach; - - /** - * Inserts supplied variable values into a format string. - * - * @param str - input string - * @param args - variable values - * @throws invalid flags - * @returns formatted string - * - * @example - * var str = ns.format( 'Hello %s!', 'world' ); - * // returns 'Hello world!' - * - * @example - * var str = ns.format( 'Pi: ~%.2f', 3.141592653589793 ); - * // returns 'Pi: ~3.14' - */ - format: typeof format; - - /** - * Creates a string from a sequence of Unicode code points. - * - * ## Notes - * - * - In addition to multiple arguments, the function also supports providing an array-like object as a single argument containing a sequence of Unicode code points. - * - * @param pt - sequence of code points - * @throws must provide either an array-like object of code points or one or more code points as separate arguments - * @throws a code point must be a nonnegative integer - * @throws must provide a valid Unicode code point - * @returns created string - * - * @example - * var str = ns.fromCodePoint( 9731 ); - * // returns '☃' - */ - fromCodePoint: typeof fromCodePoint; - - /** - * Converts a string to HTTP header case. - * - * @param str - string to convert - * @returns HTTP header-cased string - * - * @example - * var str = ns.headercase( 'Hello World!' ); - * // returns 'Hello-World' - * - * @example - * var str = ns.headercase( 'foo_bar' ); - * // returns 'Foo-Bar' - * - * @example - * var str = ns.headercase( 'foo-bar' ); - * // returns 'Foo-Bar' - */ - headercase: typeof headercase; - - /** - * Converts a string to kebab case. - * - * @param str - string to convert - * @returns kebab-cased string - * - * @example - * var str = ns.kebabcase( 'fooBar' ); - * // returns 'foo-bar' - * - * @example - * var str = ns.kebabcase( 'foo_bar' ); - * // returns 'foo-bar' - * - * @example - * var str = ns.kebabcase( 'foo-bar' ); - * // returns 'foo-bar' - */ - kebabcase: typeof kebabcase; - - /** - * Returns the last character(s) of a string. - * - * @param str - input string - * @param n - number of characters to return (default: 1) - * @returns output string - * - * @example - * var out = ns.last( 'ns.last man standing' ); - * // returns 'g' - * - * @example - * var out = ns.last( 'presidential election' ); - * // returns 'n' - * - * @example - * var out = ns.last( 'javaScript' ); - * // returns 't' - * - * @example - * var out = ns.last( 'Hidden Treasures' ); - * // returns 's' - * - * @example - * var out = ns.last( '🐶🐮🐷🐰🐸', 2 ); - * // returns '🐰🐸' - * - * @example - * var out = ns.last( 'foo bar', 3 ); - * // returns 'bar' - */ - last: typeof last; - - /** - * Left pads a string such that the padded string has a length of at least `len`. - * - * ## Notes - * - * - An output string is not guaranteed to have a length of exactly `len`, but to have a length of at least `len`. To generate a padded string having a length equal to `len`, post-process a padded string by trimming off excess characters. - * - * @param str - string to pad - * @param len - minimum string length - * @param pad - string used to pad (default: ' ') - * @throws second argument must be a nonnegative integer - * @throws padding must have a length greater than `0` - * @returns padded string - * - * @example - * var str = ns.lpad( 'a', 5 ); - * // returns ' a' - * - * @example - * var str = ns.lpad( 'beep', 10, 'b' ); - * // returns 'bbbbbbbeep' - * - * @example - * var str = ns.lpad( 'boop', 12, 'beep' ); - * // returns 'beepbeepboop' - */ - lpad: typeof lpad; - - /** - * Trims whitespace characters from the beginning of a string. - * - * @param str - input string - * @returns trimmed string - * - * @example - * var out = ns.ltrim( ' Whitespace ' ); - * // returns 'Whitespace ' - * - * @example - * var out = ns.ltrim( '\t\t\tTabs\t\t\t' ); - * // returns 'Tabs\t\t\t' - * - * @example - * var out = ns.ltrim( '\n\n\nNew Lines\n\n\n' ); - * // returns 'New Lines\n\n\n' - */ - ltrim: typeof ltrim; - - /** - * Trims `n` characters from the beginning of a string. - * - * @param str - input string - * @param n - number of characters to trim - * @param chars - characters to trim (default: whitespace characters) - * @returns trimmed string - * - * @example - * var str = ' abc '; - * var out = ns.ltrimN( str, 2 ); - * // returns ' abc ' - * - * @example - * var str = ' abc '; - * var out = ns.ltrimN( str, str.length ); - * // returns 'abc ' - * - * @example - * var str = '~~abc!~~'; - * var out = ns.ltrimN( str, str.length, [ '~', '!' ] ); - * // returns 'abc!~~' - * - * @example - * var str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨'; - * var out = ns.ltrimN( str, str.length, '👨🏼‍🎨🤖' ); - * // returns '' - */ - ltrimN: typeof ltrimN; - - /** - * Converts a string to lowercase. - * - * @param str - string to convert - * @returns lowercase string - * - * @example - * var str = ns.lowercase( 'bEEp' ); - * // returns 'beep' - */ - lowercase: typeof lowercase; - - /** - * Returns the position of the next Unicode code point in a string after a specified position. - * - * @param str - input string - * @param fromIndex - position (default: 0) - * @throws first argument must be a string - * @throws second argument must be an integer - * @returns next code point position - * - * @example - * var out = ns.nextCodePointIndex( '𐒻𐓟𐒻𐓟', 0 ); - * // returns 2 - * - * out = ns.nextCodePointIndex( '🌷' ); - * // returns -1 - */ - nextCodePointIndex: typeof nextCodePointIndex; - - /** - * Returns the next extended grapheme cluster break in a string after a specified position. - * - * @param str - input string - * @param fromIndex - position (default: 0) - * @throws first argument must be a string - * @throws second argument must be an integer - * @returns next grapheme break position - * - * @example - * var out = ns.nextGraphemeClusterBreak( 'अनुच्छेद', 1 ); - * // returns 3 - * - * out = ns.nextGraphemeClusterBreak( '🌷' ); - * // returns -1 - */ - nextGraphemeClusterBreak: typeof nextGraphemeClusterBreak; - - /** - * Returns the number of code points in a string. - * - * @param str - input string - * @returns number of code points - * - * @example - * var out = ns.numCodePoints( 'last man standing' ); - * // returns 17 - * - * @example - * var out = ns.numCodePoints( 'presidential election' ); - * // returns 21 - * - * @example - * var out = ns.numCodePoints( '六' ); - * // returns 1 - * - * @example - * var out = ns.numCodePoints( 'अनुच्छेद' ); - * // returns 8 - */ - numCodePoints: typeof numCodePoints; - - /** - * Returns the number of grapheme clusters in a string. - * - * @param str - input string - * @returns number of grapheme clusters - * - * @example - * var out = ns.numGraphemeClusters( 'last man standing' ); - * // returns 17 - * - * @example - * var out = ns.numGraphemeClusters( 'presidential election' ); - * // returns 21 - * - * @example - * var out = ns.numGraphemeClusters( '🌷' ); - * // returns 1 - * - * @example - * var out = ns.numGraphemeClusters( 'अनुच्छेद' ); - * // returns 5 - */ - numGraphemeClusters: typeof numGraphemeClusters; - - /** - * Converts a number to a word representation. - * - * @param num - number to convert - * @param options - options - * @param options.lang - language code (default: 'en') - * @returns string representation of a number - * - * @example - * var out = ns.num2words( 12 ); - * // returns 'twelve' - * - * @example - * var out = ns.num2words( 21.8 ); - * // returns 'twenty-one point eight' - * - * @example - * var out = ns.num2words( 1234 ); - * // returns 'one thousand two hundred thirty-four' - * - * @example - * var out = ns.num2words( 100381 ); - * // returns 'one hundred thousand three hundred eighty-one' - */ - num2words: typeof num2words; - - /** - * Pads a string such that the padded string has a length of `len`. - * - * @param str - string to pad - * @param len - string length - * @param options - function options - * @param options.lpad - string used to left pad (default: '') - * @param options.rpad - string used to right pad (default: ' ') - * @param options.centerRight - boolean indicating whether to center right in the event of a tie (default: false) - * @throws second argument must be a nonnegative integer - * @throws must provide valid options - * @throws at least one padding must have a length greater than `0` - * @returns padded string - * - * @example - * var str = ns.pad( 'a', 5 ); - * // returns 'a ' - * - * @example - * var str = ns.pad( 'a', 10, { - * 'lpad': 'b' - * }); - * // returns 'bbbbbbbbba' - * - * @example - * var str = ns.pad( 'a', 12, { - * 'rpad': 'b' - * }); - * // returns 'abbbbbbbbbbb' - * - * @example - * var opts = { - * 'lpad': 'a', - * 'rpad': 'c' - * }; - * var str = ns.pad( 'b', 10, opts ); - * // returns 'aaaabccccc' - * - * @example - * var opts = { - * 'lpad': 'a', - * 'rpad': 'c', - * 'centerRight': true - * }; - * var str = ns.pad( 'b', 10, opts ); - * // returns 'aaaaabcccc' - */ - pad: typeof pad; - - /** - * Converts a string to Pascal case. - * - * @param str - string to convert - * @returns Pascal-cased string - * - * @example - * var str = ns.pascalcase( 'Hello World!' ); - * // returns 'HelloWorld' - * - * @example - * var str = ns.pascalcase( 'foo_bar' ); - * // returns 'FooBar' - * - * @example - * var str = ns.pascalcase( 'foo-bar' ); - * // returns 'FooBar' - */ - pascalcase: typeof pascalcase; - - /** - * Percent-encodes a UTF-16 encoded string according to [RFC 3986][1]. - * - * [1]: https://tools.ietf.org/html/rfc3986#section-2.1 - * - * @param str - string to percent-encode - * @returns percent-encoded string - * - * @example - * var str1 = 'Ladies + Gentlemen'; - * - * var str2 = ns.percentEncode( str1 ); - * // returns 'Ladies%20%2B%20Gentlemen' - */ - percentEncode: typeof percentEncode; - - /** - * Returns the previous extended grapheme cluster break in a string before a specified position. - * - * @param str - input string - * @param fromIndex - position (default: str.length-1) - * @throws first argument must be a string - * @throws second argument must be an integer - * @returns previous grapheme break position - * - * @example - * var out = ns.prevGraphemeClusterBreak( 'अनुच्छेद', 2 ); - * // returns 0 - * - * out = ns.prevGraphemeClusterBreak( '🌷', 1 ); - * // returns -1 - */ - prevGraphemeClusterBreak: typeof prevGraphemeClusterBreak; - - /** - * Removes the first character(s) of a string. - * - * @param str - input string - * @param n - number of characters to remove (default: 1) - * @returns updated string - * - * @example - * var out = ns.removeFirst( 'last man standing' ); - * // returns 'ast man standing' - * - * @example - * var out = ns.removeFirst( 'presidential election' ); - * // returns 'residential election' - * - * @example - * var out = ns.removeFirst( 'JavaScript' ); - * // returns 'avaScript' - * - * @example - * var out = ns.removeFirst( 'Hidden Treasures' ); - * // returns 'idden Treasures' - * - * @example - * var out = ns.removeFirst( '🐶🐮🐷🐰🐸', 2 ); - * // returns '🐷🐰🐸' - * - * @example - * var out = ns.removeFirst( 'foo bar', 4 ); - * // returns 'bar' - */ - removeFirst: typeof removeFirst; - - /** - * Removes the last character(s) of a string. - * - * @param str - input string - * @param n - number of characters to remove (default: 1) - * @returns updated string - * - * @example - * var out = ns.removeLast( 'last man standing' ); - * // returns 'last man standin' - * - * @example - * var out = ns.removeLast( 'presidential election' ); - * // returns 'presidential electio' - * - * @example - * var out = ns.removeLast( 'javaScript' ); - * // returns 'javaScrip' - * - * @example - * var out = ns.removeLast( 'Hidden Treasures' ); - * // returns 'Hidden Treasure' - * - * @example - * var out = ns.removeLast( 'leader', 2 ); - * // returns 'lead' - */ - removeLast: typeof removeLast; - - /** - * Removes punctuation characters from a string. - * - * @param str - input string - * @returns output string - * - * @example - * var str = 'Sun Tzu said: "A leader leads by example not by force."'; - * var out = ns.removePunctuation( str ); - * // returns 'Sun Tzu said A leader leads by example not by force' - * - * @example - * var str = 'Double, double, toil and trouble; Fire burn, and cauldron bubble!'; - * var out = ns.removePunctuation( str ); - * // returns 'Double double toil and trouble Fire burn and cauldron bubble' - * - * @example - * var str = 'This module removes these characters: `{}[]:,!/<>().;~|?\'"'; - * var out = ns.removePunctuation( str ); - * // returns 'This module removes these characters ' - */ - removePunctuation: typeof removePunctuation; - - /** - * Removes a UTF-8 byte order mark (BOM) from the beginning of a string. - * - * ## Notes - * - * - A UTF-8 byte order mark ([BOM][1]) is the byte sequence `0xEF,0xBB,0xBF`. - * - To convert a UTF-8 encoded `Buffer` to a `string`, the `Buffer` must be converted to [UTF-16][2]. The BOM thus gets converted to the single 16-bit code point `'\ufeff'` (UTF-16 BOM). - * - * [1]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8 - * [2]: http://es5.github.io/#x4.3.16 - * - * @param str - input string - * @returns string with BOM removed - * - * @example - * var str = ns.removeUTF8BOM( '\ufeffbeep' ); - * // returns 'beep' - */ - removeUTF8BOM: typeof removeUTF8BOM; - - /** - * Removes a list of words from a string. - * - * @param str - input string - * @param words - array of words to be removed - * @param ignoreCase - boolean indicating whether to perform a case-insensitive operation (default: false) - * @returns output string - * - * @example - * var str = 'beep boop Foo bar'; - * var out = ns.removeWords( str, [ 'boop', 'foo' ] ); - * // returns 'beep Foo bar' - * - * @example - * var str = 'beep boop Foo bar'; - * var out = ns.removeWords( str, [ 'boop', 'foo' ], true ); - * // returns 'beep bar' - */ - removeWords: typeof removeWords; - - /** - * Repeats a string `n` times and returns the concatenated result. - * - * @param str - string to repeat - * @param n - number of times to repeat the string - * @returns repeated string - * - * @example - * var str = ns.repeat( 'a', 5 ); - * // returns 'aaaaa' - * - * @example - * var str = ns.repeat( '', 100 ); - * // returns '' - * - * @example - * var str = ns.repeat( 'beep', 0 ); - * // returns '' - */ - repeat: typeof repeat; - - /** - * Replaces search occurrences with a replacement string. - * - * ## Notes - * - * - When provided a `string` as the `search` value, the function replaces **all** occurrences. To remove only the first match, use a regular expression. - * - * @param str - input string - * @param search - search expression - * @param newval - replacement value or function - * @returns new string containing replacement(s) - * - * @example - * var str = 'beep'; - * var out = ns.replace( str, 'e', 'o' ); - * // returns 'boop' - * - * @example - * var str = 'Hello World'; - * var out = ns.replace( str, /world/i, 'Mr. President' ); - * // returns 'Hello Mr. President' - * - * @example - * var capitalize = require( './../../capitalize' ); - * - * var str = 'Oranges and lemons say the bells of St. Clement\'s'; - * - * function replacer( match, p1 ) { - * return capitalize( p1 ); - * } - * - * var out = ns.replace( str, /([^\s]*)/gi, replacer); - * // returns 'Oranges And Lemons Say The Bells Of St. Clement\'s' - */ - replace: typeof replace; - - /** - * Replaces the substring before the first occurrence of a specified search string. - * - * @param str - input string - * @param search - search string - * @param replacement - replacement string - * @returns output string - * - * @example - * var out = ns.replaceBefore( 'beep boop', ' ', 'foo' ); - * // returns 'foo boop' - * - * @example - * var out = ns.replaceBefore( 'beep boop', 'p', 'foo' ); - * // returns 'foop boop' - * - * @example - * var out = ns.replaceBefore( 'Hello World!', '', 'foo' ); - * // returns 'Hello World!' - * - * @example - * var out = ns.replaceBefore( 'Hello World!', 'xyz', 'foo' ); - * // returns 'Hello World!' - */ - replaceBefore: typeof replaceBefore; - - /** - * Reverses a string. - * - * @param str - input string - * @param options - options - * @returns reversed string - * - * @example - * var out = ns.reverse( 'last man standing', { - * 'mode': 'code_unit' - * }); - * // returns 'gnidnats nam tsal' - * - * @example - * var out = ns.reverse( '🐶🐮🐷🐰🐸', { - * 'mode': 'grapheme' - * }); - * // returns '🐸🐰🐷🐮🐶' - */ - reverse: typeof reverse; - - /** - * Right pads a string such that the padded string has a length of at least `len`. - * - * ## Notes - * - * - An output string is not guaranteed to have a length of exactly `len`, but to have a length of at least `len`. To generate a padded string having a length equal to `len`, post-process a padded string by trimming off excess characters. - * - * @param str - string to pad - * @param len - minimum string length - * @param pad - string used to pad (default: ' ') - * @throws second argument must be a nonnegative integer - * @throws padding must have a length greater than `0` - * @returns padded string - * - * @example - * var str = ns.rpad( 'a', 5 ); - * // returns 'a ' - * - * @example - * var str = ns.rpad( 'beep', 10, 'p' ); - * // returns 'beeppppppp' - * - * @example - * var str = ns.rpad( 'beep', 12, 'boop' ); - * // returns 'beepboopboop' - */ - rpad: typeof rpad; - - /** - * Trims whitespace characters from the end of a string. - * - * @param str - input string - * @returns trimmed string - * - * @example - * var out = ns.rtrim( ' Whitespace ' ); - * // returns ' Whitespace' - * - * @example - * var out = ns.rtrim( '\t\t\tTabs\t\t\t' ); - * // returns '\t\t\tTabs' - * - * @example - * var out = ns.rtrim( '\n\n\nNew Lines\n\n\n' ); - * // returns '\n\n\nNew Lines' - */ - rtrim: typeof rtrim; - - /** - * Trims `n` characters from the end of a string. - * - * @param str - input string - * @param n - number of characters to trim - * @param chars - characters to trim (default: whitespace characters) - * @returns trimmed string - * - * @example - * var str = ' abc '; - * var out = ns.rtrimN( str, 2 ); - * // returns ' abc ' - * - * @example - * var str = ' abc '; - * var out = ns.rtrimN( str, str.length ); - * // returns ' abc' - * - * @example - * var str = '~~abc!~~'; - * var out = ns.rtrimN( str, str.length, [ '~', '!' ] ); - * // returns '~~abc' - * - * @example - * var str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨'; - * var out = ns.rtrimN( str, str.length, '👨🏼‍🎨🤖' ); - * // returns '' - */ - rtrimN: typeof rtrimN; - - /** - * Converts a string to snake case. - * - * @param str - string to convert - * @returns snake-cased string - * - * @example - * var str = ns.snakecase( 'fooBar' ); - * // returns 'foo_bar' - * - * @example - * var str = ns.snakecase( 'foo-bar' ); - * // returns 'foo_bar' - * - * @example - * var str = ns.snakecase( 'foo_bar' ); - * // returns 'foo_bar' - */ - snakecase: typeof snakecase; - - /** - * Splits a string by its grapheme cluster breaks. - * - * @param str - input string - * @returns array of grapheme clusters - * - * @example - * var out = ns.splitGraphemeClusters( 'café' ); - * // returns [ 'c', 'a', 'f', 'é' ] - * - * @example - * var out = ns.splitGraphemeClusters( '🍕🍕🍕' ); - * // returns [ '🍕', '🍕', '🍕' ] - */ - splitGraphemeClusters: typeof splitGraphemeClusters; - - /** - * Capitalizes the first letter of each word in an input string. - * - * @param str - string to convert - * @returns start-cased string - * - * @example - * var str = ns.startcase( 'beep boop foo bar' ); - * // returns 'Beep Boop Foo Bar' - */ - startcase: typeof startcase; - - /** - * Tests if a string starts with the characters of another string. - * - * ## Notes - * - * - If provided a negative `position`, the search starting position is resolved relative to the end of the string. For example, if provided the input string `'beep boop'` and a `position` equal to `-2`, the starting position resolves to `7`. - * - * @param str - input string - * @param search - search string - * @param position - position at which to start searching (default: 0) - * @returns boolean indicating if the input string starts with the search string - * - * @example - * var bool = ns.startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember' ); - * // returns true - * - * @example - * var bool = ns.startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember' ); - * // returns false - * - * @example - * var bool = ns.startsWith( 'To be, or not to be, that is the question.', 'To be' ); - * // returns true - * - * @example - * var bool = ns.startsWith( 'To be, or not to be, that is the question.', 'to be' ); - * // returns false - * - * @example - * var bool = ns.startsWith( 'To be, or not to be, that is the question.', 'to be', 14 ); - * // returns true - * - * @example - * var bool = ns.startsWith( 'To be, or not to be, that is the question.', 'quest', -9 ); - * // returns true - */ - startsWith: typeof startsWith; - - /** - * Returns the part of a string after a specified substring. - * - * @param str - input string - * @param search - search string - * @param fromIndex - index at which to start the search (default: 0) - * @returns substring - * - * @example - * var out = ns.substringAfter( 'Hello, world!', ', ' ); - * // returns 'world!' - * - * @example - * var out = ns.substringAfter( 'beep boop', 'beep' ); - * // returns ' boop' - * - * @example - * var out = ns.substringAfter( 'beep boop', 'boop' ); - * // returns '' - * - * @example - * var out = ns.substringAfter( 'beep boop', 'xyz' ); - * // returns '' - * - * @example - * var out = ns.substringAfter( 'beep boop', 'beep', 5 ); - * // returns '' - * - * @example - * var out = ns.substringAfter( 'beep boop beep baz', 'beep', 5 ); - * // returns ' baz' - */ - substringAfter: typeof substringAfter; - - /** - * Returns the part of a string after the last occurrence of a specified substring. - * - * @param str - input string - * @param search - search string - * @param fromIndex - index of last character to be considered beginning of a match (default: `str.length`) - * @returns substring - * - * @example - * var out = ns.substringAfterLast( 'beep boop', 'b' ); - * // returns 'oop' - * - * @example - * var out = ns.substringAfterLast( 'beep boop', 'o' ); - * // returns 'p' - * - * @example - * var out = ns.substringAfterLast( 'Hello World', 'o' ); - * // returns 'rld' - * - * @example - * var out = ns.substringAfterLast( 'Hello World', '!' ); - * // returns '' - * - * @example - * var out = ns.substringAfterLast( 'Hello World', '' ); - * // returns '' - * - * @example - * var out = ns.substringAfterLast( 'beep boop baz', 'p b', 6 ); - * // returns 'oop baz' - */ - substringAfterLast: typeof substringAfterLast; - - /** - * Returns the part of a string before a specified substring. - * - * @param str - input string - * @param search - search string - * @returns substring - * - * @example - * var out = ns.substringBefore( 'beep boop', ' ' ); - * // returns 'beep' - * - * @example - * var out = ns.substringBefore( 'beep boop', 'p' ); - * // returns 'bee' - * - * @example - * var out = ns.substringBefore( 'Hello World!', '' ); - * // returns '' - * - * @example - * var out = ns.substringBefore( 'Hello World!', 'XYZ' ); - * // returns 'Hello World!' - */ - substringBefore: typeof substringBefore; - - /** - * Returns the part of a string before the last occurrence of a specified substring. - * - * @param str - input string - * @param search - search string - * @returns substring - * - * @example - * var out = ns.substringBeforeLast( 'abcba', 'b' ); - * // returns 'abc' - * - * @example - * var out = ns.substringBeforeLast( 'Hello World, my friend!', ' ' ); - * // returns 'Hello World, my' - * - * @example - * var out = ns.substringBeforeLast( 'abcba', ' ' ); - * // returns 'abcba' - * - * @example - * var out = ns.substringBeforeLast( 'abcba', '' ); - * // returns 'abcba' - */ - substringBeforeLast: typeof substringBeforeLast; - - /** - * Returns an iterator which iterates over each grapheme cluster in a string. - * - * @param src - input value - * @param mapFcn - function to invoke for each iterated value - * @param thisArg - execution context - * @returns iterator - * - * @example - * var iter = ns.graphemeClusters2iterator( '🌷🍕' ); - * - * var v = iter.next().value; - * // returns '🌷' - * - * v = iter.next().value; - * // returns '🍕' - * - * var bool = iter.next().done; - * // returns true - */ - graphemeClusters2iterator: typeof graphemeClusters2iterator; - - /** - * Returns an iterator which iterates from right to left over each grapheme cluster in a string. - * - * @param src - input value - * @param mapFcn - function to invoke for each iterated value - * @param thisArg - execution context - * @returns iterator - * - * @example - * var iter = ns.graphemeClusters2iteratorRight( '🌷🍕' ); - * - * var v = iter.next().value; - * // returns '🍕' - * - * v = iter.next().value; - * // returns '🌷' - * - * var bool = iter.next().done; - * // returns true - */ - graphemeClusters2iteratorRight: typeof graphemeClusters2iteratorRight; - - /** - * Replaces all lone surrogates in order to create a new string which is well formed. - * - * @param str - string to test - * @returns new string which does not contain any lone surrogates - * - * @example - * var result = ns.toWellFormed( '\uDBFF' ); - * // returns '�' - * - * @example - * var result = ns.toWellFormed( '\uDBFFFF\uDBFF' ); - * // returns '�FF�' - * - * @example - * var result = ns.toWellFormed( '-5' ); - * // returns '-5' - */ - toWellFormed: typeof toWellFormed; - - /** - * Trims whitespace characters from the beginning and end of a string. - * - * @param str - input string - * @returns trimmed string - * - * @example - * var out = ns.trim( ' Whitespace ' ); - * // returns 'Whitespace' - * - * @example - * var out = ns.trim( '\t\t\tTabs\t\t\t' ); - * // returns 'Tabs' - * - * @example - * var out = ns.trim( '\n\n\nNew Lines\n\n\n' ); - * // returns 'New Lines' - */ - trim: typeof trim; - - /** - * Truncates a string to a specified length. - * - * @param str - input string - * @param len - output string length (including ending) - * @param ending - custom ending (default: `...`) - * @returns truncated string - * - * @example - * var out = ns.truncate( 'beep boop', 7 ); - * // returns 'beep...' - * - * @example - * var out = ns.truncate( 'beep boop', 7, '|' ); - * // returns 'beep b|' - */ - truncate: typeof truncate; - - /** - * Truncates a string in the middle to a specified length. - * - * @param str - input string - * @param len - output string length (including sequence) - * @param seq - custom replacement sequence (default: `...`) - * @returns truncated string - * - * @example - * var str = 'beep boop'; - * var out = ns.truncateMiddle( str, 5 ); - * // returns 'b...p' - * - * @example - * var str = 'beep boop'; - * var out = ns.truncateMiddle( str, 5, '>>>' ); - * // returns 'b>>>p' - * - * @example - * var str = 'beep boop'; - * var out = ns.truncateMiddle( str, 10 ); - * // returns 'beep boop' - * - * @example - * var str = 'beep boop'; - * var out = ns.truncateMiddle( str, 0 ); - * // returns '' - * - * @example - * var str = 'beep boop'; - * var out = ns.truncateMiddle( str, 2 ); - * // returns '..' - * - * @example - * var str = '🐺 Wolf Brothers 🐺'; - * var out = ns.truncateMiddle( str, 7 ); - * // returns '🐺 ... 🐺' - */ - truncateMiddle: typeof truncateMiddle; - - /** - * Uncapitalizes the first character of a string. - * - * @param str - input string - * @returns input string with first character converted to lowercase - * - * @example - * var out = ns.uncapitalize( 'Last man standing' ); - * // returns 'last man standing' - * - * @example - * var out = ns.uncapitalize( 'Presidential election' ); - * // returns 'presidential election' - * - * @example - * var out = ns.uncapitalize( 'JavaScript' ); - * // returns 'javaScript' - * - * @example - * var out = ns.uncapitalize( 'Hidden Treasures' ); - * // returns 'hidden Treasures' - */ - uncapitalize: typeof uncapitalize; - - /** - * Converts a string to uppercase. - * - * @param str - string to convert - * @returns uppercase string - * - * @example - * var str = ns.uppercase( 'bEEp' ); - * // returns 'BEEP' - */ - uppercase: typeof uppercase; - - /** - * Converts a UTF-16 encoded string to an array of integers using UTF-8 encoding. - * - * ## Notes - * - * - The following byte sequences are used to represent a character. The sequence depends on the code point: - * - * 0x00000000 - 0x0000007F: - * 0xxxxxxx - * - * 0x00000080 - 0x000007FF: - * 110xxxxx 10xxxxxx - * - * 0x00000800 - 0x0000FFFF: - * 1110xxxx 10xxxxxx 10xxxxxx - * - * 0x00010000 - 0x001FFFFF: - * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - * - * - The `x` bit positions correspond to code point bits. - * - Only the shortest possible multi-byte sequence which can represent a code point is used. - * - * @param str - string to convert - * @returns array of integers - * @see [UTF-8]{@link https://en.wikipedia.org/wiki/UTF-8} - * @see [Stack Overflow]{@link https://stackoverflow.com/questions/6240055/manually-converting-unicode-codepoints-into-utf-8-and-utf-16} - * - * @example - * var str = '☃'; - * var out = ns.utf16ToUTF8Array( str ); - * // returns [ 226, 152, 131 ] - */ - utf16ToUTF8Array: typeof utf16ToUTF8Array; -} - -/** -* String manipulation functions. -*/ -declare var ns: Namespace; - - -// EXPORTS // - -export = ns; diff --git a/docs/types/test.ts b/docs/types/test.ts deleted file mode 100644 index c2dd14ec..00000000 --- a/docs/types/test.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 ns = require( './index' ); - - -// TESTS // - -// The exported value is the expected interface... -{ - ns; // $ExpectType Namespace -} diff --git a/dotcase/README.md b/dotcase/README.md deleted file mode 100644 index e38a1ec4..00000000 --- a/dotcase/README.md +++ /dev/null @@ -1,200 +0,0 @@ - - -# dotcase - -> Convert a string to dot case. - - - -
- -## Usage - -```javascript -var dotcase = require( '@stdlib/string/dotcase' ); -``` - -#### dotcase( str ) - -Converts a string to dot case. - -```javascript -var out = dotcase( 'foo bar' ); -// returns 'foo.bar' - -out = dotcase( 'IS_MOBILE' ); -// returns 'is.mobile' - -out = dotcase( 'Hello World!' ); -// returns 'hello.world' - -out = dotcase( '--foo-bar--' ); -// returns 'foo.bar' -``` - -
- - - - - -
- -## Examples - -```javascript -var dotcase = require( '@stdlib/string/dotcase' ); - -var str = 'Hello World!'; -var out = dotcase( str ); -// returns 'hello.world' - -str = 'HELLO WORLD!'; -out = dotcase( str ); -// returns 'hello.world' - -str = 'To be, or not to be: that is the question.'; -out = dotcase( str ); -// returns 'to.be.or.not.to.be.that.is.the.question' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: dotcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nfoo_bar' | dotcase --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nfoo_bar' | dotcase --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ dotcase 'hello world!' -hello.world -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beEp booP' | dotcase -beep.boop -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tfoo_bar' | dotcase --split '\t' -beep -foo.bar -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/dotcase/benchmark/benchmark.js b/dotcase/benchmark/benchmark.js deleted file mode 100644 index c20544a4..00000000 --- a/dotcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var dotcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = dotcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/dotcase/bin/cli b/dotcase/bin/cli deleted file mode 100755 index 117a4a4b..00000000 --- a/dotcase/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var dotcase = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( dotcase( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( dotcase( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/dotcase/docs/repl.txt b/dotcase/docs/repl.txt deleted file mode 100644 index 234089e0..00000000 --- a/dotcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to dot case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Dot-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'hello.world' - > out = {{alias}}( 'beep boop' ) - 'beep.boop' - - See Also - -------- diff --git a/dotcase/docs/types/index.d.ts b/dotcase/docs/types/index.d.ts deleted file mode 100644 index 29158d2a..00000000 --- a/dotcase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to dot case. -* -* @param str - string to convert -* @returns dot-cased string -* -* @example -* var str = dotcase( 'Hello World!' ); -* // returns 'hello.world' -* -* @example -* var str = dotcase( 'foo_bar' ); -* // returns 'foo.bar' -* -* @example -* var str = dotcase( 'foo-bar' ); -* // returns 'foo.bar' -*/ -declare function dotcase( str: string ): string; - - -// EXPORTS // - -export = dotcase; diff --git a/dotcase/docs/types/test.ts b/dotcase/docs/types/test.ts deleted file mode 100644 index 52409df0..00000000 --- a/dotcase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import dotcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - dotcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - dotcase( true ); // $ExpectError - dotcase( false ); // $ExpectError - dotcase( null ); // $ExpectError - dotcase( undefined ); // $ExpectError - dotcase( 5 ); // $ExpectError - dotcase( [] ); // $ExpectError - dotcase( {} ); // $ExpectError - dotcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - dotcase(); // $ExpectError -} diff --git a/dotcase/docs/usage.txt b/dotcase/docs/usage.txt deleted file mode 100644 index 2d7bb535..00000000 --- a/dotcase/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: dotcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/dotcase/etc/cli_opts.json b/dotcase/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/dotcase/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/dotcase/examples/index.js b/dotcase/examples/index.js deleted file mode 100644 index 07d8eceb..00000000 --- a/dotcase/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var dotcase = require( './../lib' ); - -var str = 'Hello World!'; -var out = dotcase( str ); -console.log( out ); -// => 'hello.world' - -str = 'HELLO WORLD!'; -out = dotcase( str ); -console.log( out ); -// => 'hello.world' - -str = 'To be, or not to be: that is the question.'; -out = dotcase( str ); -console.log( out ); -// => 'to.be.or.not.to.be.that.is.the.question' diff --git a/dotcase/lib/index.js b/dotcase/lib/index.js deleted file mode 100644 index 63f0d6e4..00000000 --- a/dotcase/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to dot case. -* -* @module @stdlib/string/dotcase -* -* @example -* var dotcase = require( '@stdlib/string/dotcase' ); -* -* var str = dotcase( 'foo bar' ); -* // returns 'foo.bar' -* -* str = dotcase( '--foo-bar--' ); -* // returns 'foo.bar' -* -* str = dotcase( 'Hello World!' ); -* // returns 'hello.world' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/dotcase/lib/main.js b/dotcase/lib/main.js deleted file mode 100644 index 1a015da6..00000000 --- a/dotcase/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/dotcase' ); - - -// MAIN // - -/** -* Converts a string to dot case. -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {string} dot-cased string -* -* @example -* var out = dotcase( 'foo bar' ); -* // returns 'foo.bar' -* -* @example -* var out = dotcase( 'IS_MOBILE' ); -* // returns 'is.mobile' -* -* @example -* var out = dotcase( 'Hello World!' ); -* // returns 'hello.world' -* -* @example -* var out = dotcase( '--foo-bar--' ); -* // returns 'foo.bar' -*/ -function dotcase( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = dotcase; diff --git a/dotcase/package.json b/dotcase/package.json deleted file mode 100644 index 252e1ab7..00000000 --- a/dotcase/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/dotcase", - "version": "0.0.0", - "description": "Convert a string to dot case.", - "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" - } - ], - "bin": { - "dotcase": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "case", - "convert", - "dotcase", - "dot" - ], - "__stdlib__": {} -} diff --git a/dotcase/test/fixtures/stdin_error.js.txt b/dotcase/test/fixtures/stdin_error.js.txt deleted file mode 100644 index b42c70b3..00000000 --- a/dotcase/test/fixtures/stdin_error.js.txt +++ /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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/dotcase/test/test.cli.js b/dotcase/test/test.cli.js deleted file mode 100644 index 2e29ec63..00000000 --- a/dotcase/test/test.cli.js +++ /dev/null @@ -1,263 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a string argument to dot case', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'HelloWorld!\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'hello.world\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nis-mobile"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep.boop\nis.mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'BEEP_BOOP\tis_mobile\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep.boop\nis.mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'BEEP_BOOP\tis_mobile\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep.boop\nis.mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/dotcase/test/test.js b/dotcase/test/test.js deleted file mode 100644 index ebac0afb..00000000 --- a/dotcase/test/test.js +++ /dev/null @@ -1,226 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 dotcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof dotcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - dotcase( value ); - }; - } -}); - -tape( 'the function converts a string to dot case', function test( t ) { - var expected; - var actual; - - expected = 'foo.bar'; - actual = dotcase( 'foo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'foo.bar'; - actual = dotcase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'foo.bar'; - actual = dotcase( 'foo.bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'hello.world'; - actual = dotcase( 'Hello World!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'b.eep.b.oop'; - actual = dotcase( 'bEep bOOP' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to dot case', function test( t ) { - var expected; - var actual; - - expected = 'fóo.bar'; - actual = dotcase( 'fóo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'fóo.bar'; - actual = dotcase( 'fóo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'fóo.bar'; - actual = dotcase( 'fóoBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'héllo.wórld'; - actual = dotcase( 'héllo Wórld!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in camel case to dot case', function test( t ) { - var expected; - var actual; - - expected = 'foo.bar'; - actual = dotcase( 'fooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.mostly.some.case'; - actual = dotcase( 'isMostlySomeCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.mobile'; - actual = dotcase( 'isMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.node.repl'; - actual = dotcase( 'isNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in constant case to dot case', function test( t ) { - var expected; - var actual; - - expected = 'foo.bar'; - actual = dotcase( 'FOO_BAR' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.mostly.constant.case'; - actual = dotcase( 'IS_MOSTLY_CONSTANT_CASE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.mobile'; - actual = dotcase( 'IS_MOBILE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.node.repl'; - actual = dotcase( 'IS_NODE_REPL' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in kebab case to dot case', function test( t ) { - var expected; - var actual; - - expected = 'foo.bar'; - actual = dotcase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.mostly.some.case'; - actual = dotcase( 'is-mostly-some-case' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.mobile'; - actual = dotcase( 'is-mobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.node.repl'; - actual = dotcase( 'is-node-repl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in pascal case to dot case', function test( t ) { - var expected; - var actual; - - expected = 'foo.bar'; - actual = dotcase( 'FooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.mostly.some.case'; - actual = dotcase( 'IsMostlySomeCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.mobile'; - actual = dotcase( 'IsMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.node.repl'; - actual = dotcase( 'IsNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function leaves a string that is already in dot case unchanged', function test( t ) { - var expected; - var actual; - - expected = 'foo.bar'; - actual = dotcase( 'foo.bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.mostly.some.case'; - actual = dotcase( 'is.mostly.some.case' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.mobile'; - actual = dotcase( 'is.mobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'is.node.repl'; - actual = dotcase( 'is.node.repl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/ends-with/README.md b/ends-with/README.md deleted file mode 100644 index 31c13358..00000000 --- a/ends-with/README.md +++ /dev/null @@ -1,239 +0,0 @@ - - -# endsWith - -> Test if a string ends with the characters of another string. - -
- -
- - - -
- -## Usage - -```javascript -var endsWith = require( '@stdlib/string/ends-with' ); -``` - -#### endsWith( str, search\[, len] ) - -Tests if a string ends with the characters of another string. - -```javascript -var str = 'Remember the story I used to tell you when you were a boy?'; - -var bool = endsWith( str, 'boy?' ); -// returns true - -bool = endsWith( str, 'Boy?' ); -// returns false -``` - -To search for a match at the end of a substring, provide a `len` argument. If `len` is positive, the function restricts the search to a substring with length `len`, beginning with the leftmost character. If `len` is negative, `len` indicates to ignore the last `len` characters (equivalent of `str.length + len`). - -```javascript -var str = 'To be, or not to be, that is the question.'; - -var bool = endsWith( str, 'to be', 19 ); -// returns true - -bool = endsWith( str, 'to be', -23 ); -// returns true -``` - -If provided an empty `search` string, the function **always** returns `true`. - -```javascript -var str = 'beep boop'; - -var bool = endsWith( str, '' ); -// returns true -``` - -
- - - -
- -## Notes - -- In general, exercise caution when operating on substrings containing Unicode characters, as the visual character length may not equal the number of code points. For example, - - ```javascript - var len = '🏠'.length; - // returns 2 - ``` - -- This function differs from [`String.prototype.endsWith`][mdn-string-endswith] in the following ways: - - - The function requires string values for the first and second arguments and requires that the `len` argument is an integer value. - - The function does **not** clamp positive `len` values to the end of the input string. - - Except when provided an empty `search` string, the function **always** returns `false` if `len` resolves to a starting search position which exceeds the bounds of the input string. - -
- - - -
- -## Examples - - - -```javascript -var endsWith = require( '@stdlib/string/ends-with' ); - -var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; - -var bool = endsWith( str, 'air' ); -// returns true - -bool = endsWith( str, 'fair' ); -// returns false - -bool = endsWith( str, 'fair', 30 ); -// returns true - -bool = endsWith( str, 'fair', -34 ); -// returns true -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: ends-with [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --len int Substring length. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'Hello, World!\nBeep Boop Baz' | ends-with --search=Beep --split /\r?\n/ - - # Escaped... - $ echo -n $'Hello, World!\nBeep Boop Baz' | ends-with --search=Beep --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ ends-with --search=ep beep -true -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'boop' | ends-with --search=ep -false -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'Hello, World!\tBeep Boop' | ends-with --search=Boop --split '\t' -false -true -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/ends-with/benchmark/benchmark.js b/ends-with/benchmark/benchmark.js deleted file mode 100644 index 34005bd6..00000000 --- a/ends-with/benchmark/benchmark.js +++ /dev/null @@ -1,147 +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' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var endsWith = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': typeof String.prototype.endsWith !== 'function' -}; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var bool; - var str; - var i; - - values = [ - '.', - 'z', - 'questions' - ]; - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = endsWith( str, values[ i%values.length ] ); - 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(); -}); - -bench( format( '%s::substring', pkg ), function benchmark( b ) { - var values; - var bool; - var str; - var i; - - values = [ - '.', - 'z' - ]; - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = endsWith( str, values[ i%values.length ], i%42 ); - 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(); -}); - -bench( format( '%s::builtin', pkg ), opts, function benchmark( b ) { - var values; - var bool; - var str; - var i; - - values = [ - '.', - 'z', - 'questions' - ]; - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = str.endsWith( values[ i%values.length ] ); - 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(); -}); - -bench( format( '%s::builtin,substring', pkg ), opts, function benchmark( b ) { - var values; - var bool; - var str; - var i; - - values = [ - '.', - 'z' - ]; - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = str.endsWith( values[ i%values.length ], i%42 ); - 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/ends-with/bin/cli b/ends-with/bin/cli deleted file mode 100755 index d018a800..00000000 --- a/ends-with/bin/cli +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var endsWith = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - var len; - var str; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - if ( args.length ) { - str = args[ 0 ]; - } else { - // Treat an empty value as an empty string: - str = ''; - } - if ( flags.len ) { - len = parseInt( flags.len, 10 ); - } else { - len = str.length; - } - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( endsWith( str, flags.search, len ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - if ( !len ) { - len = lines[ i ].length; - } - console.log( endsWith( lines[ i ], flags.search, len ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/ends-with/docs/repl.txt b/ends-with/docs/repl.txt deleted file mode 100644 index d3249717..00000000 --- a/ends-with/docs/repl.txt +++ /dev/null @@ -1,42 +0,0 @@ - -{{alias}}( str, search[, len] ) - Tests if a string ends with the characters of another string. - - If provided an empty search string, the function always returns `true`. - - Parameters - ---------- - str: string - Input string. - - search: string - Search string. - - len: integer (optional) - Substring length. Restricts the search to a substring within the input - string beginning from the leftmost character. If provided a negative - value, `len` indicates to ignore the last `len` characters, returning - the same output as `str.length + len`. Default: `str.length`. - - Returns - ------- - bool: boolean - Boolean indicating whether a string ends with the characters of another - string. - - Examples - -------- - > var bool = {{alias}}( 'beep', 'ep' ) - true - > bool = {{alias}}( 'Beep', 'op' ) - false - > bool = {{alias}}( 'Beep', 'ee', 3 ) - true - > bool = {{alias}}( 'Beep', 'ee', -1 ) - true - > bool = {{alias}}( 'beep', '' ) - true - - See Also - -------- - diff --git a/ends-with/docs/types/index.d.ts b/ends-with/docs/types/index.d.ts deleted file mode 100644 index 6597e701..00000000 --- a/ends-with/docs/types/index.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Tests if a string ends with the characters of another string. -* -* ## Notes -* -* - The last parameter restricts the search to a substring within the input string beginning from the leftmost character. If provided a negative value, `len` indicates to ignore the last `len` characters, returning the same output as `str.length + len`. -* -* @param str - input string -* @param search - search string -* @param len - substring length (default: str.length) -* @returns boolean indicating if the input string ends with the search string -* -* @example -* var bool = endsWith( 'Remember the story I used to tell you when you were a boy?', 'boy?' ); -* // returns true -* -* @example -* var bool = endsWith( 'Remember the story I used to tell you when you were a boy?', 'Boy?' ); -* // returns false -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be' ); -* // returns false -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 ); -* // returns true -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 ); -* // returns true -*/ -declare function endsWith( str: string, search: string, len?: number ): boolean; - - -// EXPORTS // - -export = endsWith; diff --git a/ends-with/docs/types/test.ts b/ends-with/docs/types/test.ts deleted file mode 100644 index fd518f2a..00000000 --- a/ends-with/docs/types/test.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import endsWith = require( './index' ); - - -// TESTS // - -// The function returns a boolean... -{ - endsWith( 'abd', 'd' ); // $ExpectType boolean - endsWith( 'To be, or not to be, that is the question.', 'b', 19 ); // $ExpectType boolean - endsWith( 'abd', 'ab', 2 ); // $ExpectType boolean -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - endsWith( true, 'd' ); // $ExpectError - endsWith( false, 'd' ); // $ExpectError - endsWith( 3, 'd', 3 ); // $ExpectError - endsWith( [], 'd', 3 ); // $ExpectError - endsWith( {}, 'd', 3 ); // $ExpectError - endsWith( ( x: number ): number => x, 'd', 0 ); // $ExpectError - - endsWith( 'abd', true ); // $ExpectError - endsWith( 'abd', false ); // $ExpectError - endsWith( 'abd', 5 ); // $ExpectError - endsWith( 'abd', [], 3 ); // $ExpectError - endsWith( 'abd', {}, 3 ); // $ExpectError - endsWith( 'abd', ( x: number ): number => x, 0 ); // $ExpectError - - endsWith( 'abd', 'a', true ); // $ExpectError - endsWith( 'abd', 'a', false ); // $ExpectError - endsWith( 'abd', 'a', '5' ); // $ExpectError - endsWith( 'abd', 'b', [] ); // $ExpectError - endsWith( 'abd', 'b', {} ); // $ExpectError - endsWith( 'abd', 'b', /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - endsWith(); // $ExpectError - endsWith( 'abc' ); // $ExpectError -} diff --git a/ends-with/docs/usage.txt b/ends-with/docs/usage.txt deleted file mode 100644 index e7046a16..00000000 --- a/ends-with/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: ends-with [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --len int Substring length. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/ends-with/etc/cli_opts.json b/ends-with/etc/cli_opts.json deleted file mode 100644 index 4b3a7b4e..00000000 --- a/ends-with/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "string": [ - "search", - "len", - "split" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/ends-with/examples/index.js b/ends-with/examples/index.js deleted file mode 100644 index dd503bcb..00000000 --- a/ends-with/examples/index.js +++ /dev/null @@ -1,35 +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'; - -var endsWith = require( './../lib' ); - -var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; - -console.log( endsWith( str, 'air' ) ); -// => true - -console.log( endsWith( str, 'fair' ) ); -// => false - -console.log( endsWith( str, 'fair', 30 ) ); -// => true - -console.log( endsWith( str, 'fair', -34 ) ); -// => true diff --git a/ends-with/lib/index.js b/ends-with/lib/index.js deleted file mode 100644 index 6be04fb1..00000000 --- a/ends-with/lib/index.js +++ /dev/null @@ -1,51 +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'; - -/** -* Test if a string ends with the characters of another string. -* -* @module @stdlib/string/ends-with -* -* @example -* var endsWith = require( '@stdlib/string/ends-with' ); -* -* var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; -* -* var bool = endsWith( str, 'air' ); -* // returns true -* -* bool = endsWith( str, 'fair' ); -* // returns false -* -* bool = endsWith( str, 'fair', 30 ); -* // returns true -* -* bool = endsWith( str, 'fair', -34 ); -* // returns true -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/ends-with/lib/main.js b/ends-with/lib/main.js deleted file mode 100644 index af721661..00000000 --- a/ends-with/lib/main.js +++ /dev/null @@ -1,82 +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 isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/ends-with' ); - - -// MAIN // - -/** -* Test if a string ends with the characters of another string. -* -* @param {string} str - input string -* @param {string} search - search string -* @param {integer} [len=str.length] - substring length -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a string -* @throws {TypeError} third argument must be an integer -* @returns {boolean} boolean indicating if the input string ends with the search string -* -* @example -* var bool = endsWith( 'Remember the story I used to tell you when you were a boy?', 'boy?' ); -* // returns true -* -* @example -* var bool = endsWith( 'Remember the story I used to tell you when you were a boy?', 'Boy?' ); -* // returns false -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be' ); -* // returns false -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 ); -* // returns true -* -* @example -* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 ); -* // returns true -*/ -function endsWith( str, search, len ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isString( search ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) ); - } - if ( arguments.length > 2 ) { - if ( !isInteger( len ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', len ) ); - } - } else { - len = str.length; - } - return base( str, search, len ); -} - - -// EXPORTS // - -module.exports = endsWith; diff --git a/ends-with/package.json b/ends-with/package.json deleted file mode 100644 index e0204bae..00000000 --- a/ends-with/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/ends-with", - "version": "0.0.0", - "description": "Test if a string ends with the characters of another string.", - "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" - } - ], - "bin": { - "ends-with": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "check", - "end", - "ends", - "search", - "match" - ] -} diff --git a/ends-with/test/fixtures/stdin_error.js.txt b/ends-with/test/fixtures/stdin_error.js.txt deleted file mode 100644 index d2894155..00000000 --- a/ends-with/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,34 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; -proc.stdin.write = '--search=beep'; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/ends-with/test/test.cli.js b/ends-with/test/test.cli.js deleted file mode 100644 index f54753e8..00000000 --- a/ends-with/test/test.cli.js +++ /dev/null @@ -1,290 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var replace = require( './../../replace' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints either `true` or `false` to `stdout` indicating whether a `string` ends with the characters of another `string`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=beep\'; process.argv[ 3 ] = \'boopbeep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'true\n', true, 'prints `true` to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints either `true` or `false` to `stdout` indicating whether a `string` ends with the characters of another `string` (options: len)', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=boop\'; process.argv[ 3 ] = \'--len=-4\'; process.argv[ 4 ] = \'boopbeep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'true\n', true, 'prints `true` to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop"', - '|', - EXEC_PATH, - fpath, - '--search=beep' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'true\nfalse\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'', - '--search=beep' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'true\nfalse\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/', - '--search=beep' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'true\nfalse\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/ends-with/test/test.js b/ends-with/test/test.js deleted file mode 100644 index 7cebfbcd..00000000 --- a/ends-with/test/test.js +++ /dev/null @@ -1,235 +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 endsWith = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof endsWith, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if the first argument is not a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - endsWith( value, 'abc' ); - }; - } -}); - -tape( 'the function throws an error if the second argument is not a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - endsWith( 'abc', value ); - }; - } -}); - -tape( 'the function throws an error if the `position` argument is not an integer', function test( t ) { - var values; - var i; - - values = [ - '5', - 5.5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - endsWith( 'abc', 'a', value ); - }; - } -}); - -tape( 'the function returns `true` if the input string ends with the search value', function test( t ) { - var bool; - - bool = endsWith( 'Too late, I\'m afraid', 'afraid' ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'Not too late, I\'m afraid...', 'afraid...' ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'Welcome home!', 'home!' ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if the input string does not end with the search value', function test( t ) { - var bool; - - bool = endsWith( 'Too late, I\'m afraid', 'Afraid' ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = endsWith( 'Not too late, I\'m afraid...', 'afraid' ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = endsWith( 'Welcome home!', 'welcome home!' ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports restricting the search to a substring by providing a length parameter (positive)', function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - - bool = endsWith( str, 'late', 7 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = endsWith( str, 'late', 8 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', 9 ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports restricting the search to a substring by providing a length parameter (negative)', function test( t ) { - var bool; - var str; - - str = 'Too late, I\'m afraid'; - - bool = endsWith( str, 'i', -1 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', -13 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = endsWith( str, 'late', -12 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( str, 'late', -11 ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a length parameter equal to `0`', function test( t ) { - var bool = endsWith( 'abc', 'c', 0 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a length parameter which exceeds the input string length', function test( t ) { - var bool = endsWith( 'abcdef', 'f', 9999 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input string length', function test( t ) { - var bool = endsWith( 'abc', 'abcd' ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length', function test( t ) { - var bool = endsWith( 'abcdef', 'abcd', 3 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length (negative)', function test( t ) { - var bool = endsWith( 'abcdef', 'abcd', -3 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `true` if provided an empty search string', function test( t ) { - var bool; - - bool = endsWith( '', '' ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '' ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', 10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', -10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = endsWith( 'abc', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); diff --git a/examples/index.js b/examples/index.js deleted file mode 100644 index f265fc92..00000000 --- a/examples/index.js +++ /dev/null @@ -1,24 +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'; - -var objectKeys = require( '@stdlib/utils/keys' ); -var string = require( './../lib' ); - -console.log( objectKeys( string ) ); diff --git a/first/README.md b/first/README.md deleted file mode 100644 index 88e82229..00000000 --- a/first/README.md +++ /dev/null @@ -1,230 +0,0 @@ - - -# first - -> Return the first character(s) of a string. - -
- -## Usage - -```javascript -var first = require( '@stdlib/string/first' ); -``` - -#### first( str\[, n]\[, options] ) - -Returns the first character(s) of a string. - -```javascript -var out = first( 'last man standing' ); -// returns 'l' - -out = first( 'Hidden Treasures' ); -// returns 'H' -``` - -The function supports the following options: - -- **mode**: type of characters to return. Must be one of the following: - - - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - - Default: `'grapheme'`. - -By default, the function returns the first character. To return the first `n` characters, provide a second argument specifying the number of characters to return. - -```javascript -var out = first( 'foo bar', 5 ); -// returns 'foo b' - -out = first( 'foo bar', 10 ); -// returns 'foo bar' -``` - -
- - - - - -
- -## Notes - -- By default, the function assumes the general case in which an input string may contain an arbitrary number of grapheme clusters. This assumption comes with a performance cost. Accordingly, if an input string is known to only contain visual characters of a particular type (e.g., only alphanumeric), one can achieve better performance by specifying the appropriate `mode` option. - -
- - - -
- -## Examples - - - -```javascript -var first = require( '@stdlib/string/first' ); - -var str = first( 'last man standing' ); -// returns 'l' - -str = first( 'presidential election' ); -// returns 'p' - -str = first( 'javaScript' ); -// returns 'j' - -str = first( 'Hidden Treasures' ); -// returns 'H' - -str = first( 'The Last of the Mohicans', 5 ); -// returns 'The L' - -str = first( '🐶🐮🐷🐰🐸', 2 ); -// returns '🐶🐮' - -str = first( '🐶🐮🐷🐰🐸', 10 ); -// returns '🐶🐮🐷🐰🐸' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: first [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n num Number of characters to return. Default: 1. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --mode mode Type of character to return. Default: 'grapheme'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nboop' | first --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nboop' | first --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ first beep -b -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep\nboop' | first --n=2 -be -bo -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tboop' | first --split '\t' -b -b -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/first/benchmark/benchmark.js b/first/benchmark/benchmark.js deleted file mode 100644 index 081d8f04..00000000 --- a/first/benchmark/benchmark.js +++ /dev/null @@ -1,146 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var first = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = first( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=grapheme', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'grapheme' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = first( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=code_point', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'code_point' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = first( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=code_unit', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'code_unit' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = first( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/first/bin/cli b/first/bin/cli deleted file mode 100755 index ce132cab..00000000 --- a/first/bin/cli +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var first = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var opts; - var cli; - var n; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - if ( flags.n ) { - n = parseInt( flags.n, 10 ); - } else { - n = 1; - } - opts = {}; - if ( flags.mode ) { - opts.mode = flags.mode; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - try { - console.log( first( args[ 0 ], n, opts ) ); // eslint-disable-line no-console - } catch ( error ) { - return cli.error( error ); - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - if ( lines.length ) { - try { - console.log( first( lines[ 0 ], n, opts ) ); // eslint-disable-line no-console - } catch ( error ) { - return cli.error( error ); - } - for ( i = 1; i < lines.length; i++ ) { - console.log( first( lines[ i ], n, opts ) ); // eslint-disable-line no-console - } - } - } -} - -main(); diff --git a/first/docs/repl.txt b/first/docs/repl.txt deleted file mode 100644 index a03fd7a1..00000000 --- a/first/docs/repl.txt +++ /dev/null @@ -1,48 +0,0 @@ - -{{alias}}( str[, n][, options] ) - Returns the first character(s) of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer (optional) - Number of characters to return. Default: 1. - - options: Object (optional) - Options. - - options.mode: string (optional) - Type of characters to return. The following modes are supported: - - - grapheme: grapheme clusters. Appropriate for strings containing visual - characters which can span multiple Unicode code points (e.g., emoji). - - code_point: Unicode code points. Appropriate for strings containing - visual characters which are comprised of more than one Unicode code - unit (e.g., ideographic symbols and punctuation and mathematical - alphanumerics). - - code_unit': UTF-16 code units. Appropriate for strings containing - visual characters drawn from the basic multilingual plane (BMP) (e.g., - common characters, such as those from the Latin, Greek, and Cyrillic - alphabets). - - Default: 'grapheme'. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep' ) - 'b' - > out = {{alias}}( 'Boop', 1 ) - 'B' - > out = {{alias}}( 'foo bar', 5 ) - 'foo b' - - See Also - -------- - diff --git a/first/docs/types/index.d.ts b/first/docs/types/index.d.ts deleted file mode 100644 index 8852086b..00000000 --- a/first/docs/types/index.d.ts +++ /dev/null @@ -1,118 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/** -* Interface describing function options. -*/ -interface Options { - /** - * Specifies the type of characters to return (default: 'grapheme'). - * - * ## Notes - * - * - The following option values are supported: - * - * - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - * - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - * - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - */ - mode?: 'grapheme' | 'code_point' | 'code_unit'; -} - -/** -* Returns the first `n` characters of a string. -* -* @param str - input string -* @param n - number of characters to return -* @param options - options -* @returns output string -* -* @example -* var out = first( 'last man standing', 2 ); -* // returns 'la' -* -* @example -* var out = first( '🐶🐮🐷🐰🐸', 2, { -* 'mode': 'grapheme' -* }); -* // returns '🐶🐮' -*/ -declare function first( str: string, n: number, options?: Options ): string; - -/** -* Returns the first character of a string. -* -* @param str - input string -* @param options - options -* @returns output string -* -* @example -* var out = first( 'last man standing', { -* 'mode': 'code_unit' -* }); -* // returns 'l' -* -* @example -* var out = first( '🐶🐮🐷🐰🐸', { -* 'mode': 'grapheme' -* }); -* // returns '🐶' -*/ -declare function first( str: string, options?: Options ): string; - -/** -* Returns the first character(s) of a string. -* -* @param str - input string -* @param n - number of characters to return (default: 1) -* @returns output string -* -* @example -* var out = first( 'last man standing' ); -* // returns 'l' -* -* @example -* var out = first( 'presidential election' ); -* // returns 'p' -* -* @example -* var out = first( 'javaScript' ); -* // returns 'j' -* -* @example -* var out = first( 'Hidden Treasures' ); -* // returns 'H' -* -* @example -* var out = first( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐶🐮' -* -* @example -* var out = first( 'foo bar', 5 ); -* // returns 'foo b' -*/ -declare function first( str: string, n?: number ): string; - - -// EXPORTS // - -export = first; diff --git a/first/docs/types/test.ts b/first/docs/types/test.ts deleted file mode 100644 index 81aaed33..00000000 --- a/first/docs/types/test.ts +++ /dev/null @@ -1,111 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import first = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - first( 'abc' ); // $ExpectType string - first( 'abc', 1 ); // $ExpectType string - first( 'abc', {} ); // $ExpectType string - first( 'abc', 1, {} ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - first( true ); // $ExpectError - first( false ); // $ExpectError - first( null ); // $ExpectError - first( undefined ); // $ExpectError - first( 5 ); // $ExpectError - first( [] ); // $ExpectError - first( {} ); // $ExpectError - first( ( x: number ): number => x ); // $ExpectError - - first( true, 1 ); // $ExpectError - first( false, 1 ); // $ExpectError - first( null, 1 ); // $ExpectError - first( undefined, 1 ); // $ExpectError - first( 5, 1 ); // $ExpectError - first( [], 1 ); // $ExpectError - first( {}, 1 ); // $ExpectError - first( ( x: number ): number => x, 1 ); // $ExpectError - - first( true, {} ); // $ExpectError - first( false, {} ); // $ExpectError - first( null, {} ); // $ExpectError - first( undefined, {} ); // $ExpectError - first( 5, {} ); // $ExpectError - first( [], {} ); // $ExpectError - first( {}, {} ); // $ExpectError - first( ( x: number ): number => x, {} ); // $ExpectError - - first( true, 1, {} ); // $ExpectError - first( false, 1, {} ); // $ExpectError - first( null, 1, {} ); // $ExpectError - first( undefined, 1, {} ); // $ExpectError - first( 5, 1, {} ); // $ExpectError - first( [], 1, {} ); // $ExpectError - first( {}, 1, {} ); // $ExpectError - first( ( x: number ): number => x, 1, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an invalid second argument... -{ - first( 'abc', true ); // $ExpectError - first( 'abc', false ); // $ExpectError - first( 'abc', null ); // $ExpectError - first( 'abc', '' ); // $ExpectError - first( 'abc', [] ); // $ExpectError - first( 'abc', ( x: number ): number => x ); // $ExpectError - - first( 'abc', true, {} ); // $ExpectError - first( 'abc', false, {} ); // $ExpectError - first( 'abc', null, {} ); // $ExpectError - first( 'abc', '', {} ); // $ExpectError - first( 'abc', [], {} ); // $ExpectError - first( 'abc', {}, {} ); // $ExpectError - first( 'abc', ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an invalid `mode` option... -{ - first( 'abc', { 'mode': true } ); // $ExpectError - first( 'abc', { 'mode': false } ); // $ExpectError - first( 'abc', { 'mode': null } ); // $ExpectError - first( 'abc', { 'mode': '' } ); // $ExpectError - first( 'abc', { 'mode': [] } ); // $ExpectError - first( 'abc', { 'mode': ( x: number ): number => x } ); // $ExpectError - - first( 'abc', 1, { 'mode': true } ); // $ExpectError - first( 'abc', 1, { 'mode': false } ); // $ExpectError - first( 'abc', 1, { 'mode': null } ); // $ExpectError - first( 'abc', 1, { 'mode': '' } ); // $ExpectError - first( 'abc', 1, { 'mode': [] } ); // $ExpectError - first( 'abc', 1, { 'mode': {} } ); // $ExpectError - first( 'abc', 1, { 'mode': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - first(); // $ExpectError - first( 'abc', 1, {}, {} ); // $ExpectError -} diff --git a/first/docs/usage.txt b/first/docs/usage.txt deleted file mode 100644 index 6b234737..00000000 --- a/first/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: first [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n num Number of characters to return. Default: 1. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --mode mode Type of character to return. Default: 'grapheme'. diff --git a/first/etc/cli_opts.json b/first/etc/cli_opts.json deleted file mode 100644 index 2ceae458..00000000 --- a/first/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "string": [ - "n", - "split", - "mode" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/first/examples/index.js b/first/examples/index.js deleted file mode 100644 index e63828c1..00000000 --- a/first/examples/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 first = require( './../lib' ); - -console.log( first( 'last man standing' ) ); -// => 'l' - -console.log( first( 'presidential election' ) ); -// => 'p' - -console.log( first( 'javaScript' ) ); -// => 'j' - -console.log( first( 'Hidden Treasures' ) ); -// => 'H' - -console.log( first( 'The Last of the Mohicans', 5 ) ); -// => 'The L' - -console.log( first( '🐶🐮🐷🐰🐸', 2 ) ); -// => '🐶🐮' - -console.log( first( '🐶🐮🐷🐰🐸', 10 ) ); -// => '🐶🐮🐷🐰🐸' diff --git a/first/lib/index.js b/first/lib/index.js deleted file mode 100644 index 4275dda9..00000000 --- a/first/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the first character(s) of a string. -* -* @module @stdlib/string/first -* -* @example -* var first = require( '@stdlib/string/first' ); -* -* var out = first( 'last man standing' ); -* // returns 'l' -* -* out = first( 'Hidden Treasures' ); -* // returns 'H' -* -* out = first( '🐮🐷🐸🐵', 2 ); -* // returns '🐮🐷' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/first/lib/main.js b/first/lib/main.js deleted file mode 100644 index 95f6fe25..00000000 --- a/first/lib/main.js +++ /dev/null @@ -1,131 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isPlainObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var firstCodeUnit = require( './../../base/first' ); -var firstCodePoint = require( './../../base/first-code-point' ); -var firstGraphemeCluster = require( './../../base/first-grapheme-cluster' ); -var format = require( './../../format' ); - - -// VARIABLES // - -var MODES = [ 'grapheme', 'code_point', 'code_unit' ]; -var FCNS = { - 'grapheme': firstGraphemeCluster, - 'code_point': firstCodePoint, - 'code_unit': firstCodeUnit -}; -var isMode = contains( MODES ); - - -// MAIN // - -/** -* Returns the first character(s) of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} [n=1] - number of characters to return -* @param {Options} [options] - options -* @param {string} [options.mode="grapheme"] - type of "character" to return (must be either `grapheme`, `code_point`, or `code_unit`) -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @returns {string} output string -* -* @example -* var out = first( 'last man standing' ); -* // returns 'l' -* -* @example -* var out = first( 'presidential election' ); -* // returns 'p' -* -* @example -* var out = first( 'javaScript' ); -* // returns 'j' -* -* @example -* var out = first( 'Hidden Treasures' ); -* // returns 'H' -* -* @example -* var out = first( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐶🐮' -* -* @example -* var out = first( 'foo bar', 5 ); -* // returns 'foo b' -*/ -function first( str ) { - var options; - var nargs; - var opts; - var n; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - opts = { - 'mode': 'grapheme' - }; - nargs = arguments.length; - if ( nargs === 1 ) { - n = 1; - } else if ( nargs === 2 ) { - n = arguments[ 1 ]; - if ( isPlainObject( n ) ) { - options = n; - n = 1; - } else if ( !isNonNegativeInteger( n ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) ); - } - } else { // nargs > 2 - n = arguments[ 1 ]; - if ( !isNonNegativeInteger( n ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) ); - } - options = arguments[ 2 ]; - if ( !isPlainObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - } - if ( options ) { - if ( hasOwnProp( options, 'mode' ) ) { - opts.mode = options.mode; - if ( !isMode( opts.mode ) ) { - throw new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Value: `%s`.', 'mode', MODES.join( '", "' ), opts.mode ) ); - } - } - } - return FCNS[ opts.mode ]( str, n ); -} - - -// EXPORTS // - -module.exports = first; diff --git a/first/package.json b/first/package.json deleted file mode 100644 index 70ae53b0..00000000 --- a/first/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/first", - "version": "0.0.0", - "description": "Return the first character(s) of a string.", - "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" - } - ], - "bin": { - "first": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "first", - "character", - "char", - "grapheme", - "unicode", - "codepoint" - ] -} diff --git a/first/test/fixtures/stdin_error.js.txt b/first/test/fixtures/stdin_error.js.txt deleted file mode 100644 index b42c70b3..00000000 --- a/first/test/fixtures/stdin_error.js.txt +++ /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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/first/test/test.cli.js b/first/test/test.cli.js deleted file mode 100644 index f83672ca..00000000 --- a/first/test/test.cli.js +++ /dev/null @@ -1,389 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface returns the first character of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'b\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface returns the first `n` characters of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--n=2\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the type of characters to return', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--mode=code_point\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'b\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'if provided an invalid option, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--mode=foo\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString().length > 0, true, 'expected value' ); - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'b\nb\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream (return `n` characters)', opts, function test( t ) { - var cmd = [ - 'printf "foo\nbar"', - '|', - EXEC_PATH, - fpath, - '--n=2' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'fo\nba\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'f\nb\nb\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the type of characters to return when used as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf \'foo\nbar\nbaz\'', - '|', - EXEC_PATH, - fpath, - '--mode code_point' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'f\nb\nb\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'f\nb\nb\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if provided an invalid option, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--mode=foo' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString().length > 0, true, 'expected value' ); - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/first/test/test.js b/first/test/test.js deleted file mode 100644 index 912a1ab4..00000000 --- a/first/test/test.js +++ /dev/null @@ -1,406 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 first = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof first, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - first( value ); - }; - } -}); - -tape( 'the function throws an error if not provided a string (options)', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - first( value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided a second argument which is not a nonnegative integer', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3.14, - null, - true, - void 0, - NaN, - [], - 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() { - first( 'beep', value ); - }; - } -}); - -tape( 'the function throws an error if provided a second argument which is not a nonnegative integer (options)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3.14, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - first( 'beep', value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - first( 'beep', 1, value ); - }; - } -}); - -tape( 'the function throws an error if provided a `mode` option which is not a supported mode (second argument)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - first( 'beep', { - 'mode': value - }); - }; - } -}); - -tape( 'the function throws an error if provided a `mode` option which is not a supported mode (third argument)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - first( 'beep', 1, { - 'mode': value - }); - }; - } -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( first( '' ), '', 'returns expected value' ); - t.strictEqual( first( '', 1 ), '', 'returns expected value' ); - t.strictEqual( first( '', {} ), '', 'returns expected value' ); - t.strictEqual( first( '', 1, {} ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the first character of a provided string', function test( t ) { - var out; - - out = first( 'hello world' ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = first( '!!!' ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = first( 'Hello World' ); - t.strictEqual( out, 'H', 'returns expected value' ); - - out = first( 'अनुच्छेद' ); - t.strictEqual( out, 'अ', 'returns expected value' ); - - out = first( '六书/六書' ); - t.strictEqual( out, '六', 'returns expected value' ); - - out = first( '🌷' ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty string if provided zero as the second argument', function test( t ) { - var out; - - out = first( 'hello world', 0 ); - t.strictEqual( out, '', 'returns expected value' ); - - out = first( 'hello world', 0, {} ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the first `n` characters of a provided string (default)', function test( t ) { - var out; - - out = first( 'hello world', 1 ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = first( 'hello world', 7 ); - t.strictEqual( out, 'hello w', 'returns expected value' ); - - out = first( '!!!', 1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = first( '!!!', 2 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = first( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'अ', 'returns expected value' ); - - out = first( '六书/六書', 1 ); - t.strictEqual( out, '六', 'returns expected value' ); - - out = first( '🌷', 1 ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - out = first( '👉🏿', 1 ); - t.strictEqual( out, '👉🏿', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the first `n` characters of a provided string (mode=grapheme)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'grapheme' - }; - - out = first( 'hello world', 1, opts ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = first( 'hello world', 7, opts ); - t.strictEqual( out, 'hello w', 'returns expected value' ); - - out = first( '!!!', 1, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = first( '!!!', 2, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = first( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'अ', 'returns expected value' ); - - out = first( '六书/六書', 1, opts ); - t.strictEqual( out, '六', 'returns expected value' ); - - out = first( '🌷', 1, opts ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - out = first( '👉🏿', 1, opts ); - t.strictEqual( out, '👉🏿', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the first `n` characters of a provided string (mode=code_point)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'code_point' - }; - - out = first( 'hello world', 1, opts ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = first( 'hello world', 7, opts ); - t.strictEqual( out, 'hello w', 'returns expected value' ); - - out = first( '!!!', 1, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = first( '!!!', 2, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = first( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'अ', 'returns expected value' ); - - out = first( '六书/六書', 1, opts ); - t.strictEqual( out, '六', 'returns expected value' ); - - out = first( '🌷', 1, opts ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - out = first( '👉🏿', 1, opts ); - t.strictEqual( out, '👉', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the first `n` characters of a provided string (mode=code_unit)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'code_unit' - }; - - out = first( 'hello world', 1, opts ); - t.strictEqual( out, 'h', 'returns expected value' ); - - out = first( 'hello world', 7, opts ); - t.strictEqual( out, 'hello w', 'returns expected value' ); - - out = first( '!!!', 1, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = first( '!!!', 2, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = first( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'अ', 'returns expected value' ); - - out = first( '六书/六書', 1, opts ); - t.strictEqual( out, '六', 'returns expected value' ); - - out = first( '🌷', 1, opts ); - t.strictEqual( out, '\ud83c', 'returns expected value' ); - - out = first( '👉🏿', 1, opts ); - t.strictEqual( out, '\ud83d', 'returns expected value' ); - - t.end(); -}); diff --git a/for-each/README.md b/for-each/README.md deleted file mode 100644 index 0357a408..00000000 --- a/for-each/README.md +++ /dev/null @@ -1,172 +0,0 @@ - - -# forEach - -> Invokes a function for each character in a string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var forEach = require( '@stdlib/string/for-each' ); -``` - -#### forEach( str, \[options,] clbk\[, thisArg ] ) - -Invokes a function for each character in a string. - -```javascript -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEach( 'Beep!', log ); -/* => - 0: B - 1: e - 2: e - 3: p - 4: ! -*/ -``` - -The invoked function is provided three arguments: - -- **value**: character. -- **index**: starting character index. -- **str**: input string. - -To set the function execution context, provide a `thisArg`. - -```javascript -function clbk() { - this.count += 1; -} - -var str = 'Hello, world!'; - -var ctx = { - 'count': 0 -}; - -forEach( str, clbk, ctx ); - -var bool = ( str.length === ctx.count ); -// returns true -``` - -The function supports the following options: - -- **mode**: type of characters over which to iterate. Must be one of the following: - - - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - - Default: `'grapheme'`. - -
- - - - - -
- -## Notes - -- By default, the function assumes the general case in which an input string may contain an arbitrary number of grapheme clusters. This assumption comes with a performance cost. Accordingly, if an input string is known to only contain visual characters of a particular type (e.g., only alphanumeric), one can achieve better performance by specifying the appropriate `mode` option. - -
- - - - - -
- -## Examples - - - -```javascript -var forEach = require( '@stdlib/string/for-each' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEach( 'presidential election', log ); -forEach( 'Iñtërnâtiônàlizætiøn', log ); -forEach( '🌷🍕', log ); -forEach( '\uD834\uDD1E', log ); -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/for-each/benchmark/benchmark.js b/for-each/benchmark/benchmark.js deleted file mode 100644 index 2961cd4e..00000000 --- a/for-each/benchmark/benchmark.js +++ /dev/null @@ -1,166 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var forEach = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Iñtërnâtiônàlizætiøn', - 'presidential election' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = forEach( values[ i%values.length ], clbk ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - if ( typeof v !== 'string' ) { - b.fail( 'unexpected value' ); - } - } -}); - -bench( format( '%s:mode=grapheme', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'Iñtërnâtiônàlizætiøn', - 'presidential election' - ]; - opts = { - 'mode': 'grapheme' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = forEach( values[ i%values.length ], opts, clbk ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - if ( typeof v !== 'string' ) { - b.fail( 'unexpected value' ); - } - } -}); - -bench( format( '%s:mode=code_point', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'Iñtërnâtiônàlizætiøn', - 'presidential election' - ]; - opts = { - 'mode': 'code_point' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = forEach( values[ i%values.length ], opts, clbk ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - if ( typeof v !== 'string' ) { - b.fail( 'unexpected value' ); - } - } -}); - -bench( format( '%s:mode=code_unit', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'Iñtërnâtiônàlizætiøn', - 'presidential election' - ]; - opts = { - 'mode': 'code_unit' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = forEach( values[ i%values.length ], opts, clbk ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function clbk( v ) { - if ( typeof v !== 'string' ) { - b.fail( 'unexpected value' ); - } - } -}); diff --git a/for-each/docs/repl.txt b/for-each/docs/repl.txt deleted file mode 100644 index 83786bc9..00000000 --- a/for-each/docs/repl.txt +++ /dev/null @@ -1,57 +0,0 @@ - -{{alias}}( str, [options,] clbk[, thisArg] ) - Invokes a function for each character in a string. - - When invoked, the provided function is provided three arguments: - - - value: character. - - index: starting character index. - - str: input string. - - Parameters - ---------- - str: string - Input string over which to iterate. - - options: Object (optional) - Options. - - options.mode: string (optional) - Type of characters over which to iterate. The following modes are - supported: - - - grapheme: grapheme clusters. Appropriate for strings containing visual - characters which can span multiple Unicode code points (e.g., emoji). - - code_point: Unicode code points. Appropriate for strings containing - visual characters which are comprised of more than one Unicode code - unit (e.g., ideographic symbols and punctuation and mathematical - alphanumerics). - - code_unit': UTF-16 code units. Appropriate for strings containing - visual characters drawn from the basic multilingual plane (BMP) (e.g., - common characters, such as those from the Latin, Greek, and Cyrillic - alphabets). - - Default: 'grapheme'. - - clbk: Function - The function to invoke for each character in the input string. - - thisArg: any (optional) - Execution context. - - Returns - ------- - out: string - Input string. - - Examples - -------- - > var n = 0; - > function fcn() { n += 1; }; - > {{alias}}( 'hello world!', fcn ); - > n - 12 - - See Also - -------- - diff --git a/for-each/docs/types/index.d.ts b/for-each/docs/types/index.d.ts deleted file mode 100644 index 7f29fb0d..00000000 --- a/for-each/docs/types/index.d.ts +++ /dev/null @@ -1,140 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Interface describing function options. -*/ -interface Options { - /** - * Specifies the type of characters over which to iterate (default: 'grapheme'). - * - * ## Notes - * - * - The following option values are supported: - * - * - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - * - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - * - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - */ - mode?: 'grapheme' | 'code_point' | 'code_unit'; -} - -/** -* Callback invoked for each character in a string. -* -* @returns result -*/ -type Nullary = () => any; - -/** -* Callback invoked for each character in a string. -* -* @param value - character -* @returns result -*/ -type Unary = ( value: string ) => any; - -/** -* Callback invoked for each character in a string. -* -* @param value - character -* @param index - starting character index -* @returns result -*/ -type Binary = ( value: string, index: number ) => any; - -/** -* Callback invoked for each character in a string. -* -* @param value - character -* @param index - starting character index -* @param str - input string -* @returns result -*/ -type Ternary = ( value: string, index: number, str: string ) => any; - -/** -* Callback invoked for each character in a string. -* -* @param value - character -* @param index - starting character index -* @param str - input string -* @returns result -*/ -type Callback = Nullary | Unary | Binary | Ternary; - -/** -* Invokes a function for each character in a string. -* -* ## Notes -* -* - When invoked, the provided function is provided three arguments: -* -* - **value**: character. -* - **index**: starting character index. -* - **str**: input string. -* -* @param str - input string -* @param clbk - function to invoke -* @param thisArg - execution context -* @returns input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello, World!', log ); -*/ -declare function forEach( str: string, clbk: Callback, thisArg?: any ): string; - -/** -* Invokes a function for each character in a string. -* -* ## Notes -* -* - When invoked, the provided function is provided three arguments: -* -* - **value**: character. -* - **index**: starting character index. -* - **str**: input string. -* -* @param str - input string -* @param options - options -* @param clbk - function to invoke -* @param thisArg - execution context -* @returns input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* var opts = { -* 'mode': 'code_point' -* }; -* forEach( 'Hello, World!', opts, log ); -*/ -declare function forEach( str: string, options: Options, clbk: Callback, thisArg?: any ): string; - - -// EXPORTS // - -export = forEach; diff --git a/for-each/docs/types/test.ts b/for-each/docs/types/test.ts deleted file mode 100644 index 14e9f002..00000000 --- a/for-each/docs/types/test.ts +++ /dev/null @@ -1,164 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import forEach = require( './index' ); - -/** -* Callback function. -* -* @param v - argument -* @returns result -*/ -function clbk( v: string ): string { - return v; -} - - -// TESTS // - -// The function returns a string... -{ - forEach( 'presidential election', clbk ); // $ExpectType string - forEach( 'Iñtërnâtiônàlizætiøn', clbk, {} ); // $ExpectType string - - forEach( 'presidential election', {}, clbk ); // $ExpectType string - forEach( 'Iñtërnâtiônàlizætiøn', {}, clbk, {} ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - forEach( 1, clbk ); // $ExpectError - forEach( false, clbk ); // $ExpectError - forEach( true, clbk ); // $ExpectError - forEach( null, clbk ); // $ExpectError - forEach( [], clbk ); // $ExpectError - forEach( {}, clbk ); // $ExpectError - forEach( ( x: number ): number => x, clbk ); // $ExpectError - - forEach( 1, clbk, {} ); // $ExpectError - forEach( false, clbk, {} ); // $ExpectError - forEach( true, clbk, {} ); // $ExpectError - forEach( null, clbk, {} ); // $ExpectError - forEach( [], clbk, {} ); // $ExpectError - forEach( {}, clbk, {} ); // $ExpectError - forEach( ( x: number ): number => x, clbk, {} ); // $ExpectError - - forEach( 1, {}, clbk ); // $ExpectError - forEach( false, {}, clbk ); // $ExpectError - forEach( true, {}, clbk ); // $ExpectError - forEach( null, {}, clbk ); // $ExpectError - forEach( [], {}, clbk ); // $ExpectError - forEach( {}, {}, clbk ); // $ExpectError - forEach( ( x: number ): number => x, {}, clbk ); // $ExpectError - - forEach( 1, {}, clbk, {} ); // $ExpectError - forEach( false, {}, clbk, {} ); // $ExpectError - forEach( true, {}, clbk, {} ); // $ExpectError - forEach( null, {}, clbk, {} ); // $ExpectError - forEach( [], {}, clbk, {} ); // $ExpectError - forEach( {}, {}, clbk, {} ); // $ExpectError - forEach( ( x: number ): number => x, {}, clbk, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an options argument which is not a valid object... -{ - forEach( 'presidential election', '', clbk ); // $ExpectError - forEach( 'presidential election', 1, clbk ); // $ExpectError - forEach( 'presidential election', false, clbk ); // $ExpectError - forEach( 'presidential election', true, clbk ); // $ExpectError - forEach( 'presidential election', null, clbk ); // $ExpectError - forEach( 'presidential election', [], clbk ); // $ExpectError - forEach( 'presidential election', ( x: number ): number => x, clbk ); // $ExpectError - - forEach( 'presidential election', '', clbk, {} ); // $ExpectError - forEach( 'presidential election', 1, clbk, {} ); // $ExpectError - forEach( 'presidential election', false, clbk, {} ); // $ExpectError - forEach( 'presidential election', true, clbk, {} ); // $ExpectError - forEach( 'presidential election', null, clbk, {} ); // $ExpectError - forEach( 'presidential election', [], clbk, {} ); // $ExpectError - forEach( 'presidential election', ( x: number ): number => x, clbk, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an invalid `mode` option... -{ - forEach( 'presidential election', { 'mode': '' }, clbk ); // $ExpectError - forEach( 'presidential election', { 'mode': 1 }, clbk ); // $ExpectError - forEach( 'presidential election', { 'mode': false }, clbk ); // $ExpectError - forEach( 'presidential election', { 'mode': true }, clbk ); // $ExpectError - forEach( 'presidential election', { 'mode': null }, clbk ); // $ExpectError - forEach( 'presidential election', { 'mode': [] }, clbk ); // $ExpectError - forEach( 'presidential election', { 'mode': ( x: number ): number => x }, clbk ); // $ExpectError - - forEach( 'presidential election', { 'mode': '' }, clbk, {} ); // $ExpectError - forEach( 'presidential election', { 'mode': 1 }, clbk, {} ); // $ExpectError - forEach( 'presidential election', { 'mode': false }, clbk, {} ); // $ExpectError - forEach( 'presidential election', { 'mode': true }, clbk, {} ); // $ExpectError - forEach( 'presidential election', { 'mode': null }, clbk, {} ); // $ExpectError - forEach( 'presidential election', { 'mode': [] }, clbk, {} ); // $ExpectError - forEach( 'presidential election', { 'mode': ( x: number ): number => x }, clbk, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a callback argument which is not a function having a supported signature... -{ - forEach( 'presidential election', 'abc' ); // $ExpectError - forEach( 'presidential election', 2 ); // $ExpectError - forEach( 'presidential election', true ); // $ExpectError - forEach( 'presidential election', false ); // $ExpectError - forEach( 'presidential election', null ); // $ExpectError - forEach( 'presidential election', {} ); // $ExpectError - forEach( 'presidential election', [] ); // $ExpectError - - forEach( 'presidential election', 'abc', {} ); // $ExpectError - forEach( 'presidential election', 2, {} ); // $ExpectError - forEach( 'presidential election', true, {} ); // $ExpectError - forEach( 'presidential election', false, {} ); // $ExpectError - forEach( 'presidential election', null, {} ); // $ExpectError - forEach( 'presidential election', {}, {} ); // $ExpectError - forEach( 'presidential election', [], {} ); // $ExpectError - - forEach( 'presidential election', ( x: number ): number => x ); // $ExpectError - forEach( 'presidential election', ( x: number ): number => x, {} ); // $ExpectError - - forEach( 'presidential election', {}, 'abc' ); // $ExpectError - forEach( 'presidential election', {}, 2 ); // $ExpectError - forEach( 'presidential election', {}, true ); // $ExpectError - forEach( 'presidential election', {}, false ); // $ExpectError - forEach( 'presidential election', {}, null ); // $ExpectError - forEach( 'presidential election', {}, {} ); // $ExpectError - forEach( 'presidential election', {}, [] ); // $ExpectError - - forEach( 'presidential election', {}, 'abc', {} ); // $ExpectError - forEach( 'presidential election', {}, 2, {} ); // $ExpectError - forEach( 'presidential election', {}, true, {} ); // $ExpectError - forEach( 'presidential election', {}, false, {} ); // $ExpectError - forEach( 'presidential election', {}, null, {} ); // $ExpectError - forEach( 'presidential election', {}, {}, {} ); // $ExpectError - forEach( 'presidential election', {}, [], {} ); // $ExpectError - - forEach( 'presidential election', {}, ( x: number ): number => x ); // $ExpectError - forEach( 'presidential election', {}, ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - forEach(); // $ExpectError - forEach( 'presidential election' ); // $ExpectError - forEach( 'presidential election', {} ); // $ExpectError - forEach( 'presidential election', clbk, {}, 3 ); // $ExpectError - forEach( 'presidential election', {}, clbk, {}, 3 ); // $ExpectError -} diff --git a/for-each/examples/index.js b/for-each/examples/index.js deleted file mode 100644 index 354f8ea5..00000000 --- a/for-each/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 forEach = require( './../lib' ); - -function log( value, index ) { - console.log( '%d: %s', index, value ); -} - -forEach( 'presidential election', log ); -forEach( 'Iñtërnâtiônàlizætiøn', log ); -forEach( '🌷🍕', log ); -forEach( '\uD834\uDD1E', log ); diff --git a/for-each/lib/index.js b/for-each/lib/index.js deleted file mode 100644 index 9c9dc658..00000000 --- a/for-each/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Invoke a function for each character in a string. -* -* @module @stdlib/string/for-each -* -* @example -* var forEach = require( '@stdlib/string/for-each' ); -* -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello', log ); -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/for-each/lib/main.js b/for-each/lib/main.js deleted file mode 100644 index 52243757..00000000 --- a/for-each/lib/main.js +++ /dev/null @@ -1,116 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isFunction = require( '@stdlib/assert/is-function' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isPlainObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var forEachCodeUnit = require( './../../base/for-each' ); -var forEachCodePoint = require( './../../base/for-each-code-point' ); -var forEachGraphemeCluster = require( './../../base/for-each-grapheme-cluster' ); -var format = require( './../../format' ); - - -// VARIABLES // - -var MODES = [ 'grapheme', 'code_point', 'code_unit' ]; -var FCNS = { - 'grapheme': forEachGraphemeCluster, - 'code_point': forEachCodePoint, - 'code_unit': forEachCodeUnit -}; -var isMode = contains( MODES ); - - -// MAIN // - -/** -* Invokes a function for each character in a string. -* -* @param {string} str - input string -* @param {Options} [options] - options -* @param {string} [options.mode="grapheme"] - type of "character" over which to iterate (must be either `grapheme`, `code_point`, or `code_unit`) -* @param {Function} clbk - function to invoke -* @param {*} [thisArg] - execution context -* @throws {TypeError} first argument must be a string -* @throws {TypeError} callback argument must be a function -* @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @returns {string} input string -* -* @example -* function log( value, index ) { -* console.log( '%d: %s', index, value ); -* } -* -* forEach( 'Hello', log ); -*/ -function forEach( str, options, clbk ) { - var thisArg; - var nargs; - var opts; - var cb; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - opts = { - 'mode': 'grapheme' - }; - nargs = arguments.length; - if ( nargs === 2 ) { - cb = options; - options = null; - } else if ( nargs === 3 ) { - if ( isPlainObject( options ) ) { - cb = clbk; - } else { - cb = options; - options = null; - thisArg = clbk; - } - } else { // nargs === 4 - if ( !isPlainObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - cb = clbk; - thisArg = arguments[ 3 ]; - } - if ( !isFunction( cb ) ) { - throw new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', cb ) ); - } - if ( options ) { - if ( hasOwnProp( options, 'mode' ) ) { - opts.mode = options.mode; - if ( !isMode( opts.mode ) ) { - throw new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Value: `%s`.', 'mode', MODES.join( '", "' ), opts.mode ) ); - } - } - } - FCNS[ opts.mode ]( str, cb, thisArg ); - return str; -} - - -// EXPORTS // - -module.exports = forEach; diff --git a/for-each/package.json b/for-each/package.json deleted file mode 100644 index 23652d39..00000000 --- a/for-each/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@stdlib/string/for-each", - "version": "0.0.0", - "description": "Invoke a function for each character in a string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdutils", - "stdutil", - "utilities", - "utility", - "utils", - "util", - "for", - "each", - "foreach", - "iterate", - "stdstring", - "string", - "str", - "grapheme", - "unicode", - "utf16", - "utf-16" - ] -} diff --git a/for-each/test/test.js b/for-each/test/test.js deleted file mode 100644 index facf7232..00000000 --- a/for-each/test/test.js +++ /dev/null @@ -1,903 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 noop = require( '@stdlib/utils/noop' ); -var forEach = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof forEach, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided a first argument which is not a string', function test( t ) { - var values; - var i; - - values = [ - [], - 5, - NaN, - true, - false, - null, - void 0, - {}, - function noop() {}, - new Date() - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - forEach( value, noop ); - }; - } -}); - -tape( 'the function throws an error if provided a first argument which is not a string (options)', function test( t ) { - var values; - var i; - - values = [ - [], - 5, - NaN, - true, - false, - null, - void 0, - {}, - function noop() {}, - new Date() - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - forEach( value, {}, noop ); - }; - } -}); - -tape( 'the function throws an error if provided a first argument which is not a string (thisArg)', function test( t ) { - var values; - var i; - - values = [ - [], - 5, - NaN, - true, - false, - null, - void 0, - {}, - function noop() {}, - new Date() - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - forEach( value, noop, {} ); - }; - } -}); - -tape( 'the function throws an error if provided a first argument which is not a string (options, thisArg)', function test( t ) { - var values; - var i; - - values = [ - [], - 5, - NaN, - true, - false, - null, - void 0, - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - forEach( value, {}, noop, {} ); - }; - } -}); - -tape( 'the function throws an error if provided a callback 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 a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - forEach( 'beep', value ); - }; - } -}); - -tape( 'the function throws an error if provided a callback argument which is not a function (options)', 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 a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - forEach( 'beep', {}, value ); - }; - } -}); - -tape( 'the function throws an error if provided a callback 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 a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - forEach( 'beep', value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided a callback argument which is not a function (options, 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 a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - forEach( 'beep', {}, value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - 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() { - forEach( 'beep', value, noop ); - }; - } -}); - -tape( 'the function throws an error if provided a `mode` option which is not a supported mode', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - 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() { - var opts = { - 'mode': value - }; - forEach( 'beep', opts, noop ); - }; - } -}); - -tape( 'the function throws an error if provided a `mode` option which is not a supported mode (thisArg)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - 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() { - var opts = { - 'mode': value - }; - forEach( 'beep', opts, noop, {} ); - }; - } -}); - -tape( 'if provided an empty string, the function never invokes a provided function', function test( t ) { - var opts; - var out; - - out = forEach( '', fcn ); - t.strictEqual( out, '', 'returns expected value' ); - - out = forEach( '', {}, fcn ); - t.strictEqual( out, '', 'returns expected value' ); - - out = forEach( '', fcn, {} ); - t.strictEqual( out, '', 'returns expected value' ); - - out = forEach( '', {}, fcn, {} ); - t.strictEqual( out, '', 'returns expected value' ); - - opts = {}; - - opts.mode = 'grapheme'; - out = forEach( '', opts, fcn ); - t.strictEqual( out, '', 'returns expected value' ); - - opts.mode = 'code_point'; - out = forEach( '', opts, fcn ); - t.strictEqual( out, '', 'returns expected value' ); - - opts.mode = 'code_unit'; - out = forEach( '', opts, fcn ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); - - function fcn() { - t.fail( 'should not be invoked' ); - } -}); - -tape( 'the function returns a provided string', function test( t ) { - var opts; - var str; - var out; - - str = 'Hello, world'; - - out = forEach( str, noop ); - t.strictEqual( out, str, 'returns expected value' ); - - opts = {}; - - opts.mode = 'grapheme'; - out = forEach( str, opts, noop ); - t.strictEqual( out, str, 'returns expected value' ); - - opts.mode = 'code_point'; - out = forEach( str, opts, noop ); - t.strictEqual( out, str, 'returns expected value' ); - - opts.mode = 'code_unit'; - out = forEach( str, opts, noop ); - t.strictEqual( out, str, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function invokes a provided function for each character of a provided string (default)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each character of a provided string (mode=grapheme)', function test( t ) { - var expected; - var actual; - var opts; - var str; - - str = 'Hello, world'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd' - ]; - actual = []; - - opts = { - 'mode': 'grapheme' - }; - forEach( str, opts, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each character of a provided string (mode=code_point)', function test( t ) { - var expected; - var actual; - var opts; - var str; - - str = 'Hello, world'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd' - ]; - actual = []; - - opts = { - 'mode': 'code_point' - }; - forEach( str, opts, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each character of a provided string (mode=code_unit)', function test( t ) { - var expected; - var actual; - var opts; - var str; - - str = 'Hello, world'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd' - ]; - actual = []; - - opts = { - 'mode': 'code_unit' - }; - forEach( str, opts, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each character of the string (Unicode; default)', function test( t ) { - var expected; - var actual; - var str; - - str = 'Hello, world \uD834\uDD1E'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd', - ' ', - '\uD834\uDD1E' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each character of the string (Unicode; mode=grapheme)', function test( t ) { - var expected; - var actual; - var opts; - var str; - - str = 'Hello, world \uD834\uDD1E'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd', - ' ', - '\uD834\uDD1E' - ]; - actual = []; - - opts = { - 'mode': 'grapheme' - }; - forEach( str, opts, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each character of the string (Unicode; mode=code_point)', function test( t ) { - var expected; - var actual; - var opts; - var str; - - str = 'Hello, world \uD834\uDD1E'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd', - ' ', - '\uD834\uDD1E' - ]; - actual = []; - - opts = { - 'mode': 'code_point' - }; - forEach( str, opts, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each character of the string (Unicode; mode=code_unit)', function test( t ) { - var expected; - var actual; - var opts; - var str; - - str = 'Hello, world \uD834\uDD1E'; - expected = [ - 'H', - 'e', - 'l', - 'l', - 'o', - ',', - ' ', - 'w', - 'o', - 'r', - 'l', - 'd', - ' ', - '\uD834', - '\uDD1E' - ]; - actual = []; - - opts = { - 'mode': 'code_unit' - }; - forEach( str, opts, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each character of the string (emoji; default)', function test( t ) { - var expected; - var actual; - var str; - - str = '🌷🍕👉🏿'; - expected = [ - '🌷', - '🍕', - '👉🏿' - ]; - - actual = []; - forEach( str, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each character of the string (emoji; mode=grapheme)', function test( t ) { - var expected; - var actual; - var opts; - var str; - - str = '🌷🍕👉🏿'; - expected = [ - '🌷', - '🍕', - '👉🏿' - ]; - actual = []; - - opts = { - 'mode': 'grapheme' - }; - forEach( str, opts, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each character of the string (emoji; mode=code_point)', function test( t ) { - var expected; - var actual; - var opts; - var str; - - str = '🌷🍕👉🏿'; - expected = [ - '🌷', - '🍕', - '👉', - '🏿' - ]; - actual = []; - - opts = { - 'mode': 'code_point' - }; - forEach( str, opts, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function invokes a provided function for each character of the string (emoji; mode=code_unit)', function test( t ) { - var expected; - var actual; - var opts; - var str; - - str = '🌷🍕👉🏿'; - expected = [ - '\uD83C', - '\uDF37', - '\uD83C', - '\uDF55', - '\uD83D', - '\uDC49', - '\uD83C', - '\uDFFF' - ]; - actual = []; - - opts = { - 'mode': 'code_unit' - }; - forEach( str, opts, copy ); - - t.deepEqual( actual, expected, 'returns expected value' ); - t.end(); - - function copy( value ) { - actual.push( value ); - } -}); - -tape( 'the function supports providing an execution context (default)', function test( t ) { - var ctx; - var str; - - str = '🌷🍕👉🏿'; - ctx = { - 'count': 0 - }; - - forEach( str, count, ctx ); - - t.strictEqual( ctx.count, 3, 'returns expected value' ); - t.end(); - - function count() { - this.count += 1; // eslint-disable-line no-invalid-this - } -}); - -tape( 'the function supports providing an execution context (mode=grapheme)', function test( t ) { - var opts; - var ctx; - var str; - - str = '🌷🍕👉🏿'; - ctx = { - 'count': 0 - }; - - opts = { - 'mode': 'grapheme' - }; - forEach( str, opts, count, ctx ); - - t.strictEqual( ctx.count, 3, 'returns expected value' ); - t.end(); - - function count() { - this.count += 1; // eslint-disable-line no-invalid-this - } -}); - -tape( 'the function supports providing an execution context (mode=code_point)', function test( t ) { - var opts; - var ctx; - var str; - - str = '🌷🍕👉🏿'; - ctx = { - 'count': 0 - }; - - opts = { - 'mode': 'code_point' - }; - forEach( str, opts, count, ctx ); - - t.strictEqual( ctx.count, 4, 'returns expected value' ); - t.end(); - - function count() { - this.count += 1; // eslint-disable-line no-invalid-this - } -}); - -tape( 'the function supports providing an execution context (mode=code_unit)', function test( t ) { - var opts; - var ctx; - var str; - - str = '🌷🍕👉🏿'; - ctx = { - 'count': 0 - }; - - opts = { - 'mode': 'code_unit' - }; - forEach( str, opts, count, ctx ); - - t.strictEqual( ctx.count, 8, 'returns expected value' ); - t.end(); - - function count() { - this.count += 1; // eslint-disable-line no-invalid-this - } -}); diff --git a/format/README.md b/format/README.md deleted file mode 100644 index 3c32738b..00000000 --- a/format/README.md +++ /dev/null @@ -1,250 +0,0 @@ - - -# format - -> Insert supplied variable values into a format string. - -
- -
- - - -
- -## Usage - -```javascript -var format = require( '@stdlib/string/format' ); -``` - -#### format( str, ...args ) - -Inserts supplied variable values into a format string. - -```javascript -var str = 'Hello, %s! My name is %s.'; -var out = format( str, 'world', 'Bob' ); -// returns 'Hello, world! My name is Bob.' -``` - -The format string is a string literal containing zero or more conversion specifications, each of which results in a string value being inserted to the output string. A conversion specification consists of a percent sign (`%`) followed by one or more of the following flags, width, precision, and conversion type characters. It thus takes the following form: - -```text -%[flags][width][.precision]specifier -``` - -Arguments following the format string are used to replace the placeholders in the format string. The number of arguments following the format string should be equal to the number of placeholders in the format string. - -```javascript -var str = '%s %s'; -var out = format( str, 'Hello', 'World' ); -// returns 'Hello World' -``` - -To supply arguments in a different order than they appear in the format string, positional placeholders as indicated by a `$` character in the format string are used. In this case, the conversion specification takes the form: - -```text -%[pos$][flags][width][.precision]specifier -``` - -```javascript -var str = '%3$s %2$s %1$s'; -var out = format( str, 'foo', 'bar', 'baz' ); -// returns 'baz bar foo' -``` - -The following table summarizes the supported specifiers: - -| type | description | example | -| ---- | --------------------------------- | --------- | -| s | string | beep boop | -| c | character | a | -| d, i | signed decimal integer | -12 | -| u | unsigned decimal integer | 390 | -| b | unsigned binary integer | 11011011 | -| o | unsigned octal integer | 510 | -| x | unsigned hexadecimal (lowercase) | 7b | -| X | unsigned hexadecimal (uppercase) | 7B | -| f, F | decimal floating point | 390.24 | -| e | scientific notation (lowercase) | 3.9e+1 | -| E | scientific notation (uppercase) | 3.9E+1 | -| g | shortest representation (`e`/`f`) | 3.9 | -| G | shortest representation (`E`/`F`) | 3.9 | - -```javascript -var str = '%i written as a binary number is %b.'; -var out = format( str, 9, 9 ); -// returns '9 written as a binary number is 1001.' - -str = '%i written as an octal number is %o.'; -out = format( str, 17, 17 ); -// returns '17 written as an octal number is 21.' - -str = '%i written as a hexadecimal number is %x.'; -out = format( str, 255, 255 ); -// returns '255 written as a hexadecimal number is ff.' - -str = '%i written as a hexadecimal number is %X (uppercase letters).'; -out = format( str, 255, 255 ); -// returns '255 written as a hexadecimal number is FF (uppercase letters).' - -str = '%i written as a floating point number with default precision is %f!'; -out = format( str, 8, 8 ); -// returns '8 written as a floating point number with default precision is 8.000000!' - -str = 'Scientific notation: %e'; -out = format( str, 3.14159 ); -// returns 'Scientific notation: 3.141590e+00' - -str = 'Scientific notation: %E (uppercase).'; -out = format( str, 3.14159 ); -// returns 'Scientific notation: 3.141590E+00 (uppercase).' - -str = '%g (shortest representation)'; -out = format( str, 3.14159 ); -// returns '3.14159' -``` - -A conversion specification may contain zero or more flags, which modify the behavior of the conversion. The following flags are supported: - -| flag | description | -| ----- | ------------------------------------------------------------------------------------------ | -| - | left-justify the output within the given field width by padding with spaces on the right | -| 0 | left-pad the output with zeros instead of spaces when padding is required | -| # | use an alternative format for `o` and `x` conversions | -| + | prefix the output with a plus (+) or minus (-) sign even if the value is a positive number | -| space | prefix the value with a space character if no sign is written | - -```javascript -var str = 'Always prefix with a sign: %+i'; -var out = format( str, 9 ); -// returns 'Always prefix with a sign: +9' - -out = format( str, -9 ); -// returns 'Always prefix with a sign: -9' - -str = 'Only prefix with a sign if negative: %i'; -out = format( str, 6 ); -// returns 'Only prefix with a sign if negative: 6' - -out = format( str, -6 ); -// returns 'Only prefix with a sign if negative: -6' - -str = 'Prefix with a sign if negative and a space if positive: % i'; -out = format( str, 3 ); -// returns 'Prefix with a sign if negative and a space if positive: 3' - -out = format( str, -3 ); -// returns 'Prefix with a sign if negative and a space if positive: -3' -``` - -The `width` may be specified as a decimal integer representing the minimum number of characters to be written to the output. If the value to be written is shorter than this number, the result is padded with spaces on the left. The value is not truncated even if the result is larger. Alternatively, the `width` may be specified as an asterisk character (`*`), in which case the argument preceding the conversion specification is used as the minimum field width. - -```javascript -var str = '%5s'; -var out = format( str, 'baz' ); -// returns ' baz' - -str = '%-5s'; -out = format( str, 'baz' ); -// returns 'baz ' - -str = '%05i'; -out = format( str, 2 ); -// returns '00002' - -str = '%*i'; -out = format( str, 5, 2 ); -// returns ' 2' -``` - -The `precision` may be specified as a decimal integer or as an asterisk character (`*`), in which case the argument preceding the conversion specification is used as the precision value. The behavior of the `precision` differs depending on the conversion type: - -- For `s` specifiers, the `precision` specifies the maximum number of characters to be written to the output. -- For floating point specifiers (`f`, `F`, `e`, `E`), the `precision` specifies the number of digits after the decimal point to be written to the output (by default, this is `6`). -- For `g` and `G` specifiers, the `precision` specifies the maximum number of significant digits to be written to the output. -- For integer specifiers (`d`, `i`, `u`, `b`, `o`, `x`, `X`), the `precision` specifies the minimum number of digits to be written to the output. If the value to be written is shorter than this number, the result is padded with zeros on the left. The value is not truncated even if the result is longer. - -Alternatively, the `precision` may be specified as an asterisk character (`*`), in which case the argument preceding the conversion specification is used as the minimum number of digits. - -```javascript -var str = '%5.2s'; -var out = format( str, 'baz' ); -// returns ' ba' - -str = 'PI: ~%.2f'; -out = format( str, 3.14159 ); -// returns 'PI: ~3.14' - -str = 'Agent %.3i'; -out = format( str, 7 ); -// returns 'Agent 007' -``` - -
- - - -
- -## Examples - - - -```javascript -var format = require( '@stdlib/string/format' ); - -var out = format( '%s %s!', 'Hello', 'World' ); -// returns 'Hello World!' - -out = format( 'Pi: ~%.2f', 3.141592653589793 ); -// returns 'Pi: ~3.14' - -out = format( '%-10s %-10s', 'a', 'b' ); -// returns 'a b ' - -out = format( '%10s %10s', 'a', 'b' ); -// returns ' a b' - -out = format( '%2$s %1$s %3$s', 'b', 'a', 'c' ); -// returns 'a b c' -``` - -
- - - - - - - - - - - - - - diff --git a/format/benchmark/benchmark.js b/format/benchmark/benchmark.js deleted file mode 100644 index 3e2b2359..00000000 --- a/format/benchmark/benchmark.js +++ /dev/null @@ -1,73 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var format = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var str; - var i; - - str = '%s %s!'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = format( str, 'Hello', 'World' ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::positional', pkg ), function benchmark( b ) { - var out; - var str; - var i; - - str = '%2$s %1$s!'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = format( str, 'World', 'Hello' ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/format/docs/repl.txt b/format/docs/repl.txt deleted file mode 100644 index 6e8ba9e8..00000000 --- a/format/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( str, ...args ) - Insert supplied variable values into a format string. - - Parameters - ---------- - str: string - Input string. - - args: ...any - Variable values. - - Returns - ------- - out: string - Formatted string. - - Examples - -------- - > var out = {{alias}}( 'Hello, %s!', 'World' ) - 'Hello, World!' - - > out = {{alias}}( '%s %s', 'Hello', 'World' ) - 'Hello World' - - > out = {{alias}}( 'Pi: %.2f', {{alias:@stdlib/constants/float64/pi}} ) - 'Pi: 3.14' - - See Also - -------- - diff --git a/format/docs/types/index.d.ts b/format/docs/types/index.d.ts deleted file mode 100644 index cecb88d1..00000000 --- a/format/docs/types/index.d.ts +++ /dev/null @@ -1,42 +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. -*/ - -// TypeScript Version: 4.1 - -/** -* Inserts supplied variable values into a format string. -* -* @param str - input string -* @param args - variable values -* @throws invalid flags -* @returns formatted string -* -* @example -* var str = format( 'Hello %s!', 'world' ); -* // returns 'Hello world!' -* -* @example -* var str = format( 'Pi: ~%.2f', 3.141592653589793 ); -* // returns 'Pi: ~3.14' -*/ -declare function format( str: string, ...args: Array ): string; - - -// EXPORTS // - -export = format; diff --git a/format/docs/types/test.ts b/format/docs/types/test.ts deleted file mode 100644 index 8e90a6ef..00000000 --- a/format/docs/types/test.ts +++ /dev/null @@ -1,45 +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. -*/ - -import format = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - format( 'Hello World!' ); // $ExpectType string - format( 'Hello, %s!', 'Jane' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument other than a string... -{ - format( true ); // $ExpectError - format( false ); // $ExpectError - format( null ); // $ExpectError - format( undefined ); // $ExpectError - format( 5 ); // $ExpectError - format( [] ); // $ExpectError - format( {} ); // $ExpectError - format( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - format(); // $ExpectError -} diff --git a/format/examples/index.js b/format/examples/index.js deleted file mode 100644 index 60709642..00000000 --- a/format/examples/index.js +++ /dev/null @@ -1,41 +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. -*/ - -'use strict'; - -var format = require( './../lib' ); - -var out = format( '%s %s!', 'Hello', 'World' ); -console.log( out ); -// => 'Hello World!' - -out = format( 'Pi: ~%.2f', 3.141592653589793 ); -console.log( out ); -// => 'Pi: ~3.14' - -out = format( '%-10s %-10s', 'a', 'b' ); -console.log( out ); -// => 'a b ' - -out = format( '%10s %10s', 'a', 'b' ); -console.log( out ); -// => ' a b' - -out = format( '%2$s %1$s %3$s', 'b', 'a', 'c' ); -console.log( out ); -// => 'a b c' diff --git a/format/lib/index.js b/format/lib/index.js deleted file mode 100644 index 172c007e..00000000 --- a/format/lib/index.js +++ /dev/null @@ -1,43 +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. -*/ - -'use strict'; - -/** -* Insert supplied variable values into a format string. -* -* @module @stdlib/string/format -* -* @example -* var format = require( '@stdlib/string/format' ); -* -* var out = format( '%s %s!', 'Hello', 'World' ); -* // returns 'Hello World!' -* -* out = format( 'Pi: ~%.2f', 3.141592653589793 ); -* // returns 'Pi: ~3.14' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/format/lib/is_string.js b/format/lib/is_string.js deleted file mode 100644 index 8f1fd29f..00000000 --- a/format/lib/is_string.js +++ /dev/null @@ -1,42 +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. -*/ - -'use strict'; - -/** -* Tests if a value is a string primitive. -* -* @param {*} value - value to test -* @returns {boolean} boolean indicating if a value is a string primitive -* -* @example -* var bool = isString( 'beep' ); -* // returns true -* -* @example -* var bool = isString( new String( 'beep' ) ); -* // returns false -*/ -function isString( value ) { - return ( typeof value === 'string' ); // NOTE: we inline the `isString.isPrimitive` function from `@stdlib/assert/is-string` in order to avoid circular dependencies. -} - - -// EXPORTS // - -module.exports = isString; diff --git a/format/lib/main.js b/format/lib/main.js deleted file mode 100644 index 8c26130d..00000000 --- a/format/lib/main.js +++ /dev/null @@ -1,64 +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. -*/ - -'use strict'; - -// MODULES // - -var interpolate = require( './../../base/format-interpolate' ); -var tokenize = require( './../../base/format-tokenize' ); -var isString = require( './is_string.js' ); - - -// MAIN // - -/** -* Inserts supplied variable values into a format string. -* -* @param {string} str - input string -* @param {Array} ...args - variable values -* @throws {TypeError} first argument must be a string -* @throws {Error} invalid flags -* @returns {string} formatted string -* -* @example -* var str = format( 'Hello %s!', 'world' ); -* // returns 'Hello world!' -* -* @example -* var str = format( 'Pi: ~%.2f', 3.141592653589793 ); -* // returns 'Pi: ~3.14' -*/ -function format( str ) { - var args; - var i; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - args = [ tokenize( str ) ]; - for ( i = 1; i < arguments.length; i++ ) { - args.push( arguments[ i ] ); - } - return interpolate.apply( null, args ); -} - - -// EXPORTS // - -module.exports = format; diff --git a/format/package.json b/format/package.json deleted file mode 100644 index f1bf12d4..00000000 --- a/format/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/format", - "version": "0.0.0", - "description": "Insert supplied variable values into a format string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "format", - "fmt", - "formatter", - "sprintf", - "printf", - "print" - ] -} diff --git a/format/test/test.js b/format/test/test.js deleted file mode 100644 index b2a9f8de..00000000 --- a/format/test/test.js +++ /dev/null @@ -1,1092 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var PI = require( '@stdlib/constants/float64/pi' ); -var PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); -var format = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof format, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a primitive string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - format( value ); - }; - } -}); - -tape( 'the function throws an error if provided a format string with an invalid format specifier', function test( t ) { - var values; - var i; - - values = [ - '%C', - '%S', - '%U', - '%Z' - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), Error, 'throws an error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - format( value, 'beep' ); - }; - } -}); - -tape( 'the function returns a formatted string (`s` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%s'; - actual = format( str, 'beep' ); - expected = 'beep'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %s'; - actual = format( str, 'boop' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%s %s baz'; - actual = format( str, 'beep', 'boop' ); - expected = 'beep boop baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, minimum width)', function test( t ) { - var expected; - var actual; - var str; - - str = '%6s'; - actual = format( str, 'beep' ); - expected = ' beep'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %6s'; - actual = format( str, 'boop' ); - expected = 'beep boop'; - - str = '%2s %2s baz'; - actual = format( str, 'beep', 'boop' ); - expected = 'beep boop baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, variable width)', function test( t ) { - var expected; - var actual; - var str; - - str = '%*s'; - actual = format( str, 6, 'beep' ); - expected = ' beep'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %*s'; - actual = format( str, 6, 'boop' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%*s %*s baz'; - actual = format( str, 6, 'beep', 4, 'boop' ); - expected = ' beep boop baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, minimum width, left-justified)', function test( t ) { - var expected; - var actual; - var str; - - str = '%-6s'; - actual = format( str, 'beep' ); - expected = 'beep '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %-6s'; - actual = format( str, 'boop' ); - expected = 'beep boop '; - - str = '%-2s %-2s baz'; - actual = format( str, 'beep', 'boop' ); - expected = 'beep boop baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, precision)', function test( t ) { - var expected; - var actual; - var str; - - str = '%.2s'; - actual = format( str, 'beep' ); - expected = 'be'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %.2s'; - actual = format( str, 'boop' ); - expected = 'beep bo'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, precision, minimum width)', function test( t ) { - var expected; - var actual; - var str; - - str = '%6.2s'; - actual = format( str, 'beep' ); - expected = ' be'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %6.2s'; - actual = format( str, 'boop' ); - expected = 'beep bo'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%6.8s %4.2s baz'; - actual = format( str, 'beep', 'boop' ); - expected = 'beep bo b'; - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, precision, minimum width, zero-padded)', function test( t ) { - var expected; - var actual; - var str; - - str = '%06.2s'; - actual = format( str, 'beep' ); - expected = '0000be'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %06.2s'; - actual = format( str, 'boop' ); - expected = 'beep 0000bo'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%06.8s %04.2s baz'; - actual = format( str, 'beep', 'boop' ); - expected = 'beep bo00 b'; - - t.end(); -}); - -tape( 'the function returns a formatted string (`c` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%c'; - actual = format( str, 70 ); - expected = 'F'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %c'; - actual = format( str, 75 ); - expected = 'beep K'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%c %c baz'; - actual = format( str, 70, 75 ); - expected = 'F K baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`c` specifier, string arguments)', function test( t ) { - var expected; - var actual; - var str; - - str = '%c'; - actual = format( str, 'b' ); - expected = 'b'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %c'; - actual = format( str, 'boop' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`c` specifier, minimum width)', function test( t ) { - var expected; - var actual; - var str; - - str = '%2c'; - actual = format( str, 80 ); - expected = ' P'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %4c'; - actual = format( str, 90 ); - expected = 'beep Z'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%2c %c baz'; - actual = format( str, 80, 90 ); - expected = ' P Z baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`c` specifier, minimum width, left-justified)', function test( t ) { - var expected; - var actual; - var str; - - str = '%-2c'; - actual = format( str, 80 ); - expected = 'P '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %-4c'; - actual = format( str, 90 ); - expected = 'beep Z '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%-2c %-c baz'; - actual = format( str, 80, 90 ); - expected = 'P Z baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`d` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%d'; - actual = format( str, 3 ); - expected = '3'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %d'; - actual = format( str, 5.8 ); - expected = 'beep 5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%d %d baz'; - actual = format( str, 3, 5 ); - expected = '3 5 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`d` specifier, sign)', function test( t ) { - var expected; - var actual; - var str; - - str = '%+d'; - actual = format( str, 3 ); - expected = '+3'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %+d'; - actual = format( str, 5.8 ); - expected = 'beep +5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%+d %+d baz'; - actual = format( str, 3, 5 ); - expected = '+3 +5 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%+d %+d baz'; - actual = format( str, -3, -5 ); - expected = '-3 -5 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`d` specifier, minimum width)', function test( t ) { - var expected; - var actual; - var str; - - str = '%2d'; - actual = format( str, 3 ); - expected = ' 3'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %4d'; - actual = format( str, 5 ); - expected = 'beep 5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%2d %d baz'; - actual = format( str, 3.1, 5 ); - expected = ' 3 5 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`d` specifier, minimum width, left-justified)', function test( t ) { - var expected; - var actual; - var str; - - str = '%-2d'; - actual = format( str, 3 ); - expected = '3 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %-4d'; - actual = format( str, 5.2 ); - expected = 'beep 5 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%-3d baz'; - actual = format( str, 3, 5 ); - expected = '3 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`d` specifier, minimum width, zero-padded)', function test( t ) { - var expected; - var actual; - var str; - - str = '%02d'; - actual = format( str, 3 ); - expected = '03'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %04d'; - actual = format( str, 5.1 ); - expected = 'beep 0005'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%02d %d baz'; - actual = format( str, 3, 5 ); - expected = '03 5 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%f'; - actual = format( str, 3.14 ); - expected = '3.140000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %f'; - actual = format( str, 5.0 ); - expected = 'beep 5.000000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%f %f baz'; - actual = format( str, 3.14, 5.0 ); - expected = '3.140000 5.000000 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%f %f baz'; - actual = format( str, PINF, NINF ); - expected = 'infinity -infinity baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%f'; - actual = format( str, NaN ); - expected = 'nan'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`F` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%F'; - actual = format( str, 3.14 ); - expected = '3.140000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %F'; - actual = format( str, 5.0 ); - expected = 'beep 5.000000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%F %F baz'; - actual = format( str, 3.14, 5.0 ); - expected = '3.140000 5.000000 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%F %F baz'; - actual = format( str, PINF, NINF ); - expected = 'INFINITY -INFINITY baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%F'; - actual = format( str, NaN ); - expected = 'NAN'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, specified precision)', function test( t ) { - var expected; - var actual; - var str; - - str = '%.3f'; - actual = format( str, PI ); - expected = '3.142'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %.3f'; - actual = format( str, 5.0 ); - expected = 'beep 5.000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, variable precision)', function test( t ) { - var expected; - var actual; - var str; - - str = '%.*f'; - actual = format( str, 3, PI ); - expected = '3.142'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %.*f'; - actual = format( str, 3, 5.0 ); - expected = 'beep 5.000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%.*f %.*f baz'; - actual = format( str, 3, PI, 3, PI ); - expected = '3.142 3.142 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`g` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%g'; - actual = format( str, PI ); - expected = '3.14159'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %g'; - actual = format( str, 1.0003212e-10 ); - expected = 'beep 1.00032e-10'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%g %g baz'; - actual = format( str, PI, 1.0003212e-10 ); - expected = '3.14159 1.00032e-10 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`G` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%G'; - actual = format( str, PI ); - expected = '3.14159'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%3.G'; - actual = format( str, 100 ); - expected = '1E+02'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %G'; - actual = format( str, 1.0003212e-10 ); - expected = 'beep 1.00032E-10'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%G %G baz'; - actual = format( str, PI, 1.0003212e-10 ); - expected = '3.14159 1.00032E-10 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`G` specifier, alternate form)', function test( t ) { - var expected; - var actual; - var str; - - str = '%#G'; - actual = format( str, PI ); - expected = '3.14159'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#3.G'; - actual = format( str, 100 ); - expected = '1.E+02'; // always contains a decimal point! - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %#G'; - actual = format( str, 1.0003212e-10 ); - expected = 'beep 1.00032E-10'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#G %#G baz'; - actual = format( str, PI, 1.0003212e-10 ); - expected = '3.14159 1.00032E-10 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, minimum width)', function test( t ) { - var expected; - var actual; - var str; - - str = '%12f'; - actual = format( str, 3.14 ); - expected = ' 3.140000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %12f'; - actual = format( str, 5.0 ); - expected = 'beep 5.000000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, decimal precision)', function test( t ) { - var expected; - var actual; - var str; - - str = '%.3f'; - actual = format( str, 3.14 ); - expected = '3.140'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%.3f'; - actual = format( str, PI ); - expected = '3.142'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %.3f'; - actual = format( str, 5.0 ); - expected = 'beep 5.000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, minimum width, decimal precision)', function test( t ) { - var expected; - var actual; - var str; - - str = '%8.3f'; - actual = format( str, 3.14 ); - expected = ' 3.140'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %8.3f'; - actual = format( str, 5.0 ); - expected = 'beep 5.000'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%8.3f %.3f baz'; - actual = format( str, 3.14, 5.0 ); - expected = ' 3.140 5.000 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`f` specifier, minimum width, left-justified, decimal precision)', function test( t ) { - var expected; - var actual; - var str; - - str = '%-8.3f'; - actual = format( str, 3.14 ); - expected = '3.140 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %-8.3f'; - actual = format( str, 5.0 ); - expected = 'beep 5.000 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%-8.3f %.3f baz'; - actual = format( str, 3.14, 5.0 ); - expected = '3.140 5.000 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`b` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%b'; - actual = format( str, 3 ); - expected = '11'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %b'; - actual = format( str, 5 ); - expected = 'beep 101'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%b %b baz'; - actual = format( str, 3, 5 ); - expected = '11 101 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`b` specifier, alternate form)', function test( t ) { - var expected; - var actual; - var str; - - str = '%#b'; - actual = format( str, 3 ); - expected = '11'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %#b'; - actual = format( str, 5 ); - expected = 'beep 101'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#b %#b baz'; - actual = format( str, 3, 5 ); - expected = '11 101 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`b` specifier, minimum width)', function test( t ) { - var expected; - var actual; - var str; - - str = '%12b'; - actual = format( str, 3 ); - expected = ' 11'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %12b'; - actual = format( str, 5 ); - expected = 'beep 101'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`b` specifier, minimum width, left-justified)', function test( t ) { - var expected; - var actual; - var str; - - str = '%-12b'; - actual = format( str, 3 ); - expected = '11 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %-12b'; - actual = format( str, 5 ); - expected = 'beep 101 '; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`b` specifier, minimum width, zero-padded)', function test( t ) { - var expected; - var actual; - var str; - - str = '%012b'; - actual = format( str, 3 ); - expected = '000000000011'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %012b'; - actual = format( str, 5 ); - expected = 'beep 000000000101'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`o` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%o'; - actual = format( str, 12 ); - expected = '14'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %o'; - actual = format( str, 5 ); - expected = 'beep 5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%o %o baz'; - actual = format( str, 8, 9 ); - expected = '10 11 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`o` specifier, alternate form)', function test( t ) { - var expected; - var actual; - var str; - - str = '%#o'; - actual = format( str, 12 ); - expected = '014'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %#o'; - actual = format( str, 5 ); - expected = 'beep 05'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#o %#o baz'; - actual = format( str, 8, 9 ); - expected = '010 011 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`x` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%x'; - actual = format( str, 12 ); - expected = 'c'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %x'; - actual = format( str, 5 ); - expected = 'beep 5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%x %x baz'; - actual = format( str, 14, 15 ); - expected = 'e f baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`x` specifier, alternate form)', function test( t ) { - var expected; - var actual; - var str; - - str = '%#x'; - actual = format( str, 12 ); - expected = '0xc'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %#x'; - actual = format( str, 5 ); - expected = 'beep 0x5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#x %#x baz'; - actual = format( str, 14, 15 ); - expected = '0xe 0xf baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`X` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%X'; - actual = format( str, 12 ); - expected = 'C'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %X'; - actual = format( str, 5 ); - expected = 'beep 5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%X %X baz'; - actual = format( str, 14, 15 ); - expected = 'E F baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`X` specifier, alternate form)', function test( t ) { - var expected; - var actual; - var str; - - str = '%#X'; - actual = format( str, 12 ); - expected = '0XC'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %#X'; - actual = format( str, 5 ); - expected = 'beep 0X5'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%#X %#X baz'; - actual = format( str, 14, 15 ); - expected = '0XE 0XF baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`u` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%u'; - actual = format( str, 12 ); - expected = '12'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %u'; - actual = format( str, -5 ); - expected = 'beep 4294967291'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%u %u baz'; - actual = format( str, 14, 15 ); - expected = '14 15 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`e` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%e'; - actual = format( str, 12 ); - expected = '1.200000e+01'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %e'; - actual = format( str, -5 ); - expected = 'beep -5.000000e+00'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%e %e baz'; - actual = format( str, 14, 15 ); - expected = '1.400000e+01 1.500000e+01 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`e` specifier, minimum width, precision)', function test( t ) { - var expected; - var actual; - var str; - - str = '%12.2e'; - actual = format( str, 12 ); - expected = ' 1.20e+01'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %12.2e'; - actual = format( str, -5 ); - expected = 'beep -5.00e+00'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%12.2e %12.2e baz'; - actual = format( str, 14, 15 ); - expected = ' 1.40e+01 1.50e+01 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`E` specifier)', function test( t ) { - var expected; - var actual; - var str; - - str = '%E'; - actual = format( str, 12 ); - expected = '1.200000E+01'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %E'; - actual = format( str, -5 ); - expected = 'beep -5.000000E+00'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%E %E baz'; - actual = format( str, 14, 15 ); - expected = '1.400000E+01 1.500000E+01 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`E` specifier, minimum width, precision)', function test( t ) { - var expected; - var actual; - var str; - - str = '%12.2E'; - actual = format( str, 12 ); - expected = ' 1.20E+01'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = 'beep %12.2E'; - actual = format( str, -5 ); - expected = 'beep -5.00E+00'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%12.2E %12.2E baz'; - actual = format( str, 14, 15 ); - expected = ' 1.40E+01 1.50E+01 baz'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); - -tape( 'the function returns a formatted string (`s` specifier, positional arguments)', function test( t ) { - var expected; - var actual; - var str; - - str = '%2$s %1$s!'; - actual = format( str, 'World', 'Hello' ); - expected = 'Hello World!'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%2$s %1$s %1$s!'; - actual = format( str, 'World', 'Hello' ); - expected = 'Hello World World!'; - t.strictEqual( actual, expected, 'returns expected output' ); - - str = '%3$s %2$s %1$s!'; - actual = format( str, 'C', 'B', 'A' ); - expected = 'A B C!'; - t.strictEqual( actual, expected, 'returns expected output' ); - - t.end(); -}); diff --git a/from-code-point/README.md b/from-code-point/README.md deleted file mode 100644 index 8286be1e..00000000 --- a/from-code-point/README.md +++ /dev/null @@ -1,244 +0,0 @@ - - -# fromCodePoint - -> Create a string from a sequence of Unicode [code points][code-point]. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var fromCodePoint = require( '@stdlib/string/from-code-point' ); -``` - -#### fromCodePoint( pt1\[, pt2\[, pt3\[, ...]]] ) - -Creates a `string` from a sequence of Unicode [code points][code-point]. - -```javascript -var out = fromCodePoint( 9731 ); -// returns '☃' -``` - -In addition to providing [code points][code-point] as separate arguments, the function supports providing an array-like `object` as a single argument containing a sequence of [code points][code-point]. - -```javascript -var Uint16Array = require( '@stdlib/array/uint16' ); - -var out = fromCodePoint( 97, 98, 99 ); -// returns 'abc' - -out = fromCodePoint( new Uint16Array( [ 97, 98, 99 ] ) ); -// returns 'abc' -``` - -
- - - - - -
- -## Notes - -- This function differs from [`String.fromCharCode`][mdn-string-fromcharcode] in the following ways: - - - The function provides support for all valid Unicode values (up to `21` bits). While most common Unicode values can be represented using one 16-bit unit, higher code point characters require two 16-bit units (a surrogate pair consisting of a high and a low surrogate) to form a single character. [`String.fromCharCode`][mdn-string-fromcharcode] does **not** support surrogate pairs, supporting only UCS-2, a subset of [UTF-16][utf-16]. - -- This function differs from [`String.fromCodePoint`][mdn-string-fromcodepoint] in the following ways: - - - The function supports explicitly providing an array-like `object` containing a sequence of [code points][code-point]. - - The function requires **at least** one [code point][code-point]. - - The function requires that all [code points][code-point] be nonnegative integers. The function does **not** support values, such as `null`, `undefined`, `true`, `false`, `'0'`, `'1'`, etc., which can be cast to integer values. - -
- - - - - -
- -## Examples - - - -```javascript -var randu = require( '@stdlib/random/base/randu' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var UNICODE_MAX_BMP = require( '@stdlib/constants/unicode/max-bmp' ); -var fromCodePoint = require( '@stdlib/string/from-code-point' ); - -var x; -var i; - -for ( i = 0; i < 100; i++ ) { - x = floor( randu()*UNICODE_MAX_BMP ); - console.log( '%d => %s', x, fromCodePoint( x ) ); -} -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: from-code-point [options] [ ...] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'97\n98\n99' | from-code-point --split /\r?\n/ - - # Escaped... - $ echo -n $'97\n98\n99' | from-code-point --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - - - -
- -### Examples - -```bash -$ from-code-point 9731 -☃ -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n '9731' | from-code-point -☃ -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n '97\t98\t99\t' | from-code-point --split '\t' -abc -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/from-code-point/benchmark/benchmark.apply.js b/from-code-point/benchmark/benchmark.apply.js deleted file mode 100644 index 73656222..00000000 --- a/from-code-point/benchmark/benchmark.apply.js +++ /dev/null @@ -1,116 +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' ); -var randu = require( '@stdlib/random/base/randu' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var pow = require( '@stdlib/math/base/special/pow' ); -var UNICODE_MAX = require( '@stdlib/constants/unicode/max' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var fromCodePoint = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( typeof String.fromCodePoint !== 'function' ) // eslint-disable-line n/no-unsupported-features/es-builtins, n/no-unsupported-features/es-syntax -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {Function} fcn - function to test -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( fcn, len ) { - var x; - var i; - - x = []; - for ( i = 0; i < len; i++ ) { - x.push( floor( randu()*UNICODE_MAX ) ); - } - 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++ ) { - x[ 0 ] = floor( randu()*UNICODE_MAX ); - out = fcn.apply( null, x ); - 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 = 5; // 10^max - - for ( i = min; i <= max; i++ ) { - len = pow( 10, i ); - - f = createBenchmark( fromCodePoint, len ); - bench( format( '%s::apply:len=%d', pkg, len ), f ); - - f = createBenchmark( String.fromCodePoint, len ); // eslint-disable-line n/no-unsupported-features/es-builtins, n/no-unsupported-features/es-syntax - bench( format( '%s::apply,built-in:len=%d', pkg, len ), opts, f ); - } -} - -main(); diff --git a/from-code-point/benchmark/benchmark.js b/from-code-point/benchmark/benchmark.js deleted file mode 100644 index e0a8a013..00000000 --- a/from-code-point/benchmark/benchmark.js +++ /dev/null @@ -1,82 +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' ); -var randu = require( '@stdlib/random/base/randu' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var UNICODE_MAX = require( '@stdlib/constants/unicode/max' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var fromCodePoint = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( typeof String.fromCodePoint !== 'function' ) // eslint-disable-line n/no-unsupported-features/es-builtins, n/no-unsupported-features/es-syntax -}; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var x; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x = floor( randu() * UNICODE_MAX ); - out = fromCodePoint( x ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::built-in', pkg ), opts, function benchmark( b ) { - var out; - var x; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - x = floor( randu() * UNICODE_MAX ); - out = String.fromCodePoint( x ); // eslint-disable-line n/no-unsupported-features/es-builtins, n/no-unsupported-features/es-syntax - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/from-code-point/benchmark/benchmark.length.js b/from-code-point/benchmark/benchmark.length.js deleted file mode 100644 index ddcfc530..00000000 --- a/from-code-point/benchmark/benchmark.length.js +++ /dev/null @@ -1,106 +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' ); -var randu = require( '@stdlib/random/base/randu' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pow = require( '@stdlib/math/base/special/pow' ); -var UNICODE_MAX = require( '@stdlib/constants/unicode/max' ); -var Float64Array = require( '@stdlib/array/float64' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var fromCodePoint = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - array length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var x; - var i; - - x = new Float64Array( len ); - for ( i = 0; i < x.length; i++ ) { - x[ i ] = floor( randu()*UNICODE_MAX ); - } - 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++ ) { - x[ 0 ] = floor( randu()*UNICODE_MAX ); - out = fromCodePoint( x ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - 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 = 5; // 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/from-code-point/bin/cli b/from-code-point/bin/cli deleted file mode 100755 index 1e33c504..00000000 --- a/from-code-point/bin/cli +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var fromCodePoint = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var cli; - var i; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( stdinStream.isTTY ) { - for ( i = 0; i < args.length; i++ ) { - args[ i ] = parseInt( args[ i ], 10 ); - } - return console.log( fromCodePoint( args ) ); // eslint-disable-line no-console - } - return stdin( onRead ); - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var flags; - var sep; - if ( error ) { - return cli.error( error ); - } - flags = cli.flags(); - if ( flags.split ) { - sep = reFromString( flags.split ); - if ( sep === null ) { - // If the previous command "failed", we were not provided a regular expression: - sep = flags.split; - } - } else { - sep = RE_EOL; - } - data = data.toString().split( sep ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( data[ data.length-1 ] === '' ) { - data.pop(); - } - // Cast all values to integers... - for ( i = 0; i < data.length; i++ ) { - data[ i ] = parseInt( data[ i ], 10 ); - } - console.log( fromCodePoint( data ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/from-code-point/docs/repl.txt b/from-code-point/docs/repl.txt deleted file mode 100644 index 8537d40a..00000000 --- a/from-code-point/docs/repl.txt +++ /dev/null @@ -1,32 +0,0 @@ - -{{alias}}( ...pt ) - Creates a string from a sequence of Unicode code points. - - In addition to multiple arguments, the function also supports providing an - array-like object as a single argument containing a sequence of Unicode code - points. - - Parameters - ---------- - pt: ...integer - Sequence of Unicode code points. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 9731 ) - '☃' - > out = {{alias}}( [ 9731 ] ) - '☃' - > out = {{alias}}( 97, 98, 99 ) - 'abc' - > out = {{alias}}( [ 97, 98, 99 ] ) - 'abc' - - See Also - -------- - diff --git a/from-code-point/docs/types/index.d.ts b/from-code-point/docs/types/index.d.ts deleted file mode 100644 index 5d8d501f..00000000 --- a/from-code-point/docs/types/index.d.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 { ArrayLike } from '@stdlib/types/array'; - -/** -* Creates a string from a sequence of Unicode code points. -* -* @param pts - sequence of code points -* @throws a code point must be a nonnegative integer -* @throws must provide a valid Unicode code point -* @returns created string -* -* @example -* var str = fromCodePoint( [ 9731 ] ); -* // returns '☃' -*/ -declare function fromCodePoint( pts: ArrayLike ): string; - -/** -* Creates a string from a sequence of Unicode code points. -* -* ## Notes -* -* - In addition to multiple arguments, the function also supports providing an array-like object as a single argument containing a sequence of Unicode code points. -* -* @param pt - sequence of code points -* @throws must provide either an array-like object of code points or one or more code points as separate arguments -* @throws a code point must be a nonnegative integer -* @throws must provide a valid Unicode code point -* @returns created string -* -* @example -* var str = fromCodePoint( 9731 ); -* // returns '☃' -*/ -declare function fromCodePoint( ...pt: Array ): string; - - -// EXPORTS // - -export = fromCodePoint; diff --git a/from-code-point/docs/types/test.ts b/from-code-point/docs/types/test.ts deleted file mode 100644 index 72308295..00000000 --- a/from-code-point/docs/types/test.ts +++ /dev/null @@ -1,53 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import fromCodePoint = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - fromCodePoint( 9731 ); // $ExpectType string - fromCodePoint( 97, 98, 99 ); // $ExpectType string - fromCodePoint( new Uint16Array( [ 97, 98, 99 ] ) ); // $ExpectType string -} - -// The compiler throws an error if the function is provided neither numeric values nor an array-like object of numbers... -{ - fromCodePoint( true ); // $ExpectError - fromCodePoint( false ); // $ExpectError - fromCodePoint( null ); // $ExpectError - fromCodePoint( undefined ); // $ExpectError - fromCodePoint( {} ); // $ExpectError - fromCodePoint( ( x: number ): number => x ); // $ExpectError - - fromCodePoint( 97, true ); // $ExpectError - fromCodePoint( 97, false ); // $ExpectError - fromCodePoint( 97, null ); // $ExpectError - fromCodePoint( 97, undefined ); // $ExpectError - fromCodePoint( 97, {} ); // $ExpectError - fromCodePoint( 97, ( x: number ): number => x ); // $ExpectError - - fromCodePoint( 97, 98, true ); // $ExpectError - fromCodePoint( 97, 98, false ); // $ExpectError - fromCodePoint( 97, 98, null ); // $ExpectError - fromCodePoint( 97, 98, undefined ); // $ExpectError - fromCodePoint( 97, 98, {} ); // $ExpectError - fromCodePoint( 97, 98, ( x: number ): number => x ); // $ExpectError -} diff --git a/from-code-point/docs/usage.txt b/from-code-point/docs/usage.txt deleted file mode 100644 index 81de359a..00000000 --- a/from-code-point/docs/usage.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Usage: from-code-point [options] [ ...] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - diff --git a/from-code-point/etc/cli_opts.json b/from-code-point/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/from-code-point/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/from-code-point/examples/index.js b/from-code-point/examples/index.js deleted file mode 100644 index b98ffd6c..00000000 --- a/from-code-point/examples/index.js +++ /dev/null @@ -1,32 +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'; - -var randu = require( '@stdlib/random/base/randu' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var UNICODE_MAX_BMP = require( '@stdlib/constants/unicode/max-bmp' ); -var fromCodePoint = require( './../lib' ); - -var x; -var i; - -for ( i = 0; i < 100; i++ ) { - x = floor( randu()*UNICODE_MAX_BMP ); - console.log( '%d => %s', x, fromCodePoint( x ) ); -} diff --git a/from-code-point/lib/index.js b/from-code-point/lib/index.js deleted file mode 100644 index b86b27a3..00000000 --- a/from-code-point/lib/index.js +++ /dev/null @@ -1,40 +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'; - -/** -* Create a string from a sequence of Unicode code points. -* -* @module @stdlib/string/from-code-point -* -* @example -* var fromCodePoint = require( '@stdlib/string/from-code-point' ); -* -* var str = fromCodePoint( 9731 ); -* // returns '☃' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/from-code-point/lib/main.js b/from-code-point/lib/main.js deleted file mode 100644 index fb93f0e0..00000000 --- a/from-code-point/lib/main.js +++ /dev/null @@ -1,114 +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 isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isCollection = require( '@stdlib/assert/is-collection' ); -var format = require( './../../format' ); -var UNICODE_MAX = require( '@stdlib/constants/unicode/max' ); -var UNICODE_MAX_BMP = require( '@stdlib/constants/unicode/max-bmp' ); - - -// VARIABLES // - -var fromCharCode = String.fromCharCode; - -// Factor to rescale a code point from a supplementary plane: -var Ox10000 = 0x10000|0; // 65536 - -// Factor added to obtain a high surrogate: -var OxD800 = 0xD800|0; // 55296 - -// Factor added to obtain a low surrogate: -var OxDC00 = 0xDC00|0; // 56320 - -// 10-bit mask: 2^10-1 = 1023 => 0x3ff => 00000000 00000000 00000011 11111111 -var Ox3FF = 1023|0; - - -// MAIN // - -/** -* Creates a string from a sequence of Unicode code points. -* -* ## Notes -* -* - UTF-16 encoding uses one 16-bit unit for non-surrogates (U+0000 to U+D7FF and U+E000 to U+FFFF). -* - UTF-16 encoding uses two 16-bit units (surrogate pairs) for U+10000 to U+10FFFF and encodes U+10000-U+10FFFF by subtracting 0x10000 from the code point, expressing the result as a 20-bit binary, and splitting the 20 bits of 0x0-0xFFFFF as upper and lower 10-bits. The respective 10-bits are stored in two 16-bit words: a high and a low surrogate. -* -* @param {...NonNegativeInteger} args - sequence of code points -* @throws {Error} must provide either an array-like object of code points or one or more code points as separate arguments -* @throws {TypeError} a code point must be a nonnegative integer -* @throws {RangeError} must provide a valid Unicode code point -* @returns {string} created string -* -* @example -* var str = fromCodePoint( 9731 ); -* // returns '☃' -*/ -function fromCodePoint( args ) { - var len; - var str; - var arr; - var low; - var hi; - var pt; - var i; - - len = arguments.length; - if ( len === 1 && isCollection( args ) ) { - arr = arguments[ 0 ]; - len = arr.length; - } else { - arr = []; - for ( i = 0; i < len; i++ ) { - arr.push( arguments[ i ] ); - } - } - if ( len === 0 ) { - throw new Error( 'insufficient arguments. Must provide either an array of code points or one or more code points as separate arguments.' ); - } - str = ''; - for ( i = 0; i < len; i++ ) { - pt = arr[ i ]; - if ( !isNonNegativeInteger( pt ) ) { - throw new TypeError( format( 'invalid argument. Must provide valid code points (i.e., nonnegative integers). Value: `%s`.', pt ) ); - } - if ( pt > UNICODE_MAX ) { - throw new RangeError( format( 'invalid argument. Must provide a valid code point (i.e., cannot exceed %u). Value: `%s`.', UNICODE_MAX, pt ) ); - } - if ( pt <= UNICODE_MAX_BMP ) { - str += fromCharCode( pt ); - } else { - // Code point from a supplementary plane. Split into two 16-bit code units (surrogate pair). - pt -= Ox10000; - hi = (pt >> 10) + OxD800; - low = (pt & Ox3FF) + OxDC00; - str += fromCharCode( hi, low ); - } - } - return str; -} - - -// EXPORTS // - -module.exports = fromCodePoint; diff --git a/from-code-point/package.json b/from-code-point/package.json deleted file mode 100644 index 633ba320..00000000 --- a/from-code-point/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/from-code-point", - "version": "0.0.0", - "description": "Create a string from a sequence of Unicode code points.", - "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" - } - ], - "bin": { - "from-code-point": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "code", - "point", - "pt", - "unicode", - "utf-16", - "utf16" - ] -} diff --git a/from-code-point/test/fixtures/stdin_error.js.txt b/from-code-point/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/from-code-point/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/from-code-point/test/test.cli.js b/from-code-point/test/test.cli.js deleted file mode 100644 index 9b1dcfd3..00000000 --- a/from-code-point/test/test.cli.js +++ /dev/null @@ -1,284 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface creates a string from code point arguments', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'97\'; process.argv[ 3 ] = \'98\'; process.argv[ 4 ] = \'99\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'abc\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf \'97\n98\n99\'', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'abc\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'97\t98\t99\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'abc\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'97\t98\t99\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'abc\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface ignores trailing delimiters when used as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf \'97\n98\n99\n\'', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'abc\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/from-code-point/test/test.js b/from-code-point/test/test.js deleted file mode 100644 index 3fc041fa..00000000 --- a/from-code-point/test/test.js +++ /dev/null @@ -1,168 +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 Uint16Array = require( '@stdlib/array/uint16' ); -var fromCodePoint = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof fromCodePoint, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided a code point which is not a nonnegative integer', function test( t ) { - var values; - var i; - - values = [ - -5, - 3.14, - -1.0, - NaN, - true, - false, - null, - void 0, - [ 'beep', 'boop' ], - [ 1, 2, 3, 3.14 ], // arrays are allowed, but must contain nonnegative integers - {}, - 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() { - fromCodePoint( value ); - }; - } -}); - -tape( 'the function throws an error if provided an empty array', function test( t ) { - t.throws( foo, Error, 'throws an error' ); - t.end(); - - function foo() { - fromCodePoint( [] ); - } -}); - -tape( 'the function throws an error if provided a code point which exceeds the maximum Unicode code point', function test( t ) { - var values; - var i; - - values = [ - 1e308, - 2e307, - [ 1, 2, 3, 1e308 ], - [ 1, 2, 3, 2e307 ] - ]; - - 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() { - fromCodePoint( value ); - }; - } -}); - -tape( 'the arity of the function is 1', function test( t ) { - t.strictEqual( fromCodePoint.length, 1, 'has length 1' ); - t.end(); -}); - -tape( 'the function returns a string from a sequence of code points (array)', function test( t ) { - var expected; - var values; - var out; - var i; - - values = [ - [ 0 ], - [ 9731 ], - [ 0x1D306 ], - [ 0x10437 ], - new Uint16Array( [ 97, 98, 99 ] ), - [ 0x1D306, 0x61, 0x1D307 ], - [ 0x61, 0x62, 0x1D307 ] - ]; - - expected = [ - '\0', - '☃', - '\uD834\uDF06', - '𐐷', - 'abc', - '\uD834\uDF06a\uD834\uDF07', - 'ab\uD834\uDF07' - ]; - - for ( i = 0; i < values.length; i++ ) { - out = fromCodePoint( values[ i ] ); - t.strictEqual( out, expected[ i ], 'returns expected value for '+values[i] ); - } - t.end(); -}); - -tape( 'the function returns a string from a sequence of code points (arguments)', function test( t ) { - var expected; - var values; - var out; - var i; - - values = [ - [ 0 ], - [ 9731 ], - [ 0x1D306 ], - [ 0x10437 ], - [ 97, 98, 99 ], - [ 0x1D306, 0x61, 0x1D307 ], - [ 0x61, 0x62, 0x1D307 ] - ]; - - expected = [ - '\0', - '☃', - '\uD834\uDF06', - '𐐷', - 'abc', - '\uD834\uDF06a\uD834\uDF07', - 'ab\uD834\uDF07' - ]; - - for ( i = 0; i < values.length; i++ ) { - out = fromCodePoint.apply( null, values[ i ] ); - t.strictEqual( out, expected[ i ], 'returns expected value for '+values[i] ); - } - t.end(); -}); diff --git a/headercase/README.md b/headercase/README.md deleted file mode 100644 index 5cd485d0..00000000 --- a/headercase/README.md +++ /dev/null @@ -1,200 +0,0 @@ - - -# headercase - -> Convert a string to HTTP header case. - - - -
- -## Usage - -```javascript -var headercase = require( '@stdlib/string/headercase' ); -``` - -#### headercase( str ) - -Converts a string to HTTP header case. - -```javascript -var out = headercase( 'foo bar' ); -// returns 'Foo-Bar' - -out = headercase( 'IS_MOBILE' ); -// returns 'Is-Mobile' - -out = headercase( 'Hello World!' ); -// returns 'Hello-World' - -out = headercase( '--foo-bar--' ); -// returns 'Foo-Bar' -``` - -
- - - - - -
- -## Examples - -```javascript -var headercase = require( '@stdlib/string/headercase' ); - -var str = 'Hello World!'; -var out = headercase( str ); -// returns 'Hello-World' - -str = 'HELLO WORLD!'; -out = headercase( str ); -// returns 'Hello-World' - -str = 'To be, or not to be: that is the question.'; -out = headercase( str ); -// returns 'To-Be-Or-Not-To-Be-That-Is-The-Question' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: headercase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nfoo_bar' | headercase --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nfoo_bar' | headercase --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ headercase 'hello world!' -Hello-World -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beEp booP' | headercase -Beep-Boop -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tfoo_bar' | headercase --split '\t' -Beep -Foo-Bar -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/headercase/benchmark/benchmark.js b/headercase/benchmark/benchmark.js deleted file mode 100644 index ce6c4cdf..00000000 --- a/headercase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var headercase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = headercase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/headercase/bin/cli b/headercase/bin/cli deleted file mode 100755 index 2b145e8f..00000000 --- a/headercase/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var headercase = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( headercase( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( headercase( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/headercase/docs/repl.txt b/headercase/docs/repl.txt deleted file mode 100644 index 4728f5f7..00000000 --- a/headercase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to HTTP header case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - HTTP header-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'Hello-World' - > out = {{alias}}( 'beep boop' ) - 'Beep-Boop' - - See Also - -------- diff --git a/headercase/docs/types/index.d.ts b/headercase/docs/types/index.d.ts deleted file mode 100644 index 09b82f0e..00000000 --- a/headercase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to HTTP header case. -* -* @param str - string to convert -* @returns HTTP header-cased string -* -* @example -* var str = headercase( 'Hello World!' ); -* // returns 'Hello-World' -* -* @example -* var str = headercase( 'foo_bar' ); -* // returns 'Foo-Bar' -* -* @example -* var str = headercase( 'foo-bar' ); -* // returns 'Foo-Bar' -*/ -declare function headercase( str: string ): string; - - -// EXPORTS // - -export = headercase; diff --git a/headercase/docs/types/test.ts b/headercase/docs/types/test.ts deleted file mode 100644 index 5af42715..00000000 --- a/headercase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import headercase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - headercase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - headercase( true ); // $ExpectError - headercase( false ); // $ExpectError - headercase( null ); // $ExpectError - headercase( undefined ); // $ExpectError - headercase( 5 ); // $ExpectError - headercase( [] ); // $ExpectError - headercase( {} ); // $ExpectError - headercase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - headercase(); // $ExpectError -} diff --git a/headercase/docs/usage.txt b/headercase/docs/usage.txt deleted file mode 100644 index 5d29079b..00000000 --- a/headercase/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: headercase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/headercase/etc/cli_opts.json b/headercase/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/headercase/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/headercase/examples/index.js b/headercase/examples/index.js deleted file mode 100644 index e6b12f9d..00000000 --- a/headercase/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var headercase = require( './../lib' ); - -var str = 'Hello World!'; -var out = headercase( str ); -console.log( out ); -// => 'Hello-World' - -str = 'HELLO WORLD!'; -out = headercase( str ); -console.log( out ); -// => 'Hello-World' - -str = 'To be, or not to be: that is the question.'; -out = headercase( str ); -console.log( out ); -// => 'To-Be-Or-Not-To-Be-That-Is-The-Question' diff --git a/headercase/lib/index.js b/headercase/lib/index.js deleted file mode 100644 index 77ebe373..00000000 --- a/headercase/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to HTTP header case. -* -* @module @stdlib/string/headercase -* -* @example -* var headercase = require( '@stdlib/string/headercase' ); -* -* var str = headercase( 'foo bar' ); -* // returns 'Foo-Bar' -* -* str = headercase( '--foo-bar--' ); -* // returns 'Foo-Bar' -* -* str = headercase( 'Hello World!' ); -* // returns 'Hello-World' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/headercase/lib/main.js b/headercase/lib/main.js deleted file mode 100644 index da313b85..00000000 --- a/headercase/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/headercase' ); - - -// MAIN // - -/** -* Converts a string to HTTP header case. -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {string} HTTP header-cased string -* -* @example -* var out = headercase( 'foo bar' ); -* // returns 'Foo-Bar' -* -* @example -* var out = headercase( 'IS_MOBILE' ); -* // returns 'Is-Mobile' -* -* @example -* var out = headercase( 'Hello World!' ); -* // returns 'Hello-World' -* -* @example -* var out = headercase( '--foo-bar--' ); -* // returns 'Foo-Bar' -*/ -function headercase( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = headercase; diff --git a/headercase/package.json b/headercase/package.json deleted file mode 100644 index 50d58cb0..00000000 --- a/headercase/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/headercase", - "version": "0.0.0", - "description": "Convert a string to HTTP header case.", - "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" - } - ], - "bin": { - "headercase": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "case", - "convert", - "headercase", - "header", - "http" - ], - "__stdlib__": {} -} diff --git a/headercase/test/fixtures/stdin_error.js.txt b/headercase/test/fixtures/stdin_error.js.txt deleted file mode 100644 index b42c70b3..00000000 --- a/headercase/test/fixtures/stdin_error.js.txt +++ /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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/headercase/test/test.cli.js b/headercase/test/test.cli.js deleted file mode 100644 index b5c5f8ed..00000000 --- a/headercase/test/test.cli.js +++ /dev/null @@ -1,263 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a string argument to HTTP header case', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'HelloWorld!\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'Hello-World\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nis-mobile"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'Beep-Boop\nIs-Mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'BEEP_BOOP\tis_mobile\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'Beep-Boop\nIs-Mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'BEEP_BOOP\tis_mobile\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'Beep-Boop\nIs-Mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/headercase/test/test.js b/headercase/test/test.js deleted file mode 100644 index f10c2fc3..00000000 --- a/headercase/test/test.js +++ /dev/null @@ -1,226 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 headercase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof headercase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - headercase( value ); - }; - } -}); - -tape( 'the function converts a string to HTTP header case', function test( t ) { - var expected; - var actual; - - expected = 'Foo-Bar'; - actual = headercase( 'foo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Foo-Bar'; - actual = headercase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Foo-Bar'; - actual = headercase( 'foo.bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Hello-World'; - actual = headercase( 'Hello World!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'B-Eep-B-Oop'; - actual = headercase( 'bEep bOOP' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to HTTP header case', function test( t ) { - var expected; - var actual; - - expected = 'Fóo-Bar'; - actual = headercase( 'fóo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Fóo-Bar'; - actual = headercase( 'fóo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Fóo-Bar'; - actual = headercase( 'fóoBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Héllo-Wórld'; - actual = headercase( 'héllo Wórld!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in camel case to HTTP header case', function test( t ) { - var expected; - var actual; - - expected = 'Foo-Bar'; - actual = headercase( 'fooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Mostly-Some-Case'; - actual = headercase( 'isMostlySomeCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Mobile'; - actual = headercase( 'isMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Node-Repl'; - actual = headercase( 'isNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in constant case to HTTP header case', function test( t ) { - var expected; - var actual; - - expected = 'Foo-Bar'; - actual = headercase( 'FOO_BAR' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Mostly-Constant-Case'; - actual = headercase( 'IS_MOSTLY_CONSTANT_CASE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Mobile'; - actual = headercase( 'IS_MOBILE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Node-Repl'; - actual = headercase( 'IS_NODE_REPL' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in kebab case to HTTP header case', function test( t ) { - var expected; - var actual; - - expected = 'Foo-Bar'; - actual = headercase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Mostly-Some-Case'; - actual = headercase( 'is-mostly-some-case' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Mobile'; - actual = headercase( 'is-mobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Node-Repl'; - actual = headercase( 'is-node-repl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in pascal case to HTTP header case', function test( t ) { - var expected; - var actual; - - expected = 'Foo-Bar'; - actual = headercase( 'FooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Mostly-Some-Case'; - actual = headercase( 'IsMostlySomeCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Mobile'; - actual = headercase( 'IsMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Node-Repl'; - actual = headercase( 'IsNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function leaves a string that is already in dot case unchanged', function test( t ) { - var expected; - var actual; - - expected = 'Foo-Bar'; - actual = headercase( 'Foo-Bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Mostly-Some-Case'; - actual = headercase( 'Is-Mostly-Some-Case' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Mobile'; - actual = headercase( 'Is-Mobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'Is-Node-Repl'; - actual = headercase( 'Is-Node-Repl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/index.js b/index.js new file mode 100644 index 00000000..2d919c3c --- /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(e,r){"object"==typeof exports&&"undefined"!=typeof module?module.exports=r(require("buffer")):"function"==typeof define&&define.amd?define(["buffer"],r):(e="undefined"!=typeof globalThis?globalThis:e||self).string=r(e.require$$0)}(this,(function(e){"use strict";var r="function"==typeof Object.defineProperty?Object.defineProperty:null;var t=Object.defineProperty;function n(e){return"number"==typeof e}function i(e){var r,t="";for(r=0;r0&&(t-=1),n=e.toExponential(t)):n=e.toPrecision(r.precision),r.alternate||(n=c.call(n,w,"$1e"),n=c.call(n,y,"e"),n=c.call(n,d,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return n=c.call(n,g,"e+0$1"),n=c.call(n,p,"e-0$1"),r.alternate&&(n=c.call(n,m,"$1."),n=c.call(n,v,"$1.e")),e>=0&&r.sign&&(n=r.sign+n),n=r.specifier===h.call(r.specifier)?h.call(n):f.call(n)}function E(e){var r,t="";for(r=0;r127)throw new Error("invalid character code. Value: "+i.arg);i.arg=A(u)?String(i.arg):_(u)}break;case"e":case"E":case"f":case"F":case"g":case"G":if(r||(i.precision=6),h=parseFloat(i.arg),!isFinite(h)){if(!n(i.arg))throw new Error("invalid floating-point number. Value: "+l);h=i.arg,i.padZeros=!1}i.arg=b(h,i);break;default:throw new Error("invalid specifier: "+i.specifier)}i.maxWidth>=0&&i.arg.length>i.maxWidth&&(i.arg=i.arg.substring(0,i.maxWidth)),i.padZeros?i.arg=o(i.arg,i.width||i.precision,i.padRight):i.width&&(i.arg=T(i.arg,i.width,i.padRight)),l+=i.arg||"",f+=1}return l}var S=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function L(e){var r={mapping:e[1]?parseInt(e[1],10):void 0,flags:e[2],width:e[3],precision:e[5],specifier:e[6]};return"."===e[4]&&void 0===e[5]&&(r.precision="1"),r}function O(e){var r,t,n,i;for(t=[],i=0,n=S.exec(e);n;)(r=e.slice(i,S.lastIndex-n[0].length)).length&&t.push(r),"%"===n[6]?t.push("%"):t.push(L(n)),i=S.lastIndex,n=S.exec(e);return(r=e.slice(i)).length&&t.push(r),t}function R(e){var r,t;if("string"!=typeof e)throw new TypeError(R("invalid argument. First argument must be a string. Value: `%s`.",e));for(r=[O(e)],t=1;t=0&&"/"!==e[t];t--);return void 0===t||t<=0?e.replace(te,"\\$&"):(r=(r=e.substring(1,t)).replace(te,"\\$&"),e=e[0]+r+e.substring(t))}var ie=/./;function oe(e){return"boolean"==typeof e}var ae=Boolean,ue=Boolean.prototype.toString;var se=W();function le(e){return"object"==typeof e&&(e instanceof ae||(se?function(e){try{return ue.call(e),!0}catch(e){return!1}}(e):"[object Boolean]"===Q(e)))}function fe(e){return oe(e)||le(e)}Y(fe,"isPrimitive",oe),Y(fe,"isObject",le);var he="object"==typeof self?self:null,ce="object"==typeof window?window:null,ge="object"==typeof global?global:null,pe="object"==typeof globalThis?globalThis:null;var me=function(e){if(arguments.length){if(!oe(e))throw new TypeError(R("invalid argument. Must provide a boolean. Value: `%s`.",e));if(e)return new Function("return this;")()}if(pe)return pe;if(he)return he;if(ce)return ce;if(ge)return ge;throw new Error("unexpected error. Unable to resolve global object.")}(),ve=me.document&&me.document.childNodes,de=Int8Array;function ye(){return/^\s*function\s*([^(]*)/i}var we=/^\s*function\s*([^(]*)/i;Y(ye,"REGEXP",we);var be=Array.isArray?Array.isArray:function(e){return"[object Array]"===Q(e)};function Ee(e){if("function"!=typeof e)throw new TypeError(R("invalid argument. Must provide a function. Value: `%s`.",e));return function(r){var t,n;if(!be(r))return!1;if(0===(t=r.length))return!1;for(n=0;n0&&(t-=1),n=e.toExponential(t)):n=e.toPrecision(r.precision),r.alternate||(n=Be.call(n,Ge,"$1e"),n=Be.call(n,ze,"e"),n=Be.call(n,We,""));break;default:throw new Error("invalid double notation. Value: "+r.specifier)}return n=Be.call(n,Pe,"e+0$1"),n=Be.call(n,Ye,"e-0$1"),r.alternate&&(n=Be.call(n,Ue,"$1."),n=Be.call(n,$e,"$1.e")),e>=0&&r.sign&&(n=r.sign+n),n=r.specifier===De.call(r.specifier)?De.call(n):Ie.call(n)}function Je(e){var r,t="";for(r=0;r127)throw new Error("invalid character code. Value: "+n.arg);n.arg=Xe(o)?String(n.arg):He(o)}break;case"e":case"E":case"f":case"F":case"g":case"G":if(r||(n.precision=6),s=parseFloat(n.arg),!isFinite(s)){if(!Oe(n.arg))throw new Error("invalid floating-point number. Value: "+a);s=n.arg,n.padZeros=!1}n.arg=qe(s,n);break;default:throw new Error("invalid specifier: "+n.specifier)}n.maxWidth>=0&&n.arg.length>n.maxWidth&&(n.arg=n.arg.substring(0,n.maxWidth)),n.padZeros?n.arg=Ne(n.arg,n.width||n.precision,n.padRight):n.width&&(n.arg=Ze(n.arg,n.width,n.padRight)),a+=n.arg||"",u+=1}return a}var rr=/%(?:([1-9]\d*)\$)?([0 +\-#]*)(\*|\d+)?(?:(\.)(\*|\d+)?)?[hlL]?([%A-Za-z])/g;function tr(e){var r={mapping:e[1]?parseInt(e[1],10):void 0,flags:e[2],width:e[3],precision:e[5],specifier:e[6]};return"."===e[4]&&void 0===e[5]&&(r.precision="1"),r}function nr(e){var r,t,n,i;for(t=[],i=0,n=rr.exec(e);n;)(r=e.slice(i,rr.lastIndex-n[0].length)).length&&t.push(r),"%"===n[6]?t.push("%"):t.push(tr(n)),i=rr.lastIndex,n=rr.exec(e);return(r=e.slice(i)).length&&t.push(r),t}function ir(e){var r,t;if("string"!=typeof e)throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));for(r=[nr(e)],t=1;t?`{}|~\/\\\[\]]/g;function sr(e){if(!U(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));return ar(e,ur,"")}var lr={"i.e.":["i.e."],"I.e.":["I.e."],"I.E.":["I.E."],"e.g.":["e.g."],"E.g.":["E.g."],"E.G.":["E.G."],"et al.":["et al."],"etc.":["etc."],"vs.":["vs."],"A.S.A.P":["A.S.A.P"],"E.T.A.":["E.T.A."],"D.I.Y":["D.I.Y"],"R.S.V.P":["R.S.V.P"],"P.S.":["P.S."],"B.Y.O.B":["B.Y.O.B"],"Ms.":["Ms."],"Mr.":["Mr."],"Dr.":["Dr."],"Prof.":["Prof."],"Mrs.":["Mrs."],"Messrs.":["Messrs."],"Gov.":["Gov."],"Gen.":["Gen."],"Lt.":["Lt."],"Col.":["Col."],"Mt.":["Mt."],"Bros.":["Bros."],"Corp.":["Corp."],"Co.":["Co."],"co.":["co."],"Inc.":["Inc."],"Ltd.":["Ltd."],"Rep.":["Rep."],"Sen.":["Sen."],"Jr.":["Jr."],"Sr.":["Sr."],"Ph.D.":["Ph.D."],"J.D.":["J.D."],"M.D.":["M.D."],"Rev.":["Rev."],"Adm.":["Adm."],"St.":["St."],"a.m.":["a.m."],"p.m.":["p.m."],"b.c.":["b.c."],"B.C.":["B.C."],"a.d.":["a.d."],"A.D.":["A.D."],"b.c.e.":["b.c.e."],"B.C.E.":["B.C.E."],"Jan.":["Jan."],"Feb.":["Feb."],"Mar.":["Mar."],"Apr.":["Apr."],"May.":["May."],"Jun.":["Jun."],"Jul.":["Jul."],"Aug.":["Aug."],"Sep.":["Sep."],"Sept.":["Sept."],"Oct.":["Oct."],"Nov.":["Nov."],"Dec.":["Dec."],"Ala.":["Ala."],"Ariz.":["Ariz."],"Ark.":["Ark."],"Calif.":["Calif."],"Colo.":["Colo."],"Conn.":["Conn."],"Del.":["Del."],"D.C.":["D.C."],"Fla.":["Fla."],"Ga.":["Ga."],"Ill.":["Ill."],"Ind.":["Ind."],"Kans.":["Kans."],"Kan.":["Kan."],"Ky.":["Ky."],"La.":["La."],"Md.":["Md."],"Mass.":["Mass."],"Mich.":["Mich."],"Minn.":["Minn."],"Miss.":["Miss."],"Mo.":["Mo."],"Mont.":["Mont."],"Nebr.":["Nebr."],"Neb.":["Neb."],"Nev.":["Nev."],"N.H.":["N.H."],"N.J.":["N.J."],"N.M.":["N.M."],"N.Y.":["N.Y."],"N.C.":["N.C."],"N.D.":["N.D."],"Okla.":["Okla."],"Ore.":["Ore."],"Pa.":["Pa."],"Tenn.":["Tenn."],"Va.":["Va."],"Wash.":["Wash."],"Wis.":["Wis."]},fr={"^_^":["^_^"],"=D":["=D"],";-p":[";-p"],":O":[":O"],":-/":[":-/"],xD:["xD"],V_V:["V_V"],";(":[";("],"(:":["(:"],'")':['")'],":Y":[":Y"],":]":[":]"],":3":[":3"],":(":[":("],":-)":[":-)"],"=3":["=3"],":))":[":))"],":>":[":>"],";p":[";p"],":p":[":p"],"=[[":["=[["],xDD:["xDD"],"<333":["<333"],"<33":["<33"],":P":[":P"],"o.O":["o.O"],"<3":["<3"],";-)":[";-)"],":)":[":)"],"-_-":["-_-"],":')":[":')"],o_O:["o_O"],";)":[";)"],"=]":["=]"],"(=":["(="],"-__-":["-__-"],":/":[":/"],":0":[":0"],"(^_^)":["(^_^)"],";D":[";D"],o_o:["o_o"],":((":[":(("],"=)":["=)"]},hr={"'s":["'s"],"'S":["'S"],"ain't":["ai","n't"],aint:["ai","nt"],"Ain't":["Ai","n't"],"aren't":["are","n't"],arent:["are","nt"],"Aren't":["Are","n't"],"can't":["ca","n't"],cant:["ca","nt"],"Can't":["Ca","n't"],"can't've":["ca","n't","'ve"],"'cause":["'cause'"],cannot:["can","not"],Cannot:["Can","not"],"could've":["could","'ve"],couldve:["could","ve"],"Could've":["Could","'ve"],"couldn't":["could","n't"],couldnt:["could","nt"],"Couldn't":["Could","n't"],"couldn't've":["could","n't","'ve"],couldntve:["could","nt","ve"],"Couldn't've":["Could","n't","'ve"],"didn't":["did","n't"],didnt:["did","nt"],"Didn't":["Did","n't"],"doesn't":["does","n't"],doesnt:["does","nt"],"Doesn't":["Does","n't"],"don't":["do","n't"],dont:["do","nt"],"Don't":["Do","n't"],"hadn't":["had","n't"],hadnt:["had","nt"],"Hadn't":["Had","n't"],"hadn't've":["had","n't","'ve"],"hasn't":["has","n't"],hasnt:["has","nt"],"haven't":["have","n't"],havent:["have","nt"],"he'd":["he","'d"],hed:["he","d"],"he'd've":["he","'d","'ve"],hedve:["he","d","ve"],"he'll":["he","'ll"],"he'll've":["he","'ll","'ve"],"he's":["he","'s"],hes:["he","s"],"how'd":["how","'d"],howd:["how","d"],"how'd'y":["how","'d","'y"],"how'll":["how","'ll"],howll:["how","ll"],"how's":["how","'s"],hows:["how","s"],"I'd":["I","'d"],"I'd've":["I","'d","'ve"],"I'll":["I","'ll"],"i'll":["i","'ll"],"I'll've":["I","'ll","'ve"],"i'll've":["i","'ll","'ve"],"I'm":["I","'m"],"i'm":["i","'m"],Im:["I","m"],im:["i","m"],"I'ma":["I","'ma"],"i'ma":["i","'ma"],"I've":["I","'ve"],"i've":["i","'ve"],"isn't":["is","n't"],isnt:["is","nt"],"Isn't":["Is","n't"],"It'd":["It","'d"],"it'd":["it","'d"],"it'd've":["it","'d","'ve"],"it'll've":["it","'ll","'ve"],"it'll":["it","'ll"],itll:["it","ll"],"it's":["it","'s"],"let's":["let","'s"],lets:["let","s"],"ma'am":["ma'am"],"mayn't":["may","n't"],"mightn't":["might","n't"],"mightn't've":["might","n't","'ve"],"might've":["might","'ve"],"mustn't":["must","n't"],"mustn't've":["must","n't","'ve"],"must've":["must","'ve"],"needn't":["need","n't"],"needn't've":["need","n't","'ve"],"not've":["not","'ve"],"o'clock":["o'clock"],"oughtn't":["ought","n't"],"oughtn't've":["ought","n't","'ve"],"so've":["so","'ve"],"so's":["so","'s"],"shan't":["sha","n't"],"sha'n't":["sha'","n't"],"shan't've":["sha","n't","'ve"],"she'd":["she","'d"],"she'd've":["she","'d","'ve"],"she'll":["she","'ll"],"she'll've":["she","'ll","'ve"],"she's":["she","'s"],"should've":["should","'ve"],"shouldn't":["should","n't"],"shouldn't've":["should","n't","'ve"],"that'd":["that","'d"],"that'd've":["that","'d","'ve"],"that's":["that","'s"],thats:["that","s"],"there'd":["there","'d"],"there'd've":["there","'d","'ve"],"there's":["there","'s"],"they'd":["they","'d"],"They'd":["They","'d"],"they'd've":["they","'d","'ve"],"They'd've":["They","'d","'ve"],"they'll":["they","'ll"],"They'll":["They","'ll"],"they'll've":["they","'ll","'ve"],"They'll've":["They","'ll","'ve"],"they're":["they","'re"],"They're":["They","'re"],"they've":["they","'ve"],"They've":["They","'ve"],"to've":["to","'ve"],"wasn't":["was","n't"],"we'd":["we","'d"],"We'd":["We","'d"],"we'd've":["we","'d","'ve"],"we'll":["we","'ll"],"We'll":["We","'ll"],"we'll've":["we","'ll","'ve"],"We'll've":["We","'ll","'ve"],"we're":["we","'re"],"We're":["We","'re"],"we've":["we","'ve"],"We've":["We","'ve"],"weren't":["were","n't"],"what'll":["what","'ll"],"what'll've":["what","'ll","'ve"],"what're":["what","'re"],"what's":["what","'s"],"what've":["what","'ve"],"when's":["when","'s"],"when've":["when","'ve"],"where'd":["where","'d"],"where's":["where","'s"],"where've":["where","'ve"],"who'd":["who","'d"],"who'll":["who","'ll"],"who'll've":["who","'ll'","'ve'"],"who're":["who","'re"],"who's":["who","'s"],"who've":["who","'ve"],"why've":["why","'ve"],"why'll":["why","'ll"],"why're":["why","'re"],"why's":["why","'s"],"will've":["will","'ve"],"won't":["wo","n't"],wont:["wo","nt"],"won't've":["wo","n't","'ve"],"would've":["would","'ve"],"wouldn't":["would","n't"],"wouldn't've":["would","n't","'ve"],"y'all":["y'","all"],"y'all'd":["y'","all","'d"],"y'all'd've":["y'","all","'d","'ve"],"y'all're":["y'","all","'re'"],"y'all've":["y'","all","ve"],"you'd":["you","'d"],"You'd":["You","'d"],"you'd've":["you","'d","'ve"],"You'd've":["You","'d","'ve"],"you'll":["you","'ll"],"You'll":["You","'ll"],"you'll've":["you","'ll","'ve"],"You'll've":["You","'ll","'ve"],"you're":["you","'re"],"You're":["You","'re"],"you've":["you","'ve"],"You've":["You","'ve"]},cr=/^([,([{*<"“'`‘]|\.{1,3})/gi,gr=/([,.!?%*>:;"'”`)\]}]|\.\.\.)$/gi;function pr(e,r){var t;for(t=0;t1?(i.push(r[1]),e=r[2]):(r=e.split(gr)).length>1?(e=r[0],o.unshift(r[1])):t=!0}while(!t);return n=i,e&&n.push(e),"..."===o[o.length-1]&&(o.pop(),o.unshift("...")),pr(n,o),n}function vr(e,r){var t,n,i,o,a,u;if(!U(e))throw new TypeError(R("invalid argument. First argument must be a string. Value: `%s`.",e));if(arguments.length>1&&!oe(r))throw new TypeError(R("invalid argument. Second argument must be a boolean. Value: `%s`.",r));if(!e)return[];for(n=r?e.split(/(\s+)/):e.split(/\s+/),a={},i=[],u=0;uxt&&St(e)}function Ot(e){return bt(e)&&Lt(e)}function Rt(e){return Vt(e)&&Lt(e.valueOf())}function Nt(e){return Ot(e)||Rt(e)}function Mt(e){return Ot(e)&&e>=0}function kt(e){return Rt(e)&&e.valueOf()>=0}function jt(e){return Mt(e)||kt(e)}Y(Nt,"isPrimitive",Ot),Y(Nt,"isObject",Rt),Y(jt,"isPrimitive",Mt),Y(jt,"isObject",kt);var Ct=4294967295;function It(e){return"object"==typeof e&&null!==e&&"number"==typeof e.length&&St(e.length)&&e.length>=0&&e.length<=Ct}var Dt=9007199254740991;function Bt(e){return"object"==typeof e&&null!==e&&"number"==typeof e.length&&St(e.length)&&e.length>=0&&e.length<=Dt}var Pt="function"==typeof ArrayBuffer;function Yt(e){return Pt&&e instanceof ArrayBuffer||"[object ArrayBuffer]"===Q(e)}function Ut(e){return"object"==typeof e&&null!==e&&!be(e)}var $t=Ee(re.isPrimitive),Wt=Ee(re.isObject),zt=Ee(re);function Gt(e,r){if(!(this instanceof Gt))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!bt(e))throw new TypeError(R("invalid argument. Real component must be a number. Value: `%s`.",e));if(!bt(r))throw new TypeError(R("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return P(this,"re",e),P(this,"im",r),this}Y(zt,"primitives",$t),Y(zt,"objects",Wt),Y(Gt,"name","Complex128"),Y(Gt,"BYTES_PER_ELEMENT",8),Y(Gt.prototype,"BYTES_PER_ELEMENT",8),Y(Gt.prototype,"byteLength",16),Y(Gt.prototype,"toString",(function(){var e=""+this.re;return this.im<0?e+=" - "+-this.im:e+=" + "+this.im,e+="i"})),Y(Gt.prototype,"toJSON",(function(){var e={type:"Complex128"};return e.re=this.re,e.im=this.im,e}));var qt="function"==typeof Math.fround?Math.fround:null,Jt=new Cr(1);var Zt="function"==typeof qt?qt:function(e){return Jt[0]=e,Jt[0]};function Ht(e,r){if(!(this instanceof Ht))throw new TypeError("invalid invocation. Constructor must be called with the `new` keyword.");if(!bt(e))throw new TypeError(R("invalid argument. Real component must be a number. Value: `%s`.",e));if(!bt(r))throw new TypeError(R("invalid argument. Imaginary component must be a number. Value: `%s`.",r));return P(this,"re",Zt(e)),P(this,"im",Zt(r)),this}function Qt(e){return e instanceof Gt||e instanceof Ht||"object"==typeof e&&null!==e&&"number"==typeof e.re&&"number"==typeof e.im}function Xt(e){return St(e/2)}Y(Ht,"name","Complex64"),Y(Ht,"BYTES_PER_ELEMENT",4),Y(Ht.prototype,"BYTES_PER_ELEMENT",4),Y(Ht.prototype,"byteLength",8),Y(Ht.prototype,"toString",(function(){var e=""+this.re;return this.im<0?e+=" - "+-this.im:e+=" + "+this.im,e+="i"})),Y(Ht.prototype,"toJSON",(function(){var e={type:"Complex64"};return e.re=this.re,e.im=this.im,e}));var Kt=8;function en(e){return"object"==typeof e&&null!==e&&"Complex64Array"===e.constructor.name&&e.BYTES_PER_ELEMENT===Kt}var rn=16;function tn(e){return"object"==typeof e&&null!==e&&"Complex128Array"===e.constructor.name&&e.BYTES_PER_ELEMENT===rn}function nn(){return"function"==typeof Z&&"symbol"==typeof Z("foo")&&q(Z,"iterator")&&"symbol"==typeof Z.iterator}var on=nn()?Symbol.iterator:null;function an(e,r,t){B(e,r,{configurable:!1,enumerable:!1,get:t})}function un(e){return e.re}function sn(e){return e.im}function ln(e,r){return new Cr(e.buffer,e.byteOffset+e.BYTES_PER_ELEMENT*r,2*(e.length-r))}function fn(e,r){return new Or(e.buffer,e.byteOffset+e.BYTES_PER_ELEMENT*r,2*(e.length-r))}function hn(e){var r,t,n;for(r=[];!(t=e.next()).done;)if(It(n=t.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!Qt(n))return new TypeError(R("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));r.push(un(n),sn(n))}return r}var cn=2*Cr.BYTES_PER_ELEMENT,gn=nn();function pn(e){return e instanceof dn||"object"==typeof e&&null!==e&&("Complex64Array"===e.constructor.name||"Complex128Array"===e.constructor.name)&&"number"==typeof e._length&&"object"==typeof e._buffer}function mn(e){return e===dn||"Complex128Array"===e.name}function vn(e,r){return new Ht(e[r*=2],e[r+1])}function dn(){var e,r,t,n;if(r=arguments.length,!(this instanceof dn))return 0===r?new dn:1===r?new dn(arguments[0]):2===r?new dn(arguments[0],arguments[1]):new dn(arguments[0],arguments[1],arguments[2]);if(0===r)t=new Cr(0);else if(1===r)if(Mt(arguments[0]))t=new Cr(2*arguments[0]);else if(Bt(arguments[0]))if((n=(t=arguments[0]).length)&&be(t)&&Qt(t[0])){if(t=function(e,r){var t,n,i,o;for(t=r.length,o=0,i=0;it.byteLength-e)throw new RangeError(R("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*cn));t=new Cr(t,e,2*n)}}return Y(this,"_buffer",t),Y(this,"_length",t.length/2),this}function yn(e){return e.re}function wn(e){return e.im}function bn(e){var r,t,n;for(r=[];!(t=e.next()).done;)if(It(n=t.value)&&n.length>=2)r.push(n[0],n[1]);else{if(!Qt(n))return new TypeError(R("invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",n));r.push(yn(n),wn(n))}return r}Y(dn,"BYTES_PER_ELEMENT",cn),Y(dn,"name","Complex64Array"),Y(dn,"from",(function(e){var r,t,n,i,o,a,u,s,l,f,h,c;if(!xe(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!mn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!xe(n=arguments[1]))throw new TypeError(R("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(r=arguments[2])}if(pn(e)){if(s=e.length,n){for(o=(i=new this(s))._buffer,c=0,h=0;h=2))throw new TypeError(R("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",f));o[c]=f[0],o[c+1]=f[1]}c+=2}return i}return new this(e)}if(Bt(e)){if(n){for(s=e.length,u=e.get&&e.set?Tr("default"):Vr("default"),h=0;h=2))throw new TypeError(R("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",f));o[c]=f[0],o[c+1]=f[1]}c+=2}return i}return new this(e)}if(Ut(e)&&gn&&xe(e[on])){if(!xe((o=e[on]()).next))throw new TypeError(R("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",e));if(a=n?function(e,r,t){var n,i,o,a;for(n=[],a=-1;!(i=e.next()).done;)if(a+=1,It(o=r.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Qt(o))return new TypeError(R("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(un(o),sn(o))}return n}(o,n,r):hn(o),a instanceof Error)throw a;for(o=(i=new this(s=a.length/2))._buffer,h=0;h=this._length))return vn(this._buffer,e)})),an(dn.prototype,"buffer",(function(){return this._buffer.buffer})),an(dn.prototype,"byteLength",(function(){return this._buffer.byteLength})),an(dn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),Y(dn.prototype,"BYTES_PER_ELEMENT",dn.BYTES_PER_ELEMENT),Y(dn.prototype,"copyWithin",(function(e,r){if(!pn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*e,2*r):this._buffer.copyWithin(2*e,2*r,2*arguments[2]),this})),Y(dn.prototype,"entries",(function(){var e,r,t,n,i,o;if(!pn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return e=this,n=this._buffer,t=this._length,o=-1,Y(r={},"next",(function(){if(o+=1,i||o>=t)return{done:!0};return{value:[o,vn(n,o)],done:!1}})),Y(r,"return",(function(e){if(i=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(r,on,(function(){return e.entries()})),r})),Y(dn.prototype,"every",(function(e,r){var t,n;if(!pn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n1){if(!St(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!St(t))throw new TypeError(R("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else r=0,t=i;for(a=un(e),u=sn(e),s=r;s=0;n--)if(i=vn(t,n),e.call(r,i,n,this))return i})),Y(dn.prototype,"findLastIndex",(function(e,r){var t,n,i;if(!pn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=vn(t,n),e.call(r,i,n,this))return n;return-1})),Y(dn.prototype,"forEach",(function(e,r){var t,n,i;if(!pn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n=this._length))return vn(this._buffer,e)})),Y(dn.prototype,"includes",(function(e,r){var t,n,i,o,a;if(!pn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Qt(e))throw new TypeError(R("invalid argument. First argument must be a complex number. Value: `%s`.",e));if(arguments.length>1){if(!St(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=un(e),o=sn(e),t=this._buffer,a=r;a1){if(!St(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=un(e),o=sn(e),t=this._buffer,a=r;a=t)return{done:!0};return{value:i,done:!1}})),Y(r,"return",(function(e){if(n=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(r,on,(function(){return e.keys()})),r})),Y(dn.prototype,"lastIndexOf",(function(e,r){var t,n,i,o,a;if(!pn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Qt(e))throw new TypeError(R("invalid argument. First argument must be a complex number. Value: `%s`.",e));if(arguments.length>1){if(!St(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(i=un(e),o=sn(e),t=this._buffer,a=r;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),an(dn.prototype,"length",(function(){return this._length})),Y(dn.prototype,"map",(function(e,r){var t,n,i,o,a;if(!pn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(n=this._buffer,t=(i=new this.constructor(this._length))._buffer,o=0;o1)n=r,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=vn(t,0),o=1}for(;o1)n=r,o=i-1;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=vn(t,i-1),o=i-2}for(;o>=0;o--)n=e(n,vn(t,o),o,this);return n})),Y(dn.prototype,"reverse",(function(){var e,r,t,n,i,o;if(!pn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,e=this._buffer,n=Ft(t/2),i=0;i1){if(!Mt(t=arguments[1]))throw new TypeError(R("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(Qt(e)){if(t>=this._length)throw new RangeError(R("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=un(e),void(n[t+1]=sn(e))}if(pn(e)){if(t+(a=e._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=e._buffer,l=n.byteOffset+t*cn,r.buffer===n.buffer&&r.byteOffsetl){for(i=new Cr(r.length),s=0;sthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=e,l=n.byteOffset+t*cn,r.buffer===n.buffer&&r.byteOffsetl){for(i=new Cr(a),s=0;sthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,s=0;su&&(r=u)}}for(t=ei&&(r=i)}}return e>=i?(i=0,t=n.byteLength):e>=r?(i=0,t=n.byteOffset+e*cn):(i=r-e,t=n.byteOffset+e*cn),new this.constructor(n.buffer,t,i<0?0:i)})),Y(dn.prototype,"toLocaleString",(function(e,r){var t,n,i,o,a;if(!pn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=[];else{if(!U(e)&&!$t(e))throw new TypeError(R("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",e));n=e}if(arguments.length<2)t={};else{if(!Ut(r))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",r));t=r}for(o=this._buffer,i=[],a=0;a=t)return{done:!0};return{value:vn(i,o),done:!1}})),Y(e,"return",(function(e){if(n=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(e,on,(function(){return r.values()})),e})),Y(dn.prototype,"with",(function(e,r){var t,n,i;if(!pn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!St(e))throw new TypeError(R("invalid argument. First argument must be an integer. Value: `%s`.",e));if(i=this._length,e<0&&(e+=i),e<0||e>=i)throw new RangeError(R("invalid argument. Index argument is out-of-bounds. Value: `%s`.",e));if(!Qt(r))throw new TypeError(R("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(t=(n=new this.constructor(this._buffer))._buffer)[2*e]=un(r),t[2*e+1]=sn(r),n}));var En=2*Or.BYTES_PER_ELEMENT,Tn=nn();function _n(e){return e instanceof xn||"object"==typeof e&&null!==e&&("Complex64Array"===e.constructor.name||"Complex128Array"===e.constructor.name)&&"number"==typeof e._length&&"object"==typeof e._buffer}function Vn(e){return e===xn||"Complex64Array"===e.name}function An(e,r){return new Gt(e[r*=2],e[r+1])}function xn(){var e,r,t,n;if(r=arguments.length,!(this instanceof xn))return 0===r?new xn:1===r?new xn(arguments[0]):2===r?new xn(arguments[0],arguments[1]):new xn(arguments[0],arguments[1],arguments[2]);if(0===r)t=new Or(0);else if(1===r)if(Mt(arguments[0]))t=new Or(2*arguments[0]);else if(Bt(arguments[0]))if((n=(t=arguments[0]).length)&&be(t)&&Qt(t[0])){if(t=function(e,r){var t,n,i,o;for(t=r.length,o=0,i=0;it.byteLength-e)throw new RangeError(R("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*En));t=new Or(t,e,2*n)}}return Y(this,"_buffer",t),Y(this,"_length",t.length/2),this}function Fn(e){var r,t;for(r=[];!(t=e.next()).done;)r.push(ae(t.value));return r}Y(xn,"BYTES_PER_ELEMENT",En),Y(xn,"name","Complex128Array"),Y(xn,"from",(function(e){var r,t,n,i,o,a,u,s,l,f,h,c;if(!xe(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Vn(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if((t=arguments.length)>1){if(!xe(n=arguments[1]))throw new TypeError(R("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(r=arguments[2])}if(_n(e)){if(s=e.length,n){for(o=(i=new this(s))._buffer,c=0,h=0;h=2))throw new TypeError(R("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",f));o[c]=f[0],o[c+1]=f[1]}c+=2}return i}return new this(e)}if(Bt(e)){if(n){for(s=e.length,u=e.get&&e.set?Tr("default"):Vr("default"),h=0;h=2))throw new TypeError(R("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",f));o[c]=f[0],o[c+1]=f[1]}c+=2}return i}return new this(e)}if(Ut(e)&&Tn&&xe(e[on])){if(!xe((o=e[on]()).next))throw new TypeError(R("invalid argument. First argument must be an array-like object or an iterable. Value: `%s`.",e));if(a=n?function(e,r,t){var n,i,o,a;for(n=[],a=-1;!(i=e.next()).done;)if(a+=1,It(o=r.call(t,i.value,a))&&o.length>=2)n.push(o[0],o[1]);else{if(!Qt(o))return new TypeError(R("invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.",o));n.push(yn(o),wn(o))}return n}(o,n,r):bn(o),a instanceof Error)throw a;for(o=(i=new this(s=a.length/2))._buffer,h=0;h=this._length))return An(this._buffer,e)})),an(xn.prototype,"buffer",(function(){return this._buffer.buffer})),an(xn.prototype,"byteLength",(function(){return this._buffer.byteLength})),an(xn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),Y(xn.prototype,"BYTES_PER_ELEMENT",xn.BYTES_PER_ELEMENT),Y(xn.prototype,"copyWithin",(function(e,r){if(!_n(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return 2===arguments.length?this._buffer.copyWithin(2*e,2*r):this._buffer.copyWithin(2*e,2*r,2*arguments[2]),this})),Y(xn.prototype,"entries",(function(){var e,r,t,n,i,o,a;if(!_n(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");return r=this,e=this._buffer,n=this._length,o=-1,a=-2,Y(t={},"next",(function(){var r;if(o+=1,i||o>=n)return{done:!0};return r=new Gt(e[a+=2],e[a+1]),{value:[o,r],done:!1}})),Y(t,"return",(function(e){if(i=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(t,on,(function(){return r.entries()})),t})),Y(xn.prototype,"every",(function(e,r){var t,n;if(!_n(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n1){if(!St(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!St(t))throw new TypeError(R("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else r=0,t=i;for(a=yn(e),u=wn(e),s=r;s=0;n--)if(i=An(t,n),e.call(r,i,n,this))return i})),Y(xn.prototype,"findLastIndex",(function(e,r){var t,n,i;if(!_n(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=this._length-1;n>=0;n--)if(i=An(t,n),e.call(r,i,n,this))return n;return-1})),Y(xn.prototype,"forEach",(function(e,r){var t,n,i;if(!_n(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n=this._length))return An(this._buffer,e)})),an(xn.prototype,"length",(function(){return this._length})),Y(xn.prototype,"includes",(function(e,r){var t,n,i,o,a;if(!_n(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Qt(e))throw new TypeError(R("invalid argument. First argument must be a complex number. Value: `%s`.",e));if(arguments.length>1){if(!St(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=yn(e),o=wn(e),t=this._buffer,a=r;a1){if(!St(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(i=yn(e),o=wn(e),t=this._buffer,a=r;a=t)return{done:!0};return{value:i,done:!1}})),Y(r,"return",(function(e){if(n=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(r,on,(function(){return e.keys()})),r})),Y(xn.prototype,"lastIndexOf",(function(e,r){var t,n,i,o,a;if(!_n(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!Qt(e))throw new TypeError(R("invalid argument. First argument must be a complex number. Value: `%s`.",e));if(arguments.length>1){if(!St(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(i=yn(e),o=wn(e),t=this._buffer,a=r;a>=0;a--)if(i===t[n=2*a]&&o===t[n+1])return a;return-1})),Y(xn.prototype,"map",(function(e,r){var t,n,i,o,a;if(!_n(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(n=this._buffer,t=(i=new this.constructor(this._length))._buffer,o=0;o1)n=r,o=0;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=An(t,0),o=1}for(;o1)n=r,o=i-1;else{if(0===i)throw new Error("invalid operation. If not provided an initial value, an array must contain at least one element.");n=An(t,i-1),o=i-2}for(;o>=0;o--)n=e(n,An(t,o),o,this);return n})),Y(xn.prototype,"reverse",(function(){var e,r,t,n,i,o;if(!_n(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");for(t=this._length,e=this._buffer,n=Ft(t/2),i=0;i1){if(!Mt(t=arguments[1]))throw new TypeError(R("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(Qt(e)){if(t>=this._length)throw new RangeError(R("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));return n[t*=2]=yn(e),void(n[t+1]=wn(e))}if(_n(e)){if(t+(a=e._length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=e._buffer,l=n.byteOffset+t*En,r.buffer===n.buffer&&r.byteOffsetl){for(i=new Or(r.length),s=0;sthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=e,l=n.byteOffset+t*En,r.buffer===n.buffer&&r.byteOffsetl){for(i=new Or(a),s=0;sthis._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");for(t*=2,s=0;su&&(r=u)}}for(t=ei&&(r=i)}}return e>=i?(i=0,t=n.byteLength):e>=r?(i=0,t=n.byteOffset+e*En):(i=r-e,t=n.byteOffset+e*En),new this.constructor(n.buffer,t,i<0?0:i)})),Y(xn.prototype,"toLocaleString",(function(e,r){var t,n,i,o,a;if(!_n(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(0===arguments.length)n=[];else{if(!re(e)&&!$t(e))throw new TypeError(R("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",e));n=e}if(arguments.length<2)t={};else{if(!Ut(r))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",r));t=r}for(o=this._buffer,i=[],a=0;a=t)return{done:!0};return{value:An(i,o),done:!1}})),Y(e,"return",(function(e){if(n=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(e,on,(function(){return r.values()})),e})),Y(xn.prototype,"with",(function(e,r){var t,n,i;if(!_n(this))throw new TypeError("invalid invocation. `this` is not a complex number array.");if(!St(e))throw new TypeError(R("invalid argument. First argument must be an integer. Value: `%s`.",e));if(i=this._length,e<0&&(e+=i),e<0||e>=i)throw new RangeError(R("invalid argument. Index argument is out-of-bounds. Value: `%s`.",e));if(!Qt(r))throw new TypeError(R("invalid argument. Second argument must be a complex number. Value: `%s`.",r));return(t=(n=new this.constructor(this._buffer))._buffer)[2*e]=yn(r),t[2*e+1]=wn(r),n}));var Sn=lt.BYTES_PER_ELEMENT,Ln=nn();function On(e){return"object"==typeof e&&null!==e&&"BooleanArray"===e.constructor.name&&e.BYTES_PER_ELEMENT===Sn}function Rn(e){return e===Nn}function Nn(){var e,r,t,n,i;if(r=arguments.length,!(this instanceof Nn))return 0===r?new Nn:1===r?new Nn(arguments[0]):2===r?new Nn(arguments[0],arguments[1]):new Nn(arguments[0],arguments[1],arguments[2]);if(0===r)t=new lt(0);else if(1===r)if(Mt(i=arguments[0]))t=new lt(i);else if(Bt(i))t=function(e,r){var t,n;for(t=r.length,n=0;nt.byteLength-e)throw new RangeError(R("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*Sn));t=new lt(t,e,n)}}return Y(this,"_buffer",t),Y(this,"_length",t.length),this}Y(Nn,"BYTES_PER_ELEMENT",Sn),Y(Nn,"name","BooleanArray"),Y(Nn,"from",(function(e){var r,t,n,i,o,a,u,s,l;if(!xe(this))throw new TypeError("invalid invocation. `this` context must be a constructor.");if(!Rn(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if((t=arguments.length)>1){if(!xe(n=arguments[1]))throw new TypeError(R("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(r=arguments[2])}if(Bt(e)){if(n){for(s=e.length,u=e.get&&e.set?Tr("default"):Vr("default"),o=(i=new this(s))._buffer,l=0;l=t))return ae(r[e])})),an(Nn.prototype,"buffer",(function(){return this._buffer.buffer})),an(Nn.prototype,"byteLength",(function(){return this._buffer.byteLength})),an(Nn.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),Y(Nn.prototype,"BYTES_PER_ELEMENT",Nn.BYTES_PER_ELEMENT),Y(Nn.prototype,"copyWithin",(function(e,r){if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return 2===arguments.length?this._buffer.copyWithin(e,r):this._buffer.copyWithin(e,r,arguments[2]),this})),Y(Nn.prototype,"entries",(function(){var e,r,t,n,i,o;if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");return e=this,n=this._buffer,t=this._length,o=-1,Y(r={},"next",(function(){if(o+=1,i||o>=t)return{done:!0};return{value:[o,ae(n[o])],done:!1}})),Y(r,"return",(function(e){if(i=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(r,on,(function(){return e.entries()})),r})),Y(Nn.prototype,"every",(function(e,r){var t,n;if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n1){if(!Ot(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!Ot(t))throw new TypeError(R("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else r=0,t=i;for(o=e?1:0,a=r;a=0;i--)if(n=ae(t[i]),e.call(r,n,i,this))return n})),Y(Nn.prototype,"findLastIndex",(function(e,r){var t,n,i;if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,i=this._length-1;i>=0;i--)if(n=ae(t[i]),e.call(r,n,i,this))return i;return-1})),Y(Nn.prototype,"forEach",(function(e,r){var t,n;if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n=this._length))return ae(this._buffer[e])})),Y(Nn.prototype,"includes",(function(e,r){var t,n;if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!oe(e))throw new TypeError(R("invalid argument. First argument must be a boolean. Value: `%s`.",e));if(arguments.length>1){if(!Ot(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(t=this._buffer,n=r;n1){if(!Ot(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(t=this._buffer,n=r;n0){if(!U(e))throw new TypeError(R("invalid argument. First argument must be a string. Value: `%s`.",e))}else e=",";for(r=this._buffer,t=[],n=0;n=t)return{done:!0};return{value:i,done:!1}})),Y(r,"return",(function(e){if(n=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(r,on,(function(){return e.keys()})),r})),Y(Nn.prototype,"lastIndexOf",(function(e,r){var t,n;if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!oe(e))throw new TypeError(R("invalid argument. First argument must be a boolean. Value: `%s`.",e));if(arguments.length>1){if(!Ot(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(t=this._buffer,n=r;n>=0;n--)if(e===ae(t[n]))return n;return-1})),an(Nn.prototype,"length",(function(){return this._length})),Y(Nn.prototype,"map",(function(e,r){var t,n,i,o;if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!xe(e))throw new TypeError("invalid argument. First argument must be a function. Value: `%s`.",e);for(i=this._buffer,t=(n=new this.constructor(this._length))._buffer,o=0;o1)i=r,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=ae(t[0]),o=1}for(;o1)i=r,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=ae(t[n-1]),o=n-2}for(;o>=0;o--)i=e(i,ae(t[o]),o,this);return i})),Y(Nn.prototype,"reverse",(function(){var e,r,t,n,i,o;if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");for(e=this._buffer,t=this._length,n=Ft(t/2),i=0;i1){if(!Mt(t=arguments[1]))throw new TypeError(R("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(Bt(e)){if(t+(o=e.length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(r=On(e)?e._buffer:e,u=n.byteOffset+t*Sn,r.buffer===n.buffer&&r.byteOffsetu){for(i=new lt(r.length),a=0;a=this._length)throw new RangeError(R("invalid argument. Index argument is out-of-bounds. Value: `%u`.",t));n[t]=e?1:0}})),Y(Nn.prototype,"slice",(function(e,r){var t,n,i,o,a,u;if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(o=this._buffer,a=this._length,0===arguments.length)e=0,r=a;else{if(!Ot(e))throw new TypeError(R("invalid argument. First argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=a)<0&&(e=0),1===arguments.length)r=a;else{if(!Ot(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0?(r+=a)<0&&(r=0):r>a&&(r=a)}}for(t=ei&&(r=i)}}return e>=i?(i=0,t=n.byteLength):e>=r?(i=0,t=n.byteOffset+e*Sn):(i=r-e,t=n.byteOffset+e*Sn),new this.constructor(n.buffer,t,i<0?0:i)})),Y(Nn.prototype,"toLocaleString",(function(e,r){var t,n,i,o,a;if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(0===arguments.length)n=[];else{if(!U(e)&&!$t(e))throw new TypeError(R("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",e));n=e}if(arguments.length<2)t={};else{if(!Ut(r))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",r));t=r}for(o=this._buffer,i=[],a=0;a=t)return{done:!0};return{value:ae(i[o]),done:!1}})),Y(e,"return",(function(e){if(n=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(e,on,(function(){return r.values()})),e})),Y(Nn.prototype,"with",(function(e,r){var t,n;if(!On(this))throw new TypeError("invalid invocation. `this` is not a boolean array.");if(!Ot(e))throw new TypeError(R("invalid argument. First argument must be an integer. Value: `%s`.",e));if(n=this._length,e<0&&(e+=n),e<0||e>=n)throw new RangeError(R("invalid argument. Index argument is out-of-bounds. Value: `%s`.",e));if(!oe(r))throw new TypeError(R("invalid argument. Second argument must be a boolean. Value: `%s`.",r));return(t=new this.constructor(this._buffer))._buffer[e]=r?1:0,t}));var Mn=[Or,Cr,Jr,$r,it,Kr,wt,lt,pt,dn,xn,Nn],kn=["float64","float32","int32","uint32","int16","uint16","int8","uint8","uint8c","complex64","complex128","bool"],jn=kn.length;function Cn(e){var r;if(be(e))return"generic";if(_e(e))return null;for(r=0;r1){if(!U(r))throw new TypeError(R("invalid argument. Second argument must be a string. Value: `%s`.",r));return ei.from(e,r)}return ei.from(e,"utf8")}:function(e,r){if(!U(e))throw new TypeError(R("invalid argument. First argument must be a string. Value: `%s`.",e));if(arguments.length>1){if(!U(r))throw new TypeError(R("invalid argument. Second argument must be a string. Value: `%s`.",r));return new ei(e,r)}return new ei(e,"utf8")};var ri,ti=Kn,ni=/[^\u0000-\u007F]/;ri=function(){var e;if("function"!=typeof Jn)return!1;try{e="Hello, world"===Jn("SGVsbG8sIHdvcmxk")}catch(r){e=!1}return e}()?function(e){try{return Zn(e)}catch(e){return null}}:function(e){return ni.test(e)?null:ti(e,"base64").toString("utf8")};var ii=ri;function oi(e){return""===e?"":e.charAt(0).toUpperCase()+e.slice(1)}var ai=void 0!==String.prototype.trim,ui=String.prototype.trim;var si=/^[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]*([\S\s]*?)[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]*$/;var li=ai&&""===ui.call(" \n\t\r\n\f\v            \u2028\u2029   \ufeff")&&"᠎"===ui.call("᠎")?function(e){return ui.call(e)}:function(e){return or(e,si,"$1")},fi=/\s+/g,hi=/[-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g,ci=/(?:\s|^)([^\s]+)(?=\s|$)/g,gi=/([a-z0-9])([A-Z])/g;function pi(e,r,t){return r=yr(r),0===t?r:oi(r)}function mi(e){return e=or(e,hi," "),e=or(e,fi," "),e=or(e,gi,"$1 $2"),or(e=li(e),ci,pi)}var vi=65536,di=1024,yi=55296,wi=56319,bi=56320,Ei=57343;function Ti(e,r,t){var n,i,o;return r<0&&(r+=e.length),(n=e.charCodeAt(r))>=yi&&n<=wi&&r=bi&&n<=Ei&&r>=1?(o=e.charCodeAt(r-1),i=n,yi<=o&&o<=wi?(o-yi)*di+(i-bi)+vi:i):n}var _i=/\s+/g,Vi=/[\-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g,Ai=/([a-z0-9])([A-Z])/g;function xi(e){return e=or(e,Vi," "),e=or(e,Ai,"$1 $2"),dr(e=or(e=li(e),_i,"_"))}function Fi(e){return e!=e}function Si(e,r){return Fi(e)||Fi(r)?NaN:e===xt||r===xt?xt:e===r&&0===e?function(e){return 0===e&&1/e===xt}(e)?e:r:e?`{}|~\/\\\[\]_#$*&^@%]+/g,Ni=/([a-z0-9])([A-Z])/g;function Mi(e){return e=or(e,Ri," "),e=or(e,Ni,"$1 $2"),yr(e=or(e=li(e),Oi,"."))}var ki=void 0!==String.prototype.endsWith;var ji,Ci=String.prototype.endsWith;ji=ki?function(e,r,t){var n,i;return i=r.length,0===t?0===i:(n=t<0?e.length+t:t,0===i||!(n-i<0||n>e.length)&&Ci.call(e,r,n))}:function(e,r,t){var n,i,o;if(i=r.length,0===t)return 0===i;if(n=t<0?e.length+t:t,0===i)return!0;if((n-=i)<0)return!1;for(o=0;o=e.length)throw new RangeError(ir("invalid argument. Second argument must be a valid position (i.e., be within string bounds). Value: `%d`.",r));if(arguments.length>2){if(!oe(t))throw new TypeError(ir("invalid argument. Third argument must be a boolean. Value: `%s`.",t));n=t}else n=!1;return Ti(e,r,n)}var zi=55296,Gi=56319,qi=56320,Ji=57343;function Zi(e,r){var t,n;if(!U(e))throw new TypeError(R("invalid argument. Must provide a string. Value: `%s`.",e));if(!Mt(r))throw new TypeError(R("invalid argument. Must provide a valid position (i.e., a nonnegative integer). Value: `%s`.",r));if(r>=e.length)throw new RangeError(R("invalid argument. Must provide a valid position (i.e., within string bounds). Value: `%u`.",r));return t=e.charCodeAt(r),n=e.charCodeAt(r+1),t>=zi&&t<=Gi&&n>=qi&&n<=Ji}var Hi={CR:0,LF:1,Control:2,Extend:3,RegionalIndicator:4,SpacingMark:5,L:6,V:7,T:8,LV:9,LVT:10,Other:11,Prepend:12,ZWJ:13,NotBreak:0,BreakStart:1,Break:2,BreakLastRegional:3,BreakPenultimateRegional:4,ExtendedPictographic:101};function Qi(e,r,t,n){var i;for(t>=e.length&&(t=e.length-1),i=r;i<=t;i++)if(e[i]!==n)return!1;return!0}function Xi(e,r,t,n){var i;for(r>=e.length-1&&(r=e.length-1),i=r;i>=t;i--)if(e[i]===n)return i;return-1}var Ki={};Y(Ki,"constants",Hi),Y(Ki,"breakType",(function(e,r){var t,n,i,o,a;return i=e[(a=e.length-1)-1],n=e[a],t=r[a],(o=Xi(e,a,0,Hi.RegionalIndicator))>0&&i!==Hi.Prepend&&i!==Hi.RegionalIndicator&&Qi(e,1,o-1,Hi.RegionalIndicator)?function(e,r,t,n){var i,o;for(t>=e.length&&(t=e.length-1),i=0,o=r;o<=t;o++)e[o]===n&&(i+=1);return i}(e,0,a,Hi.RegionalIndicator)%2==1?Hi.BreakLastRegional:Hi.BreakPenultimateRegional:i===Hi.CR&&n===Hi.LF?Hi.NotBreak:i===Hi.Control||i===Hi.CR||i===Hi.LF||n===Hi.Control||n===Hi.CR||n===Hi.LF?Hi.BreakStart:(i!==Hi.L||n!==Hi.L&&n!==Hi.V&&n!==Hi.LV&&n!==Hi.LVT)&&(i!==Hi.LV&&i!==Hi.V||n!==Hi.V&&n!==Hi.T)&&(i!==Hi.LVT&&i!==Hi.T||n!==Hi.T)?n===Hi.Extend||n===Hi.ZWJ||n===Hi.SpacingMark||i===Hi.Prepend||(o=Xi(r,a-1,0,Hi.ExtendedPictographic))>=0&&i===Hi.ZWJ&&t===Hi.ExtendedPictographic&&r[o]===Hi.ExtendedPictographic&&Qi(e,o+1,a-2,Hi.Extend)?Hi.NotBreak:function(e,r,t,n){var i;for(t>=e.length&&(t=e.length-1),i=r;i<=t;i++)if(e[i]===n)return i;return-1}(e,1,a-1,Hi.RegionalIndicator)>=0?Hi.Break:i===Hi.RegionalIndicator&&n===Hi.RegionalIndicator?Hi.NotBreak:Hi.BreakStart:Hi.NotBreak})),Y(Ki,"emojiProperty",(function(e){return 169===e||174===e||8252===e||8265===e||8482===e||8505===e||8596<=e&&e<=8601||8617<=e&&e<=8618||8986<=e&&e<=8987||9e3===e||9096===e||9167===e||9193<=e&&e<=9196||9197<=e&&e<=9198||9199===e||9200===e||9201<=e&&e<=9202||9203===e||9208<=e&&e<=9210||9410===e||9642<=e&&e<=9643||9654===e||9664===e||9723<=e&&e<=9726||9728<=e&&e<=9729||9730<=e&&e<=9731||9732===e||9733===e||9735<=e&&e<=9741||9742===e||9743<=e&&e<=9744||9745===e||9746===e||9748<=e&&e<=9749||9750<=e&&e<=9751||9752===e||9753<=e&&e<=9756||9757===e||9758<=e&&e<=9759||9760===e||9761===e||9762<=e&&e<=9763||9764<=e&&e<=9765||9766===e||9767<=e&&e<=9769||9770===e||9771<=e&&e<=9773||9774===e||9775===e||9776<=e&&e<=9783||9784<=e&&e<=9785||9786===e||9787<=e&&e<=9791||9792===e||9793===e||9794===e||9795<=e&&e<=9799||9800<=e&&e<=9811||9812<=e&&e<=9822||9823===e||9824===e||9825<=e&&e<=9826||9827===e||9828===e||9829<=e&&e<=9830||9831===e||9832===e||9833<=e&&e<=9850||9851===e||9852<=e&&e<=9853||9854===e||9855===e||9856<=e&&e<=9861||9872<=e&&e<=9873||9874===e||9875===e||9876===e||9877===e||9878<=e&&e<=9879||9880===e||9881===e||9882===e||9883<=e&&e<=9884||9885<=e&&e<=9887||9888<=e&&e<=9889||9890<=e&&e<=9894||9895===e||9896<=e&&e<=9897||9898<=e&&e<=9899||9900<=e&&e<=9903||9904<=e&&e<=9905||9906<=e&&e<=9916||9917<=e&&e<=9918||9919<=e&&e<=9923||9924<=e&&e<=9925||9926<=e&&e<=9927||9928===e||9929<=e&&e<=9933||9934===e||9935===e||9936===e||9937===e||9938===e||9939===e||9940===e||9941<=e&&e<=9960||9961===e||9962===e||9963<=e&&e<=9967||9968<=e&&e<=9969||9970<=e&&e<=9971||9972===e||9973===e||9974===e||9975<=e&&e<=9977||9978===e||9979<=e&&e<=9980||9981===e||9982<=e&&e<=9985||9986===e||9987<=e&&e<=9988||9989===e||9992<=e&&e<=9996||9997===e||9998===e||9999===e||1e4<=e&&e<=10001||10002===e||10004===e||10006===e||10013===e||10017===e||10024===e||10035<=e&&e<=10036||10052===e||10055===e||10060===e||10062===e||10067<=e&&e<=10069||10071===e||10083===e||10084===e||10085<=e&&e<=10087||10133<=e&&e<=10135||10145===e||10160===e||10175===e||10548<=e&&e<=10549||11013<=e&&e<=11015||11035<=e&&e<=11036||11088===e||11093===e||12336===e||12349===e||12951===e||12953===e||126976<=e&&e<=126979||126980===e||126981<=e&&e<=127182||127183===e||127184<=e&&e<=127231||127245<=e&&e<=127247||127279===e||127340<=e&&e<=127343||127344<=e&&e<=127345||127358<=e&&e<=127359||127374===e||127377<=e&&e<=127386||127405<=e&&e<=127461||127489<=e&&e<=127490||127491<=e&&e<=127503||127514===e||127535===e||127538<=e&&e<=127546||127548<=e&&e<=127551||127561<=e&&e<=127567||127568<=e&&e<=127569||127570<=e&&e<=127743||127744<=e&&e<=127756||127757<=e&&e<=127758||127759===e||127760===e||127761===e||127762===e||127763<=e&&e<=127765||127766<=e&&e<=127768||127769===e||127770===e||127771===e||127772===e||127773<=e&&e<=127774||127775<=e&&e<=127776||127777===e||127778<=e&&e<=127779||127780<=e&&e<=127788||127789<=e&&e<=127791||127792<=e&&e<=127793||127794<=e&&e<=127795||127796<=e&&e<=127797||127798===e||127799<=e&&e<=127818||127819===e||127820<=e&&e<=127823||127824===e||127825<=e&&e<=127867||127868===e||127869===e||127870<=e&&e<=127871||127872<=e&&e<=127891||127892<=e&&e<=127893||127894<=e&&e<=127895||127896===e||127897<=e&&e<=127899||127900<=e&&e<=127901||127902<=e&&e<=127903||127904<=e&&e<=127940||127941===e||127942===e||127943===e||127944===e||127945===e||127946===e||127947<=e&&e<=127950||127951<=e&&e<=127955||127956<=e&&e<=127967||127968<=e&&e<=127971||127972===e||127973<=e&&e<=127984||127985<=e&&e<=127986||127987===e||127988===e||127989===e||127990===e||127991===e||127992<=e&&e<=127994||128e3<=e&&e<=128007||128008===e||128009<=e&&e<=128011||128012<=e&&e<=128014||128015<=e&&e<=128016||128017<=e&&e<=128018||128019===e||128020===e||128021===e||128022===e||128023<=e&&e<=128041||128042===e||128043<=e&&e<=128062||128063===e||128064===e||128065===e||128066<=e&&e<=128100||128101===e||128102<=e&&e<=128107||128108<=e&&e<=128109||128110<=e&&e<=128172||128173===e||128174<=e&&e<=128181||128182<=e&&e<=128183||128184<=e&&e<=128235||128236<=e&&e<=128237||128238===e||128239===e||128240<=e&&e<=128244||128245===e||128246<=e&&e<=128247||128248===e||128249<=e&&e<=128252||128253===e||128254===e||128255<=e&&e<=128258||128259===e||128260<=e&&e<=128263||128264===e||128265===e||128266<=e&&e<=128276||128277===e||128278<=e&&e<=128299||128300<=e&&e<=128301||128302<=e&&e<=128317||128326<=e&&e<=128328||128329<=e&&e<=128330||128331<=e&&e<=128334||128335===e||128336<=e&&e<=128347||128348<=e&&e<=128359||128360<=e&&e<=128366||128367<=e&&e<=128368||128369<=e&&e<=128370||128371<=e&&e<=128377||128378===e||128379<=e&&e<=128390||128391===e||128392<=e&&e<=128393||128394<=e&&e<=128397||128398<=e&&e<=128399||128400===e||128401<=e&&e<=128404||128405<=e&&e<=128406||128407<=e&&e<=128419||128420===e||128421===e||128422<=e&&e<=128423||128424===e||128425<=e&&e<=128432||128433<=e&&e<=128434||128435<=e&&e<=128443||128444===e||128445<=e&&e<=128449||128450<=e&&e<=128452||128453<=e&&e<=128464||128465<=e&&e<=128467||128468<=e&&e<=128475||128476<=e&&e<=128478||128479<=e&&e<=128480||128481===e||128482===e||128483===e||128484<=e&&e<=128487||128488===e||128489<=e&&e<=128494||128495===e||128496<=e&&e<=128498||128499===e||128500<=e&&e<=128505||128506===e||128507<=e&&e<=128511||128512===e||128513<=e&&e<=128518||128519<=e&&e<=128520||128521<=e&&e<=128525||128526===e||128527===e||128528===e||128529===e||128530<=e&&e<=128532||128533===e||128534===e||128535===e||128536===e||128537===e||128538===e||128539===e||128540<=e&&e<=128542||128543===e||128544<=e&&e<=128549||128550<=e&&e<=128551||128552<=e&&e<=128555||128556===e||128557===e||128558<=e&&e<=128559||128560<=e&&e<=128563||128564===e||128565===e||128566===e||128567<=e&&e<=128576||128577<=e&&e<=128580||128581<=e&&e<=128591||128640===e||128641<=e&&e<=128642||128643<=e&&e<=128645||128646===e||128647===e||128648===e||128649===e||128650<=e&&e<=128651||128652===e||128653===e||128654===e||128655===e||128656===e||128657<=e&&e<=128659||128660===e||128661===e||128662===e||128663===e||128664===e||128665<=e&&e<=128666||128667<=e&&e<=128673||128674===e||128675===e||128676<=e&&e<=128677||128678===e||128679<=e&&e<=128685||128686<=e&&e<=128689||128690===e||128691<=e&&e<=128693||128694===e||128695<=e&&e<=128696||128697<=e&&e<=128702||128703===e||128704===e||128705<=e&&e<=128709||128710<=e&&e<=128714||128715===e||128716===e||128717<=e&&e<=128719||128720===e||128721<=e&&e<=128722||128723<=e&&e<=128724||128725===e||128726<=e&&e<=128727||128728<=e&&e<=128735||128736<=e&&e<=128741||128742<=e&&e<=128744||128745===e||128746===e||128747<=e&&e<=128748||128749<=e&&e<=128751||128752===e||128753<=e&&e<=128754||128755===e||128756<=e&&e<=128758||128759<=e&&e<=128760||128761===e||128762===e||128763<=e&&e<=128764||128765<=e&&e<=128767||128884<=e&&e<=128895||128981<=e&&e<=128991||128992<=e&&e<=129003||129004<=e&&e<=129023||129036<=e&&e<=129039||129096<=e&&e<=129103||129114<=e&&e<=129119||129160<=e&&e<=129167||129198<=e&&e<=129279||129292===e||129293<=e&&e<=129295||129296<=e&&e<=129304||129305<=e&&e<=129310||129311===e||129312<=e&&e<=129319||129320<=e&&e<=129327||129328===e||129329<=e&&e<=129330||129331<=e&&e<=129338||129340<=e&&e<=129342||129343===e||129344<=e&&e<=129349||129351<=e&&e<=129355||129356===e||129357<=e&&e<=129359||129360<=e&&e<=129374||129375<=e&&e<=129387||129388<=e&&e<=129392||129393===e||129394===e||129395<=e&&e<=129398||129399<=e&&e<=129400||129401===e||129402===e||129403===e||129404<=e&&e<=129407||129408<=e&&e<=129412||129413<=e&&e<=129425||129426<=e&&e<=129431||129432<=e&&e<=129442||129443<=e&&e<=129444||129445<=e&&e<=129450||129451<=e&&e<=129453||129454<=e&&e<=129455||129456<=e&&e<=129465||129466<=e&&e<=129471||129472===e||129473<=e&&e<=129474||129475<=e&&e<=129482||129483===e||129484===e||129485<=e&&e<=129487||129488<=e&&e<=129510||129511<=e&&e<=129535||129536<=e&&e<=129647||129648<=e&&e<=129651||129652===e||129653<=e&&e<=129655||129656<=e&&e<=129658||129659<=e&&e<=129663||129664<=e&&e<=129666||129667<=e&&e<=129670||129671<=e&&e<=129679||129680<=e&&e<=129685||129686<=e&&e<=129704||129705<=e&&e<=129711||129712<=e&&e<=129718||129719<=e&&e<=129727||129728<=e&&e<=129730||129731<=e&&e<=129743||129744<=e&&e<=129750||129751<=e&&e<=129791||130048<=e&&e<=131069?Hi.ExtendedPictographic:Hi.Other})),Y(Ki,"breakProperty",(function(e){return 1536<=e&&e<=1541||1757===e||1807===e||2274===e||3406===e||69821===e||69837===e||70082<=e&&e<=70083||71999===e||72001===e||72250===e||72324<=e&&e<=72329||73030===e?Hi.Prepend:13===e?Hi.CR:10===e?Hi.LF:0<=e&&e<=9||11<=e&&e<=12||14<=e&&e<=31||127<=e&&e<=159||173===e||1564===e||6158===e||8203===e||8206<=e&&e<=8207||8232===e||8233===e||8234<=e&&e<=8238||8288<=e&&e<=8292||8293===e||8294<=e&&e<=8303||65279===e||65520<=e&&e<=65528||65529<=e&&e<=65531||78896<=e&&e<=78904||113824<=e&&e<=113827||119155<=e&&e<=119162||917504===e||917505===e||917506<=e&&e<=917535||917632<=e&&e<=917759||918e3<=e&&e<=921599?Hi.Control:768<=e&&e<=879||1155<=e&&e<=1159||1160<=e&&e<=1161||1425<=e&&e<=1469||1471===e||1473<=e&&e<=1474||1476<=e&&e<=1477||1479===e||1552<=e&&e<=1562||1611<=e&&e<=1631||1648===e||1750<=e&&e<=1756||1759<=e&&e<=1764||1767<=e&&e<=1768||1770<=e&&e<=1773||1809===e||1840<=e&&e<=1866||1958<=e&&e<=1968||2027<=e&&e<=2035||2045===e||2070<=e&&e<=2073||2075<=e&&e<=2083||2085<=e&&e<=2087||2089<=e&&e<=2093||2137<=e&&e<=2139||2259<=e&&e<=2273||2275<=e&&e<=2306||2362===e||2364===e||2369<=e&&e<=2376||2381===e||2385<=e&&e<=2391||2402<=e&&e<=2403||2433===e||2492===e||2494===e||2497<=e&&e<=2500||2509===e||2519===e||2530<=e&&e<=2531||2558===e||2561<=e&&e<=2562||2620===e||2625<=e&&e<=2626||2631<=e&&e<=2632||2635<=e&&e<=2637||2641===e||2672<=e&&e<=2673||2677===e||2689<=e&&e<=2690||2748===e||2753<=e&&e<=2757||2759<=e&&e<=2760||2765===e||2786<=e&&e<=2787||2810<=e&&e<=2815||2817===e||2876===e||2878===e||2879===e||2881<=e&&e<=2884||2893===e||2901<=e&&e<=2902||2903===e||2914<=e&&e<=2915||2946===e||3006===e||3008===e||3021===e||3031===e||3072===e||3076===e||3134<=e&&e<=3136||3142<=e&&e<=3144||3146<=e&&e<=3149||3157<=e&&e<=3158||3170<=e&&e<=3171||3201===e||3260===e||3263===e||3266===e||3270===e||3276<=e&&e<=3277||3285<=e&&e<=3286||3298<=e&&e<=3299||3328<=e&&e<=3329||3387<=e&&e<=3388||3390===e||3393<=e&&e<=3396||3405===e||3415===e||3426<=e&&e<=3427||3457===e||3530===e||3535===e||3538<=e&&e<=3540||3542===e||3551===e||3633===e||3636<=e&&e<=3642||3655<=e&&e<=3662||3761===e||3764<=e&&e<=3772||3784<=e&&e<=3789||3864<=e&&e<=3865||3893===e||3895===e||3897===e||3953<=e&&e<=3966||3968<=e&&e<=3972||3974<=e&&e<=3975||3981<=e&&e<=3991||3993<=e&&e<=4028||4038===e||4141<=e&&e<=4144||4146<=e&&e<=4151||4153<=e&&e<=4154||4157<=e&&e<=4158||4184<=e&&e<=4185||4190<=e&&e<=4192||4209<=e&&e<=4212||4226===e||4229<=e&&e<=4230||4237===e||4253===e||4957<=e&&e<=4959||5906<=e&&e<=5908||5938<=e&&e<=5940||5970<=e&&e<=5971||6002<=e&&e<=6003||6068<=e&&e<=6069||6071<=e&&e<=6077||6086===e||6089<=e&&e<=6099||6109===e||6155<=e&&e<=6157||6277<=e&&e<=6278||6313===e||6432<=e&&e<=6434||6439<=e&&e<=6440||6450===e||6457<=e&&e<=6459||6679<=e&&e<=6680||6683===e||6742===e||6744<=e&&e<=6750||6752===e||6754===e||6757<=e&&e<=6764||6771<=e&&e<=6780||6783===e||6832<=e&&e<=6845||6846===e||6847<=e&&e<=6848||6912<=e&&e<=6915||6964===e||6965===e||6966<=e&&e<=6970||6972===e||6978===e||7019<=e&&e<=7027||7040<=e&&e<=7041||7074<=e&&e<=7077||7080<=e&&e<=7081||7083<=e&&e<=7085||7142===e||7144<=e&&e<=7145||7149===e||7151<=e&&e<=7153||7212<=e&&e<=7219||7222<=e&&e<=7223||7376<=e&&e<=7378||7380<=e&&e<=7392||7394<=e&&e<=7400||7405===e||7412===e||7416<=e&&e<=7417||7616<=e&&e<=7673||7675<=e&&e<=7679||8204===e||8400<=e&&e<=8412||8413<=e&&e<=8416||8417===e||8418<=e&&e<=8420||8421<=e&&e<=8432||11503<=e&&e<=11505||11647===e||11744<=e&&e<=11775||12330<=e&&e<=12333||12334<=e&&e<=12335||12441<=e&&e<=12442||42607===e||42608<=e&&e<=42610||42612<=e&&e<=42621||42654<=e&&e<=42655||42736<=e&&e<=42737||43010===e||43014===e||43019===e||43045<=e&&e<=43046||43052===e||43204<=e&&e<=43205||43232<=e&&e<=43249||43263===e||43302<=e&&e<=43309||43335<=e&&e<=43345||43392<=e&&e<=43394||43443===e||43446<=e&&e<=43449||43452<=e&&e<=43453||43493===e||43561<=e&&e<=43566||43569<=e&&e<=43570||43573<=e&&e<=43574||43587===e||43596===e||43644===e||43696===e||43698<=e&&e<=43700||43703<=e&&e<=43704||43710<=e&&e<=43711||43713===e||43756<=e&&e<=43757||43766===e||44005===e||44008===e||44013===e||64286===e||65024<=e&&e<=65039||65056<=e&&e<=65071||65438<=e&&e<=65439||66045===e||66272===e||66422<=e&&e<=66426||68097<=e&&e<=68099||68101<=e&&e<=68102||68108<=e&&e<=68111||68152<=e&&e<=68154||68159===e||68325<=e&&e<=68326||68900<=e&&e<=68903||69291<=e&&e<=69292||69446<=e&&e<=69456||69633===e||69688<=e&&e<=69702||69759<=e&&e<=69761||69811<=e&&e<=69814||69817<=e&&e<=69818||69888<=e&&e<=69890||69927<=e&&e<=69931||69933<=e&&e<=69940||70003===e||70016<=e&&e<=70017||70070<=e&&e<=70078||70089<=e&&e<=70092||70095===e||70191<=e&&e<=70193||70196===e||70198<=e&&e<=70199||70206===e||70367===e||70371<=e&&e<=70378||70400<=e&&e<=70401||70459<=e&&e<=70460||70462===e||70464===e||70487===e||70502<=e&&e<=70508||70512<=e&&e<=70516||70712<=e&&e<=70719||70722<=e&&e<=70724||70726===e||70750===e||70832===e||70835<=e&&e<=70840||70842===e||70845===e||70847<=e&&e<=70848||70850<=e&&e<=70851||71087===e||71090<=e&&e<=71093||71100<=e&&e<=71101||71103<=e&&e<=71104||71132<=e&&e<=71133||71219<=e&&e<=71226||71229===e||71231<=e&&e<=71232||71339===e||71341===e||71344<=e&&e<=71349||71351===e||71453<=e&&e<=71455||71458<=e&&e<=71461||71463<=e&&e<=71467||71727<=e&&e<=71735||71737<=e&&e<=71738||71984===e||71995<=e&&e<=71996||71998===e||72003===e||72148<=e&&e<=72151||72154<=e&&e<=72155||72160===e||72193<=e&&e<=72202||72243<=e&&e<=72248||72251<=e&&e<=72254||72263===e||72273<=e&&e<=72278||72281<=e&&e<=72283||72330<=e&&e<=72342||72344<=e&&e<=72345||72752<=e&&e<=72758||72760<=e&&e<=72765||72767===e||72850<=e&&e<=72871||72874<=e&&e<=72880||72882<=e&&e<=72883||72885<=e&&e<=72886||73009<=e&&e<=73014||73018===e||73020<=e&&e<=73021||73023<=e&&e<=73029||73031===e||73104<=e&&e<=73105||73109===e||73111===e||73459<=e&&e<=73460||92912<=e&&e<=92916||92976<=e&&e<=92982||94031===e||94095<=e&&e<=94098||94180===e||113821<=e&&e<=113822||119141===e||119143<=e&&e<=119145||119150<=e&&e<=119154||119163<=e&&e<=119170||119173<=e&&e<=119179||119210<=e&&e<=119213||119362<=e&&e<=119364||121344<=e&&e<=121398||121403<=e&&e<=121452||121461===e||121476===e||121499<=e&&e<=121503||121505<=e&&e<=121519||122880<=e&&e<=122886||122888<=e&&e<=122904||122907<=e&&e<=122913||122915<=e&&e<=122916||122918<=e&&e<=122922||123184<=e&&e<=123190||123628<=e&&e<=123631||125136<=e&&e<=125142||125252<=e&&e<=125258||127995<=e&&e<=127999||917536<=e&&e<=917631||917760<=e&&e<=917999?Hi.Extend:127462<=e&&e<=127487?Hi.RegionalIndicator:2307===e||2363===e||2366<=e&&e<=2368||2377<=e&&e<=2380||2382<=e&&e<=2383||2434<=e&&e<=2435||2495<=e&&e<=2496||2503<=e&&e<=2504||2507<=e&&e<=2508||2563===e||2622<=e&&e<=2624||2691===e||2750<=e&&e<=2752||2761===e||2763<=e&&e<=2764||2818<=e&&e<=2819||2880===e||2887<=e&&e<=2888||2891<=e&&e<=2892||3007===e||3009<=e&&e<=3010||3014<=e&&e<=3016||3018<=e&&e<=3020||3073<=e&&e<=3075||3137<=e&&e<=3140||3202<=e&&e<=3203||3262===e||3264<=e&&e<=3265||3267<=e&&e<=3268||3271<=e&&e<=3272||3274<=e&&e<=3275||3330<=e&&e<=3331||3391<=e&&e<=3392||3398<=e&&e<=3400||3402<=e&&e<=3404||3458<=e&&e<=3459||3536<=e&&e<=3537||3544<=e&&e<=3550||3570<=e&&e<=3571||3635===e||3763===e||3902<=e&&e<=3903||3967===e||4145===e||4155<=e&&e<=4156||4182<=e&&e<=4183||4228===e||6070===e||6078<=e&&e<=6085||6087<=e&&e<=6088||6435<=e&&e<=6438||6441<=e&&e<=6443||6448<=e&&e<=6449||6451<=e&&e<=6456||6681<=e&&e<=6682||6741===e||6743===e||6765<=e&&e<=6770||6916===e||6971===e||6973<=e&&e<=6977||6979<=e&&e<=6980||7042===e||7073===e||7078<=e&&e<=7079||7082===e||7143===e||7146<=e&&e<=7148||7150===e||7154<=e&&e<=7155||7204<=e&&e<=7211||7220<=e&&e<=7221||7393===e||7415===e||43043<=e&&e<=43044||43047===e||43136<=e&&e<=43137||43188<=e&&e<=43203||43346<=e&&e<=43347||43395===e||43444<=e&&e<=43445||43450<=e&&e<=43451||43454<=e&&e<=43456||43567<=e&&e<=43568||43571<=e&&e<=43572||43597===e||43755===e||43758<=e&&e<=43759||43765===e||44003<=e&&e<=44004||44006<=e&&e<=44007||44009<=e&&e<=44010||44012===e||69632===e||69634===e||69762===e||69808<=e&&e<=69810||69815<=e&&e<=69816||69932===e||69957<=e&&e<=69958||70018===e||70067<=e&&e<=70069||70079<=e&&e<=70080||70094===e||70188<=e&&e<=70190||70194<=e&&e<=70195||70197===e||70368<=e&&e<=70370||70402<=e&&e<=70403||70463===e||70465<=e&&e<=70468||70471<=e&&e<=70472||70475<=e&&e<=70477||70498<=e&&e<=70499||70709<=e&&e<=70711||70720<=e&&e<=70721||70725===e||70833<=e&&e<=70834||70841===e||70843<=e&&e<=70844||70846===e||70849===e||71088<=e&&e<=71089||71096<=e&&e<=71099||71102===e||71216<=e&&e<=71218||71227<=e&&e<=71228||71230===e||71340===e||71342<=e&&e<=71343||71350===e||71456<=e&&e<=71457||71462===e||71724<=e&&e<=71726||71736===e||71985<=e&&e<=71989||71991<=e&&e<=71992||71997===e||72e3===e||72002===e||72145<=e&&e<=72147||72156<=e&&e<=72159||72164===e||72249===e||72279<=e&&e<=72280||72343===e||72751===e||72766===e||72873===e||72881===e||72884===e||73098<=e&&e<=73102||73107<=e&&e<=73108||73110===e||73461<=e&&e<=73462||94033<=e&&e<=94087||94192<=e&&e<=94193||119142===e||119149===e?Hi.SpacingMark:4352<=e&&e<=4447||43360<=e&&e<=43388?Hi.L:4448<=e&&e<=4519||55216<=e&&e<=55238?Hi.V:4520<=e&&e<=4607||55243<=e&&e<=55291?Hi.T:44032===e||44060===e||44088===e||44116===e||44144===e||44172===e||44200===e||44228===e||44256===e||44284===e||44312===e||44340===e||44368===e||44396===e||44424===e||44452===e||44480===e||44508===e||44536===e||44564===e||44592===e||44620===e||44648===e||44676===e||44704===e||44732===e||44760===e||44788===e||44816===e||44844===e||44872===e||44900===e||44928===e||44956===e||44984===e||45012===e||45040===e||45068===e||45096===e||45124===e||45152===e||45180===e||45208===e||45236===e||45264===e||45292===e||45320===e||45348===e||45376===e||45404===e||45432===e||45460===e||45488===e||45516===e||45544===e||45572===e||45600===e||45628===e||45656===e||45684===e||45712===e||45740===e||45768===e||45796===e||45824===e||45852===e||45880===e||45908===e||45936===e||45964===e||45992===e||46020===e||46048===e||46076===e||46104===e||46132===e||46160===e||46188===e||46216===e||46244===e||46272===e||46300===e||46328===e||46356===e||46384===e||46412===e||46440===e||46468===e||46496===e||46524===e||46552===e||46580===e||46608===e||46636===e||46664===e||46692===e||46720===e||46748===e||46776===e||46804===e||46832===e||46860===e||46888===e||46916===e||46944===e||46972===e||47e3===e||47028===e||47056===e||47084===e||47112===e||47140===e||47168===e||47196===e||47224===e||47252===e||47280===e||47308===e||47336===e||47364===e||47392===e||47420===e||47448===e||47476===e||47504===e||47532===e||47560===e||47588===e||47616===e||47644===e||47672===e||47700===e||47728===e||47756===e||47784===e||47812===e||47840===e||47868===e||47896===e||47924===e||47952===e||47980===e||48008===e||48036===e||48064===e||48092===e||48120===e||48148===e||48176===e||48204===e||48232===e||48260===e||48288===e||48316===e||48344===e||48372===e||48400===e||48428===e||48456===e||48484===e||48512===e||48540===e||48568===e||48596===e||48624===e||48652===e||48680===e||48708===e||48736===e||48764===e||48792===e||48820===e||48848===e||48876===e||48904===e||48932===e||48960===e||48988===e||49016===e||49044===e||49072===e||49100===e||49128===e||49156===e||49184===e||49212===e||49240===e||49268===e||49296===e||49324===e||49352===e||49380===e||49408===e||49436===e||49464===e||49492===e||49520===e||49548===e||49576===e||49604===e||49632===e||49660===e||49688===e||49716===e||49744===e||49772===e||49800===e||49828===e||49856===e||49884===e||49912===e||49940===e||49968===e||49996===e||50024===e||50052===e||50080===e||50108===e||50136===e||50164===e||50192===e||50220===e||50248===e||50276===e||50304===e||50332===e||50360===e||50388===e||50416===e||50444===e||50472===e||50500===e||50528===e||50556===e||50584===e||50612===e||50640===e||50668===e||50696===e||50724===e||50752===e||50780===e||50808===e||50836===e||50864===e||50892===e||50920===e||50948===e||50976===e||51004===e||51032===e||51060===e||51088===e||51116===e||51144===e||51172===e||51200===e||51228===e||51256===e||51284===e||51312===e||51340===e||51368===e||51396===e||51424===e||51452===e||51480===e||51508===e||51536===e||51564===e||51592===e||51620===e||51648===e||51676===e||51704===e||51732===e||51760===e||51788===e||51816===e||51844===e||51872===e||51900===e||51928===e||51956===e||51984===e||52012===e||52040===e||52068===e||52096===e||52124===e||52152===e||52180===e||52208===e||52236===e||52264===e||52292===e||52320===e||52348===e||52376===e||52404===e||52432===e||52460===e||52488===e||52516===e||52544===e||52572===e||52600===e||52628===e||52656===e||52684===e||52712===e||52740===e||52768===e||52796===e||52824===e||52852===e||52880===e||52908===e||52936===e||52964===e||52992===e||53020===e||53048===e||53076===e||53104===e||53132===e||53160===e||53188===e||53216===e||53244===e||53272===e||53300===e||53328===e||53356===e||53384===e||53412===e||53440===e||53468===e||53496===e||53524===e||53552===e||53580===e||53608===e||53636===e||53664===e||53692===e||53720===e||53748===e||53776===e||53804===e||53832===e||53860===e||53888===e||53916===e||53944===e||53972===e||54e3===e||54028===e||54056===e||54084===e||54112===e||54140===e||54168===e||54196===e||54224===e||54252===e||54280===e||54308===e||54336===e||54364===e||54392===e||54420===e||54448===e||54476===e||54504===e||54532===e||54560===e||54588===e||54616===e||54644===e||54672===e||54700===e||54728===e||54756===e||54784===e||54812===e||54840===e||54868===e||54896===e||54924===e||54952===e||54980===e||55008===e||55036===e||55064===e||55092===e||55120===e||55148===e||55176===e?Hi.LV:44033<=e&&e<=44059||44061<=e&&e<=44087||44089<=e&&e<=44115||44117<=e&&e<=44143||44145<=e&&e<=44171||44173<=e&&e<=44199||44201<=e&&e<=44227||44229<=e&&e<=44255||44257<=e&&e<=44283||44285<=e&&e<=44311||44313<=e&&e<=44339||44341<=e&&e<=44367||44369<=e&&e<=44395||44397<=e&&e<=44423||44425<=e&&e<=44451||44453<=e&&e<=44479||44481<=e&&e<=44507||44509<=e&&e<=44535||44537<=e&&e<=44563||44565<=e&&e<=44591||44593<=e&&e<=44619||44621<=e&&e<=44647||44649<=e&&e<=44675||44677<=e&&e<=44703||44705<=e&&e<=44731||44733<=e&&e<=44759||44761<=e&&e<=44787||44789<=e&&e<=44815||44817<=e&&e<=44843||44845<=e&&e<=44871||44873<=e&&e<=44899||44901<=e&&e<=44927||44929<=e&&e<=44955||44957<=e&&e<=44983||44985<=e&&e<=45011||45013<=e&&e<=45039||45041<=e&&e<=45067||45069<=e&&e<=45095||45097<=e&&e<=45123||45125<=e&&e<=45151||45153<=e&&e<=45179||45181<=e&&e<=45207||45209<=e&&e<=45235||45237<=e&&e<=45263||45265<=e&&e<=45291||45293<=e&&e<=45319||45321<=e&&e<=45347||45349<=e&&e<=45375||45377<=e&&e<=45403||45405<=e&&e<=45431||45433<=e&&e<=45459||45461<=e&&e<=45487||45489<=e&&e<=45515||45517<=e&&e<=45543||45545<=e&&e<=45571||45573<=e&&e<=45599||45601<=e&&e<=45627||45629<=e&&e<=45655||45657<=e&&e<=45683||45685<=e&&e<=45711||45713<=e&&e<=45739||45741<=e&&e<=45767||45769<=e&&e<=45795||45797<=e&&e<=45823||45825<=e&&e<=45851||45853<=e&&e<=45879||45881<=e&&e<=45907||45909<=e&&e<=45935||45937<=e&&e<=45963||45965<=e&&e<=45991||45993<=e&&e<=46019||46021<=e&&e<=46047||46049<=e&&e<=46075||46077<=e&&e<=46103||46105<=e&&e<=46131||46133<=e&&e<=46159||46161<=e&&e<=46187||46189<=e&&e<=46215||46217<=e&&e<=46243||46245<=e&&e<=46271||46273<=e&&e<=46299||46301<=e&&e<=46327||46329<=e&&e<=46355||46357<=e&&e<=46383||46385<=e&&e<=46411||46413<=e&&e<=46439||46441<=e&&e<=46467||46469<=e&&e<=46495||46497<=e&&e<=46523||46525<=e&&e<=46551||46553<=e&&e<=46579||46581<=e&&e<=46607||46609<=e&&e<=46635||46637<=e&&e<=46663||46665<=e&&e<=46691||46693<=e&&e<=46719||46721<=e&&e<=46747||46749<=e&&e<=46775||46777<=e&&e<=46803||46805<=e&&e<=46831||46833<=e&&e<=46859||46861<=e&&e<=46887||46889<=e&&e<=46915||46917<=e&&e<=46943||46945<=e&&e<=46971||46973<=e&&e<=46999||47001<=e&&e<=47027||47029<=e&&e<=47055||47057<=e&&e<=47083||47085<=e&&e<=47111||47113<=e&&e<=47139||47141<=e&&e<=47167||47169<=e&&e<=47195||47197<=e&&e<=47223||47225<=e&&e<=47251||47253<=e&&e<=47279||47281<=e&&e<=47307||47309<=e&&e<=47335||47337<=e&&e<=47363||47365<=e&&e<=47391||47393<=e&&e<=47419||47421<=e&&e<=47447||47449<=e&&e<=47475||47477<=e&&e<=47503||47505<=e&&e<=47531||47533<=e&&e<=47559||47561<=e&&e<=47587||47589<=e&&e<=47615||47617<=e&&e<=47643||47645<=e&&e<=47671||47673<=e&&e<=47699||47701<=e&&e<=47727||47729<=e&&e<=47755||47757<=e&&e<=47783||47785<=e&&e<=47811||47813<=e&&e<=47839||47841<=e&&e<=47867||47869<=e&&e<=47895||47897<=e&&e<=47923||47925<=e&&e<=47951||47953<=e&&e<=47979||47981<=e&&e<=48007||48009<=e&&e<=48035||48037<=e&&e<=48063||48065<=e&&e<=48091||48093<=e&&e<=48119||48121<=e&&e<=48147||48149<=e&&e<=48175||48177<=e&&e<=48203||48205<=e&&e<=48231||48233<=e&&e<=48259||48261<=e&&e<=48287||48289<=e&&e<=48315||48317<=e&&e<=48343||48345<=e&&e<=48371||48373<=e&&e<=48399||48401<=e&&e<=48427||48429<=e&&e<=48455||48457<=e&&e<=48483||48485<=e&&e<=48511||48513<=e&&e<=48539||48541<=e&&e<=48567||48569<=e&&e<=48595||48597<=e&&e<=48623||48625<=e&&e<=48651||48653<=e&&e<=48679||48681<=e&&e<=48707||48709<=e&&e<=48735||48737<=e&&e<=48763||48765<=e&&e<=48791||48793<=e&&e<=48819||48821<=e&&e<=48847||48849<=e&&e<=48875||48877<=e&&e<=48903||48905<=e&&e<=48931||48933<=e&&e<=48959||48961<=e&&e<=48987||48989<=e&&e<=49015||49017<=e&&e<=49043||49045<=e&&e<=49071||49073<=e&&e<=49099||49101<=e&&e<=49127||49129<=e&&e<=49155||49157<=e&&e<=49183||49185<=e&&e<=49211||49213<=e&&e<=49239||49241<=e&&e<=49267||49269<=e&&e<=49295||49297<=e&&e<=49323||49325<=e&&e<=49351||49353<=e&&e<=49379||49381<=e&&e<=49407||49409<=e&&e<=49435||49437<=e&&e<=49463||49465<=e&&e<=49491||49493<=e&&e<=49519||49521<=e&&e<=49547||49549<=e&&e<=49575||49577<=e&&e<=49603||49605<=e&&e<=49631||49633<=e&&e<=49659||49661<=e&&e<=49687||49689<=e&&e<=49715||49717<=e&&e<=49743||49745<=e&&e<=49771||49773<=e&&e<=49799||49801<=e&&e<=49827||49829<=e&&e<=49855||49857<=e&&e<=49883||49885<=e&&e<=49911||49913<=e&&e<=49939||49941<=e&&e<=49967||49969<=e&&e<=49995||49997<=e&&e<=50023||50025<=e&&e<=50051||50053<=e&&e<=50079||50081<=e&&e<=50107||50109<=e&&e<=50135||50137<=e&&e<=50163||50165<=e&&e<=50191||50193<=e&&e<=50219||50221<=e&&e<=50247||50249<=e&&e<=50275||50277<=e&&e<=50303||50305<=e&&e<=50331||50333<=e&&e<=50359||50361<=e&&e<=50387||50389<=e&&e<=50415||50417<=e&&e<=50443||50445<=e&&e<=50471||50473<=e&&e<=50499||50501<=e&&e<=50527||50529<=e&&e<=50555||50557<=e&&e<=50583||50585<=e&&e<=50611||50613<=e&&e<=50639||50641<=e&&e<=50667||50669<=e&&e<=50695||50697<=e&&e<=50723||50725<=e&&e<=50751||50753<=e&&e<=50779||50781<=e&&e<=50807||50809<=e&&e<=50835||50837<=e&&e<=50863||50865<=e&&e<=50891||50893<=e&&e<=50919||50921<=e&&e<=50947||50949<=e&&e<=50975||50977<=e&&e<=51003||51005<=e&&e<=51031||51033<=e&&e<=51059||51061<=e&&e<=51087||51089<=e&&e<=51115||51117<=e&&e<=51143||51145<=e&&e<=51171||51173<=e&&e<=51199||51201<=e&&e<=51227||51229<=e&&e<=51255||51257<=e&&e<=51283||51285<=e&&e<=51311||51313<=e&&e<=51339||51341<=e&&e<=51367||51369<=e&&e<=51395||51397<=e&&e<=51423||51425<=e&&e<=51451||51453<=e&&e<=51479||51481<=e&&e<=51507||51509<=e&&e<=51535||51537<=e&&e<=51563||51565<=e&&e<=51591||51593<=e&&e<=51619||51621<=e&&e<=51647||51649<=e&&e<=51675||51677<=e&&e<=51703||51705<=e&&e<=51731||51733<=e&&e<=51759||51761<=e&&e<=51787||51789<=e&&e<=51815||51817<=e&&e<=51843||51845<=e&&e<=51871||51873<=e&&e<=51899||51901<=e&&e<=51927||51929<=e&&e<=51955||51957<=e&&e<=51983||51985<=e&&e<=52011||52013<=e&&e<=52039||52041<=e&&e<=52067||52069<=e&&e<=52095||52097<=e&&e<=52123||52125<=e&&e<=52151||52153<=e&&e<=52179||52181<=e&&e<=52207||52209<=e&&e<=52235||52237<=e&&e<=52263||52265<=e&&e<=52291||52293<=e&&e<=52319||52321<=e&&e<=52347||52349<=e&&e<=52375||52377<=e&&e<=52403||52405<=e&&e<=52431||52433<=e&&e<=52459||52461<=e&&e<=52487||52489<=e&&e<=52515||52517<=e&&e<=52543||52545<=e&&e<=52571||52573<=e&&e<=52599||52601<=e&&e<=52627||52629<=e&&e<=52655||52657<=e&&e<=52683||52685<=e&&e<=52711||52713<=e&&e<=52739||52741<=e&&e<=52767||52769<=e&&e<=52795||52797<=e&&e<=52823||52825<=e&&e<=52851||52853<=e&&e<=52879||52881<=e&&e<=52907||52909<=e&&e<=52935||52937<=e&&e<=52963||52965<=e&&e<=52991||52993<=e&&e<=53019||53021<=e&&e<=53047||53049<=e&&e<=53075||53077<=e&&e<=53103||53105<=e&&e<=53131||53133<=e&&e<=53159||53161<=e&&e<=53187||53189<=e&&e<=53215||53217<=e&&e<=53243||53245<=e&&e<=53271||53273<=e&&e<=53299||53301<=e&&e<=53327||53329<=e&&e<=53355||53357<=e&&e<=53383||53385<=e&&e<=53411||53413<=e&&e<=53439||53441<=e&&e<=53467||53469<=e&&e<=53495||53497<=e&&e<=53523||53525<=e&&e<=53551||53553<=e&&e<=53579||53581<=e&&e<=53607||53609<=e&&e<=53635||53637<=e&&e<=53663||53665<=e&&e<=53691||53693<=e&&e<=53719||53721<=e&&e<=53747||53749<=e&&e<=53775||53777<=e&&e<=53803||53805<=e&&e<=53831||53833<=e&&e<=53859||53861<=e&&e<=53887||53889<=e&&e<=53915||53917<=e&&e<=53943||53945<=e&&e<=53971||53973<=e&&e<=53999||54001<=e&&e<=54027||54029<=e&&e<=54055||54057<=e&&e<=54083||54085<=e&&e<=54111||54113<=e&&e<=54139||54141<=e&&e<=54167||54169<=e&&e<=54195||54197<=e&&e<=54223||54225<=e&&e<=54251||54253<=e&&e<=54279||54281<=e&&e<=54307||54309<=e&&e<=54335||54337<=e&&e<=54363||54365<=e&&e<=54391||54393<=e&&e<=54419||54421<=e&&e<=54447||54449<=e&&e<=54475||54477<=e&&e<=54503||54505<=e&&e<=54531||54533<=e&&e<=54559||54561<=e&&e<=54587||54589<=e&&e<=54615||54617<=e&&e<=54643||54645<=e&&e<=54671||54673<=e&&e<=54699||54701<=e&&e<=54727||54729<=e&&e<=54755||54757<=e&&e<=54783||54785<=e&&e<=54811||54813<=e&&e<=54839||54841<=e&&e<=54867||54869<=e&&e<=54895||54897<=e&&e<=54923||54925<=e&&e<=54951||54953<=e&&e<=54979||54981<=e&&e<=55007||55009<=e&&e<=55035||55037<=e&&e<=55063||55065<=e&&e<=55091||55093<=e&&e<=55119||55121<=e&&e<=55147||55149<=e&&e<=55175||55177<=e&&e<=55203?Hi.LVT:8205===e?Hi.ZWJ:Hi.Other}));var eo=Ki.breakType,ro=Ki.breakProperty,to=Ki.emojiProperty;function no(e,r){var t,n,i,o,a,u;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(arguments.length>1){if(!Ot(r))throw new TypeError(ir("invalid argument. Second argument must be an integer. Value: `%s`.",r));o=r}else o=0;if(i=e.length,o<0&&(o+=i)<0&&(o=0),0===i||o>=i)return-1;for(t=[],n=[],a=Wi(e,o),t.push(ro(a)),n.push(to(a)),u=o+1;u0))return u;return-1}function io(e,r){for(var t=0;r>0;)t=no(e,t),r-=1;return""===e||-1===t?e:e.substring(0,t)}function oo(e,r,t){var n;for(n=0;n0){if(t=function(e,r){return Wn(r)?q(r,"flags")&&(e.flags=r.flags,!U(e.flags))?new TypeError(R("invalid option. `%s` option must be a string. Option: `%s`.","flags",e.flags)):q(r,"capture")&&(e.capture=r.capture,!oe(e.capture))?new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","capture",e.capture)):null:new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",r))}(r={},e),t)throw t;return r.capture?new RegExp("("+co+")",r.flags):new RegExp(co,r.flags)}return/[\u0009\u000A\u000B\u000C\u000D\u0020\u0085\u00A0\u1680\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]/}var po=go({capture:!0}),mo=go();function vo(e){var r,t,n,i;for(r=!0,t="",i=0;i?`{}|~\/\\\[\]_#$*&^@%]+/g,bo=/([a-z0-9])([A-Z])/g;function Eo(e){return e=or(e,wo," "),e=or(e,bo,"$1 $2"),or(e=vo(e=yr(e=li(e))),yo,"-")}var To=/\s+/g,_o=/[!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g,Vo=/([a-z0-9])([A-Z])/g;function Ao(e){return e=or(e,_o," "),e=or(e,Vo,"$1 $2"),yr(e=or(e=li(e),To,"-"))}function xo(e,r){var t=e.length;return e.substring(t-r,t)}var Fo=/[\uDC00-\uDFFF]/,So=/[\uD800-\uDBFF]/;function Lo(e,r){var t,n,i,o,a,u;if(t=e.length,n="",a=0,""===e||0===r)return"";if(1===r)return e=e.substring(t-2,t),Pi.test(e)?e:e[1];for(u=t-1;u>=0;u--){if(n=(i=e[u])+n,a+=1,Fo.test(i)){if(0===u)break;o=e[u-1],So.test(o)&&(n=o+n,u-=1)}if(a===r)break}return n}function Oo(e){return Ot(e)&&e>0}function Ro(e){return Rt(e)&&e.valueOf()>0}function No(e){return Oo(e)||Ro(e)}Y(No,"isPrimitive",Oo),Y(No,"isObject",Ro);var Mo={float64:function(e,r,t){e[r]=t},float32:function(e,r,t){e[r]=t},int32:function(e,r,t){e[r]=t},int16:function(e,r,t){e[r]=t},int8:function(e,r,t){e[r]=t},uint32:function(e,r,t){e[r]=t},uint16:function(e,r,t){e[r]=t},uint8:function(e,r,t){e[r]=t},uint8c:function(e,r,t){e[r]=t},generic:function(e,r,t){e[r]=t},default:function(e,r,t){e[r]=t}};function ko(e){var r=Mo[e];return"function"==typeof r?r:Mo.default}var jo={complex128:function(e,r,t){e.set(t,r)},complex64:function(e,r,t){e.set(t,r)},default:function(e,r,t){e.set(t,r)}};function Co(e){var r=jo[e];return"function"==typeof r?r:jo.default}function Io(e){var r=Cn(e);return br(e)?{data:e,dtype:r,accessorProtocol:!0,accessors:[Tr(r),Co(r)]}:{data:e,dtype:r,accessorProtocol:!1,accessors:[Vr(r),ko(r)]}}function Do(e){var r,t;if(!(this instanceof Do))return new Do(e);if(Oo(e))for(r=[],t=0;ti)return{done:!0};if(t._count!==t._length)return n=!0,{done:!0};return a=(a+1)%t._length,{value:t._buffer.accessors[0](t._buffer.data,a),done:!1}})),Y(r,"return",(function(e){if(n=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(r,on,(function(){return t.iterator(i)})),r})),an(Do.prototype,"length",(function(){return this._length})),Y(Do.prototype,"push",(function(e){var r,t,n,i;return n=this._buffer.data,t=this._buffer.accessors[0],r=this._buffer.accessors[1],this._i=(this._i+1)%this._length,this._count>>=1);)e+=e;return t},$o=Math.ceil;function Wo(e,r,t){var n=(r-e.length)/t.length;return n<=0?e:(n=$o(n),Uo(t,n)+e)}var zo=void 0!==String.prototype.trimLeft,Go=/^[\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/;var qo=String.prototype.trimLeft;var Jo=zo?function(e){return qo.call(e)}:function(e){return or(e,Go,"")},Zo=/\s+/g,Ho=/[-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g,Qo=/(?:\s|^)([^\s]+)(?=\s|$)/g,Xo=/([a-z0-9])([A-Z])/g;function Ko(e,r){return oi(yr(r))}function ea(e){return e=or(e,Ho," "),e=or(e,Zo," "),e=or(e,Xo,"$1 $2"),or(e=li(e),Qo,Ko)}var ra=63,ta=128,na=192,ia=224,oa=240,aa=1023,ua=2048,sa=55296,la=57344,fa=65536;function ha(e){var r,t,n,i;if(!U(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));for(n=e.length,t=[],i=0;i>6),t.push(ta|r&ra)):r=la?(t.push(ia|r>>12),t.push(ta|r>>6&ra),t.push(ta|r&ra)):(i+=1,r=fa+((r&aa)<<10|e.charCodeAt(i)&aa),t.push(oa|r>>18),t.push(ta|r>>12&ra),t.push(ta|r>>6&ra),t.push(ta|r&ra));return t}var ca=95,ga=46,pa=45,ma=126,va=48,da=57,ya=65,wa=90,ba=97,Ea=122;function Ta(e){var r,t,n,i,o;for(n=(i=ha(e)).length,t="",o=0;o=va&&r<=da||r>=ya&&r<=wa||r>=ba&&r<=Ea||r===pa||r===ga||r===ca||r===ma?e.charAt(o):"%"+r.toString(16).toUpperCase();return t}function _a(e,r){return e.substring(r,e.length)}var Va=/[\uDC00-\uDFFF]/,Aa=/[\uD800-\uDBFF]/;function xa(e,r){var t,n,i,o,a;if(0===r)return e;for(t=e.length,o=0,a=0;a0;)t=no(e,t),r-=1;return""===e||-1===t?"":e.substring(t,e.length)}function Sa(e,r){return e.substring(0,e.length-r)}var La=/[\uDC00-\uDFFF]/,Oa=/[\uD800-\uDBFF]/;function Ra(e,r){var t,n,i,o;if(0===r)return e;for(i=0,o=e.length-1;o>=0;o--){if(t=e[o],i+=1,La.test(t)){if(0===o)break;n=e[o-1],Oa.test(n)&&(o-=1)}if(i===r)break}return e.substring(0,o)}function Na(e){var r,t,n;if(!U(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));for(r=0,n=no(e,t=0);-1!==n;)r+=1,n=no(e,t=n);return t=e.length)return e;return i=e.indexOf(r,n),""===e||""===r||""===t||i<0?e:t+e.substring(i)}function ja(e){var r,t;for(r="",t=e.length-1;t>=0;t--)r+=e[t];return r}var Ca=/[\uDC00-\uDFFF]/,Ia=/[\uD800-\uDBFF]/;function Da(e){var r,t,n,i,o;for(r=e.length,t="",o=0;or?e:r}var Ha=/[\uDC00-\uDFFF]/,Qa=/[\uD800-\uDBFF]/;var Xa=/\s+/g,Ka=/[\-!"'(),–.:;<>?`{}|~\/\\\[\]_#$*&^@%]+/g,eu=/([a-z0-9])([A-Z])/g;function ru(e){return e=or(e,Ka," "),e=or(e,eu,"$1 $2"),yr(e=or(e=li(e),Xa,"_"))}var tu=void 0!==String.prototype.startsWith;var nu=String.prototype.startsWith;var iu=tu?function(e,r,t){var n;return n=t<0?e.length+t:t,0===r.length||!(n<0||n+r.length>e.length)&&nu.call(e,r,n)}:function(e,r,t){var n,i;if(n=t<0?e.length+t:t,0===r.length)return!0;if(n<0||n+r.length>e.length)return!1;for(i=0;i=0&&e<=1}function uu(e){return Vt(e)&&e.valueOf()>=0&&e.valueOf()<=1}function su(e){return au(e)||uu(e)}function lu(e){return function(){return e}}function fu(){}Y(su,"isPrimitive",au),Y(su,"isObject",uu);var hu=9007199254740991;function cu(e,r){return Fi(e)||Fi(r)?NaN:e===Nr||r===Nr?Nr:e===r&&0===e?function(e){return 0===e&&1/e===Nr}(e)?e:r:e>r?e:r}var gu,pu="function"==typeof Math.imul?Math.imul:null;gu="function"==typeof pu?pu:function(e,r){var t,n;return((t=(65535&(e|=0))>>>0)*(n=(65535&(r|=0))>>>0)>>>0)+((e>>>16>>>0)*n+t*(r>>>16>>>0)<<16>>>0)|0};var mu=gu;function vu(e,r){return mu(e,r)>>>0}function du(e,r,t,n,i,o,a){var u,s,l,f,h,c,g;for(u=r.data,s=i.data,f=r.accessors[0],l=i.accessors[1],h=n,c=a,g=0;g0)for(f=0;f0)for(c=0;cxt&&e65504||isNaN(r)?i*Nr:i*r)};var Nu=Ou,Mu=Et.NEGATIVE_INFINITY;var ku=new Cr(1),ju=new $r(ku.buffer);function Cu(e){return ku[0]=e,ju[0]}var Iu=127,Du=2139095040;var Bu=new Cr(1);new $r(Bu.buffer)[0]=4286578688;var Pu=Bu[0];var Yu=8388607,Uu=32256,$u=31744,Wu=64512,zu=0,Gu=32768,qu=8388608,Ju=8191,Zu=4095,Hu=1023;function Qu(e){var r,t,n,i,o,a,u,s;return function(e){return e!=e}(e)?Uu:e===Tu?$u:e===Mu?Wu:0===e?function(e){return 0===e&&1/e===Pu}(e)?Gu:zu:(s=e<0?1:0,u=Cu(e=function(e){return Math.abs(e)}(e))&Yu,r=function(e){var r=Cu(e);return(r=(r&Du)>>>23)-Iu}(e),(t=r+15)>=31?s?Wu:$u:t<=0?t<-10?s<<15:(i=(qu|u)>>>13,(a=1-t)<11?(o=i>>>a-1&1,(n=0!=(i&(1<>>13-(a-11)-1&1,n=0!=(u&(1<<13-(a-11)-1)-1)),i>>>=a,o&&(n||1&i)&&(i+=1),s<<15|i):(i=u>>>13,n=0!=(u&Zu),(o=u>>>12&1)&&(n||1&i)&&(i+=1)>Hu&&(i=0,(t+=1)>=31)?s?Wu:$u:s<<15|t<<10|i))}var Xu=1023,Ku=-1022,es=Math.round,rs=1023,ts=-1023,ns=-1074;function is(e){return e===Nr||e===xt}var os=2147483648,as=2147483647,us={uint16:Kr,uint8:lt};var ss,ls,fs,hs=((ss=new us.uint16(1))[0]=4660,52===new us.uint8(ss.buffer)[0]);!0===hs?(ls=1,fs=0):(ls=0,fs=1);var cs={HIGH:ls,LOW:fs},gs=new Or(1),ps=new $r(gs.buffer),ms=cs.HIGH,vs=cs.LOW;function ds(e,r,t,n){return gs[0]=e,r[n]=ps[ms],r[n+t]=ps[vs],r}function ys(e){return ds(e,[0,0],1,0)}Y(ys,"assign",ds);var ws,bs,Es=!0===hs?1:0,Ts=new Or(1),_s=new $r(Ts.buffer);function Vs(e){return Ts[0]=e,_s[Es]}!0===hs?(ws=1,bs=0):(ws=0,bs=1);var As={HIGH:ws,LOW:bs},xs=new Or(1),Fs=new $r(xs.buffer),Ss=As.HIGH,Ls=As.LOW;function Os(e,r){return Fs[Ss]=e,Fs[Ls]=r,xs[0]}var Rs=[0,0];var Ns=22250738585072014e-324,Ms=4503599627370496;function ks(e,r,t,n){return Fi(e)||is(e)?(r[n]=e,r[n+t]=0,r):0!==e&&Lu(e)>>20)-rs|0}(e),rXu?e<0?xt:Nr:(r<=ts?(r+=52,n=Cs):n=1,ys.assign(e,Bs,1,0),t=Bs[0],t&=Is,n*Os(t|=r+rs<<20,Bs[1])))}function Ys(e){var r,t,n;return Fi(e)?e:e>Xu?Nr:e>>15,r=1023&e,(t=(31744&e)>>>10)===Us?0===r?1===n?Mu:Tu:NaN:0===t?0===r?1===n?-0:0:(i=Ys(-14)*(r/1024),n?-i:i):(i=Ys(t-15)*(1+r/1024),n?-i:i)}function Ws(e){var r,t;for(r=[];!(t=e.next()).done;)r.push(Qu(Nu(t.value)));return r}var zs=Kr.BYTES_PER_ELEMENT,Gs=nn();function qs(e){return"object"==typeof e&&null!==e&&"Float16Array"===e.constructor.name&&e.BYTES_PER_ELEMENT===zs}function Js(e){return e===Qs}function Zs(e,r){return function(){return e._get(r)}}function Hs(e,r){return function(t){e.set([t],r)}}function Qs(){var e,r,t,n,i,o;if(r=arguments.length,!(this instanceof Qs))return 0===r?new Qs:1===r?new Qs(arguments[0]):2===r?new Qs(arguments[0],arguments[1]):new Qs(arguments[0],arguments[1],arguments[2]);if(0===r)t=new Kr(0);else if(1===r)if(Mt(i=arguments[0]))t=new Kr(i);else if(Bt(i))qs(i)?(t=new Kr(i.length),wu.ndarray(i.length,new Kr(i.buffer,i.byteOffset,i.length),1,0,t,1,0)):t=function(e,r){var t,n;for(t=r.length,n=0;nt.byteLength-e)throw new RangeError(R("invalid arguments. ArrayBuffer has insufficient capacity. Either decrease the array length or provide a bigger buffer. Minimum capacity: `%u`.",n*zs));t=new Kr(t,e,n)}}for(Y(this,"_buffer",t),Y(this,"_length",t.length),o=0;o1){if(!xe(n=arguments[1]))throw new TypeError(R("invalid argument. Second argument must be a function. Value: `%s`.",n));t>2&&(r=arguments[2])}if(Bt(e)){if(n){for(o=(i=new this(u=e.length))._buffer,s=0;s=this._length))return $s(this._buffer[e])})),an(Qs.prototype,"buffer",(function(){return this._buffer.buffer})),an(Qs.prototype,"byteLength",(function(){return this._buffer.byteLength})),an(Qs.prototype,"byteOffset",(function(){return this._buffer.byteOffset})),Y(Qs.prototype,"BYTES_PER_ELEMENT",Qs.BYTES_PER_ELEMENT),Y(Qs.prototype,"copyWithin",(function(e,r){if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");return 2===arguments.length?this._buffer.copyWithin(e,r):this._buffer.copyWithin(e,r,arguments[2]),this})),Y(Qs.prototype,"entries",(function(){var e,r,t,n,i,o;if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");return e=this,n=this._buffer,t=this._length,o=-1,Y(r={},"next",(function(){if(o+=1,i||o>=t)return{done:!0};return{value:[o,$s(n[o])],done:!1}})),Y(r,"return",(function(e){if(i=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(r,on,(function(){return e.entries()})),r})),Y(Qs.prototype,"every",(function(e,r){var t,n;if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n1){if(!Ot(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));if(r<0&&(r+=i)<0&&(r=0),arguments.length>2){if(!Ot(t))throw new TypeError(R("invalid argument. Third argument must be an integer. Value: `%s`.",t));t<0&&(t+=i)<0&&(t=0),t>i&&(t=i)}else t=i}else r=0,t=i;for(a=Qu(e),o=r;o=0;i--)if(n=$s(t[i]),e.call(r,n,i,this))return n})),Y(Qs.prototype,"findLastIndex",(function(e,r){var t,n,i;if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,i=this._length-1;i>=0;i--)if(n=$s(t[i]),e.call(r,n,i,this))return i;return-1})),Y(Qs.prototype,"forEach",(function(e,r){var t,n;if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));for(t=this._buffer,n=0;n=this._length))return $s(this._buffer[e])})),Y(Qs.prototype,"includes",(function(e,r){var t,n,i;if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!bt(e))throw new TypeError(R("invalid argument. First argument must be a number. Value: `%s`.",e));if(arguments.length>1){if(!Ot(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(t=this._buffer,i=Qu(e),n=r;n1){if(!Ot(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0&&(r+=this._length)<0&&(r=0)}else r=0;for(t=this._buffer,i=Qu(e),n=r;n0){if(!U(e))throw new TypeError(R("invalid argument. First argument must be a string. Value: `%s`.",e))}else e=",";for(r=this._buffer,t=[],n=0;n=t)return{done:!0};return{value:i,done:!1}})),Y(r,"return",(function(e){if(n=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(r,on,(function(){return e.keys()})),r})),Y(Qs.prototype,"lastIndexOf",(function(e,r){var t,n,i;if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!bt(e))throw new TypeError(R("invalid argument. First argument must be a number. Value: `%s`.",e));if(arguments.length>1){if(!Ot(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r>=this._length?r=this._length-1:r<0&&(r+=this._length)}else r=this._length-1;for(t=this._buffer,i=Qu(e),n=r;n>=0;n--)if(i===t[n])return n;return-1})),an(Qs.prototype,"length",(function(){return this._length})),Y(Qs.prototype,"map",(function(e,r){var t,n,i,o;if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!xe(e))throw new TypeError("invalid argument. First argument must be a function. Value: `%s`.",e);for(i=this._buffer,t=(n=new this.constructor(this._length))._buffer,o=0;o1)i=r,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=$s(t[0]),o=1}for(;o1)i=r,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=$s(t[n-1]),o=n-2}for(;o>=0;o--)i=e(i,$s(t[o]),o,this);return i})),Y(Qs.prototype,"reverse",(function(){var e,r,t,n,i,o;if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");for(e=this._buffer,t=this._length,n=Ft(t/2),i=0;i1){if(!Mt(t=arguments[1]))throw new TypeError(R("invalid argument. Index argument must be a nonnegative integer. Value: `%s`.",t))}else t=0;if(t+(a=e.length)>this._length)throw new RangeError("invalid arguments. Target array lacks sufficient storage to accommodate source values.");if(qs(e)?(r=e._buffer,o=!0):(r=e,o=!1),s=n.byteOffset+t*zs,r.buffer===n.buffer&&r.byteOffsets){for(i=new Kr(r.length),u=0;ua&&(r=a)}}for(t=en)return 1;return 0})),this;if(!xe(e))throw new TypeError(R("invalid argument. First argument must be a function. Value: `%s`.",e));return r.sort((function(r,t){return e($s(r),$s(t))})),this})),Y(Qs.prototype,"subarray",(function(e,r){var t,n,i;if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(n=this._buffer,i=this._length,0===arguments.length)e=0,r=i;else{if(!Ot(e))throw new TypeError(R("invalid argument. First argument must be an integer. Value: `%s`.",e));if(e<0&&(e+=i)<0&&(e=0),1===arguments.length)r=i;else{if(!Ot(r))throw new TypeError(R("invalid argument. Second argument must be an integer. Value: `%s`.",r));r<0?(r+=i)<0&&(r=0):r>i&&(r=i)}}return e>=i?(i=0,t=n.byteLength):e>=r?(i=0,t=n.byteOffset+e*zs):(i=r-e,t=n.byteOffset+e*zs),new this.constructor(n.buffer,t,i<0?0:i)})),Y(Qs.prototype,"toLocaleString",(function(e,r){var t,n,i,o,a;if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(0===arguments.length)n=[];else{if(!U(e)&&!$t(e))throw new TypeError(R("invalid argument. First argument must be a string or an array of strings. Value: `%s`.",e));n=e}if(arguments.length<2)t={};else{if(!Ut(r))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",r));t=r}for(o=this._buffer,i=[],a=0;a=t)return{done:!0};return{value:$s(i[o]),done:!1}})),Y(e,"return",(function(e){if(n=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(e,on,(function(){return r.values()})),e})),Y(Qs.prototype,"with",(function(e,r){var t,n;if(!qs(this))throw new TypeError("invalid invocation. `this` is not a floating-point number array.");if(!Ot(e))throw new TypeError(R("invalid argument. First argument must be an integer. Value: `%s`.",e));if(n=this._length,e<0&&(e+=n),e<0||e>=n)throw new RangeError(R("invalid argument. Index argument is out-of-bounds. Value: `%s`.",e));if(!bt(r))throw new TypeError(R("invalid argument. Second argument must be a number. Value: `%s`.",r));return(t=new this.constructor(this))[e]=r,t}));var Xs,Ks="function"==typeof Float16Array?Float16Array:void 0;Xs=function(){var e,r;if("function"!=typeof _u)return!1;try{e="object"==typeof(r=new _u([1,3.14,-3.14,5e40]))&&null!==r&&"Float16Array"===r.constructor.name&&2===r.BYTES_PER_ELEMENT&&1===r[0]&&3.14!==r[1]&&-3.14!==r[2]&&r[3]===Tu&&4===r.length}catch(r){e=!1}return e}()?Ks:Qs;var el=[Or,Cr,Xs,Jr,$r,it,Kr,wt,lt,pt],rl=["Int8Array","Uint8Array","Uint8ClampedArray","Int16Array","Uint16Array","Int32Array","Uint32Array","Float16Array","Float32Array","Float64Array"],tl=Sr()?Un(Or):nl;function nl(){}tl="TypedArray"===function(e){if(!1===xe(e))throw new TypeError(R("invalid argument. Must provide a function. Value: `%s`.",e));return Eu?e.name:we.exec(e.toString())[1]}(tl)?tl:nl;var il=[xn,dn],ol=["Complex64Array","Complex128Array"];function al(){return"function"==typeof Z&&"symbol"==typeof Z("foo")&&q(Z,"hasInstance")&&"symbol"==typeof Z.hasInstance}var ul=al()?Symbol.hasInstance:null,sl=al();function ll(e,r){if("function"!=typeof r&&(!sl||"object"!=typeof r||"function"!=typeof r[ul]))throw new TypeError(R("invalid argument. Second argument must be callable. Value: `%s`.",r));return e instanceof r}var fl=[[Or,"Float64Array"],[Cr,"Float32Array"],[Jr,"Int32Array"],[$r,"Uint32Array"],[it,"Int16Array"],[Kr,"Uint16Array"],[wt,"Int8Array"],[lt,"Uint8Array"],[pt,"Uint8ClampedArray"],[dn,"Complex64Array"],[xn,"Complex128Array"],[Nn,"BooleanArray"]];function hl(e){var r,t;for(t=0;t>>0}var ml=624,vl=397,dl=Br>>>0,yl=19650218,wl=2147483648,bl=2147483647,El=1812433253,Tl=1664525,_l=1566083941,Vl=2636928640,Al=4022730752,xl=[0,2567483615],Fl=1/(hu+1),Sl=67108864,Ll=2147483648,Ol=1,Rl=hu*Fl,Nl=1,Ml=3,kl=2,jl=ml+3,Cl=ml+5,Il=ml+6;function Dl(e,r){var t;return t=r?"option":"argument",e.length>>0,n=1;n>>0)^t>>>30)>>>0,e[n]=vu(t,El)+n>>>0;return e}function Pl(e){var r,t,n,i,o,a;if(n={},arguments.length){if(!Wn(e))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));if(q(e,"copy")&&(n.copy=e.copy,!oe(e.copy)))throw new TypeError(R("invalid option. `%s` option must be a boolean. Option: `%s`.","copy",e.copy));if(q(e,"state")){if(t=e.state,n.state=!0,!Dr(t))throw new TypeError(R("invalid option. `%s` option must be a Uint32Array. Option: `%s`.","state",t));if(a=Dl(t,!0))throw a;!1===n.copy?r=t:(r=new $r(t.length),wu(t.length,t,1,r,1)),t=new $r(r.buffer,r.byteOffset+(kl+1)*r.BYTES_PER_ELEMENT,ml),i=new $r(r.buffer,r.byteOffset+(Cl+1)*r.BYTES_PER_ELEMENT,t[Cl])}if(void 0===i)if(q(e,"seed"))if(i=e.seed,n.seed=!0,Oo(i)){if(i>dl)throw new RangeError(R("invalid option. `%s` option must be a positive integer less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.","seed",i));i>>>=0}else{if(!1===Bt(i)||i.length<1)throw new TypeError(R("invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.","seed",i));if(1===i.length){if(!Oo(i=i[0]))throw new TypeError(R("invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.","seed",i));if(i>dl)throw new RangeError(R("invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.","seed",i));i>>>=0}else o=i.length,(r=new $r(Il+o))[0]=Nl,r[1]=Ml,r[kl]=ml,r[jl]=1,r[jl+1]=ml,r[Cl]=o,wu.ndarray(o,i,1,0,r,1,Cl+1),t=new $r(r.buffer,r.byteOffset+(kl+1)*r.BYTES_PER_ELEMENT,ml),i=new $r(r.buffer,r.byteOffset+(Cl+1)*r.BYTES_PER_ELEMENT,o),t=function(e,r,t,n){var i,o,a,u;for(o=1,a=0,u=cu(r,n);u>0;u--)i=vu(i=((i=e[o-1]>>>0)^i>>>30)>>>0,Tl)>>>0,e[o]=(e[o]>>>0^i)+t[a]+a>>>0,a+=1,(o+=1)>=r&&(e[0]=e[r-1],o=1),a>=n&&(a=0);for(u=r-1;u>0;u--)i=vu(i=((i=e[o-1]>>>0)^i>>>30)>>>0,_l)>>>0,e[o]=(e[o]>>>0^i)-o>>>0,(o+=1)>=r&&(e[0]=e[r-1],o=1);return e[0]=Ll,e}(t=Bl(t,ml,yl),ml,i,o)}else i=pl()>>>0}else i=pl()>>>0;return void 0===t&&((r=new $r(Il+1))[0]=Nl,r[1]=Ml,r[kl]=ml,r[jl]=1,r[jl+1]=ml,r[Cl]=1,r[Cl+1]=i,t=new $r(r.buffer,r.byteOffset+(kl+1)*r.BYTES_PER_ELEMENT,ml),i=new $r(r.buffer,r.byteOffset+(Cl+1)*r.BYTES_PER_ELEMENT,1),t=Bl(t,ml,i)),Y(p,"NAME","mt19937"),an(p,"seed",u),an(p,"seedLength",s),ou(p,"state",h,c),an(p,"stateLength",l),an(p,"byteLength",f),Y(p,"toJSON",g),Y(p,"MIN",0),Y(p,"MAX",Br),Y(p,"normalized",m),Y(m,"NAME",p.NAME),an(m,"seed",u),an(m,"seedLength",s),ou(m,"state",h,c),an(m,"stateLength",l),an(m,"byteLength",f),Y(m,"toJSON",g),Y(m,"MIN",0),Y(m,"MAX",Rl),p;function u(){var e=r[Cl];return wu(e,i,1,new $r(e),1)}function s(){return r[Cl]}function l(){return r.length}function f(){return r.byteLength}function h(){var e=r.length;return wu(e,r,1,new $r(e),1)}function c(e){var o;if(!Dr(e))throw new TypeError(R("invalid argument. Must provide a Uint32Array. Value: `%s`.",e));if(o=Dl(e,!1))throw o;!1===n.copy?n.state&&e.length===r.length?wu(e.length,e,1,r,1):(r=e,n.state=!0):(e.length!==r.length&&(r=new $r(e.length)),wu(e.length,e,1,r,1)),t=new $r(r.buffer,r.byteOffset+(kl+1)*r.BYTES_PER_ELEMENT,ml),i=new $r(r.buffer,r.byteOffset+(Cl+1)*r.BYTES_PER_ELEMENT,r[Cl])}function g(){var e={type:"PRNG"};return e.name=p.NAME,e.state=cl(r),e.params=[],e}function p(){var e,n;return(n=r[jl+1])>=ml&&(t=function(e){var r,t,n,i;for(i=ml-vl,t=0;t>>1^xl[r&Ol];for(n=ml-1;t>>1^xl[r&Ol];return r=e[n]&wl|e[0]&bl,e[n]=e[vl-1]^r>>>1^xl[r&Ol],e}(t),n=0),e=t[n],r[jl+1]=n+1,e^=e>>>11,e^=e<<7&Vl,e^=e<<15&Al,(e^=e>>>18)>>>0}function m(){var e=p()>>>5,r=p()>>>6;return(e*Sl+r)*Fl}}function Yl(){var e,r,t,n;if(0===arguments.length)r=Pl();else if(1===arguments.length&&Wn(arguments[0]))if(q(e=arguments[0],"prng")){if(!xe(e.prng))throw new TypeError(R("invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.","prng",e.prng));r=e.prng}else r=Pl(e);else{if(!au(n=arguments[0]))throw new TypeError(R("invalid argument. First argument must be a probability. Value: `%s`.",n));if(arguments.length>1){if(!Wn(e=arguments[1]))throw new TypeError(R("invalid argument. Options argument must be an object. Value: `%s`.",e));if(q(e,"prng")){if(!xe(e.prng))throw new TypeError(R("invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.","prng",e.prng));r=e.prng}else r=Pl(e)}else r=Pl()}return Y(t=void 0===n?function(e){if(Fi(e)||e<0||e>1)return NaN;return r()<=e?1:0}:function(){return r()<=n?1:0},"NAME","bernoulli"),e&&e.prng?(Y(t,"seed",null),Y(t,"seedLength",null),ou(t,"state",lu(null),fu),Y(t,"stateLength",null),Y(t,"byteLength",null),Y(t,"toJSON",lu(null)),Y(t,"PRNG",r)):(an(t,"seed",(function(){return r.seed})),an(t,"seedLength",(function(){return r.seedLength})),ou(t,"state",(function(){return r.state}),(function(e){r.state=e})),an(t,"stateLength",(function(){return r.stateLength})),an(t,"byteLength",(function(){return r.byteLength})),Y(t,"toJSON",(function(){var e={type:"PRNG"};e.name=t.NAME,e.state=cl(r.state),e.params=void 0===n?[]:[n];return e})),Y(t,"PRNG",r),r=r.normalized),t}Y(Pl({seed:pl()}),"factory",Pl);var Ul=Yl();function $l(e){return""===e?"":e.charAt(0).toLowerCase()+e.slice(1)}Y(Ul,"factory",Yl);var Wl={};P(Wl,"altcase",(function(e){var r,t="";for(r=0;r=0;u--)o=u,a=n=e[u],u>0&&lo.test(n)&&(i=e[u-1],fo.test(i)&&(a=i+n,u-=1)),r.call(t,a,o,e);return e})),P(Wl,"forEachGraphemeCluster",ho),P(Wl,"forEachRight",(function(e,r,t){var n;for(n=e.length-1;n>=0;n--)r.call(t,e[n],n,e);return e})),P(Wl,"formatInterpolate",er),P(Wl,"formatTokenize",nr),P(Wl,"headercase",Eo),P(Wl,"invcase",(function(e){var r,t,n,i;for(r=[],i=0;i=e.length)return e;return i=e.indexOf(r,n),""===e||""===r||""===t||i<0?e:e.substring(0,i+r.length)+t})),P(Wl,"replaceAfterLast",(function(e,r,t,n){var i;return n<0&&(n+=e.length)<0?e:(i=e.lastIndexOf(r,n),""===e||""===r||""===t||i<0?e:e.substring(0,i+r.length)+t)})),P(Wl,"replaceBefore",ka),P(Wl,"replaceBeforeLast",(function(e,r,t,n){var i;return n<0&&(n+=e.length)<0?e:(i=e.lastIndexOf(r,n),""===e||""===r||""===t||i<0?e:t+e.substring(i))})),P(Wl,"reverse",ja),P(Wl,"reverseCodePoints",Da),P(Wl,"reverseGraphemeClusters",Ba),P(Wl,"rpad",Pa),P(Wl,"rtrim",Wa),P(Wl,"slice",(function(e,r,t){return za.call(e,r,t)})),P(Wl,"sliceCodePoints",(function(e,r,t){var n,i,o,a,u,s,l,f;if(0===(o=e.length))return"";if(n=Ja(e),r<0&&(r=Za(n+r,0)),t<0?t=Za(n+t,0):t>n&&(t=n),r>=n||t<=r)return"";for(i="",s=0,f=0;f=r&&s=n||r>=t)return"";for(t>n&&(t=n),i="",o=0,u=0;o=r&&u=t)););return i})),P(Wl,"snakecase",ru),P(Wl,"startcase",vo),P(Wl,"startsWith",iu),P(Wl,"stickycase",(function(e,r){var t,n,i="";for(r="number"==typeof r&&r>=0&&r<=1?r:.5,n=0;n(o=e.length)?e:(n=r-i)<0?t.slice(0,r):(a=es(n/2),u=o-(u=Xt((s=n)>0?s-1:s+1)?a-1:a),e.substring(0,a)+t+e.substring(u))})),P(Wl,"uncapitalize",$l),P(Wl,"uppercase",dr);var zl=["grapheme","code_point","code_unit"],Gl={grapheme:io,code_point:$i,code_unit:Di},ql=In(zl);var Jl=["grapheme","code_point","code_unit"],Zl={grapheme:ho,code_point:so,code_unit:oo},Hl=In(Jl);var Ql=1114111,Xl=String.fromCharCode;var Kl=["grapheme","code_point","code_unit"],ef={grapheme:Bo,code_point:Lo,code_unit:xo},rf=In(Kl);function tf(e,r,t){var n;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(!Mt(r))throw new TypeError(ir("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",r));if(arguments.length>2){if(!U(n=t))throw new TypeError(ir("invalid argument. Third argument must be a string. Value: `%s`.",n));if(0===n.length)throw new RangeError("invalid argument. Third argument must not be an empty string.")}else n=" ";if(r>hu)throw new RangeError(ir("invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.",r));return Wo(e,r,n)}function nf(e){var r,t,n;if(!U(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));if(r=0,n=[],0===e.length)return n;for(t=no(e,r);-1!==t;)n.push(e.substring(r,t)),t=no(e,r=t);return n.push(e.substring(r)),n}var of=/[\uDC00-\uDFFF]/,af=/[\uD800-\uDBFF]/;var uf=[{VAL:1,EN:"zero",DE:"null"},{VAL:10,EN:"ten",DE:"zehn"},{VAL:100,EN:"hundred",DE:"hundert"},{VAL:1e3,EN:"thousand",DE:"tausend"},{VAL:1e6,EN:"million",DE:"Million"},{VAL:1e9,EN:"billion",DE:"Milliarde"},{VAL:1e12,EN:"trillion",DE:"Billion"},{VAL:1e15,EN:"quadrillion",DE:"Billiarde"},{VAL:1e18,EN:"quintillion",DE:"Trillion"},{VAL:1e21,EN:"sextillion",DE:"Trilliarde"},{VAL:1e24,EN:"septillion",DE:"Quadrillion"},{VAL:1e27,EN:"octillion",DE:"Quadrilliarde"},{VAL:1e30,EN:"nonillion",DE:"Quintillion"},{VAL:1e33,EN:"decillion",DE:"Quintilliarde"},{VAL:1e36,EN:"undecillion",DE:"Sextillion"},{VAL:1e39,EN:"duodecillion",DE:"Sextilliarde"},{VAL:1e42,EN:"tredecillion",DE:"Septillion"},{VAL:1e45,EN:"quattuordecillion",DE:"Septilliarde"},{VAL:1e48,EN:"quindecillion",DE:"Octillion"},{VAL:1e51,EN:"sedecillion",DE:"Octilliarde"},{VAL:1e54,EN:"septendecillion",DE:"Nonillion"},{VAL:1e57,EN:"octodecillion",DE:"Nonilliarde"},{VAL:1e60,EN:"novendecillion",DE:"Decillion"},{VAL:1e63,EN:"vigintillion",DE:"Decilliarde"},{VAL:1e66,EN:"unvigintillion",DE:"Undecillion"},{VAL:1e69,EN:"duovigintillion",DE:"Undecilliarde"},{VAL:1e72,EN:"tresvigintillion",DE:"Duodecillion"},{VAL:1e75,EN:"quattuorvigintillion",DE:"Duodecilliarde"},{VAL:1e78,EN:"quinquavigintillion",DE:"Tredecillion"},{VAL:1e81,EN:"sesvigintillion",DE:"Tredecilliarde"},{VAL:1e84,EN:"septemvigintillion",DE:"Quattuordecillion"},{VAL:1e87,EN:"octovigintillion",DE:"Quattuordecilliarde"},{VAL:1e90,EN:"novemvigintillion",DE:"Quindecillion"},{VAL:1e93,EN:"trigintillion",DE:"Quindecilliarde"},{VAL:1e96,EN:"untrigintillion",DE:"Sedecillion"},{VAL:1e99,EN:"duotrigintillion",DE:"Sedecilliarde"},{VAL:1e102,EN:"trestrigintillion",DE:"Septendecillion"},{VAL:1e105,EN:"quattuortrigintillion",DE:"Septendecilliarde"},{VAL:1e108,EN:"quinquatrigintillion",DE:"Octodecillion"},{VAL:1e111,EN:"sestrigintillion",DE:"Octodecilliarde"},{VAL:1e114,EN:"septentrigintillion",DE:"Novendecillion"},{VAL:1e117,EN:"octotrigintillion",DE:"Novendecilliarde"},{VAL:1e120,EN:"noventrigintillion",DE:"Vigintillion"},{VAL:1e123,EN:"quadragintillion",DE:"Vigintilliarde"},{VAL:1e153,EN:"quinquagintillion",DE:"Quinvigintilliarde"},{VAL:1e183,EN:"sexagintillion",DE:"Trigintilliarde"},{VAL:1e213,EN:"septuagintillion",DE:"Quintrigintilliarde"},{VAL:1e243,EN:"octogintillion",DE:"Quadragintilliarde"},{VAL:1e273,EN:"nonagintillion",DE:"Quin­quadra­gint­illiarde"},{VAL:1e303,EN:"centillion",DE:"Quinquagintilliarde"},{VAL:1e306,EN:"uncentillion",DE:"Unquinquagintillione"}],sf=["null","eins","zwei","drei","vier","fünf","sechs","sieben","acht","neun","zehn","elf","zwölf","dreizehn","vierzehn","fünfzehn","sechzehn","siebzehn","achtzehn","neunzehn"],lf=["null","zehn","zwanzig","dreißig","vierzig","fünfzig","sechzig","siebzig","achtzig","neunzig"];function ff(e){return Ii(e,"e")?e+"n":e+"en"}function hf(e,r){var t,n,i;if(0===e)return r||"null";if(e<0&&(r+="minus ",e*=-1),e<20)n=0,t=1===e&&0===r.length?"ein":sf[e];else if(e<100)n=e%10,t=lf[Ft(e/10)],n&&(t=(1===n?"ein":sf[n])+"und"+t,n=0);else if(e<1e3)n=e%100,t=hf(Ft(e/100),"")+"hundert";else if(e<1e6)n=e%1e3,t=hf(Ft(e/1e3),"")+"tausend";else for(i=5;i0&&(t+="-"+cf[n],n=0);else{for(i=3;i0&&(r+=" "),pf(n,r+=t)}function mf(e){return bt(e)&&Fi(e)}function vf(e){return Vt(e)&&Fi(e.valueOf())}function df(e){return mf(e)||vf(e)}Y(df,"isPrimitive",mf),Y(df,"isObject",vf);var yf=["en","de"];function wf(e,r){return Wn(r)?q(r,"lang")&&(e.lang=r.lang,-1===function(e,r,t){var n,i;if(!Bt(e)&&!U(e))throw new TypeError(R("invalid argument. First argument must be an array-like object. Value: `%s`.",e));if(0===(n=e.length))return-1;if(3===arguments.length){if(!Ot(t))throw new TypeError(R("invalid argument. Third argument must be an integer. Value: `%s`.",t));if(t>=0){if(t>=n)return-1;i=t}else(i=n+t)<0&&(i=0)}else i=0;if(df(r)){for(;i2){if(!U(n=t))throw new TypeError(ir("invalid argument. Third argument must be a string. Value: `%s`.",n));if(0===n.length)throw new RangeError("invalid argument. Pad string must not be an empty string.")}else n=" ";if(r>hu)throw new RangeError(ir("invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.",r));return Pa(e,r,n)}var _f=Ki.breakType,Vf=Ki.breakProperty,Af=Ki.emojiProperty;function xf(e,r){var t,n,i,o,a,u,s;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(o=e.length,arguments.length>1){if(!Nt(r))throw new TypeError(ir("invalid argument. Second argument must be an integer. Value: `%s`.",r));a=r}else a=o-1;if(0===o||a<=0)return-1;for(a>=o&&(a=o-1),t=[],n=[],u=Wi(e,0),t.push(Vf(u)),n.push(Af(u)),i=-1,s=1;s<=a;s++)Zi(e,s-1)?(i=s-2,t.length=0,n.length=0):(u=Wi(e,s),t.push(Vf(u)),n.push(Af(u)),_f(t,n)>0&&(i=s-1,t.length=0,n.length=0));return i}var Ff=["grapheme","code_point","code_unit"],Sf={grapheme:Fa,code_point:xa,code_unit:_a},Lf=In(Ff);var Of=["grapheme","code_point","code_unit"],Rf={grapheme:Ma,code_point:Ra,code_unit:Sa},Nf=In(Of);function Mf(e){if(!U(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));return e.toUpperCase()}var kf=["grapheme","code_point","code_unit"],jf={grapheme:Ba,code_point:Da,code_unit:ja},Cf=In(kf);var If=/[\uDC00-\uDFFF]/,Df=/[\uD800-\uDBFF]/;function Bf(e){var r;for(r=0;r0&&If.test(e[r])&&!Df.test(e[r-1]))return!1}return!0}function Pf(e){return"string"==typeof e&&Bf(e)}function Yf(e){return re.isObject(e)&&Bf(e.valueOf())}function Uf(e){return Pf(e)||Yf(e)}Y(Uf,"isPrimitive",Pf),Y(Uf,"isObject",Yf);var $f=/[\uDC00-\uDFFF]/,Wf=/[\uD800-\uDBFF]/;var zf={};return P(zf,"acronym",(function(e,r){var t,n,i,o,a,u;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(i={},arguments.length>1&&(o=zn(i,r)))throw o;for(t=In(i.stopwords||Gn),n=vr(e=or(e=sr(e),qn," ")),a="",u=0;u2){if(!Ot(t))throw new TypeError(ir("invalid argument. Third argument must be an integer. Value: `%s`.",t))}else t=e.length;return Ii(e,r,t)})),P(zf,"first",(function(e){var r,t,n,i;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(n={mode:"grapheme"},1===(t=arguments.length))i=1;else if(2===t){if(Wn(i=arguments[1]))r=i,i=1;else if(!Mt(i))throw new TypeError(ir("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i))}else{if(!Mt(i=arguments[1]))throw new TypeError(ir("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i));if(!Wn(r=arguments[2]))throw new TypeError(ir("invalid argument. Options argument must be an object. Value: `%s`.",r))}if(r&&q(r,"mode")&&(n.mode=r.mode,!ql(n.mode)))throw new TypeError(ir('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",zl.join('", "'),n.mode));return Gl[n.mode](e,i)})),P(zf,"forEach",(function(e,r,t){var n,i,o,a;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(o={mode:"grapheme"},2===(i=arguments.length))a=r,r=null;else if(3===i)Wn(r)?a=t:(a=r,r=null,n=t);else{if(!Wn(r))throw new TypeError(ir("invalid argument. Options argument must be an object. Value: `%s`.",r));a=t,n=arguments[3]}if(!xe(a))throw new TypeError(ir("invalid argument. Callback argument must be a function. Value: `%s`.",a));if(r&&q(r,"mode")&&(o.mode=r.mode,!Hl(o.mode)))throw new TypeError(ir('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",Jl.join('", "'),o.mode));return Zl[o.mode](e,a,n),e})),P(zf,"format",ir),P(zf,"fromCodePoint",(function(e){var r,t,n,i,o;if(1===(r=arguments.length)&&Bt(e))r=(n=arguments[0]).length;else for(n=[],o=0;oQl)throw new RangeError(ir("invalid argument. Must provide a valid code point (i.e., cannot exceed %u). Value: `%s`.",Ql,i));t+=i<=65535?Xl(i):Xl(55296+((i-=65536)>>10),56320+(1023&i))}return t})),P(zf,"headercase",(function(e){if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));return Eo(e)})),P(zf,"kebabcase",(function(e){if(!U(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));return Ao(e)})),P(zf,"last",(function(e){var r,t,n,i;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(n={mode:"grapheme"},1===(t=arguments.length))i=1;else if(2===t){if(Wn(i=arguments[1]))r=i,i=1;else if(!Mt(i))throw new TypeError(ir("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i))}else{if(!Mt(i=arguments[1]))throw new TypeError(ir("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i));if(!Wn(r=arguments[2]))throw new TypeError(ir("invalid argument. Options argument must be an object. Value: `%s`.",r))}if(r&&q(r,"mode")&&(n.mode=r.mode,!rf(n.mode)))throw new TypeError(ir('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",Kl.join('", "'),n.mode));return ef[n.mode](e,i)})),P(zf,"lpad",tf),P(zf,"ltrim",(function(e){if(!U(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));return Jo(e)})),P(zf,"ltrimN",(function(e,r,t){var n,i,o,a,u;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(!Mt(r))throw new TypeError(ir("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",r));if(arguments.length>2){if(!(o=U(t))&&!$t(t))throw new TypeError(ir("invalid argument. Third argument must be a string or an array of strings. Value: `%s`.",t));for(o&&(t=nf(t)),n=t.length-1,i="",u=0;u1){if(!Ot(r))throw new TypeError(ir("invalid argument. Second argument must be an integer. Value: `%s`.",r));i=r}else i=0;return n=e.length,i<0&&(i+=n)<0&&(i=0),i>=(t=n-1)?-1:(a=(o=i+1)+1,af.test(e[i])&&of.test(e[o])?a>=t?-1:a:o)})),P(zf,"nextGraphemeClusterBreak",no),P(zf,"numCodePoints",Ja),P(zf,"numGraphemeClusters",Na),P(zf,"num2words",(function(e,r){var t,n,i;if(!bt(e))throw new TypeError(ir("invalid argument. First argument must be a number. Value: `%s`.",e));if(n={},arguments.length>1&&(i=wf(n,r)))throw i;return Ot(e)?"de"===n.lang?hf(e,""):pf(e,""):xu(e)?(t=e.toString().split("."),"de"===n.lang?hf(t[0],"")+" Komma "+bf(t[1],hf):pf(t[0],"")+" point "+bf(t[1],pf)):"de"===n.lang?e<0?"minus unendlich":"unendlich":e<0?"negative infinity":"infinity"})),P(zf,"pad",(function(e,r,t){var n,i,o,a,u,s,l,f,h;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(!Mt(r))throw new TypeError(ir("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",r));if(r>hu)throw new RangeError(ir("invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.",r));if(s={},arguments.length>2&&(l=function(e,r){return Wn(r)?q(r,"lpad")&&(e.lpad=r.lpad,!U(e.lpad))?new TypeError(ir("invalid option. `%s` option must be a string. Option: `%s`.","lpad",e.lpad)):q(r,"rpad")&&(e.rpad=r.rpad,!U(e.rpad))?new TypeError(ir("invalid option. `%s` option must be a string. Option: `%s`.","rpad",e.rpad)):q(r,"centerRight")&&(e.centerRight=r.centerRight,!oe(e.centerRight))?new TypeError(ir("invalid option. `%s` option must be a boolean. Option: `%s`.","centerRight",e.centerRight)):null:new TypeError(ir("invalid argument. Options argument must be an object. Value: `%s`.",r))}(s,t)))throw l;if(s.lpad&&s.rpad)return 0===(h=(r-e.length)/2)?e:((f=Ft(h))!==h&&(o=!0),h<0?(i=h=Ft(Lu(h)),n=e.length-h,o&&(s.centerRight?n-=1:i+=1),e.substring(i,n)):(i=$o(h/s.lpad.length),u=Ef(s.lpad,i),n=$o(h/s.rpad.length),a=Ef(s.rpad,n),i=h=f,n=h,o&&(s.centerRight?i+=1:n+=1),(u=u.substring(0,i))+e+(a=a.substring(0,n))));if(s.lpad)return(f=tf(e,r,s.lpad)).substring(f.length-r);if(s.rpad)return Tf(e,r,s.rpad).substring(0,r);if(void 0===s.rpad)return Tf(e,r," ").substring(0,r);throw new RangeError(ir("invalid argument. At least one padding option must have a length greater than 0. Left padding: `%s`. Right padding: `%s`.",s.lpad,s.rpad))})),P(zf,"pascalcase",(function(e){if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));return ea(e)})),P(zf,"percentEncode",(function(e){if(!U(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));return Ta(e)})),P(zf,"prevGraphemeClusterBreak",xf),P(zf,"removeFirst",(function(e){var r,t,n,i;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(n={mode:"grapheme"},1===(t=arguments.length))i=1;else if(2===t){if(Wn(i=arguments[1]))r=i,i=1;else if(!Mt(i))throw new TypeError(ir("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i))}else{if(!Mt(i=arguments[1]))throw new TypeError(ir("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i));if(!Wn(r=arguments[2]))throw new TypeError(ir("invalid argument. Options argument must be an object. Value: `%s`.",r))}if(r&&q(r,"mode")&&(n.mode=r.mode,!Lf(n.mode)))throw new TypeError(ir('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",Ff.join('", "'),n.mode));return Sf[n.mode](e,i)})),P(zf,"removeLast",(function(e){var r,t,n,i;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(n={mode:"grapheme"},1===(t=arguments.length))i=1;else if(2===t){if(Wn(i=arguments[1]))r=i,i=1;else if(!Mt(i))throw new TypeError(ir("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i))}else{if(!Mt(i=arguments[1]))throw new TypeError(ir("invalid argument. Second argument must be a nonnegative integer. Value: `%s`.",i));if(!Wn(r=arguments[2]))throw new TypeError(ir("invalid argument. Options argument must be an object. Value: `%s`.",r))}if(r&&q(r,"mode")&&(n.mode=r.mode,!Nf(n.mode)))throw new TypeError(ir('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",Of.join('", "'),n.mode));return Rf[n.mode](e,i)})),P(zf,"removePunctuation",sr),P(zf,"removeUTF8BOM",(function(e){if(!U(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));return 65279===e.charCodeAt(0)?e.slice(1):e})),P(zf,"removeWords",(function(e,r,t){var n,i,o,a,u,s,l,f;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(!zt(r))throw new TypeError(ir("invalid argument. Second argument must be an array of strings. Value: `%s`.",r));if(arguments.length>2&&!oe(t))throw new TypeError(ir("invalid argument. Third argument must be a boolean. Value: `%s`.",t));if(n=vr(e,!0),s=r.length,u=[],t){for(o=r.slice(),l=0;l1&&!Wn(r=arguments[1]))throw new TypeError(ir("invalid argument. Options argument must be an object. Value: `%s`.",r));if(r&&q(r,"mode")&&(t.mode=r.mode,!Cf(t.mode)))throw new TypeError(ir('invalid option. `%s` option must be one of the following: "%s". Value: `%s`.',"mode",kf.join('", "'),t.mode));return jf[t.mode](e)})),P(zf,"rpad",Tf),P(zf,"rtrim",(function(e){if(!U(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));return Wa(e)})),P(zf,"rtrimN",(function(e,r,t){var n,i,o,a,u;if(!U(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));if(!Mt(r))throw new TypeError(ir("invalid argument. Must provide a nonnegative integer. Value: `%s`.",r));if(arguments.length>2){if(!(o=U(t))&&!$t(t))throw new TypeError(ir("invalid argument. Must provide a string or an array of strings. Value: `%s`.",t));for(o&&(t=nf(t)),n=t.length-1,i="",u=0;u2){if(!Ot(t))throw new TypeError(ir("invalid argument. Third argument must be an integer. Value: `%s`.",t));n=t}else n=0;return iu(e,r,n)})),P(zf,"substringAfter",(function(e,r,t){var n;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(!U(r))throw new TypeError(ir("invalid argument. Second argument must be a string. Value: `%s`.",r));if(arguments.length>2){if(!Ot(t))throw new TypeError(ir("invalid argument. Third argument must be an integer. Value: `%s`.",t));n=e.indexOf(r,t)}else n=e.indexOf(r);return-1===n?"":e.substring(n+r.length)})),P(zf,"substringAfterLast",(function(e,r,t){var n;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(!U(r))throw new TypeError(ir("invalid argument. Second argument must be a string. Value: `%s`.",r));if(arguments.length>2){if(!Ot(t))throw new TypeError(ir("invalid argument. Third argument must be a nonnegative integer. Value: `%s`.",t));n=e.lastIndexOf(r,t)}else n=e.lastIndexOf(r);return-1===n?"":e.substring(n+r.length)})),P(zf,"substringBefore",(function(e,r){var t;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(!U(r))throw new TypeError(ir("invalid argument. Second argument must be a string. Value: `%s`.",r));return-1===(t=e.indexOf(r))?e:e.substring(0,t)})),P(zf,"substringBeforeLast",(function(e,r){var t;if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));if(!U(r))throw new TypeError(ir("invalid argument. Second argument must be a string. Value: `%s`.",r));return-1===(t=e.lastIndexOf(r))?e:e.substring(0,t)})),P(zf,"graphemeClusters2iterator",(function e(r){var t,n,i,o,a;if(!U(r))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",r));if(arguments.length>1){if(!xe(o=arguments[1]))throw new TypeError(ir("invalid argument. Second argument must be a function. Value: `%s`.",o));t=arguments[2]}return a=0,Y(n={},"next",o?function(){var e,n;if(i)return{done:!0};if(-1===(n=no(r,a)))return i=!0,r.length?{value:o.call(t,r.substring(a),a,r),done:!1}:{done:!0};return e=o.call(t,r.substring(a,n),a,r),a=n,{value:e,done:!1}}:function(){var e,t;if(i)return{done:!0};if(-1===(t=no(r,a)))return i=!0,r.length?{value:r.substring(a),done:!1}:{done:!0};return e=r.substring(a,t),a=t,{value:e,done:!1}}),Y(n,"return",(function(e){if(i=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(n,on,(function(){if(o)return e(r,o,t);return e(r)})),n})),P(zf,"graphemeClusters2iteratorRight",(function e(r){var t,n,i,o,a;if(!U(r))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",r));if(arguments.length>1){if(!xe(o=arguments[1]))throw new TypeError(ir("invalid argument. Second argument must be a function. Value: `%s`.",o));t=arguments[2]}return a=r.length-1,Y(n={},"next",o?function(){var e,n;if(i)return{done:!0};if(-1===(n=xf(r,a)))return i=!0,r.length?{value:o.call(t,r.substring(n+1,a+1),n+1,r),done:!1}:{done:!0};return e=o.call(t,r.substring(n+1,a+1),n+1,r),a=n,{value:e,done:!1}}:function(){var e,t;if(i)return{done:!0};if(-1===(t=xf(r,a)))return i=!0,r.length?{value:r.substring(t+1,a+1),done:!1}:{done:!0};return e=r.substring(t+1,a+1),a=t,{value:e,done:!1}}),Y(n,"return",(function(e){if(i=!0,arguments.length)return{value:e,done:!0};return{done:!0}})),on&&Y(n,on,(function(){if(o)return e(r,o,t);return e(r)})),n})),P(zf,"toWellFormed",(function(e){var r,t;if(r="",!re(e))throw new TypeError(ir("invalid argument. Must provide a string. Value: `%s`.",e));if(Uf(e)){for(t=0;t2&&!U(t))throw new TypeError(ir("invalid argument. Third argument must be a string. Value: `%s`.",t));if(n=Na(t=t||"..."),i=0,r>=Na(e))return e;if(r-n<=0)return t.slice(0,r);for(o=0;o2&&!U(t))throw new TypeError(ir("invalid argument. Third argument must be a string. Value: `%s`.",t));if(n=Na(t=t||"..."),i=0,r>(o=Na(e)))return e;if(r-n<0)return t.slice(0,r);for(a=es((r-n)/2),s=o-Ft((r-n)/2),u=0;u0&&!((l=no(e,i))>=s+i-u);)i=l,u+=1;return e.substring(0,f)+t+e.substring(l)})),P(zf,"uncapitalize",(function(e){if(!U(e))throw new TypeError(ir("invalid argument. First argument must be a string. Value: `%s`.",e));return $l(e)})),P(zf,"uppercase",Mf),P(zf,"utf16ToUTF8Array",ha),zf})); +//# sourceMappingURL=index.js.map diff --git a/index.js.map b/index.js.map new file mode 100644 index 00000000..119e8920 --- /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-read-only-property/lib/main.js","../node_modules/@stdlib/utils/define-nonenumerable-read-only-property/lib/main.js","../node_modules/@stdlib/assert/is-string/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/index.js","../node_modules/@stdlib/utils/native-class/lib/tostringtag.js","../node_modules/@stdlib/utils/native-class/lib/polyfill.js","../node_modules/@stdlib/utils/native-class/lib/main.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/utils/escape-regexp-string/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/regexp/function-name/lib/index.js","../node_modules/@stdlib/assert/is-array/lib/main.js","../node_modules/@stdlib/assert/tools/array-function/lib/main.js","../node_modules/@stdlib/assert/is-object-like/lib/main.js","../node_modules/@stdlib/assert/is-buffer/lib/main.js","../node_modules/@stdlib/utils/constructor-name/lib/main.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-regexp/lib/exec.js","../node_modules/@stdlib/assert/is-regexp/lib/main.js","../node_modules/@stdlib/assert/is-regexp/lib/try2exec.js","../base/format-interpolate/lib/is_number.js","../base/format-interpolate/lib/zero_pad.js","../base/format-interpolate/lib/format_integer.js","../base/format-interpolate/lib/format_double.js","../base/format-interpolate/lib/space_pad.js","../base/format-interpolate/lib/main.js","../base/format-interpolate/lib/is_string.js","../base/format-tokenize/lib/main.js","../format/lib/main.js","../format/lib/is_string.js","../base/replace/lib/main.js","../replace/lib/main.js","../remove-punctuation/lib/main.js","../node_modules/@stdlib/nlp/tokenize/lib/main.js","../base/uppercase/lib/main.js","../base/lowercase/lib/main.js","../node_modules/@stdlib/array/base/assert/is-accessor-array/lib/main.js","../node_modules/@stdlib/array/base/accessor-getter/lib/main.js","../node_modules/@stdlib/array/base/getter/lib/main.js","../node_modules/@stdlib/array/dtype/lib/ctor2dtype.js","../node_modules/@stdlib/assert/is-float64array/lib/main.js","../node_modules/@stdlib/assert/has-float64array-support/lib/float64array.js","../node_modules/@stdlib/assert/has-float64array-support/lib/main.js","../node_modules/@stdlib/array/float64/lib/main.js","../node_modules/@stdlib/array/float64/lib/index.js","../node_modules/@stdlib/array/float64/lib/polyfill.js","../node_modules/@stdlib/assert/is-float32array/lib/main.js","../node_modules/@stdlib/constants/float64/pinf/lib/index.js","../node_modules/@stdlib/assert/has-float32array-support/lib/float32array.js","../node_modules/@stdlib/array/float32/lib/main.js","../node_modules/@stdlib/array/float32/lib/index.js","../node_modules/@stdlib/assert/has-float32array-support/lib/main.js","../node_modules/@stdlib/array/float32/lib/polyfill.js","../node_modules/@stdlib/assert/is-uint32array/lib/main.js","../node_modules/@stdlib/constants/uint32/max/lib/index.js","../node_modules/@stdlib/assert/has-uint32array-support/lib/uint32array.js","../node_modules/@stdlib/array/uint32/lib/main.js","../node_modules/@stdlib/array/uint32/lib/index.js","../node_modules/@stdlib/assert/has-uint32array-support/lib/main.js","../node_modules/@stdlib/array/uint32/lib/polyfill.js","../node_modules/@stdlib/assert/is-int32array/lib/main.js","../node_modules/@stdlib/constants/int32/max/lib/index.js","../node_modules/@stdlib/assert/has-int32array-support/lib/int32array.js","../node_modules/@stdlib/array/int32/lib/main.js","../node_modules/@stdlib/array/int32/lib/index.js","../node_modules/@stdlib/assert/has-int32array-support/lib/main.js","../node_modules/@stdlib/constants/int32/min/lib/index.js","../node_modules/@stdlib/array/int32/lib/polyfill.js","../node_modules/@stdlib/assert/is-uint16array/lib/main.js","../node_modules/@stdlib/constants/uint16/max/lib/index.js","../node_modules/@stdlib/assert/has-uint16array-support/lib/uint16array.js","../node_modules/@stdlib/array/uint16/lib/main.js","../node_modules/@stdlib/array/uint16/lib/index.js","../node_modules/@stdlib/assert/has-uint16array-support/lib/main.js","../node_modules/@stdlib/array/uint16/lib/polyfill.js","../node_modules/@stdlib/assert/is-int16array/lib/main.js","../node_modules/@stdlib/constants/int16/max/lib/index.js","../node_modules/@stdlib/assert/has-int16array-support/lib/int16array.js","../node_modules/@stdlib/array/int16/lib/main.js","../node_modules/@stdlib/array/int16/lib/index.js","../node_modules/@stdlib/assert/has-int16array-support/lib/main.js","../node_modules/@stdlib/constants/int16/min/lib/index.js","../node_modules/@stdlib/array/int16/lib/polyfill.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/assert/is-uint8clampedarray/lib/main.js","../node_modules/@stdlib/assert/has-uint8clampedarray-support/lib/uint8clampedarray.js","../node_modules/@stdlib/array/uint8c/lib/main.js","../node_modules/@stdlib/array/uint8c/lib/index.js","../node_modules/@stdlib/assert/has-uint8clampedarray-support/lib/main.js","../node_modules/@stdlib/array/uint8c/lib/polyfill.js","../node_modules/@stdlib/assert/is-int8array/lib/main.js","../node_modules/@stdlib/constants/int8/max/lib/index.js","../node_modules/@stdlib/assert/has-int8array-support/lib/int8array.js","../node_modules/@stdlib/array/int8/lib/main.js","../node_modules/@stdlib/array/int8/lib/index.js","../node_modules/@stdlib/assert/has-int8array-support/lib/main.js","../node_modules/@stdlib/constants/int8/min/lib/index.js","../node_modules/@stdlib/array/int8/lib/polyfill.js","../node_modules/@stdlib/assert/is-number/lib/primitive.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/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-array-length/lib/index.js","../node_modules/@stdlib/assert/is-array-like-object/lib/main.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-object/lib/main.js","../node_modules/@stdlib/assert/is-string-array/lib/index.js","../node_modules/@stdlib/complex/float64/ctor/lib/main.js","../node_modules/@stdlib/complex/float64/ctor/lib/tostring.js","../node_modules/@stdlib/complex/float64/ctor/lib/tojson.js","../node_modules/@stdlib/number/float64/base/to-float32/lib/main.js","../node_modules/@stdlib/number/float64/base/to-float32/lib/polyfill.js","../node_modules/@stdlib/number/float64/base/to-float32/lib/index.js","../node_modules/@stdlib/complex/float32/ctor/lib/main.js","../node_modules/@stdlib/assert/is-complex-like/lib/main.js","../node_modules/@stdlib/math/base/assert/is-even/lib/main.js","../node_modules/@stdlib/complex/float32/ctor/lib/tostring.js","../node_modules/@stdlib/complex/float32/ctor/lib/tojson.js","../node_modules/@stdlib/array/base/assert/is-complex64array/lib/main.js","../node_modules/@stdlib/array/base/assert/is-complex128array/lib/main.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/complex/float32/real/lib/main.js","../node_modules/@stdlib/complex/float32/imag/lib/main.js","../node_modules/@stdlib/strided/base/reinterpret-complex64/lib/main.js","../node_modules/@stdlib/strided/base/reinterpret-complex128/lib/main.js","../node_modules/@stdlib/array/complex64/lib/from_iterator.js","../node_modules/@stdlib/array/complex64/lib/main.js","../node_modules/@stdlib/array/complex64/lib/from_array.js","../node_modules/@stdlib/complex/float64/real/lib/main.js","../node_modules/@stdlib/complex/float64/imag/lib/main.js","../node_modules/@stdlib/array/complex128/lib/from_iterator.js","../node_modules/@stdlib/array/complex64/lib/from_iterator_map.js","../node_modules/@stdlib/array/complex128/lib/main.js","../node_modules/@stdlib/array/complex128/lib/from_array.js","../node_modules/@stdlib/array/bool/lib/from_iterator.js","../node_modules/@stdlib/array/complex128/lib/from_iterator_map.js","../node_modules/@stdlib/array/bool/lib/main.js","../node_modules/@stdlib/array/bool/lib/from_array.js","../node_modules/@stdlib/array/bool/lib/from_iterator_map.js","../node_modules/@stdlib/array/dtype/lib/ctors.js","../node_modules/@stdlib/array/dtype/lib/dtypes.js","../node_modules/@stdlib/array/dtype/lib/main.js","../node_modules/@stdlib/array/base/assert/contains/lib/factory.js","../node_modules/@stdlib/array/base/assert/contains/lib/index.js","../node_modules/@stdlib/array/base/assert/contains/lib/main.js","../node_modules/@stdlib/object/ctor/lib/main.js","../node_modules/@stdlib/utils/get-prototype-of/lib/detect.js","../node_modules/@stdlib/utils/get-prototype-of/lib/native.js","../node_modules/@stdlib/utils/get-prototype-of/lib/polyfill.js","../node_modules/@stdlib/utils/get-prototype-of/lib/proto.js","../node_modules/@stdlib/utils/get-prototype-of/lib/main.js","../node_modules/@stdlib/assert/is-plain-object/lib/main.js","../acronym/lib/validate.js","../node_modules/@stdlib/assert/is-empty-array/lib/main.js","../acronym/lib/main.js","../node_modules/@stdlib/assert/has-atob-support/lib/atob.js","../base/atob/lib/global.js","../node_modules/@stdlib/assert/has-node-buffer-support/lib/buffer.js","../node_modules/@stdlib/buffer/ctor/lib/main.js","../node_modules/@stdlib/buffer/ctor/lib/index.js","../node_modules/@stdlib/assert/has-node-buffer-support/lib/main.js","../node_modules/@stdlib/buffer/ctor/lib/polyfill.js","../node_modules/@stdlib/buffer/from-string/lib/index.js","../node_modules/@stdlib/buffer/from-string/lib/has_from.js","../node_modules/@stdlib/buffer/from-string/lib/main.js","../node_modules/@stdlib/buffer/from-string/lib/polyfill.js","../base/atob/lib/index.js","../base/atob/lib/re_non_ascii.js","../node_modules/@stdlib/assert/has-atob-support/lib/main.js","../base/atob/lib/main.js","../base/atob/lib/polyfill.js","../base/capitalize/lib/main.js","../base/trim/lib/has_builtin.js","../base/trim/lib/builtin.js","../base/trim/lib/polyfill.js","../base/trim/lib/index.js","../base/trim/lib/check.js","../base/trim/lib/main.js","../base/camelcase/lib/main.js","../base/code-point-at/lib/main.js","../base/constantcase/lib/main.js","../node_modules/@stdlib/math/base/assert/is-nan/lib/main.js","../node_modules/@stdlib/math/base/special/min/lib/main.js","../node_modules/@stdlib/math/base/assert/is-negative-zero/lib/main.js","../base/distances/lib/index.js","../base/distances/hamming/lib/main.js","../base/distances/levenshtein/lib/main.js","../base/dotcase/lib/main.js","../base/ends-with/lib/has_builtin.js","../base/ends-with/lib/builtin.js","../base/ends-with/lib/index.js","../base/ends-with/lib/main.js","../base/ends-with/lib/polyfill.js","../base/first/lib/main.js","../node_modules/@stdlib/regexp/utf16-surrogate-pair/lib/main.js","../node_modules/@stdlib/regexp/utf16-surrogate-pair/lib/regexp.js","../node_modules/@stdlib/regexp/utf16-surrogate-pair/lib/index.js","../base/first-code-point/lib/main.js","../code-point-at/lib/main.js","../node_modules/@stdlib/assert/has-utf16-surrogate-pair-at/lib/main.js","../tools/grapheme-cluster-break/lib/constants.js","../tools/grapheme-cluster-break/lib/break_type.js","../tools/grapheme-cluster-break/lib/index.js","../tools/grapheme-cluster-break/lib/emoji_property.js","../tools/grapheme-cluster-break/lib/break_property.js","../next-grapheme-cluster-break/lib/main.js","../base/first-grapheme-cluster/lib/main.js","../base/for-each/lib/main.js","../base/for-each-code-point/lib/main.js","../base/for-each-code-point-right/lib/main.js","../base/for-each-grapheme-cluster/lib/main.js","../node_modules/@stdlib/regexp/whitespace/lib/main.js","../node_modules/@stdlib/regexp/whitespace/lib/validate.js","../node_modules/@stdlib/regexp/whitespace/lib/regexp_capture.js","../node_modules/@stdlib/regexp/whitespace/lib/regexp.js","../base/startcase/lib/main.js","../node_modules/@stdlib/regexp/whitespace/lib/index.js","../base/headercase/lib/main.js","../base/kebabcase/lib/main.js","../base/last/lib/main.js","../base/last-code-point/lib/main.js","../node_modules/@stdlib/assert/is-positive-integer/lib/primitive.js","../node_modules/@stdlib/assert/is-positive-integer/lib/object.js","../node_modules/@stdlib/assert/is-positive-integer/lib/main.js","../node_modules/@stdlib/assert/is-positive-integer/lib/index.js","../node_modules/@stdlib/constants/float64/max/lib/index.js","../node_modules/@stdlib/array/base/setter/lib/main.js","../node_modules/@stdlib/array/base/accessor-setter/lib/main.js","../node_modules/@stdlib/array/base/arraylike2object/lib/main.js","../node_modules/@stdlib/dstructs/circular-buffer/lib/main.js","../base/last-grapheme-cluster/lib/main.js","../node_modules/@stdlib/array/base/filled/lib/main.js","../node_modules/@stdlib/array/base/zeros/lib/main.js","../base/repeat/lib/has_builtin.js","../base/repeat/lib/builtin.js","../base/repeat/lib/index.js","../base/repeat/lib/main.js","../base/repeat/lib/polyfill.js","../node_modules/@stdlib/math/base/special/ceil/lib/main.js","../base/left-pad/lib/main.js","../base/left-trim/lib/has_builtin.js","../base/left-trim/lib/polyfill.js","../base/left-trim/lib/builtin.js","../base/left-trim/lib/index.js","../base/left-trim/lib/main.js","../base/pascalcase/lib/main.js","../utf16-to-utf8-array/lib/main.js","../base/percent-encode/lib/main.js","../base/remove-first/lib/main.js","../base/remove-first-code-point/lib/main.js","../base/remove-first-grapheme-cluster/lib/main.js","../base/remove-last/lib/main.js","../base/remove-last-code-point/lib/main.js","../num-grapheme-clusters/lib/main.js","../base/remove-last-grapheme-cluster/lib/main.js","../base/replace-before/lib/main.js","../base/reverse/lib/main.js","../base/reverse-code-points/lib/main.js","../base/reverse-grapheme-clusters/lib/main.js","../base/right-pad/lib/main.js","../base/right-trim/lib/has_builtin.js","../base/right-trim/lib/polyfill.js","../base/right-trim/lib/builtin.js","../base/right-trim/lib/index.js","../base/right-trim/lib/main.js","../base/slice/lib/main.js","../num-code-points/lib/main.js","../node_modules/@stdlib/math/base/special/fast/max/lib/main.js","../base/slice-code-points/lib/main.js","../base/snakecase/lib/main.js","../base/starts-with/lib/has_builtin.js","../base/starts-with/lib/builtin.js","../base/starts-with/lib/index.js","../base/starts-with/lib/main.js","../base/starts-with/lib/polyfill.js","../node_modules/@stdlib/utils/define-nonenumerable-read-write-accessor/lib/main.js","../node_modules/@stdlib/assert/is-probability/lib/primitive.js","../node_modules/@stdlib/assert/is-probability/lib/object.js","../node_modules/@stdlib/assert/is-probability/lib/main.js","../node_modules/@stdlib/utils/constant-function/lib/main.js","../node_modules/@stdlib/utils/noop/lib/main.js","../node_modules/@stdlib/assert/is-probability/lib/index.js","../node_modules/@stdlib/constants/float64/max-safe-integer/lib/index.js","../node_modules/@stdlib/math/base/special/max/lib/main.js","../node_modules/@stdlib/math/base/assert/is-positive-zero/lib/main.js","../node_modules/@stdlib/number/int32/base/mul/lib/main.js","../node_modules/@stdlib/number/int32/base/mul/lib/index.js","../node_modules/@stdlib/number/int32/base/mul/lib/polyfill.js","../node_modules/@stdlib/number/uint32/base/mul/lib/main.js","../node_modules/@stdlib/blas/base/gcopy/lib/accessors.js","../node_modules/@stdlib/blas/base/gcopy/lib/main.js","../node_modules/@stdlib/assert/has-function-name-support/lib/foo.js","../node_modules/@stdlib/blas/base/gcopy/lib/index.js","../node_modules/@stdlib/blas/base/gcopy/lib/ndarray.js","../node_modules/@stdlib/utils/function-name/lib/main.js","../node_modules/@stdlib/assert/has-function-name-support/lib/main.js","../node_modules/@stdlib/constants/float16/pinf/lib/index.js","../node_modules/@stdlib/assert/has-float16array-support/lib/float16array.js","../node_modules/@stdlib/utils/define-read-write-accessor/lib/main.js","../node_modules/@stdlib/number/float64/base/to-float16/lib/main.js","../node_modules/@stdlib/math/base/assert/is-finite/lib/main.js","../node_modules/@stdlib/constants/float16/eps/lib/index.js","../node_modules/@stdlib/constants/float16/smallest-normal/lib/index.js","../node_modules/@stdlib/math/base/special/abs/lib/main.js","../node_modules/@stdlib/number/float64/base/to-float16/lib/polyfill.js","../node_modules/@stdlib/number/float64/base/to-float16/lib/index.js","../node_modules/@stdlib/constants/float16/max/lib/index.js","../node_modules/@stdlib/constants/float16/ninf/lib/index.js","../node_modules/@stdlib/number/float32/base/to-word/lib/main.js","../node_modules/@stdlib/constants/float32/exponent-bias/lib/index.js","../node_modules/@stdlib/number/float32/base/exponent/lib/main.js","../node_modules/@stdlib/constants/float32/ninf/lib/index.js","../node_modules/@stdlib/constants/float32/significand-mask/lib/index.js","../node_modules/@stdlib/number/float16/base/to-word/lib/main.js","../node_modules/@stdlib/math/base/assert/is-nanf/lib/main.js","../node_modules/@stdlib/math/base/assert/is-negative-zerof/lib/main.js","../node_modules/@stdlib/math/base/special/absf/lib/main.js","../node_modules/@stdlib/constants/float64/max-base2-exponent/lib/index.js","../node_modules/@stdlib/constants/float64/min-base2-exponent/lib/index.js","../node_modules/@stdlib/math/base/special/round/lib/main.js","../node_modules/@stdlib/constants/float64/exponent-bias/lib/index.js","../node_modules/@stdlib/constants/float64/max-base2-exponent-subnormal/lib/index.js","../node_modules/@stdlib/constants/float64/min-base2-exponent-subnormal/lib/index.js","../node_modules/@stdlib/math/base/assert/is-infinite/lib/main.js","../node_modules/@stdlib/constants/float64/high-word-sign-mask/lib/index.js","../node_modules/@stdlib/constants/float64/high-word-abs-mask/lib/index.js","../node_modules/@stdlib/assert/is-little-endian/lib/ctors.js","../node_modules/@stdlib/assert/is-little-endian/lib/main.js","../node_modules/@stdlib/number/float64/base/to-words/lib/indices.js","../node_modules/@stdlib/number/float64/base/to-words/lib/assign.js","../node_modules/@stdlib/number/float64/base/to-words/lib/main.js","../node_modules/@stdlib/number/float64/base/to-words/lib/index.js","../node_modules/@stdlib/number/float64/base/get-high-word/lib/high.js","../node_modules/@stdlib/number/float64/base/from-words/lib/indices.js","../node_modules/@stdlib/number/float64/base/get-high-word/lib/main.js","../node_modules/@stdlib/number/float64/base/from-words/lib/main.js","../node_modules/@stdlib/math/base/special/copysign/lib/main.js","../node_modules/@stdlib/constants/float64/smallest-normal/lib/index.js","../node_modules/@stdlib/number/float64/base/normalize/lib/assign.js","../node_modules/@stdlib/number/float64/base/normalize/lib/index.js","../node_modules/@stdlib/number/float64/base/normalize/lib/main.js","../node_modules/@stdlib/constants/float64/high-word-exponent-mask/lib/index.js","../node_modules/@stdlib/math/base/special/ldexp/lib/main.js","../node_modules/@stdlib/number/float64/base/exponent/lib/main.js","../node_modules/@stdlib/math/base/special/exp2/lib/main.js","../node_modules/@stdlib/math/base/special/exp2/lib/polyval_p.js","../node_modules/@stdlib/math/base/special/exp2/lib/polyval_q.js","../node_modules/@stdlib/constants/float16/exponent-bias/lib/index.js","../node_modules/@stdlib/number/float16/base/from-word/lib/main.js","../node_modules/@stdlib/constants/float16/num-exponent-bits/lib/index.js","../node_modules/@stdlib/constants/float16/sign-mask/lib/index.js","../node_modules/@stdlib/constants/float16/significand-mask/lib/index.js","../node_modules/@stdlib/constants/float16/exponent-mask/lib/index.js","../node_modules/@stdlib/constants/float16/num-significand-bits/lib/index.js","../node_modules/@stdlib/array/float16/lib/polyfill/from_iterator.js","../node_modules/@stdlib/array/float16/lib/polyfill/index.js","../node_modules/@stdlib/array/float16/lib/polyfill/from_array.js","../node_modules/@stdlib/array/float16/lib/polyfill/from_iterator_map.js","../node_modules/@stdlib/array/float16/lib/main.js","../node_modules/@stdlib/array/float16/lib/index.js","../node_modules/@stdlib/assert/has-float16array-support/lib/main.js","../node_modules/@stdlib/assert/is-typed-array/lib/ctors.js","../node_modules/@stdlib/assert/is-typed-array/lib/main.js","../node_modules/@stdlib/assert/is-complex-typed-array/lib/ctors.js","../node_modules/@stdlib/assert/has-has-instance-symbol-support/lib/main.js","../node_modules/@stdlib/symbol/has-instance/lib/main.js","../node_modules/@stdlib/assert/instance-of/lib/main.js","../node_modules/@stdlib/array/to-json/lib/ctors.js","../node_modules/@stdlib/array/to-json/lib/type.js","../node_modules/@stdlib/array/to-json/lib/main.js","../node_modules/@stdlib/strided/base/reinterpret-boolean/lib/main.js","../node_modules/@stdlib/assert/is-booleanarray/lib/main.js","../node_modules/@stdlib/assert/is-complex-typed-array/lib/main.js","../node_modules/@stdlib/random/base/mt19937/lib/rand_uint32.js","../node_modules/@stdlib/random/base/mt19937/lib/factory.js","../node_modules/@stdlib/random/base/bernoulli/lib/factory.js","../node_modules/@stdlib/random/base/mt19937/lib/index.js","../node_modules/@stdlib/random/base/mt19937/lib/main.js","../node_modules/@stdlib/random/base/bernoulli/lib/main.js","../base/uncapitalize/lib/main.js","../node_modules/@stdlib/random/base/bernoulli/lib/index.js","../base/lib/index.js","../base/altcase/lib/main.js","../base/base64-to-uint8array/lib/main.js","../base/for-each-right/lib/main.js","../base/invcase/lib/main.js","../base/replace-after/lib/main.js","../base/replace-after-last/lib/main.js","../base/replace-before-last/lib/main.js","../base/slice-grapheme-clusters/lib/main.js","../base/stickycase/lib/main.js","../base/truncate-middle/lib/main.js","../node_modules/@stdlib/math/base/assert/is-odd/lib/main.js","../first/lib/main.js","../for-each/lib/main.js","../node_modules/@stdlib/constants/unicode/max/lib/index.js","../from-code-point/lib/main.js","../last/lib/main.js","../left-pad/lib/main.js","../split-grapheme-clusters/lib/main.js","../next-code-point-index/lib/main.js","../num2words/lib/int2words_de.js","../num2words/lib/int2words_en.js","../node_modules/@stdlib/assert/is-nan/lib/primitive.js","../node_modules/@stdlib/assert/is-nan/lib/object.js","../node_modules/@stdlib/assert/is-nan/lib/main.js","../node_modules/@stdlib/assert/is-nan/lib/index.js","../num2words/lib/validate.js","../node_modules/@stdlib/utils/index-of/lib/main.js","../num2words/lib/decimals.js","../repeat/lib/main.js","../right-pad/lib/main.js","../prev-grapheme-cluster-break/lib/main.js","../remove-first/lib/main.js","../remove-last/lib/main.js","../uppercase/lib/main.js","../reverse/lib/main.js","../node_modules/@stdlib/assert/is-well-formed-string/lib/iswellformed.js","../node_modules/@stdlib/assert/is-well-formed-string/lib/primitive.js","../node_modules/@stdlib/assert/is-well-formed-string/lib/object.js","../node_modules/@stdlib/assert/is-well-formed-string/lib/main.js","../node_modules/@stdlib/assert/is-well-formed-string/lib/index.js","../to-well-formed/lib/main.js","../lib/index.js","../camelcase/lib/main.js","../capitalize/lib/main.js","../constantcase/lib/main.js","../dotcase/lib/main.js","../ends-with/lib/main.js","../node_modules/@stdlib/constants/unicode/max-bmp/lib/index.js","../headercase/lib/main.js","../kebabcase/lib/main.js","../left-trim/lib/main.js","../left-trim-n/lib/main.js","../lowercase/lib/main.js","../num2words/lib/main.js","../pad/lib/main.js","../pad/lib/validate.js","../pascalcase/lib/main.js","../percent-encode/lib/main.js","../remove-utf8-bom/lib/main.js","../remove-words/lib/main.js","../replace-before/lib/main.js","../right-trim/lib/main.js","../right-trim-n/lib/main.js","../snakecase/lib/main.js","../startcase/lib/main.js","../starts-with/lib/main.js","../substring-after/lib/main.js","../substring-after-last/lib/main.js","../substring-before/lib/main.js","../substring-before-last/lib/main.js","../to-grapheme-cluster-iterator/lib/main.js","../to-grapheme-cluster-iterator-right/lib/main.js","../trim/lib/main.js","../truncate/lib/main.js","../truncate-middle/lib/main.js","../uncapitalize/lib/main.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 './../../base/format-interpolate';\nimport tokenize from './../../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 './../../define-property';\n\n\n// MAIN //\n\n/**\n* Defines a 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* setReadOnly( obj, 'foo', 'bar' );\n*\n* try {\n* obj.foo = 'boop';\n* } catch ( err ) {\n* console.error( err.message );\n* }\n*/\nfunction setReadOnly( obj, prop, value ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'writable': false,\n\t\t'value': value\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setReadOnly;\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 './../../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 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// MODULES //\n\nimport hasSymbols from './../../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/**\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 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// 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// 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 './../../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// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar RE_CHARS = /[-\\/\\\\^$*+?.()|[\\]{}]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Escapes a regular expression string.\n*\n* @param {string} str - regular expression string\n* @throws {TypeError} first argument must be a string\n* @returns {string} escaped string\n*\n* @example\n* var str = rescape( '[A-Z]*' );\n* // returns '\\[A\\-Z\\]\\*'\n*/\nfunction rescape( str ) {\n\tvar len;\n\tvar s;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a regular expression string. Value: `%s`.', str ) );\n\t}\n\t// Check if the string starts with a forward slash...\n\tif ( str[ 0 ] === '/' ) {\n\t\t// Find the last forward slash...\n\t\tlen = str.length;\n\t\tfor ( i = len-1; i >= 0; i-- ) {\n\t\t\tif ( str[ i ] === '/' ) {\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\t// If we searched the string to no avail or if the first letter is not `/`, assume that the string is not of the form `/[...]/[guimy]`:\n\tif ( i === void 0 || i <= 0 ) {\n\t\treturn str.replace( RE_CHARS, '\\\\$&' );\n\t}\n\t// We need to de-construct the string...\n\ts = str.substring( 1, i );\n\n\t// Only escape the characters between the `/`:\n\ts = s.replace( RE_CHARS, '\\\\$&' );\n\n\t// Reassemble:\n\tstr = str[ 0 ] + s + str.substring( i );\n\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default rescape;\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 './../../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 './../../../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) 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// 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 './../../../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 isObjectLike from './../../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) 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 './../../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/**\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 './../../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 './../../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 './../../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\nvar exec = RegExp.prototype.exec; // non-generic\n\n\n// EXPORTS //\n\nexport default exec;\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 './../../has-tostringtag-support';\nimport nativeClass from '@stdlib/utils/native-class';\nimport test from './try2exec.js';\n\n\n// VARIABLES //\n\nvar FLG = hasToStringTag();\n\n\n// MAIN //\n\n/**\n* Tests if a value is a regular expression.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a regular expression\n*\n* @example\n* var bool = isRegExp( /\\.+/ );\n* // returns true\n*\n* @example\n* var bool = isRegExp( {} );\n* // returns false\n*/\nfunction isRegExp( value ) {\n\tif ( typeof value === 'object' ) {\n\t\tif ( value instanceof RegExp ) {\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 RegExp]' );\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isRegExp;\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 exec from './exec.js';\n\n\n// MAIN //\n\n/**\n* Attempts to call a `RegExp` method.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if able to call a `RegExp` method\n*/\nfunction test( value ) {\n\ttry {\n\t\texec.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) 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 './../../base/format-interpolate';\nimport tokenize from './../../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) 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* Replaces search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {RegExp} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* import capitalize from '@stdlib/string/base/capitalize';\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer );\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\treturn str.replace( search, newval );\n}\n\n\n// EXPORTS //\n\nexport default replace;\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 rescape from '@stdlib/utils/escape-regexp-string';\nimport isFunction from '@stdlib/assert/is-function';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isRegExp from '@stdlib/assert/is-regexp';\nimport format from './../../format';\nimport base from './../../base/replace';\n\n\n// MAIN //\n\n/**\n* Replaces search occurrences with a replacement string.\n*\n* @param {string} str - input string\n* @param {(string|RegExp)} search - search expression\n* @param {(string|Function)} newval - replacement value or function\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string or regular expression\n* @throws {TypeError} third argument must be a string or function\n* @returns {string} new string containing replacement(s)\n*\n* @example\n* var str = 'beep';\n* var out = replace( str, 'e', 'o' );\n* // returns 'boop'\n*\n* @example\n* var str = 'Hello World';\n* var out = replace( str, /world/i, 'Mr. President' );\n* // returns 'Hello Mr. President'\n*\n* @example\n* import capitalize from '@stdlib/string/capitalize';\n*\n* var str = 'Oranges and lemons say the bells of St. Clement\\'s';\n*\n* function replacer( match, p1 ) {\n* return capitalize( p1 );\n* }\n*\n* var out = replace( str, /([^\\s]*)/gi, replacer );\n* // returns 'Oranges And Lemons Say The Bells Of St. Clement\\'s'\n*/\nfunction replace( str, search, newval ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( isString( search ) ) {\n\t\tsearch = new RegExp( rescape( search ), 'g' );\n\t} else if ( !isRegExp( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string or regular expression. Value: `%s`.', search ) );\n\t}\n\tif ( !isString( newval ) && !isFunction( newval ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string or replacement function. Value: `%s`.', newval ) );\n\t}\n\treturn base( str, search, newval );\n}\n\n\n// EXPORTS //\n\nexport default replace;\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 isString } from '@stdlib/assert/is-string';\nimport replace from './../../replace';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar RE = /[!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]]/g; // eslint-disable-line no-useless-escape\n\n\n// MAIN //\n\n/**\n* Removes punctuation characters from a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string primitive\n* @returns {string} output string\n*\n* @example\n* var str = 'Sun Tzu said: \"A leader leads by example not by force.\"';\n* var out = removePunctuation( str );\n* // returns 'Sun Tzu said A leader leads by example not by force'\n*\n* @example\n* var str = 'Double, double, toil and trouble; Fire burn, and cauldron bubble!';\n* var out = removePunctuation( str );\n* // returns 'Double double toil and trouble Fire burn and cauldron bubble'\n*\n* @example\n* var str = 'This module removes these characters: `{}[]:,!/<>().;~|?\\'\"';\n* var out = removePunctuation( str );\n* // returns 'This module removes these characters '\n*/\nfunction removePunctuation( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn replace( str, RE, '' );\n}\n\n\n// EXPORTS //\n\nexport default removePunctuation;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport format from '@stdlib/string/format';\nimport ABBRS from './abbreviations.json';\nimport EMOJIS from './emojis.json';\nimport CONTRACT from './contractions.json';\n\n\n// VARIABLES //\n\nvar REGEXP_PREFIXES = /^([,([{*<\"“'`‘]|\\.{1,3})/gi;\nvar REGEXP_SUFFIXES = /([,.!?%*>:;\"'”`)\\]}]|\\.\\.\\.)$/gi;\n\n\n// FUNCTIONS //\n\n/**\n* Extends an array by the elements of another array.\n*\n* @private\n* @param {Array} arr - input array\n* @param {Array} ext - array to extend `arr` with\n* @returns {Array} mutated input array\n*\n* @example\n* var arr = [ 1, 2, 3 ];\n* var out = extend( arr, [ 4, 5 ] );\n* // returns [ 1, 2, 3, 4, 5 ]\n*/\nfunction extend( arr, ext ) {\n\tvar i;\n\tfor ( i = 0; i < ext.length; i++ ) {\n\t\tarr.push( ext[ i ] );\n\t}\n\treturn arr;\n}\n\n/**\n* Tokenizes a substring.\n*\n* @private\n* @param {string} substr - input string\n* @returns {Array} token array\n*\n* @example\n* var str = '(never)';\n* var out = tokenizeSubstring( str );\n* // returns [ '(', 'never', ')' ]\n*/\nfunction tokenizeSubstring( substr ) {\n\tvar prefixes = [];\n\tvar suffixes = [];\n\tvar match;\n\tvar done;\n\tvar res;\n\n\tdo {\n\t\tif (\n\t\t\t!EMOJIS[ substr ] &&\n\t\t\t!ABBRS[ substr ] &&\n\t\t\t!CONTRACT[ substr ]\n\t\t) {\n\t\t\tmatch = substr.split( REGEXP_PREFIXES );\n\t\t\tif ( match.length > 1 ) {\n\t\t\t\tprefixes.push( match[ 1 ] );\n\t\t\t\tsubstr = match[ 2 ];\n\t\t\t}\n\t\t\telse {\n\t\t\t\tmatch = substr.split( REGEXP_SUFFIXES );\n\t\t\t\tif ( match.length > 1 ) {\n\t\t\t\t\tsubstr = match[ 0 ];\n\t\t\t\t\tsuffixes.unshift( match[ 1 ] );\n\t\t\t\t} else {\n\t\t\t\t\tdone = true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\telse {\n\t\t\tdone = true;\n\t\t}\n\t} while ( !done );\n\n\tres = prefixes;\n\tif ( substr ) {\n\t\tres.push( substr );\n\t}\n\n\t// If the last suffix is an ellipsis, move it to the front of the suffix array:\n\tif ( suffixes[ suffixes.length-1 ] === '...' ) {\n\t\tsuffixes.pop();\n\t\tsuffixes.unshift( '...' );\n\t}\n\textend( res, suffixes );\n\treturn res;\n}\n\n\n// MAIN //\n\n/**\n* Tokenize a string.\n*\n* @param {string} str - input string\n* @param {boolean} [keepWhitespace=false] - boolean indicating whether whitespace characters should be returned as part of the token array\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a boolean\n* @returns {Array} array of tokens\n*\n* @example\n* var str = 'Hello World!';\n* var out = tokenize( str );\n* // returns [ 'Hello', 'World', '!' ]\n*\n* @example\n* var str = '';\n* var out = tokenize( str );\n* // returns []\n*\n* @example\n* var str = 'Hello Mrs. Maple, could you call me back?';\n* var out = tokenize( str );\n* // returns [ 'Hello', 'Mrs.', 'Maple', ',', 'could', 'you', 'call', 'me', 'back', '?' ]\n*/\nfunction tokenize( str, keepWhitespace ) {\n\tvar subtkns;\n\tvar substrs;\n\tvar tokens;\n\tvar substr;\n\tvar cache;\n\tvar i;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isBoolean( keepWhitespace ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a boolean. Value: `%s`.', keepWhitespace ) );\n\t\t}\n\t}\n\tif ( !str ) {\n\t\treturn [];\n\t}\n\n\t// Split on whitespace:\n\tif ( keepWhitespace ) {\n\t\tsubstrs = str.split( /(\\s+)/ );\n\t} else {\n\t\tsubstrs = str.split( /\\s+/ );\n\t}\n\n\t// Set up cache to hold tokens for substring matches:\n\tcache = {};\n\n\t// Initialize token array:\n\ttokens = [];\n\n\tfor ( i = 0; i < substrs.length; i++ ) {\n\t\tsubstr = substrs[ i ];\n\t\tif ( hasOwnProp( cache, substr ) ) {\n\t\t\textend( tokens, cache[ substr ] );\n\t\t}\n\t\telse {\n\t\t\tsubtkns = tokenizeSubstring( substr );\n\t\t\textend( tokens, subtkns );\n\t\t\tcache[ substr ] = subtkns;\n\t\t}\n\t}\n\treturn tokens;\n}\n\n\n// EXPORTS //\n\nexport default tokenize;\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* Converts a string to uppercase.\n*\n* @param {string} str - string to convert\n* @returns {string} uppercase string\n*\n* @example\n* var str = uppercase( 'bEEp' );\n* // returns 'BEEP'\n*/\nfunction uppercase( str ) {\n\treturn str.toUpperCase();\n}\n\n\n// EXPORTS //\n\nexport default uppercase;\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* Converts a string to lowercase.\n*\n* @param {string} str - string to convert\n* @returns {string} lowercase string\n*\n* @example\n* var str = lowercase( 'bEEp' );\n* // returns 'beep'\n*/\nfunction lowercase( str ) {\n\treturn str.toLowerCase();\n}\n\n\n// EXPORTS //\n\nexport default lowercase;\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 TYPE = 'function';\n\n\n// MAIN //\n\n/**\n* Tests if an array-like object supports the accessor (get/set) protocol.\n*\n* @param {Object} value - value to test\n* @returns {boolean} boolean indicating whether a value is an accessor array\n*\n* @example\n* import Complex128Array from '@stdlib/array/complex128';\n*\n* var bool = isAccessorArray( new Complex128Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isAccessorArray( [] );\n* // returns false\n*/\nfunction isAccessorArray( value ) {\n\treturn ( typeof value.get === TYPE && typeof value.set === TYPE ); // eslint-disable-line valid-typeof\n}\n\n\n// EXPORTS //\n\nexport default isAccessorArray;\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// 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) 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// MAIN //\n\n// Mapping from array constructors to data types...\nvar ctor2dtypes = {\n\t'Float32Array': 'float32',\n\t'Float64Array': 'float64',\n\t'Array': 'generic',\n\t'Int16Array': 'int16',\n\t'Int32Array': 'int32',\n\t'Int8Array': 'int8',\n\t'Uint16Array': 'uint16',\n\t'Uint32Array': 'uint32',\n\t'Uint8Array': 'uint8',\n\t'Uint8ClampedArray': 'uint8c',\n\t'Complex64Array': 'complex64',\n\t'Complex128Array': 'complex128',\n\t'BooleanArray': 'bool'\n};\n\n\n// EXPORTS //\n\nexport default ctor2dtypes;\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 hasFloat64Array = ( typeof Float64Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float64Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float64Array\n*\n* @example\n* import Float64Array from '@stdlib/array/float64';\n*\n* var bool = isFloat64Array( new Float64Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat64Array( [] );\n* // returns false\n*/\nfunction isFloat64Array( value ) {\n\treturn (\n\t\t( hasFloat64Array && value instanceof Float64Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float64Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isFloat64Array;\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 Float64Array === 'function' ) ? Float64Array : 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// MODULES //\n\nimport isFloat64Array from './../../is-float64array';\nimport GlobalFloat64Array from './float64array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Float64Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float64Array` support\n*\n* @example\n* var bool = hasFloat64ArraySupport();\n* // returns \n*/\nfunction hasFloat64ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat64Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat64Array( [ 1.0, 3.14, -3.14, NaN ] );\n\t\tbool = (\n\t\t\tisFloat64Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.14 &&\n\t\t\tarr[ 2 ] === -3.14 &&\n\t\t\tarr[ 3 ] !== arr[ 3 ]\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 hasFloat64ArraySupport;\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 Float64Array === 'function' ) ? Float64Array : 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 double-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array/float64\n*\n* @example\n* import ctor from '@stdlib/array/float64';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasFloat64ArraySupport from '@stdlib/assert/has-float64array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat64ArraySupport() ) {\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// TODO: write polyfill\n\n// MAIN //\n\n/**\n* Typed array which represents an array of double-precision floating-point numbers 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) 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 hasFloat32Array = ( typeof Float32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Float32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Float32Array\n*\n* @example\n* import Float32Array from '@stdlib/array/float32';\n*\n* var bool = isFloat32Array( new Float32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isFloat32Array( [] );\n* // returns false\n*/\nfunction isFloat32Array( value ) {\n\treturn (\n\t\t( hasFloat32Array && value instanceof Float32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Float32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isFloat32Array;\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// MAIN //\n\nvar main = ( typeof Float32Array === 'function' ) ? Float32Array : 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 Float32Array === 'function' ) ? Float32Array : 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 single-precision floating-point numbers in the platform byte order.\n*\n* @module @stdlib/array/float32\n*\n* @example\n* import ctor from '@stdlib/array/float32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasFloat32ArraySupport from '@stdlib/assert/has-float32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat32ArraySupport() ) {\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 isFloat32Array from './../../is-float32array';\nimport PINF from '@stdlib/constants/float64/pinf';\nimport GlobalFloat32Array from './float32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Float32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float32Array` support\n*\n* @example\n* var bool = hasFloat32ArraySupport();\n* // returns \n*/\nfunction hasFloat32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat32Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\tisFloat32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] === 3.140000104904175 &&\n\t\t\tarr[ 2 ] === -3.140000104904175 &&\n\t\t\tarr[ 3 ] === PINF\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 hasFloat32ArraySupport;\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 single-precision floating-point numbers 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) 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 hasUint32Array = ( typeof Uint32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint32Array\n*\n* @example\n* import Uint32Array from '@stdlib/array/uint32';\n*\n* var bool = isUint32Array( new Uint32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint32Array( [] );\n* // returns false\n*/\nfunction isUint32Array( value ) {\n\treturn (\n\t\t( hasUint32Array && value instanceof Uint32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint32Array;\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 32-bit integer.\n*\n* @module @stdlib/constants/uint32/max\n* @type {uinteger32}\n*\n* @example\n* import UINT32_MAX from '@stdlib/constants/uint32/max';\n* // returns 4294967295\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{32} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 11111111111111111111111111111111\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 4294967295\n*/\nvar UINT32_MAX = 4294967295;\n\n\n// EXPORTS //\n\nexport default UINT32_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 Uint32Array === 'function' ) ? Uint32Array : 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 Uint32Array === 'function' ) ? Uint32Array : 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 32-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array/uint32\n*\n* @example\n* import ctor from '@stdlib/array/uint32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint32ArraySupport from '@stdlib/assert/has-uint32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint32ArraySupport() ) {\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 isUint32Array from './../../is-uint32array';\nimport UINT32_MAX from '@stdlib/constants/uint32/max';\nimport GlobalUint32Array from './uint32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint32Array` support\n*\n* @example\n* var bool = hasUint32ArraySupport();\n* // returns \n*/\nfunction hasUint32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT32_MAX+1, UINT32_MAX+2 ];\n\t\tarr = new GlobalUint32Array( arr );\n\t\tbool = (\n\t\t\tisUint32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT32_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 hasUint32ArraySupport;\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 32-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) 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 hasInt32Array = ( typeof Int32Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int32Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int32Array\n*\n* @example\n* import Int32Array from '@stdlib/array/int32';\n*\n* var bool = isInt32Array( new Int32Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt32Array( [] );\n* // returns false\n*/\nfunction isInt32Array( value ) {\n\treturn (\n\t\t( hasInt32Array && value instanceof Int32Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int32Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt32Array;\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 signed 32-bit integer.\n*\n* @module @stdlib/constants/int32/max\n* @type {integer32}\n*\n* @example\n* import INT32_MAX from '@stdlib/constants/int32/max';\n* // returns 2147483647\n*/\n\n\n// MAIN //\n\n/**\n* Maximum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{31} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 01111111111111111111111111111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 2147483647\n*/\nvar INT32_MAX = 2147483647|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT32_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 Int32Array === 'function' ) ? Int32Array : 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 Int32Array === 'function' ) ? Int32Array : 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 twos-complement 32-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array/int32\n*\n* @example\n* import ctor from '@stdlib/array/int32';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt32ArraySupport from '@stdlib/assert/has-int32array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt32ArraySupport() ) {\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 isInt32Array from './../../is-int32array';\nimport INT32_MAX from '@stdlib/constants/int32/max';\nimport INT32_MIN from '@stdlib/constants/int32/min';\nimport GlobalInt32Array from './int32array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int32Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int32Array` support\n*\n* @example\n* var bool = hasInt32ArraySupport();\n* // returns \n*/\nfunction hasInt32ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt32Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt32Array( [ 1, 3.14, -3.14, INT32_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt32Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT32_MIN // 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 hasInt32ArraySupport;\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* Minimum signed 32-bit integer.\n*\n* @module @stdlib/constants/int32/min\n* @type {integer32}\n*\n* @example\n* import INT32_MIN from '@stdlib/constants/int32/min';\n* // returns -2147483648\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 32-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{31})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -2147483648\n*/\nvar INT32_MIN = -2147483648|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT32_MIN;\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 twos-complement 32-bit signed 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) 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 hasUint16Array = ( typeof Uint16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint16Array\n*\n* @example\n* import Uint16Array from '@stdlib/array/uint16';\n*\n* var bool = isUint16Array( new Uint16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint16Array( [] );\n* // returns false\n*/\nfunction isUint16Array( value ) {\n\treturn (\n\t\t( hasUint16Array && value instanceof Uint16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint16Array;\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 16-bit integer.\n*\n* @module @stdlib/constants/uint16/max\n* @type {integer32}\n*\n* @example\n* import UINT16_MAX from '@stdlib/constants/uint16/max';\n* // returns 65535\n*/\n\n\n// MAIN //\n\n/**\n* Maximum unsigned 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{16} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 1111111111111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 65535\n*/\nvar UINT16_MAX = 65535|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default UINT16_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 Uint16Array === 'function' ) ? Uint16Array : 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 Uint16Array === 'function' ) ? Uint16Array : 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 16-bit unsigned integers in the platform byte order.\n*\n* @module @stdlib/array/uint16\n*\n* @example\n* import ctor from '@stdlib/array/uint16';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint16ArraySupport from '@stdlib/assert/has-uint16array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint16ArraySupport() ) {\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 isUint16Array from './../../is-uint16array';\nimport UINT16_MAX from '@stdlib/constants/uint16/max';\nimport GlobalUint16Array from './uint16array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint16Array` support\n*\n* @example\n* var bool = hasUint16ArraySupport();\n* // returns \n*/\nfunction hasUint16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = [ 1, 3.14, -3.14, UINT16_MAX+1, UINT16_MAX+2 ];\n\t\tarr = new GlobalUint16Array( arr );\n\t\tbool = (\n\t\t\tisUint16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === UINT16_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 hasUint16ArraySupport;\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 16-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) 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 hasInt16Array = ( typeof Int16Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int16Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int16Array\n*\n* @example\n* import Int16Array from '@stdlib/array/int16';\n*\n* var bool = isInt16Array( new Int16Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt16Array( [] );\n* // returns false\n*/\nfunction isInt16Array( value ) {\n\treturn (\n\t\t( hasInt16Array && value instanceof Int16Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int16Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt16Array;\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 signed 16-bit integer.\n*\n* @module @stdlib/constants/int16/max\n* @type {integer32}\n*\n* @example\n* import INT16_MAX from '@stdlib/constants/int16/max';\n* // returns 32767\n*/\n\n\n// MAIN //\n\n/**\n* Maximum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* 2^{15} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 0111111111111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 32767\n*/\nvar INT16_MAX = 32767|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT16_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 Int16Array === 'function' ) ? Int16Array : 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 Int16Array === 'function' ) ? Int16Array : 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 twos-complement 16-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array/int16\n*\n* @example\n* import ctor from '@stdlib/array/int16';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt16ArraySupport from '@stdlib/assert/has-int16array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt16ArraySupport() ) {\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 isInt16Array from './../../is-int16array';\nimport INT16_MAX from '@stdlib/constants/int16/max';\nimport INT16_MIN from '@stdlib/constants/int16/min';\nimport GlobalInt16Array from './int16array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int16Array` support\n*\n* @example\n* var bool = hasInt16ArraySupport();\n* // returns \n*/\nfunction hasInt16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt16Array( [ 1, 3.14, -3.14, INT16_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt16Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT16_MIN // 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 hasInt16ArraySupport;\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* Minimum signed 16-bit integer.\n*\n* @module @stdlib/constants/int16/min\n* @type {integer32}\n*\n* @example\n* import INT16_MIN from '@stdlib/constants/int16/min';\n* // returns -32768\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 16-bit integer.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* -(2^{15})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 1000000000000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -32768\n*/\nvar INT16_MIN = -32768|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT16_MIN;\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 twos-complement 16-bit signed 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) 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 './../../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) 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 hasUint8ClampedArray = ( typeof Uint8ClampedArray === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is a Uint8ClampedArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a Uint8ClampedArray\n*\n* @example\n* import Uint8ClampedArray from '@stdlib/array/uint8c';\n*\n* var bool = isUint8ClampedArray( new Uint8ClampedArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isUint8ClampedArray( [] );\n* // returns false\n*/\nfunction isUint8ClampedArray( value ) {\n\treturn (\n\t\t( hasUint8ClampedArray && value instanceof Uint8ClampedArray ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Uint8ClampedArray]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isUint8ClampedArray;\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 Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : 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 Uint8ClampedArray === 'function' ) ? Uint8ClampedArray : 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 clamped to 0-255.\n*\n* @module @stdlib/array/uint8c\n*\n* @example\n* import ctor from '@stdlib/array/uint8c';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasUint8ClampedArraySupport from '@stdlib/assert/has-uint8clampedarray-support'; // eslint-disable-line id-length\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasUint8ClampedArraySupport() ) {\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 isUint8ClampedArray from './../../is-uint8clampedarray';\nimport GlobalUint8ClampedArray from './uint8clampedarray.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Uint8ClampedArray` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Uint8ClampedArray` support\n*\n* @example\n* var bool = hasUint8ClampedArraySupport();\n* // returns \n*/\nfunction hasUint8ClampedArraySupport() { // eslint-disable-line id-length\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalUint8ClampedArray !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalUint8ClampedArray( [ -1, 0, 1, 3.14, 4.99, 255, 256 ] );\n\t\tbool = (\n\t\t\tisUint8ClampedArray( arr ) &&\n\t\t\tarr[ 0 ] === 0 && // clamped\n\t\t\tarr[ 1 ] === 0 &&\n\t\t\tarr[ 2 ] === 1 &&\n\t\t\tarr[ 3 ] === 3 && // round to nearest\n\t\t\tarr[ 4 ] === 5 && // round to nearest\n\t\t\tarr[ 5 ] === 255 &&\n\t\t\tarr[ 6 ] === 255 // clamped\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 hasUint8ClampedArraySupport;\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 clamped to 0-255.\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) 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 hasInt8Array = ( typeof Int8Array === 'function' ); // eslint-disable-line stdlib/require-globals\n\n\n// MAIN //\n\n/**\n* Tests if a value is an Int8Array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an Int8Array\n*\n* @example\n* import Int8Array from '@stdlib/array/int8';\n*\n* var bool = isInt8Array( new Int8Array( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isInt8Array( [] );\n* // returns false\n*/\nfunction isInt8Array( value ) {\n\treturn (\n\t\t( hasInt8Array && value instanceof Int8Array ) || // eslint-disable-line stdlib/require-globals\n\t\tnativeClass( value ) === '[object Int8Array]'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isInt8Array;\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 signed 8-bit integer.\n*\n* @module @stdlib/constants/int8/max\n* @type {integer32}\n*\n* @example\n* import INT8_MAX from '@stdlib/constants/int8/max';\n* // returns 127\n*/\n\n\n// MAIN //\n\n/**\n* Maximum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* 2^{7} - 1\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 01111111\n* ```\n*\n* @constant\n* @type {integer32}\n* @default 127\n*/\nvar INT8_MAX = 127|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_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 Int8Array === 'function' ) ? Int8Array : 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 Int8Array === 'function' ) ? Int8Array : 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 twos-complement 8-bit signed integers in the platform byte order.\n*\n* @module @stdlib/array/int8\n*\n* @example\n* import ctor from '@stdlib/array/int8';\n*\n* var arr = new ctor( 10 );\n* // returns \n*/\n\n// MODULES //\n\nimport hasInt8ArraySupport from '@stdlib/assert/has-int8array-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasInt8ArraySupport() ) {\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 isInt8Array from './../../is-int8array';\nimport INT8_MAX from '@stdlib/constants/int8/max';\nimport INT8_MIN from '@stdlib/constants/int8/min';\nimport GlobalInt8Array from './int8array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Int8Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Int8Array` support\n*\n* @example\n* var bool = hasInt8ArraySupport();\n* // returns \n*/\nfunction hasInt8ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalInt8Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalInt8Array( [ 1, 3.14, -3.14, INT8_MAX+1 ] );\n\t\tbool = (\n\t\t\tisInt8Array( arr ) &&\n\t\t\tarr[ 0 ] === 1 &&\n\t\t\tarr[ 1 ] === 3 && // truncation\n\t\t\tarr[ 2 ] === -3 && // truncation\n\t\t\tarr[ 3 ] === INT8_MIN // 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 hasInt8ArraySupport;\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* Minimum signed 8-bit integer.\n*\n* @module @stdlib/constants/int8/min\n* @type {integer32}\n*\n* @example\n* import INT8_MIN from '@stdlib/constants/int8/min';\n* // returns -128\n*/\n\n\n// MAIN //\n\n/**\n* Minimum signed 8-bit integer.\n*\n* ## Notes\n*\n* The number is given by\n*\n* ```tex\n* -(2^{7})\n* ```\n*\n* which corresponds to the two's complement bit sequence\n*\n* ```binarystring\n* 10000000\n* ```\n*\n* @constant\n* @type {integer32}\n* @default -128\n*/\nvar INT8_MIN = -128|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default INT8_MIN;\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 twos-complement 8-bit signed 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) 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// 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 './../../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 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 './../../../../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 './../../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 './../../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 './../../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 './../../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 generic array.\n*\n* @module @stdlib/constants/array/max-array-length\n*\n* @example\n* import MAX_ARRAY_LENGTH from '@stdlib/constants/array/max-array-length';\n* // returns 4294967295\n*/\n\n// MAIN //\n\n/**\n* Maximum length of a generic array.\n*\n* ```tex\n* 2^{32} - 1\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 4294967295\n*/\nvar MAX_ARRAY_LENGTH = 4294967295>>>0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default MAX_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-array-length';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an array-like object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is an array-like object\n*\n* @example\n* var bool = isArrayLikeObject( [] );\n* // returns true\n*\n* @example\n* var bool = isArrayLikeObject( { 'length': 10 } );\n* // returns true\n*\n* @example\n* var bool = isArrayLikeObject( 'beep' );\n* // returns false\n*/\nfunction isArrayLikeObject( 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 isArrayLikeObject;\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 isArray from './../../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\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 './../../tools/array-function';\nimport isString from './../../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 { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport setEnumerableReadOnly from '@stdlib/utils/define-read-only-property';\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport format from '@stdlib/string/format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 128-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex128} 128-bit complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex128( real, imag ) {\n\tif ( !( this instanceof Complex128 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tsetEnumerableReadOnly( this, 're', real );\n\tsetEnumerableReadOnly( this, 'im', imag );\n\treturn this;\n}\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex128\n* @readonly\n* @type {string}\n* @default 'Complex128'\n*\n* @example\n* var name = Complex128.name;\n* // returns 'Complex128'\n*/\nsetReadOnly( Complex128, 'name', 'Complex128' );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex128.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex128.prototype, 'BYTES_PER_ELEMENT', 8 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex128.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 16\n*/\nsetReadOnly( Complex128.prototype, 'byteLength', 16 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex128.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex128` instance.\n*\n* @name toJSON\n* @memberof Complex128.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex128', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex128.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex128;\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex128';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\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 fround = ( typeof Math.fround === 'function' ) ? Math.fround : null; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default fround;\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 Float32Array from '@stdlib/array/float32';\n\n\n// VARIABLES //\n\nvar FLOAT32_VIEW = new Float32Array( 1 );\n\n\n// MAIN //\n\n/**\n* Converts a double-precision floating-point number to the nearest single-precision floating-point number.\n*\n* @param {number} x - double-precision floating-point number\n* @returns {number} nearest single-precision floating-point number\n*\n* @example\n* var y = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*/\nfunction float64ToFloat32( x ) {\n\tFLOAT32_VIEW[ 0 ] = x;\n\treturn FLOAT32_VIEW[ 0 ];\n}\n\n\n// EXPORTS //\n\nexport default float64ToFloat32;\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* Convert a double-precision floating-point number to the nearest single-precision floating-point number.\n*\n* @module @stdlib/number/float64/base/to-float32\n*\n* @example\n* import float64ToFloat32 from '@stdlib/number/float64/base/to-float32';\n*\n* var y = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*/\n\n// MODULES //\n\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar float64ToFloat32;\nif ( typeof builtin === 'function' ) {\n\tfloat64ToFloat32 = builtin;\n} else {\n\tfloat64ToFloat32 = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default float64ToFloat32;\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 setEnumerableReadOnly from '@stdlib/utils/define-read-only-property';\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport float64ToFloat32 from '@stdlib/number/float64/base/to-float32';\nimport format from '@stdlib/string/format';\nimport toStr from './tostring.js';\nimport toJSON from './tojson.js';\n\n\n// MAIN //\n\n/**\n* 64-bit complex number constructor.\n*\n* @constructor\n* @param {number} real - real component\n* @param {number} imag - imaginary component\n* @throws {TypeError} must invoke using the `new` keyword\n* @throws {TypeError} real component must be a number\n* @throws {TypeError} imaginary component must be a number\n* @returns {Complex64} 64-bit complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n* // returns \n*/\nfunction Complex64( real, imag ) {\n\tif ( !( this instanceof Complex64 ) ) {\n\t\tthrow new TypeError( 'invalid invocation. Constructor must be called with the `new` keyword.' );\n\t}\n\tif ( !isNumber( real ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Real component must be a number. Value: `%s`.', real ) );\n\t}\n\tif ( !isNumber( imag ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Imaginary component must be a number. Value: `%s`.', imag ) );\n\t}\n\tsetEnumerableReadOnly( this, 're', float64ToFloat32( real ) );\n\tsetEnumerableReadOnly( this, 'im', float64ToFloat32( imag ) );\n\treturn this;\n}\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex64\n* @readonly\n* @type {string}\n* @default 'Complex64'\n*\n* @example\n* var name = Complex64.name;\n* // returns 'Complex64'\n*/\nsetReadOnly( Complex64, 'name', 'Complex64' );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var nbytes = Complex64.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Size (in bytes) of each component.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} size of each component\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.BYTES_PER_ELEMENT;\n* // returns 4\n*/\nsetReadOnly( Complex64.prototype, 'BYTES_PER_ELEMENT', 4 );\n\n/**\n* Length (in bytes) of a complex number.\n*\n* @name byteLength\n* @memberof Complex64.prototype\n* @type {integer}\n* @returns {integer} byte length\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var nbytes = z.byteLength;\n* // returns 8\n*/\nsetReadOnly( Complex64.prototype, 'byteLength', 8 );\n\n/**\n* Serializes a complex number as a string.\n*\n* @name toString\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {string} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var str = z.toString();\n* // returns '5 + 3i'\n*/\nsetReadOnly( Complex64.prototype, 'toString', toStr );\n\n/**\n* Serializes a complex number as a JSON object.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `Complex64` instance.\n*\n* @name toJSON\n* @memberof Complex64.prototype\n* @type {Function}\n* @returns {Object} serialized complex number\n*\n* @example\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var obj = z.toJSON();\n* // returns { 'type': 'Complex64', 're': 5.0, 'im': 3.0 }\n*/\nsetReadOnly( Complex64.prototype, 'toJSON', toJSON );\n\n\n// EXPORTS //\n\nexport default Complex64;\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 Complex128 from '@stdlib/complex/float64/ctor';\nimport Complex64 from '@stdlib/complex/float32/ctor';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a complex number-like object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex number-like object.\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var x = new Complex128( 4.0, 2.0 );\n* var bool = isComplexLike( x );\n* // returns true\n*\n* x = new Complex64( 4.0, 2.0 );\n* bool = isComplexLike( x );\n* // returns true\n*/\nfunction isComplexLike( value ) {\n\tif ( value instanceof Complex128 || value instanceof Complex64 ) {\n\t\treturn true;\n\t}\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\ttypeof value.re === 'number' &&\n\t\ttypeof value.im === 'number'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplexLike;\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 './../../../../base/assert/is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a finite numeric value is an even number.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an even number\n*\n* @example\n* var bool = isEven( 5.0 );\n* // returns false\n*\n* @example\n* var bool = isEven( -2.0 );\n* // returns true\n*\n* @example\n* var bool = isEven( 0.0 );\n* // returns true\n*\n* @example\n* var bool = isEven( NaN );\n* // returns false\n*/\nfunction isEven( x ) {\n\treturn isInteger( x/2.0 );\n}\n\n\n// EXPORTS //\n\nexport default isEven;\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* Serializes a complex number as a string.\n*\n* @private\n* @returns {string} serialized complex number\n*/\nfunction toString() { // eslint-disable-line stdlib/no-redeclare\n\t/* eslint-disable no-invalid-this */\n\tvar str = '' + this.re;\n\tif ( this.im < 0 ) {\n\t\tstr += ' - ' + (-this.im);\n\t} else {\n\t\tstr += ' + ' + this.im;\n\t}\n\tstr += 'i';\n\treturn str;\n}\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/**\n* Serializes a complex number as a JSON object.\n*\n* @private\n* @returns {Object} JSON representation\n*/\nfunction toJSON() {\n\t/* eslint-disable no-invalid-this */\n\tvar out = {};\n\tout.type = 'Complex64';\n\tout.re = this.re;\n\tout.im = this.im;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toJSON;\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// VARIABLES //\n\nvar BYTES_PER_ELEMENT = 8; // 4 bytes per float32 x (1 real + 1 imag component)\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a value is a `Complex64Array`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `Complex64Array`\n*\n* @example\n* import Complex64Array from '@stdlib/array/complex64';\n*\n* var bool = isComplex64Array( new Complex64Array( 10 ) );\n* // returns true\n*\n* bool = isComplex64Array( [] );\n* // returns false\n*/\nfunction isComplex64Array( value ) {\n\t// Note: the following is not robust and that is intentional. In this case, we are seeking a lower cost way to reasonably determine whether an input value is a `Complex64Array` in order to avoid walking the prototype chain and resolving constructors, which is necessary for robust identification of cross-realm instances. For more robust validation, see `@stdlib/assert/is-complex64array`.\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'Complex64Array' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplex64Array;\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// VARIABLES //\n\nvar BYTES_PER_ELEMENT = 16; // 8 bytes per float64 x (1 real + 1 imag component)\n\n\n// MAIN //\n\n/**\n* Returns a boolean indicating if a value is a `Complex128Array`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `Complex128Array`\n*\n* @example\n* import Complex128Array from '@stdlib/array/complex128';\n*\n* var bool = isComplex128Array( new Complex128Array( 10 ) );\n* // returns true\n*\n* bool = isComplex128Array( [] );\n* // returns false\n*/\nfunction isComplex128Array( value ) {\n\t// Note: the following is not robust and that is intentional. In this case, we are seeking a lower cost way to reasonably determine whether an input value is a `Complex128Array` in order to avoid walking the prototype chain and resolving constructors, which is necessary for robust identification of cross-realm instances. For more robust validation, see `@stdlib/assert/is-complex128array`.\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'Complex128Array' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isComplex128Array;\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 './../../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 './../../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) 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* Returns the real component of a single-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} real component\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var re = real( z );\n* // returns 5.0\n*/\nfunction real( z ) {\n\treturn z.re;\n}\n\n\n// EXPORTS //\n\nexport default real;\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* Returns the imaginary component of a single-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} imaginary component\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var z = new Complex64( 5.0, 3.0 );\n*\n* var im = imag( z );\n* // returns 3.0\n*/\nfunction imag( z ) {\n\treturn z.im;\n}\n\n\n// EXPORTS //\n\nexport default imag;\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 Float32Array from '@stdlib/array/float32';\n\n\n// MAIN //\n\n/**\n* Reinterprets a `Complex64Array` as a `Float32Array`.\n*\n* @param {Complex64Array} x - input array\n* @param {NonNegativeInteger} offset - starting index\n* @returns {Float32Array} `Float32Array` view\n*\n* @example\n* import Complex64Array from '@stdlib/array/complex64';\n*\n* var x = new Complex64Array( 10 );\n*\n* var out = reinterpret( x, 0 );\n* // returns \n*\n* var bool = ( out.buffer === x.buffer );\n* // returns true\n*/\nfunction reinterpret( x, offset ) {\n\treturn new Float32Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), 2*(x.length-offset) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default reinterpret;\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 Float64Array from '@stdlib/array/float64';\n\n\n// MAIN //\n\n/**\n* Reinterprets a `Complex128Array` as a `Float64Array`.\n*\n* @param {Complex128Array} x - input array\n* @param {NonNegativeInteger} offset - starting index\n* @returns {Float64Array} `Float64Array` view\n*\n* @example\n* import Complex128Array from '@stdlib/array/complex128';\n*\n* var x = new Complex128Array( 10 );\n*\n* var out = reinterpret( x, 0 );\n* // returns \n*\n* var bool = ( out.buffer === x.buffer );\n* // returns true\n*/\nfunction reinterpret( x, offset ) {\n\treturn new Float64Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), 2*(x.length-offset) ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default reinterpret;\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 isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport realf from '@stdlib/complex/float32/real';\nimport imagf from '@stdlib/complex/float32/imag';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\tvar z;\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\tz = v.value;\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( realf( z ), imagf( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIterator;\n","/* eslint-disable no-restricted-syntax, max-lines, no-invalid-this */\n\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 isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isCollection from '@stdlib/assert/is-collection';\nimport isArrayBuffer from '@stdlib/assert/is-arraybuffer';\nimport isObject from '@stdlib/assert/is-object';\nimport isArray from '@stdlib/assert/is-array';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isFunction from '@stdlib/assert/is-function';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport isEven from '@stdlib/math/base/assert/is-even';\nimport isInteger from '@stdlib/math/base/assert/is-integer';\nimport isComplex64Array from './../../base/assert/is-complex64array';\nimport isComplex128Array from './../../base/assert/is-complex128array';\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 Float32Array from './../../float32';\nimport Complex64 from '@stdlib/complex/float32/ctor';\nimport format from '@stdlib/string/format';\nimport realf from '@stdlib/complex/float32/real';\nimport imagf from '@stdlib/complex/float32/imag';\nimport floor from '@stdlib/math/base/special/floor';\nimport reinterpret64 from '@stdlib/strided/base/reinterpret-complex64';\nimport reinterpret128 from '@stdlib/strided/base/reinterpret-complex128';\nimport getter from './../../base/getter';\nimport accessorGetter from './../../base/accessor-getter';\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 = Float32Array.BYTES_PER_ELEMENT * 2;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a complex typed array.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array\n*/\nfunction isComplexArray( value ) {\n\treturn (\n\t\tvalue instanceof Complex64Array ||\n\t\t(\n\t\t\ttypeof value === 'object' &&\n\t\t\tvalue !== null &&\n\t\t\t(\n\t\t\t\tvalue.constructor.name === 'Complex64Array' ||\n\t\t\t\tvalue.constructor.name === 'Complex128Array'\n\t\t\t) &&\n\t\t\ttypeof value._length === 'number' && // eslint-disable-line no-underscore-dangle\n\n\t\t\t// NOTE: we don't perform a more rigorous test here for a typed array for performance reasons, as robustly checking for a typed array instance could require walking the prototype tree and performing relatively expensive constructor checks...\n\t\t\ttypeof value._buffer === 'object' // eslint-disable-line no-underscore-dangle\n\t\t)\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a complex typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array constructor\n*/\nfunction isComplexArrayConstructor( value ) {\n\treturn (\n\t\tvalue === Complex64Array ||\n\n\t\t// NOTE: weaker test in order to avoid a circular dependency with Complex128Array...\n\t\tvalue.name === 'Complex128Array'\n\t);\n}\n\n/**\n* Retrieves a complex number from a complex number array buffer.\n*\n* @private\n* @param {Float32Array} buf - array buffer\n* @param {NonNegativeInteger} idx - element index\n* @returns {Complex64} complex number\n*/\nfunction getComplex64( buf, idx ) {\n\tidx *= 2;\n\treturn new Complex64( buf[ idx ], buf[ idx+1 ] );\n}\n\n\n// MAIN //\n\n/**\n* 64-bit complex number 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 {RangeError} ArrayBuffer byte length must be a multiple of `8`\n* @throws {RangeError} array-like object and typed array input arguments must have a length which is a multiple of two\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} byte offset must be a multiple of `8`\n* @throws {TypeError} view length must be a positive multiple of `8`\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex64Array} complex number array\n*\n* @example\n* var arr = new Complex64Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new Complex64Array( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var arr = new Complex64Array( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Complex64Array( buf );\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 Complex64Array( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Complex64Array( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction Complex64Array() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof Complex64Array) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new Complex64Array();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new Complex64Array( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new Complex64Array( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new Complex64Array( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Float32Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\tif ( isNonNegativeInteger( arguments[0] ) ) {\n\t\t\tbuf = new Float32Array( arguments[0]*2 );\n\t\t} else if ( isCollection( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tlen = buf.length;\n\n\t\t\t// If provided a \"generic\" array, peak at the first value, and, if the value is a complex number, try to process as an array of complex numbers, falling back to \"normal\" typed array initialization if we fail and ensuring consistency if the first value had not been a complex number...\n\t\t\tif ( len && isArray( buf ) && isComplexLike( buf[0] ) ) {\n\t\t\t\tbuf = fromArray( new Float32Array( len*2 ), buf );\n\t\t\t\tif ( buf === null ) {\n\t\t\t\t\t// We failed and we are now forced to allocate a new array :-(\n\t\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t\t}\n\t\t\t\t\t// We failed, so fall back to directly setting values...\n\t\t\t\t\tbuf = new Float32Array( arguments[0] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( isComplex64Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret64( buf, 0 );\n\t\t\t\t} else if ( isComplex128Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret128( buf, 0 );\n\t\t\t\t} else if ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tbuf = new Float32Array( buf );\n\t\t\t}\n\t\t} else if ( isArrayBuffer( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( !isInteger( buf.byteLength/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.', BYTES_PER_ELEMENT, buf.byteLength ) );\n\t\t\t}\n\t\t\tbuf = new Float32Array( buf );\n\t\t} else if ( isObject( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\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`.', buf ) );\n\t\t\t}\n\t\t\tif ( !isFunction( buf[ 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`.', buf ) );\n\t\t\t}\n\t\t\tbuf = buf[ 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`.', buf ) ); // FIXME: `buf` is what is returned from above, NOT the original value\n\t\t\t}\n\t\t\tbuf = fromIterator( buf );\n\t\t\tif ( buf instanceof Error ) {\n\t\t\t\tthrow buf;\n\t\t\t}\n\t\t\tbuf = new Float32Array( 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`.', arguments[0] ) );\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 ( !isInteger( byteOffset/BYTES_PER_ELEMENT ) ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Byte offset must be a multiple of %u. Value: `%u`.', BYTES_PER_ELEMENT, byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t\tif ( !isInteger( len/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.', BYTES_PER_ELEMENT, len ) );\n\t\t\t}\n\t\t\tbuf = new Float32Array( 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 Float32Array( buf, byteOffset, len*2 );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length/2 );\n\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex64Array\n* @readonly\n* @type {PositiveInteger}\n* @default 8\n*\n* @example\n* var nbytes = Complex64Array.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex64Array, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex64Array\n* @readonly\n* @type {string}\n* @default 'Complex64Array'\n*\n* @example\n* var str = Complex64Array.name;\n* // returns 'Complex64Array'\n*/\nsetReadOnly( Complex64Array, 'name', 'Complex64Array' );\n\n/**\n* Creates a new 64-bit complex number array from an array-like object or an iterable.\n*\n* @name from\n* @memberof Complex64Array\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 complex number 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* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @throws {TypeError} when provided an iterator, a callback must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex64Array} 64-bit complex number array\n*\n* @example\n* var arr = Complex64Array.from( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = Complex64Array.from( [ new Complex64( 1.0, 1.0 ) ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function clbk( v ) {\n* return new Complex64( realf(v)*2.0, imagf(v)*2.0 );\n* }\n*\n* var arr = Complex64Array.from( [ new Complex64( 1.0, 1.0 ) ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*/\nsetReadOnly( Complex64Array, '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 flg;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( isComplexArray( src ) ) {\n\t\tlen = src.length;\n\t\tif ( clbk ) {\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, src.get( i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = realf( v );\n\t\t\t\t\tbuf[ j+1 ] = imagf( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isCollection( src ) ) {\n\t\tif ( clbk ) {\n\t\t\t// Note: array contents affect how we iterate over a provided data source. If only complex number objects, we can extract real and imaginary components. Otherwise, for non-complex number arrays (e.g., `Float64Array`, etc), we assume a strided array where real and imaginary components are interleaved. In the former case, we expect a callback to return real and imaginary components (possibly as a complex number). In the latter case, we expect a callback to return *either* a real or imaginary component.\n\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\t// Detect whether we've been provided an array which returns complex number objects...\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tif ( !isComplexLike( get( src, i ) ) ) {\n\t\t\t\t\tflg = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If an array does not contain only complex number objects, then we assume interleaved real and imaginary components...\n\t\t\tif ( flg ) {\n\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. First argument must have a length which is a multiple of %u. Length: `%u`.', 2, len ) );\n\t\t\t\t}\n\t\t\t\tout = new this( len/2 );\n\t\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tbuf[ i ] = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\t// If an array contains only complex number objects, then we need to extract real and imaginary components...\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = realf( v );\n\t\t\t\t\tbuf[ j+1 ] = imagf( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\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\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\n\t\t}\n\t\tlen = tmp.length / 2;\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 64-bit complex number array from a variable number of arguments.\n*\n* @name of\n* @memberof Complex64Array\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} 64-bit complex number array\n*\n* @example\n* var arr = Complex64Array.of( 1.0, 1.0, 1.0, 1.0 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( Complex64Array, '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 ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide an integer\n* @returns {(Complex64|void)} array element\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var z = arr.at( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 9.0, -9.0 ], 9 );\n*\n* z = arr.at( 0 );\n* // returns [ 1.0, -1.0 ]\n*\n* z = arr.at( -1 );\n* // returns [ 9.0, -9.0 ]\n*\n* z = arr.at( 100 );\n* // returns undefined\n*\n* z = arr.at( -100 );\n* // returns undefined\n*/\nsetReadOnly( Complex64Array.prototype, 'at', function at( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tif ( idx < 0 ) {\n\t\tidx += this._length;\n\t}\n\tif ( idx < 0 || idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex64( this._buffer, idx );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof Complex64Array.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( Complex64Array.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 Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 80\n*/\nsetReadOnlyAccessor( Complex64Array.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 Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( Complex64Array.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 Complex64Array.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 8\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 8\n*/\nsetReadOnly( Complex64Array.prototype, 'BYTES_PER_ELEMENT', Complex64Array.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 Complex64Array.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 complex number array\n* @returns {Complex64Array} modified array\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( 4 );\n*\n* // Set the array elements:\n* arr.set( new Complex64( 1.0, 1.0 ), 0 );\n* arr.set( new Complex64( 2.0, 2.0 ), 1 );\n* arr.set( new Complex64( 3.0, 3.0 ), 2 );\n* arr.set( new Complex64( 4.0, 4.0 ), 3 );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n* // arr => [ 1.0, 1.0, 2.0, 2.0, 1.0, 1.0, 2.0, 2.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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*2, start*2 );\n\t} else {\n\t\tthis._buffer.copyWithin( target*2, start*2, arguments[2]*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 Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = [\n* new Complex64( 1.0, 1.0 ),\n* new Complex64( 2.0, 2.0 ),\n* new Complex64( 3.0, 3.0 )\n* ];\n* arr = new Complex64Array( arr );\n*\n* // Create an iterator:\n* var it = arr.entries();\n*\n* // Iterate over the key-value pairs...\n* var v = it.next().value;\n* // returns [ 0, ]\n*\n* v = it.next().value;\n* // returns [ 1, ]\n*\n* v = it.next().value;\n* // returns [ 2, ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'entries', function entries() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar buf;\n\tvar FLG;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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, getComplex64( 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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number 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* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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, getComplex64( 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 Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} 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 complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n* @returns {Complex64Array} modified array\n*\n* @example\n* var arr = new Complex64Array( 3 );\n*\n* arr.fill( new Complex64( 1.0, 1.0 ), 1 );\n*\n* var z = arr.get( 1 );\n* // returns [ 1.0, 1.0 ]\n*\n* z = arr.get( 2 );\n* // returns [ 1.0, 1.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = realf( value );\n\tim = imagf( value );\n\tfor ( i = start; i < end; i++ ) {\n\t\tidx = 2*i;\n\t\tbuf[ idx ] = re;\n\t\tbuf[ idx+1 ] = im;\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} complex number array\n*\n* @example\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.filter( predicate );\n* // returns [ 2.0, 2.0 ]\n*\n* var len = out.length;\n* // returns 1\n*/\nsetReadOnly( Complex64Array.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\tout.push( z );\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex64|void)} array element or undefined\n*\n* @example\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.find( predicate );\n* // returns [ 1.0, 1.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var idx = arr.findIndex( predicate );\n* // returns 2\n*/\nsetReadOnly( Complex64Array.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, 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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex64|void)} array element or undefined\n*\n* @example\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.findLast( predicate );\n* // returns [ 3.0, 3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var idx = arr.findLastIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Complex64Array.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tif ( predicate.call( thisArg, z, 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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* function log( v, i ) {\n* console.log( '%s: %s', i, v.toString() );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( Complex64Array.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex64( buf, i );\n\t\tfcn.call( thisArg, z, i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @name get\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(Complex64|void)} array element\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns [ 1.0, -1.0 ]\n*\n* z = arr.get( 100 );\n* // returns undefined\n*/\nsetReadOnly( Complex64Array.prototype, 'get', function get( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 getComplex64( this._buffer, idx );\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {boolean} boolean indicating whether an array includes a provided value\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var bool = arr.includes( new Complex64( 3.0, -3.0 ) );\n* // returns true\n*\n* bool = arr.includes( new Complex64( 3.0, -3.0 ), 3 );\n* // returns false\n*\n* bool = arr.includes( new Complex64( 4.0, -4.0 ), -3 );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\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 Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( 10 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var idx = arr.indexOf( new Complex64( 3.0, -3.0 ) );\n* // returns 2\n*\n* idx = arr.indexOf( new Complex64( 3.0, -3.0 ), 3 );\n* // returns -1\n*\n* idx = arr.indexOf( new Complex64( 4.0, -4.0 ), -3 );\n* // returns -1\n*/\nsetReadOnly( Complex64Array.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\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 Complex64Array.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.join();\n* // returns '1 + 1i,2 + 2i'\n*\n* str = arr.join( '/' );\n* // returns '1 + 1i/2 + 2i'\n*/\nsetReadOnly( Complex64Array.prototype, 'join', function join( separator ) {\n\tvar out;\n\tvar buf;\n\tvar sep;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( arguments.length === 0 ) {\n\t\tsep = ',';\n\t} else if ( isString( separator ) ) {\n\t\tsep = separator;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', separator ) );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex64( buf, i ).toString() );\n\t}\n\treturn out.join( sep );\n});\n\n/**\n* Returns an iterator for iterating over each index key in a typed array.\n*\n* @name keys\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 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( Complex64Array.prototype, 'keys', function keys() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 Complex64Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex] - index at which to start searching backward (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 3.0, -3.0 ], 4 );\n*\n* var idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ) );\n* // returns 4\n*\n* idx = arr.lastIndexOf( new Complex64( 3.0, -3.0 ), 3 );\n* // returns 2\n*\n* idx = arr.lastIndexOf( new Complex64( 5.0, -5.0 ), 3 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( new Complex64( 2.0, -2.0 ), -3 );\n* // returns 1\n*/\nsetReadOnly( Complex64Array.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = realf( searchElement );\n\tim = imagf( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\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 Complex64Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex64Array( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( Complex64Array.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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} complex number array\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function scale( v, i ) {\n* return new Complex64( 2.0*realf( v ), 2.0*imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.map( scale );\n* // returns [ 2.0, -2.0, 4.0, -4.0, 6.0, -6.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\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\tv = fcn.call( thisArg, getComplex64( buf, i ), i, this );\n\t\tif ( isComplexLike( v ) ) {\n\t\t\toutbuf[ 2*i ] = realf( v );\n\t\t\toutbuf[ (2*i)+1 ] = imagf( v );\n\t\t} else if ( isArrayLikeObject( v ) && v.length === 2 ) {\n\t\t\toutbuf[ 2*i ] = v[ 0 ];\n\t\t\toutbuf[ (2*i)+1 ] = v[ 1 ];\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t}\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\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* import caddf from '@stdlib/complex/float32/base/add';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduce( caddf );\n* // returns [ 6.0, 6.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 = getComplex64( buf, 0 );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tv = getComplex64( buf, i );\n\t\tacc = reducer( acc, v, 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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\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* import caddf from '@stdlib/complex/float32/base/add';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduceRight( caddf );\n* // returns [ 6.0, 6.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'reduceRight', function reduceRight( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 = getComplex64( buf, len-1 );\n\t\ti = len-2;\n\t}\n\tfor ( ; i >= 0; i-- ) {\n\t\tv = getComplex64( buf, i );\n\t\tacc = reducer( acc, v, i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} reversed array\n*\n* @example\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.reverse();\n* // returns [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'reverse', function reverse() {\n\tvar buf;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tbuf = this._buffer;\n\tN = floor( len / 2 );\n\tfor ( i = 0; i < N; i++ ) {\n\t\tj = len - i - 1;\n\t\ttmp = buf[ (2*i) ];\n\t\tbuf[ (2*i) ] = buf[ (2*j) ];\n\t\tbuf[ (2*j) ] = tmp;\n\t\ttmp = buf[ (2*i)+1 ];\n\t\tbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t\tbuf[ (2*j)+1 ] = tmp;\n\t}\n\treturn this;\n});\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - When provided a typed array, real or complex, 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 Complex64Array.prototype\n* @type {Function}\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be either a complex number, an array-like object, or a complex number array\n* @throws {TypeError} index argument must be a nonnegative integer\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\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 Complex64Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns [ 1.0, -1.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'set', function set( value ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar flg;\n\tvar N;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( isComplexLike( value ) ) {\n\t\tif ( idx >= this._length ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );\n\t\t}\n\t\tidx *= 2;\n\t\tbuf[ idx ] = realf( value );\n\t\tbuf[ idx+1 ] = imagf( value );\n\t\treturn;\n\t}\n\tif ( isComplexArray( 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\tsbuf = value._buffer;\n\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 Float32Array( sbuf.length );\n\t\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t}\n\t\t\tsbuf = tmp;\n\t\t}\n\t\tidx *= 2;\n\t\tj = 0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\tidx += 2; // stride\n\t\t\tj += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tif ( isCollection( value ) ) {\n\t\t// Detect whether we've been provided an array of complex numbers...\n\t\tN = value.length;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tif ( !isComplexLike( value[ i ] ) ) {\n\t\t\t\tflg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// If an array does not contain only complex numbers, then we assume interleaved real and imaginary components...\n\t\tif ( flg ) {\n\t\t\tif ( !isEven( N ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', N ) );\n\t\t\t}\n\t\t\tif ( idx+(N/2) > this._length ) {\n\t\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t\t}\n\t\t\tsbuf = value;\n\n\t\t\t// Check for overlapping memory...\n\t\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\t\tif (\n\t\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t\t(\n\t\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// We need to copy source values...\n\t\t\t\ttmp = new Float32Array( N );\n\t\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\t\ttmp[ i ] = sbuf[ i ]; // TODO: handle accessor arrays\n\t\t\t\t}\n\t\t\t\tsbuf = tmp;\n\t\t\t}\n\t\t\tidx *= 2;\n\t\t\tN /= 2;\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\t\tidx += 2; // stride\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t// If an array contains only complex numbers, then we need to extract real and imaginary components...\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\tidx *= 2;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tv = value[ i ];\n\t\t\tbuf[ idx ] = realf( v );\n\t\t\tbuf[ idx+1 ] = imagf( v );\n\t\t\tidx += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.', value ) );\n\n\t/* eslint-enable no-underscore-dangle */\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} complex number array\n*\n* @example\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var out = arr.slice();\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0, 4.0, -4.0, 5.0, -5.0 ]\n*\n* out = arr.slice( 1, -2 );\n* // returns [ 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'slice', function slice( start, end ) {\n\tvar outlen;\n\tvar outbuf;\n\tvar out;\n\tvar idx;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tstart = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First 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 === 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 ( start < end ) {\n\t\toutlen = end - start;\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\tidx = 2*(i+start);\n\t\toutbuf[ 2*i ] = buf[ idx ];\n\t\toutbuf[ (2*i)+1 ] = buf[ idx+1 ];\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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number 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* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function predicate( v ) {\n* return ( realf( v ) === imagf( v ) );\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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, getComplex64( 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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} compareFcn - comparison function\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} sorted array\n*\n* @example\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function compare( a, b ) {\n* var re1;\n* var re2;\n* var im1;\n* var im2;\n* re1 = realf( a );\n* re2 = realf( b );\n* if ( re1 < re2 ) {\n* return -1;\n* }\n* if ( re1 > re2 ) {\n* return 1;\n* }\n* im1 = imagf( a );\n* im2 = imagf( b );\n* if ( im1 < im2 ) {\n* return -1;\n* }\n* if ( im1 > im2 ) {\n* return 1;\n* }\n* return 0;\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 3.0, -3.0 ], 0 );\n* arr.set( [ 1.0, -1.0 ], 1 );\n* arr.set( [ 2.0, -2.0 ], 2 );\n*\n* var out = arr.sort( compare );\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'sort', function sort( compareFcn ) {\n\tvar tmp;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\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 = this._buffer;\n\tlen = this._length;\n\ttmp = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\ttmp.push( getComplex64( buf, i ) );\n\t}\n\ttmp.sort( compareFcn );\n\tfor ( i = 0; i < len; i++ ) {\n\t\tj = 2 * i;\n\t\tbuf[ j ] = realf( tmp[i] );\n\t\tbuf[ j+1 ] = imagf( tmp[i] );\n\t}\n\treturn this;\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 Complex64Array.prototype\n* @type {Function}\n* @param {integer} [begin=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} subarray\n*\n* @example\n* var arr = new Complex64Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var subarr = arr.subarray();\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0, 4.0, -4.0, 5.0, -5.0 ]\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns [ 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 Complex64Array.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 complex number 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 Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toLocaleString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex64Array.prototype, 'toLocaleString', function toLocaleString( locales, options ) {\n\tvar opts;\n\tvar loc;\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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( getComplex64( 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 Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex64Array} reversed array\n*\n* @example\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.toReversed();\n* // returns [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tj = len - i - 1;\n\t\toutbuf[ (2*i) ] = buf[ (2*j) ];\n\t\toutbuf[ (2*i)+1 ] = buf[ (2*j)+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 Complex64Array.prototype\n* @type {Function}\n* @param {Function} compareFcn - comparison function\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex64Array} sorted array\n*\n* @example\n* import realf from '@stdlib/complex/float32/real';\n* import imagf from '@stdlib/complex/float32/imag';\n*\n* function compare( a, b ) {\n* var re1;\n* var re2;\n* var im1;\n* var im2;\n* re1 = realf( a );\n* re2 = realf( b );\n* if ( re1 < re2 ) {\n* return -1;\n* }\n* if ( re1 > re2 ) {\n* return 1;\n* }\n* im1 = imagf( a );\n* im2 = imagf( b );\n* if ( im1 < im2 ) {\n* return -1;\n* }\n* if ( im1 > im2 ) {\n* return 1;\n* }\n* return 0;\n* }\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 3.0, -3.0 ], 0 );\n* arr.set( [ 1.0, -1.0 ], 1 );\n* arr.set( [ 2.0, -2.0 ], 2 );\n*\n* var out = arr.sort( compare );\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'toSorted', function toSorted( compareFcn ) {\n\tvar tmp;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\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 = this._buffer;\n\tlen = this._length;\n\ttmp = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\ttmp.push( getComplex64( buf, i ) );\n\t}\n\ttmp.sort( compareFcn );\n\treturn new Complex64Array( tmp );\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex64Array.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex64( buf, i ).toString() );\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 Complex64Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Complex64Array( 2 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n*\n* var iter = arr.values();\n*\n* var v = iter.next().value;\n* // returns [ 1.0, -1.0 ]\n*\n* v = iter.next().value;\n* // returns [ 2.0, -2.0 ]\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( Complex64Array.prototype, 'values', function values() {\n\tvar iter;\n\tvar self;\n\tvar len;\n\tvar FLG;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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': getComplex64( 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 Complex64Array.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {ComplexLike} value - new value\n* @throws {TypeError} `this` must be a complex number 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 complex number\n* @returns {Complex64Array} new typed array\n*\n* @example\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.with( 0, new Complex64( 4.0, 4.0 ) );\n* // returns [ 4.0, 4.0, 2.0, 2.0, 3.0, 3.0 ]\n*/\nsetReadOnly( Complex64Array.prototype, 'with', function copyWith( index, value ) {\n\tvar buf;\n\tvar out;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tout = new this.constructor( this._buffer );\n\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tbuf[ 2*index ] = realf( value );\n\tbuf[ (2*index)+1 ] = imagf( value );\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default Complex64Array;\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 isComplexLike from '@stdlib/assert/is-complex-like';\nimport realf from '@stdlib/complex/float32/real';\nimport imagf from '@stdlib/complex/float32/imag';\n\n\n// MAIN //\n\n/**\n* Returns a strided array of real and imaginary components.\n*\n* @private\n* @param {Float32Array} buf - output array\n* @param {Array} arr - array containing complex numbers\n* @returns {(Float32Array|null)} output array or null\n*/\nfunction fromArray( buf, arr ) {\n\tvar len;\n\tvar v;\n\tvar i;\n\tvar j;\n\n\tlen = arr.length;\n\tj = 0;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tv = arr[ i ];\n\t\tif ( !isComplexLike( v ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tbuf[ j ] = realf( v );\n\t\tbuf[ j+1 ] = imagf( v );\n\t\tj += 2; // stride\n\t}\n\treturn buf;\n}\n\n\n// EXPORTS //\n\nexport default fromArray;\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* Returns the real component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} real component\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var re = real( z );\n* // returns 5.0\n*/\nfunction real( z ) {\n\treturn z.re;\n}\n\n\n// EXPORTS //\n\nexport default real;\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* Returns the imaginary component of a double-precision complex floating-point number.\n*\n* @param {Complex} z - complex number\n* @returns {number} imaginary component\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var z = new Complex128( 5.0, 3.0 );\n*\n* var im = imag( z );\n* // returns 3.0\n*/\nfunction imag( z ) {\n\treturn z.im;\n}\n\n\n// EXPORTS //\n\nexport default imag;\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 isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport format from '@stdlib/string/format';\nimport real from '@stdlib/complex/float64/real';\nimport imag from '@stdlib/complex/float64/imag';\n\n\n// MAIN //\n\n/**\n* Returns an array of iterated values.\n*\n* @private\n* @param {Object} it - iterator\n* @returns {(Array|TypeError)} array or an error\n*/\nfunction fromIterator( it ) {\n\tvar out;\n\tvar v;\n\tvar z;\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\tz = v.value;\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( real( z ), imag( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. An iterator must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIterator;\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 isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport realf from '@stdlib/complex/float32/real';\nimport imagf from '@stdlib/complex/float32/imag';\nimport format from '@stdlib/string/format';\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|TypeError)} array or an error\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar z;\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\tz = clbk.call( thisArg, v.value, i );\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( realf( z ), imagf( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIteratorMap;\n","/* eslint-disable no-restricted-syntax, max-lines, no-invalid-this */\n\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 { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isCollection from '@stdlib/assert/is-collection';\nimport isArrayBuffer from '@stdlib/assert/is-arraybuffer';\nimport isObject from '@stdlib/assert/is-object';\nimport isArray from '@stdlib/assert/is-array';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport isString from '@stdlib/assert/is-string';\nimport isFunction from '@stdlib/assert/is-function';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport isEven from '@stdlib/math/base/assert/is-even';\nimport isInteger from '@stdlib/math/base/assert/is-integer';\nimport isComplex64Array from './../../base/assert/is-complex64array';\nimport isComplex128Array from './../../base/assert/is-complex128array';\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 Float64Array from './../../float64';\nimport Complex128 from '@stdlib/complex/float64/ctor';\nimport real from '@stdlib/complex/float64/real';\nimport imag from '@stdlib/complex/float64/imag';\nimport floor from '@stdlib/math/base/special/floor';\nimport reinterpret64 from '@stdlib/strided/base/reinterpret-complex64';\nimport reinterpret128 from '@stdlib/strided/base/reinterpret-complex128';\nimport getter from './../../base/getter';\nimport accessorGetter from './../../base/accessor-getter';\nimport format from '@stdlib/string/format';\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 = Float64Array.BYTES_PER_ELEMENT * 2;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a complex typed array.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array\n*/\nfunction isComplexArray( value ) {\n\treturn (\n\t\tvalue instanceof Complex128Array ||\n\t\t(\n\t\t\ttypeof value === 'object' &&\n\t\t\tvalue !== null &&\n\t\t\t(\n\t\t\t\tvalue.constructor.name === 'Complex64Array' ||\n\t\t\t\tvalue.constructor.name === 'Complex128Array'\n\t\t\t) &&\n\t\t\ttypeof value._length === 'number' && // eslint-disable-line no-underscore-dangle\n\n\t\t\t// NOTE: we don't perform a more rigorous test here for a typed array for performance reasons, as robustly checking for a typed array instance could require walking the prototype tree and performing relatively expensive constructor checks...\n\t\t\ttypeof value._buffer === 'object' // eslint-disable-line no-underscore-dangle\n\t\t)\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a complex typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array constructor\n*/\nfunction isComplexArrayConstructor( value ) {\n\treturn (\n\t\tvalue === Complex128Array ||\n\n\t\t// NOTE: weaker test in order to avoid a circular dependency with Complex64Array...\n\t\tvalue.name === 'Complex64Array'\n\t);\n}\n\n/**\n* Retrieves a complex number from a complex number array buffer.\n*\n* @private\n* @param {Float64Array} buf - array buffer\n* @param {NonNegativeInteger} idx - element index\n* @returns {Complex128} complex number\n*/\nfunction getComplex128( buf, idx ) {\n\tidx *= 2;\n\treturn new Complex128( buf[ idx ], buf[ idx+1 ] );\n}\n\n\n// MAIN //\n\n/**\n* 128-bit complex number array constructor.\n*\n* @constructor\n* @param {(NonNegativeInteger|Collection|ArrayBuffer|Iterable)} [arg] - length, typed array, array-like object, buffer, or iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @throws {RangeError} ArrayBuffer byte length must be a multiple of `16`\n* @throws {RangeError} array-like object and typed array input arguments must have a length which is a multiple of two\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} byte offset must be a multiple of `16`\n* @throws {TypeError} view length must be a positive multiple of `16`\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex128Array} complex number array\n*\n* @example\n* var arr = new Complex128Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new Complex128Array( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* var arr = new Complex128Array( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Complex128Array( buf );\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( 32 );\n* var arr = new Complex128Array( buf, 16 );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 64 );\n* var arr = new Complex128Array( buf, 16, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction Complex128Array() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof Complex128Array) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new Complex128Array();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new Complex128Array( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new Complex128Array( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new Complex128Array( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Float64Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\tif ( isNonNegativeInteger( arguments[0] ) ) {\n\t\t\tbuf = new Float64Array( arguments[0]*2 );\n\t\t} else if ( isCollection( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tlen = buf.length;\n\n\t\t\t// If provided a \"generic\" array, peak at the first value, and, if the value is a complex number, try to process as an array of complex numbers, falling back to \"normal\" typed array initialization if we fail and ensuring consistency if the first value had not been a complex number...\n\t\t\tif ( len && isArray( buf ) && isComplexLike( buf[0] ) ) {\n\t\t\t\tbuf = fromArray( new Float64Array( len*2 ), buf );\n\t\t\t\tif ( buf === null ) {\n\t\t\t\t\t// We failed and we are now forced to allocate a new array :-(\n\t\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t\t}\n\t\t\t\t\t// We failed, so fall back to directly setting values...\n\t\t\t\t\tbuf = new Float64Array( arguments[0] );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif ( isComplex64Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret64( buf, 0 );\n\t\t\t\t} else if ( isComplex128Array( buf ) ) {\n\t\t\t\t\tbuf = reinterpret128( buf, 0 );\n\t\t\t\t} else if ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object and typed array arguments must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tbuf = new Float64Array( buf );\n\t\t\t}\n\t\t} else if ( isArrayBuffer( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\n\t\t\tif ( !isInteger( buf.byteLength/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.', BYTES_PER_ELEMENT, buf.byteLength ) );\n\t\t\t}\n\t\t\tbuf = new Float64Array( buf );\n\t\t} else if ( isObject( arguments[0] ) ) {\n\t\t\tbuf = arguments[ 0 ];\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`.', buf ) );\n\t\t\t}\n\t\t\tif ( !isFunction( buf[ 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`.', buf ) );\n\t\t\t}\n\t\t\tbuf = buf[ 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`.', buf ) );\n\t\t\t}\n\t\t\tbuf = fromIterator( buf );\n\t\t\tif ( buf instanceof Error ) {\n\t\t\t\tthrow buf;\n\t\t\t}\n\t\t\tbuf = new Float64Array( 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`.', arguments[0] ) );\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 ( !isInteger( byteOffset/BYTES_PER_ELEMENT ) ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Byte offset must be a multiple of %u. Value: `%u`.', BYTES_PER_ELEMENT, byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t\tif ( !isInteger( len/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.', BYTES_PER_ELEMENT, len ) );\n\t\t\t}\n\t\t\tbuf = new Float64Array( 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 Float64Array( buf, byteOffset, len*2 );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length/2 );\n\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Complex128Array\n* @readonly\n* @type {PositiveInteger}\n* @default 16\n*\n* @example\n* var nbytes = Complex128Array.BYTES_PER_ELEMENT;\n* // returns 16\n*/\nsetReadOnly( Complex128Array, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Complex128Array\n* @readonly\n* @type {string}\n* @default 'Complex128Array'\n*\n* @example\n* var name = Complex128Array.name;\n* // returns 'Complex128Array'\n*/\nsetReadOnly( Complex128Array, 'name', 'Complex128Array' );\n\n/**\n* Creates a new 128-bit complex number array from an array-like object or an iterable.\n*\n* @name from\n* @memberof Complex128Array\n* @type {Function}\n* @param {(Collection|Object)} 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 complex number 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* @throws {RangeError} array-like objects must have a length which is a multiple of two\n* @throws {TypeError} an iterator must return either a two element array containing real and imaginary components or a complex number\n* @throws {TypeError} when provided an iterator, a callback must return either a two element array containing real and imaginary components or a complex number\n* @returns {Complex128Array} 128-bit complex number array\n*\n* @example\n* var arr = Complex128Array.from( [ 1.0, -1.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = Complex128Array.from( [ new Complex128( 1.0, 1.0 ) ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function clbk( v ) {\n* return new Complex128( real(v)*2.0, imag(v)*2.0 );\n* }\n*\n* var arr = Complex128Array.from( [ new Complex128( 1.0, 1.0 ) ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 1\n*/\nsetReadOnly( Complex128Array, '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 flg;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isFunction( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` context must be a constructor.' );\n\t}\n\tif ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( isComplexArray( src ) ) {\n\t\tlen = src.length;\n\t\tif ( clbk ) {\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, src.get( i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = real( v );\n\t\t\t\t\tbuf[ j+1 ] = imag( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn out;\n\t\t}\n\t\treturn new this( src );\n\t}\n\tif ( isCollection( src ) ) {\n\t\tif ( clbk ) {\n\t\t\t// Note: array contents affect how we iterate over a provided data source. If only complex number objects, we can extract real and imaginary components. Otherwise, for non-complex number arrays (e.g., `Float64Array`, etc), we assume a strided array where real and imaginary components are interleaved. In the former case, we expect a callback to return real and imaginary components (possibly as a complex number). In the latter case, we expect a callback to return *either* a real or imaginary component.\n\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\t// Detect whether we've been provided an array which returns complex number objects...\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tif ( !isComplexLike( get( src, i ) ) ) {\n\t\t\t\t\tflg = true;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\t// If an array does not contain only complex number objects, then we assume interleaved real and imaginary components...\n\t\t\tif ( flg ) {\n\t\t\t\tif ( !isEven( len ) ) {\n\t\t\t\t\tthrow new RangeError( format( 'invalid argument. First argument must have a length which is a multiple of two. Length: `%u`.', len ) );\n\t\t\t\t}\n\t\t\t\tout = new this( len/2 );\n\t\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\t\tbuf[ i ] = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\t}\n\t\t\t\treturn out;\n\t\t\t}\n\t\t\t// If an array contains only complex number objects, then we need to extract real and imaginary components...\n\t\t\tout = new this( len );\n\t\t\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\t\tv = clbk.call( thisArg, get( src, i ), i );\n\t\t\t\tif ( isComplexLike( v ) ) {\n\t\t\t\t\tbuf[ j ] = real( v );\n\t\t\t\t\tbuf[ j+1 ] = imag( v );\n\t\t\t\t} else if ( isArrayLikeObject( v ) && v.length >= 2 ) {\n\t\t\t\t\tbuf[ j ] = v[ 0 ];\n\t\t\t\t\tbuf[ j+1 ] = v[ 1 ];\n\t\t\t\t} else {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t\t\t}\n\t\t\t\tj += 2; // stride\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\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\n\t\t}\n\t\tlen = tmp.length / 2;\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 128-bit complex number array from a variable number of arguments.\n*\n* @name of\n* @memberof Complex128Array\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} 128-bit complex number array\n*\n* @example\n* var arr = Complex128Array.of( 1.0, 1.0, 1.0, 1.0 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( Complex128Array, '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 ( !isComplexArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide an integer\n* @returns {(Complex128|void)} array element\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var z = arr.at( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 9.0, -9.0 ], 9 );\n*\n* z = arr.at( 0 );\n* // returns [ 1.0, -1.0 ]\n*\n* z = arr.at( -1 );\n* // returns [ 9.0, -9.0 ]\n*\n* z = arr.at( 100 );\n* // returns undefined\n*\n* z = arr.at( -100 );\n* // returns undefined\n*/\nsetReadOnly( Complex128Array.prototype, 'at', function at( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tif ( idx < 0 ) {\n\t\tidx += this._length;\n\t}\n\tif ( idx < 0 || idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn getComplex128( this._buffer, idx );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( Complex128Array.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 Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 160\n*/\nsetReadOnlyAccessor( Complex128Array.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 Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( Complex128Array.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 Complex128Array.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 16\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 16\n*/\nsetReadOnly( Complex128Array.prototype, 'BYTES_PER_ELEMENT', Complex128Array.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 Complex128Array.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 complex number array\n* @returns {Complex128Array} modified array\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( 4 );\n*\n* // Set the array elements:\n* arr.set( new Complex128( 1.0, 1.0 ), 0 );\n* arr.set( new Complex128( 2.0, 2.0 ), 1 );\n* arr.set( new Complex128( 3.0, 3.0 ), 2 );\n* arr.set( new Complex128( 4.0, 4.0 ), 3 );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n* // arr => [ 1.0, 1.0, 2.0, 2.0, 1.0, 1.0, 2.0, 2.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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*2, start*2 );\n\t} else {\n\t\tthis._buffer.copyWithin( target*2, start*2, arguments[2]*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 Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = [\n* new Complex128( 1.0, 1.0 ),\n* new Complex128( 2.0, 2.0 ),\n* new Complex128( 3.0, 3.0 )\n* ];\n* arr = new Complex128Array( arr );\n*\n* // Create an iterator:\n* var it = arr.entries();\n*\n* // Iterate over the key-value pairs...\n* var v = it.next().value;\n* // returns [ 0, ]\n*\n* v = it.next().value;\n* // returns [ 1, ]\n*\n* v = it.next().value;\n* // returns [ 2, ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'entries', function entries() {\n\tvar buffer;\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tself = this;\n\tbuffer = this._buffer;\n\tlen = this._length;\n\n\t// Initialize the iteration indices:\n\ti = -1;\n\tj = -2;\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\tvar z;\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\tj += 2;\n\t\tz = new Complex128( buffer[ j ], buffer[ j+1 ] );\n\t\treturn {\n\t\t\t'value': [ i, z ],\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number 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* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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, getComplex128( 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 Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} 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 complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n* @returns {Complex128Array} modified array\n*\n* @example\n* var arr = new Complex128Array( 3 );\n*\n* arr.fill( new Complex128( 1.0, 1.0 ), 1 );\n*\n* var z = arr.get( 1 );\n* // returns [ 1.0, 1.0 ]\n*\n* z = arr.get( 2 );\n* // returns [ 1.0, 1.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = real( value );\n\tim = imag( value );\n\tfor ( i = start; i < end; i++ ) {\n\t\tidx = 2*i;\n\t\tbuf[ idx ] = re;\n\t\tbuf[ idx+1 ] = im;\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} complex number array\n*\n* @example\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.filter( predicate );\n* // returns \n*\n* var len = out.length;\n* // returns 1\n*\n* var z = out.get( 0 );\n* // returns [ 2.0, 2.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\tout.push( z );\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex128|void)} array element or undefined\n*\n* @example\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.find( predicate );\n* // returns [ 1.0, 1.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var idx = arr.findIndex( predicate );\n* // returns 2\n*/\nsetReadOnly( Complex128Array.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, 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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {(Complex128|void)} array element or undefined\n*\n* @example\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.findLast( predicate );\n* // returns [ 3.0, 3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, i, this ) ) {\n\t\t\treturn z;\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {integer} index or -1\n*\n* @example\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var idx = arr.findLastIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Complex128Array.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tif ( predicate.call( thisArg, z, 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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* function log( v, i ) {\n* console.log( '%s: %s', i, v.toString() );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( Complex128Array.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\tvar z;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tz = getComplex128( buf, i );\n\t\tfcn.call( thisArg, z, i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @name get\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(Complex128|void)} array element\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns [ 1.0, -1.0 ]\n*\n* z = arr.get( 100 );\n* // returns undefined\n*/\nsetReadOnly( Complex128Array.prototype, 'get', function get( idx ) {\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 getComplex128( this._buffer, idx );\n});\n\n/**\n* Number of array elements.\n*\n* @name length\n* @memberof Complex128Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Complex128Array( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( Complex128Array.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {boolean} boolean indicating whether an array includes a provided value\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var bool = arr.includes( new Complex128( 3.0, -3.0 ) );\n* // returns true\n*\n* bool = arr.includes( new Complex128( 3.0, -3.0 ), 3 );\n* // returns false\n*\n* bool = arr.includes( new Complex128( 4.0, -4.0 ), -3 );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\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 Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var idx = arr.indexOf( new Complex128( 3.0, -3.0 ) );\n* // returns 2\n*\n* idx = arr.indexOf( new Complex128( 3.0, -3.0 ), 3 );\n* // returns -1\n*\n* idx = arr.indexOf( new Complex128( 4.0, -4.0 ), -3 );\n* // returns 3\n*/\nsetReadOnly( Complex128Array.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\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 Complex128Array.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.join();\n* // returns '1 + 1i,2 + 2i'\n*\n* str = arr.join( '/' );\n* // returns '1 + 1i/2 + 2i'\n*/\nsetReadOnly( Complex128Array.prototype, 'join', function join( separator ) {\n\tvar out;\n\tvar buf;\n\tvar sep;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( arguments.length === 0 ) {\n\t\tsep = ',';\n\t} else if ( isString( separator ) ) {\n\t\tsep = separator;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', separator ) );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex128( buf, i ).toString() );\n\t}\n\treturn out.join( sep );\n});\n\n/**\n* Returns an iterator for iterating over each index key in a typed array.\n*\n* @name keys\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 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( Complex128Array.prototype, 'keys', function keys() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 Complex128Array.prototype\n* @type {Function}\n* @param {ComplexLike} searchElement - element to find\n* @param {integer} [fromIndex] - index at which to start searching backward (inclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a complex number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 3.0, -3.0 ], 4 );\n*\n* var idx = arr.lastIndexOf( new Complex128( 3.0, -3.0 ) );\n* // returns 4\n*\n* idx = arr.lastIndexOf( new Complex128( 3.0, -3.0 ), 3 );\n* // returns 2\n*\n* idx = arr.lastIndexOf( new Complex128( 5.0, -5.0 ), 3 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( new Complex128( 2.0, -2.0 ), -3 );\n* // returns 1\n*/\nsetReadOnly( Complex128Array.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar idx;\n\tvar re;\n\tvar im;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tif ( !isComplexLike( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a complex number. 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\tre = real( searchElement );\n\tim = imag( searchElement );\n\tbuf = this._buffer;\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tidx = 2 * i;\n\t\tif ( re === buf[ idx ] && im === buf[ idx+1 ] ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} complex number array\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function scale( v, i ) {\n* return new Complex128( 2.0*real( v ), 2.0*imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var out = arr.map( scale );\n* // returns [ 2.0, -2.0, 4.0, -4.0, 6.0, -6.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\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\tv = fcn.call( thisArg, getComplex128( buf, i ), i, this );\n\t\tif ( isComplexLike( v ) ) {\n\t\t\toutbuf[ 2*i ] = real( v );\n\t\t\toutbuf[ (2*i)+1 ] = imag( v );\n\t\t} else if ( isArrayLikeObject( v ) && v.length === 2 ) {\n\t\t\toutbuf[ 2*i ] = v[ 0 ];\n\t\t\toutbuf[ (2*i)+1 ] = v[ 1 ];\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', v ) );\n\t\t}\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\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* import cadd from '@stdlib/complex/float64/base/add';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduce( cadd );\n* // returns [ 6.0, 6.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 = getComplex128( buf, 0 );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tv = getComplex128( buf, i );\n\t\tacc = reducer( acc, v, 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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\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* import cadd from '@stdlib/complex/float64/base/add';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var z = arr.reduceRight( cadd );\n* // returns [ 6.0, 6.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'reduceRight', function reduceRight( reducer, initialValue ) {\n\tvar buf;\n\tvar acc;\n\tvar len;\n\tvar v;\n\tvar i;\n\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 = getComplex128( buf, len-1 );\n\t\ti = len-2;\n\t}\n\tfor ( ; i >= 0; i-- ) {\n\t\tv = getComplex128( buf, i );\n\t\tacc = reducer( acc, v, i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} reversed array\n*\n* @example\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.reverse();\n* // returns [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'reverse', function reverse() {\n\tvar buf;\n\tvar tmp;\n\tvar len;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tlen = this._length;\n\tbuf = this._buffer;\n\tN = floor( len / 2 );\n\tfor ( i = 0; i < N; i++ ) {\n\t\tj = len - i - 1;\n\t\ttmp = buf[ (2*i) ];\n\t\tbuf[ (2*i) ] = buf[ (2*j) ];\n\t\tbuf[ (2*j) ] = tmp;\n\t\ttmp = buf[ (2*i)+1 ];\n\t\tbuf[ (2*i)+1 ] = buf[ (2*j)+1 ];\n\t\tbuf[ (2*j)+1 ] = tmp;\n\t}\n\treturn this;\n});\n\n/**\n* Sets an array element.\n*\n* ## Notes\n*\n* - When provided a typed array, real or complex, 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 Complex128Array.prototype\n* @type {Function}\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be either a complex number, an array-like object, or a complex number array\n* @throws {TypeError} index argument must be a nonnegative integer\n* @throws {RangeError} array-like objects must have a length which is a multiple of two\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 Complex128Array( 10 );\n*\n* var z = arr.get( 0 );\n* // returns [ 0.0, 0.0 ]\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n*\n* z = arr.get( 0 );\n* // returns [ 1.0, -1.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'set', function set( value ) {\n\t/* eslint-disable no-underscore-dangle */\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar flg;\n\tvar N;\n\tvar v;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( isComplexLike( value ) ) {\n\t\tif ( idx >= this._length ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Index argument is out-of-bounds. Value: `%u`.', idx ) );\n\t\t}\n\t\tidx *= 2;\n\t\tbuf[ idx ] = real( value );\n\t\tbuf[ idx+1 ] = imag( value );\n\t\treturn;\n\t}\n\tif ( isComplexArray( 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\tsbuf = value._buffer;\n\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 Float64Array( sbuf.length );\n\t\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t}\n\t\t\tsbuf = tmp;\n\t\t}\n\t\tidx *= 2;\n\t\tj = 0;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\tidx += 2; // stride\n\t\t\tj += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tif ( isCollection( value ) ) {\n\t\t// Detect whether we've been provided an array of complex numbers...\n\t\tN = value.length;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tif ( !isComplexLike( value[ i ] ) ) {\n\t\t\t\tflg = true;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\t// If an array does not contain only complex numbers, then we assume interleaved real and imaginary components...\n\t\tif ( flg ) {\n\t\t\tif ( !isEven( N ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. Array-like object arguments must have a length which is a multiple of two. Length: `%u`.', N ) );\n\t\t\t}\n\t\t\tif ( idx+(N/2) > this._length ) {\n\t\t\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t\t\t}\n\t\t\tsbuf = value;\n\n\t\t\t// Check for overlapping memory...\n\t\t\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\t\t\tif (\n\t\t\t\tsbuf.buffer === buf.buffer &&\n\t\t\t\t(\n\t\t\t\t\tsbuf.byteOffset < j &&\n\t\t\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t\t\t)\n\t\t\t) {\n\t\t\t\t// We need to copy source values...\n\t\t\t\ttmp = new Float64Array( N );\n\t\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t\t\t}\n\t\t\t\tsbuf = tmp;\n\t\t\t}\n\t\t\tidx *= 2;\n\t\t\tN /= 2;\n\t\t\tj = 0;\n\t\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\t\tbuf[ idx ] = sbuf[ j ];\n\t\t\t\tbuf[ idx+1 ] = sbuf[ j+1 ];\n\t\t\t\tidx += 2; // stride\n\t\t\t\tj += 2; // stride\n\t\t\t}\n\t\t\treturn;\n\t\t}\n\t\t// If an array contains only complex numbers, then we need to extract real and imaginary components...\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\tidx *= 2;\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tv = value[ i ];\n\t\t\tbuf[ idx ] = real( v );\n\t\t\tbuf[ idx+1 ] = imag( v );\n\t\t\tidx += 2; // stride\n\t\t}\n\t\treturn;\n\t}\n\tthrow new TypeError( format( 'invalid argument. First argument must be either a complex number, an array-like object, or a complex number array. Value: `%s`.', value ) );\n\n\t/* eslint-enable no-underscore-dangle */\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @param {integer} [start=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex128Array} complex number array\n*\n* @example\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var out = arr.slice();\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0, 4.0, -4.0, 5.0, -5.0 ]\n*\n* out = arr.slice( 1, -2 );\n* // returns [ 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'slice', function slice( start, end ) {\n\tvar outlen;\n\tvar outbuf;\n\tvar out;\n\tvar idx;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tbuf = this._buffer;\n\tlen = this._length;\n\tif ( arguments.length === 0 ) {\n\t\tstart = 0;\n\t\tend = len;\n\t} else {\n\t\tif ( !isInteger( start ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First 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 === 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 ( start < end ) {\n\t\toutlen = end - start;\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\tidx = 2*(i+start);\n\t\toutbuf[ 2*i ] = buf[ idx ];\n\t\toutbuf[ (2*i)+1 ] = buf[ idx+1 ];\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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a complex number 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* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function predicate( v ) {\n* return ( real( v ) === imag( v ) );\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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, getComplex128( 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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} compareFcn - comparison function\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} sorted array\n*\n* @example\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function compare( a, b ) {\n* var re1;\n* var re2;\n* var im1;\n* var im2;\n* re1 = real( a );\n* re2 = real( b );\n* if ( re1 < re2 ) {\n* return -1;\n* }\n* if ( re1 > re2 ) {\n* return 1;\n* }\n* im1 = imag( a );\n* im2 = imag( b );\n* if ( im1 < im2 ) {\n* return -1;\n* }\n* if ( im1 > im2 ) {\n* return 1;\n* }\n* return 0;\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 3.0, -3.0 ], 0 );\n* arr.set( [ 1.0, -1.0 ], 1 );\n* arr.set( [ 2.0, -2.0 ], 2 );\n*\n* var out = arr.sort( compare );\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'sort', function sort( compareFcn ) {\n\tvar tmp;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\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 = this._buffer;\n\tlen = this._length;\n\ttmp = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\ttmp.push( getComplex128( buf, i ) );\n\t}\n\ttmp.sort( compareFcn );\n\tfor ( i = 0; i < len; i++ ) {\n\t\tj = 2 * i;\n\t\tbuf[ j ] = real( tmp[i] );\n\t\tbuf[ j+1 ] = imag( tmp[i] );\n\t}\n\treturn this;\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 Complex128Array.prototype\n* @type {Function}\n* @param {integer} [begin=0] - starting index (inclusive)\n* @param {integer} [end] - ending index (exclusive)\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Complex64Array} subarray\n*\n* @example\n* var arr = new Complex128Array( 5 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n* arr.set( [ 3.0, -3.0 ], 2 );\n* arr.set( [ 4.0, -4.0 ], 3 );\n* arr.set( [ 5.0, -5.0 ], 4 );\n*\n* var subarr = arr.subarray();\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0, 4.0, -4.0, 5.0, -5.0 ]\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns [ 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 Complex128Array.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 complex number 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 Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toLocaleString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex128Array.prototype, 'toLocaleString', function toLocaleString( locales, options ) {\n\tvar opts;\n\tvar loc;\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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( getComplex128( 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 Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Complex128Array} reversed array\n*\n* @example\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.toReversed();\n* // returns [ 3.0, 3.0, 2.0, 2.0, 1.0, 1.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\tvar j;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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\tj = len - i - 1;\n\t\toutbuf[ (2*i) ] = buf[ (2*j) ];\n\t\toutbuf[ (2*i)+1 ] = buf[ (2*j)+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 Complex128Array.prototype\n* @type {Function}\n* @param {Function} compareFcn - comparison function\n* @throws {TypeError} `this` must be a complex number array\n* @throws {TypeError} first argument must be a function\n* @returns {Complex128Array} sorted array\n*\n* @example\n* import real from '@stdlib/complex/float64/real';\n* import imag from '@stdlib/complex/float64/imag';\n*\n* function compare( a, b ) {\n* var re1;\n* var re2;\n* var im1;\n* var im2;\n* re1 = real( a );\n* re2 = real( b );\n* if ( re1 < re2 ) {\n* return -1;\n* }\n* if ( re1 > re2 ) {\n* return 1;\n* }\n* im1 = imag( a );\n* im2 = imag( b );\n* if ( im1 < im2 ) {\n* return -1;\n* }\n* if ( im1 > im2 ) {\n* return 1;\n* }\n* return 0;\n* }\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 3.0, -3.0 ], 0 );\n* arr.set( [ 1.0, -1.0 ], 1 );\n* arr.set( [ 2.0, -2.0 ], 2 );\n*\n* var out = arr.sort( compare );\n* // returns [ 1.0, -1.0, 2.0, -2.0, 3.0, -3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'toSorted', function toSorted( compareFcn ) {\n\tvar tmp;\n\tvar buf;\n\tvar len;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\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 = this._buffer;\n\tlen = this._length;\n\ttmp = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\ttmp.push( getComplex128( buf, i ) );\n\t}\n\ttmp.sort( compareFcn );\n\treturn new Complex128Array( tmp );\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {string} string representation\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n*\n* var str = arr.toString();\n* // returns '1 + 1i,2 + 2i'\n*/\nsetReadOnly( Complex128Array.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number array.' );\n\t}\n\tout = [];\n\tbuf = this._buffer;\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( getComplex128( buf, i ).toString() );\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 Complex128Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a complex number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Complex128Array( 2 );\n*\n* arr.set( [ 1.0, -1.0 ], 0 );\n* arr.set( [ 2.0, -2.0 ], 1 );\n*\n* var iter = arr.values();\n*\n* var v = iter.next().value;\n* // returns [ 1.0, -1.0 ]\n*\n* v = iter.next().value;\n* // returns [ 2.0, -2.0 ]\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( Complex128Array.prototype, 'values', function values() {\n\tvar iter;\n\tvar self;\n\tvar len;\n\tvar FLG;\n\tvar buf;\n\tvar i;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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': getComplex128( 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 Complex128Array.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {ComplexLike} value - new value\n* @throws {TypeError} `this` must be a complex number 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 complex number\n* @returns {Complex128Array} new typed array\n*\n* @example\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( 3 );\n*\n* arr.set( [ 1.0, 1.0 ], 0 );\n* arr.set( [ 2.0, 2.0 ], 1 );\n* arr.set( [ 3.0, 3.0 ], 2 );\n*\n* var out = arr.with( 0, new Complex128( 4.0, 4.0 ) );\n* // returns [ 4.0, 4.0, 2.0, 2.0, 3.0, 3.0 ]\n*/\nsetReadOnly( Complex128Array.prototype, 'with', function copyWith( index, value ) {\n\tvar buf;\n\tvar out;\n\tvar len;\n\tif ( !isComplexArray( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a complex number 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 ( !isComplexLike( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a complex number. Value: `%s`.', value ) );\n\t}\n\tout = new this.constructor( this._buffer );\n\tbuf = out._buffer; // eslint-disable-line no-underscore-dangle\n\tbuf[ 2*index ] = real( value );\n\tbuf[ (2*index)+1 ] = imag( value );\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default Complex128Array;\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 isComplexLike from '@stdlib/assert/is-complex-like';\nimport real from '@stdlib/complex/float64/real';\nimport imag from '@stdlib/complex/float64/imag';\n\n\n// MAIN //\n\n/**\n* Returns a strided array of real and imaginary components.\n*\n* @private\n* @param {Float64Array} buf - output array\n* @param {Array} arr - array containing complex numbers\n* @returns {(Float64Array|null)} output array or null\n*/\nfunction fromArray( buf, arr ) {\n\tvar len;\n\tvar v;\n\tvar i;\n\tvar j;\n\n\tlen = arr.length;\n\tj = 0;\n\tfor ( i = 0; i < len; i++ ) {\n\t\tv = arr[ i ];\n\t\tif ( !isComplexLike( v ) ) {\n\t\t\treturn null;\n\t\t}\n\t\tbuf[ j ] = real( v );\n\t\tbuf[ j+1 ] = imag( v );\n\t\tj += 2; // stride\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* @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) 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 isArrayLikeObject from '@stdlib/assert/is-array-like-object';\nimport isComplexLike from '@stdlib/assert/is-complex-like';\nimport format from '@stdlib/string/format';\nimport real from '@stdlib/complex/float64/real';\nimport imag from '@stdlib/complex/float64/imag';\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|TypeError)} array or an error\n*/\nfunction fromIteratorMap( it, clbk, thisArg ) {\n\tvar out;\n\tvar v;\n\tvar z;\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\tz = clbk.call( thisArg, v.value, i );\n\t\tif ( isArrayLikeObject( z ) && z.length >= 2 ) {\n\t\t\tout.push( z[ 0 ], z[ 1 ] );\n\t\t} else if ( isComplexLike( z ) ) {\n\t\t\tout.push( real( z ), imag( z ) );\n\t\t} else {\n\t\t\treturn new TypeError( format( 'invalid argument. Callback must return either a two-element array containing real and imaginary components or a complex number. Value: `%s`.', z ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default 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/* 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 './../../uint8';\nimport Boolean from '@stdlib/boolean/ctor';\nimport getter from './../../base/getter';\nimport floor from '@stdlib/math/base/special/floor';\nimport accessorGetter from './../../base/accessor-getter';\nimport format from '@stdlib/string/format';\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( '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\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","/**\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 Float64Array from './../../float64';\nimport Float32Array from './../../float32';\nimport Uint32Array from './../../uint32';\nimport Int32Array from './../../int32';\nimport Uint16Array from './../../uint16';\nimport Int16Array from './../../int16';\nimport Uint8Array from './../../uint8';\nimport Uint8ClampedArray from './../../uint8c';\nimport Int8Array from './../../int8';\nimport Complex64Array from './../../complex64';\nimport Complex128Array from './../../complex128';\nimport BooleanArray from './../../bool';\n\n\n// MAIN //\n\n// Note: order should match `dtypes` order\nvar CTORS = [\n\tFloat64Array,\n\tFloat32Array,\n\tInt32Array,\n\tUint32Array,\n\tInt16Array,\n\tUint16Array,\n\tInt8Array,\n\tUint8Array,\n\tUint8ClampedArray,\n\tComplex64Array,\n\tComplex128Array,\n\tBooleanArray\n];\n\n\n// EXPORTS //\n\nexport default CTORS;\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// MAIN //\n\n// Note: order should match `ctors` order\nvar DTYPES = [\n\t'float64',\n\t'float32',\n\t'int32',\n\t'uint32',\n\t'int16',\n\t'uint16',\n\t'int8',\n\t'uint8',\n\t'uint8c',\n\t'complex64',\n\t'complex128',\n\t'bool'\n];\n\n\n// EXPORTS //\n\nexport default DTYPES;\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 isBuffer from '@stdlib/assert/is-buffer';\nimport isArray from '@stdlib/assert/is-array';\nimport constructorName from '@stdlib/utils/constructor-name';\nimport ctor2dtype from './ctor2dtype.js';\nimport CTORS from './ctors.js';\nimport DTYPES from './dtypes.js';\n\n\n// VARIABLES //\n\nvar NTYPES = DTYPES.length;\n\n\n// MAIN //\n\n/**\n* Returns the data type of an array.\n*\n* @param {*} value - input value\n* @returns {(string|null)} data type\n*\n* @example\n* var dt = dtype( [ 1, 2, 3 ] );\n* // returns 'generic'\n*\n* var dt = dtype( 'beep' );\n* // returns null\n*/\nfunction dtype( value ) {\n\tvar i;\n\tif ( isArray( value ) ) {\n\t\treturn 'generic';\n\t}\n\tif ( isBuffer( value ) ) {\n\t\treturn null;\n\t}\n\tfor ( i = 0; i < NTYPES; i++ ) {\n\t\tif ( value instanceof CTORS[ i ] ) {\n\t\t\treturn DTYPES[ i ];\n\t\t}\n\t}\n\t// If the above failed, fall back to a more robust (and significantly slower) means for resolving underlying data types:\n\treturn ctor2dtype[ constructorName( value ) ] || null;\n}\n\n\n// EXPORTS //\n\nexport default dtype;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isCollection from '@stdlib/assert/is-collection';\nimport isAccessorArray from './../../../../base/assert/is-accessor-array';\nimport accessorGetter from './../../../../base/accessor-getter';\nimport dtype from './../../../../dtype';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Returns a function to tests if an array contains a provided search value.\n*\n* @param {Collection} x - input array\n* @throws {TypeError} must provide an array-like object\n* @returns {Function} function to test if an array contains a search value\n*\n* @example\n* var contains = factory( [ 1, 2, 3 ] );\n* // returns \n*\n* var bool = contains( 2 );\n* // returns true\n*/\nfunction factory( x ) {\n\tvar get;\n\tvar len;\n\tvar dt;\n\n\tif ( !isCollection( x ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide an array-like object. Value: `%s`.', x ) );\n\t}\n\t// Resolve the input array data type:\n\tdt = dtype( x );\n\n\t// Resolve an accessor for retrieving input array elements:\n\tif ( isAccessorArray( x ) ) {\n\t\tget = accessorGetter( dt );\n\t}\n\t// Get the number of elements over which to iterate:\n\tlen = x.length;\n\n\treturn ( get === void 0 ) ? contains : accessors;\n\t/**\n\t* Tests if an array contains a provided search value.\n\t*\n\t* @private\n\t* @param {*} value - search value\n\t* @returns {boolean} boolean indicating if an array contains a search value\n\t*\n\t* @example\n\t* var out = contains( [ 1, 2, 3 ], 2 );\n\t* // returns true\n\t*/\n\tfunction contains( value ) {\n\t\tvar i;\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( x[ i ] === value ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\t/**\n\t* Tests if an array contains a provided search value.\n\t*\n\t* @private\n\t* @param {*} value - search value\n\t* @returns {boolean} boolean indicating if an array contains a search value\n\t*/\n\tfunction accessors( value ) {\n\t\tvar i;\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tif ( get( x, i ) === value ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default factory;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Test if an array contains a provided search value.\n*\n* @module @stdlib/array/base/assert/contains\n*\n* @example\n* import contains from '@stdlib/array/base/assert/contains';\n*\n* var out = contains( [ 1, 2, 3 ], 2 );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\n\n// exports: { \"factory\": \"main.factory\" }\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isAccessorArray from './../../../../base/assert/is-accessor-array';\nimport accessorGetter from './../../../../base/accessor-getter';\nimport getter from './../../../../base/getter';\nimport dtype from './../../../../dtype';\n\n\n// MAIN //\n\n/**\n* Tests if an array contains a provided search value.\n*\n* @param {Collection} x - input array\n* @param {*} value - search value\n* @returns {boolean} boolean indicating if an array contains a search value\n*\n* @example\n* var out = contains( [ 1, 2, 3 ], 2 );\n* // returns true\n*/\nfunction contains( x, value ) {\n\tvar len;\n\tvar get;\n\tvar dt;\n\tvar i;\n\n\t// Resolve the input array data type:\n\tdt = dtype( x );\n\n\t// Resolve an accessor for retrieving input array elements:\n\tif ( isAccessorArray( x ) ) {\n\t\tget = accessorGetter( dt );\n\t} else {\n\t\tget = getter( dt );\n\t}\n\t// Get the number of elements over which to iterate:\n\tlen = x.length;\n\n\t// Loop over the elements...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tif ( get( x, i ) === value ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default contains;\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 an object.\n*\n* @name Object\n* @constructor\n* @type {Function}\n* @param {*} value - input value\n* @returns {Object} object\n*\n* @example\n* var o = new Object( null );\n* // returns {}\n*\n* @example\n* var o = new Object( 5.0 );\n* // returns \n*\n* @example\n* var o = new Object( 'beep' );\n* // returns \n*\n* @example\n* var o1 = {};\n*\n* var o2 = new Object( o1 );\n* // returns {}\n*\n* var bool = ( o1 === o2 );\n* // returns true\n*/\nvar Obj = Object; // eslint-disable-line stdlib/require-globals\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 isFunction from '@stdlib/assert/is-function';\nimport builtin from './native.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar getProto;\nif ( isFunction( Object.getPrototypeOf ) ) {\n\tgetProto = builtin;\n} else {\n\tgetProto = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default getProto;\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 getProto = Object.getPrototypeOf;\n\n\n// EXPORTS //\n\nexport default getProto;\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 './../../native-class';\nimport Object from '@stdlib/object/ctor';\nimport getProto from './proto.js';\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {(Object|null)} prototype\n*/\nfunction getPrototypeOf( obj ) {\n\tvar proto = getProto( obj );\n\tif ( proto || proto === null ) {\n\t\treturn proto;\n\t}\n\tif ( nativeClass( obj.constructor ) === '[object Function]' ) {\n\t\t// May break if the constructor has been tampered with...\n\t\treturn obj.constructor.prototype;\n\t}\n\tif ( obj instanceof Object ) {\n\t\treturn Object.prototype;\n\t}\n\t// Return `null` for objects created via `Object.create( null )`. Also return `null` for cross-realm objects on browsers that lack `__proto__` support, such as IE < 11.\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default getPrototypeOf;\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* Returns the value of the `__proto__` property.\n*\n* @private\n* @param {Object} obj - input object\n* @returns {*} value of `__proto__` property\n*/\nfunction getProto( obj ) {\n\t// eslint-disable-next-line no-proto\n\treturn obj.__proto__;\n}\n\n\n// EXPORTS //\n\nexport default getProto;\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 Object from '@stdlib/object/ctor';\nimport getProto from './detect.js';\n\n\n// MAIN //\n\n/**\n* Returns the prototype of a provided object.\n*\n* @param {*} value - input value\n* @returns {(Object|null)} prototype\n*\n* @example\n* var proto = getPrototypeOf( {} );\n* // returns {}\n*/\nfunction getPrototypeOf( value ) {\n\tif (\n\t\tvalue === null ||\n\t\tvalue === void 0\n\t) {\n\t\treturn null;\n\t}\n\t// In order to ensure consistent ES5/ES6 behavior, cast input value to an object (strings, numbers, booleans); ES5 `Object.getPrototypeOf` throws when provided primitives and ES6 `Object.getPrototypeOf` casts:\n\tvalue = Object( value );\n\n\treturn getProto( value );\n}\n\n\n// EXPORTS //\n\nexport default getPrototypeOf;\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 from './../../is-object';\nimport isFunction from './../../is-function';\nimport getPrototypeOf from '@stdlib/utils/get-prototype-of';\nimport hasOwnProp from './../../has-own-property';\nimport nativeClass from '@stdlib/utils/native-class';\n\n\n// VARIABLES //\n\nvar objectPrototype = Object.prototype;\n\n\n// FUNCTIONS //\n\n/**\n* Tests that an object only has own properties.\n*\n* @private\n* @param {Object} obj - value to test\n* @returns {boolean} boolean indicating if an object only has own properties\n*/\nfunction ownProps( obj ) {\n\tvar key;\n\n\t// NOTE: possibility of perf boost if key enumeration order is known (see http://stackoverflow.com/questions/18531624/isplainobject-thing).\n\tfor ( key in obj ) {\n\t\tif ( !hasOwnProp( obj, key ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// MAIN //\n\n/**\n* Tests if a value is a plain object.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a plain object\n*\n* @example\n* var bool = isPlainObject( {} );\n* // returns true\n*\n* @example\n* var bool = isPlainObject( null );\n* // returns false\n*/\nfunction isPlainObject( value ) {\n\tvar proto;\n\n\t// Screen for obvious non-objects...\n\tif ( !isObject( value ) ) {\n\t\treturn false;\n\t}\n\t// Objects with no prototype (e.g., `Object.create( null )`) are plain...\n\tproto = getPrototypeOf( value );\n\tif ( !proto ) {\n\t\treturn true;\n\t}\n\t// Objects having a prototype are plain if and only if they are constructed with a global `Object` function and the prototype points to the prototype of a plain object...\n\treturn (\n\t\t// Cannot have own `constructor` property:\n\t\t!hasOwnProp( value, 'constructor' ) &&\n\n\t\t// Prototype `constructor` property must be a function (see also https://bugs.jquery.com/ticket/9897 and http://stackoverflow.com/questions/18531624/isplainobject-thing):\n\t\thasOwnProp( proto, 'constructor' ) &&\n\t\tisFunction( proto.constructor ) &&\n\t\tnativeClass( proto.constructor ) === '[object Function]' &&\n\n\t\t// Test for object-specific method:\n\t\thasOwnProp( proto, 'isPrototypeOf' ) &&\n\t\tisFunction( proto.isPrototypeOf ) &&\n\n\t\t(\n\t\t\t// Test if the prototype matches the global `Object` prototype (same realm):\n\t\t\tproto === objectPrototype ||\n\n\t\t\t// Test that all properties are own properties (cross-realm; *most* likely a plain object):\n\t\t\townProps( value )\n\t\t)\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPlainObject;\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 isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport isEmptyArray from '@stdlib/assert/is-empty-array';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {StringArray} [options.stopwords] - array of custom stop words\n* @returns {(null|Error)} error object or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'stopwords': [ 'of' ]\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isPlainObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'stopwords' ) ) {\n\t\topts.stopwords = options.stopwords;\n\t\tif (\n\t\t\t!isStringArray( opts.stopwords ) &&\n\t\t\t!isEmptyArray( opts.stopwords )\n\t\t) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be an array of strings. Option: `%s`.', 'stopwords', opts.stopwords ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\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 './../../is-array';\n\n\n// MAIN //\n\n/**\n* Tests if a value is an empty array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is an empty array\n*\n* @example\n* var bool = isEmptyArray( [] );\n* // returns true\n*\n* @example\n* var bool = isEmptyArray( [ 1, 2, 3 ] );\n* // returns false\n*\n* @example\n* var bool = isEmptyArray( {} );\n* // returns false\n*/\nfunction isEmptyArray( value ) {\n\treturn (\n\t\tisArray( value ) &&\n\t\tvalue.length === 0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isEmptyArray;\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 removePunctuation from './../../remove-punctuation';\nimport tokenize from '@stdlib/nlp/tokenize';\nimport replace from './../../base/replace';\nimport uppercase from './../../base/uppercase';\nimport lowercase from './../../base/lowercase';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport format from './../../format';\nimport validate from './validate.js';\nimport STOPWORDS from './stopwords.json';\n\n\n// VARIABLES //\n\nvar RE_HYPHEN = /-/g;\n\n\n// MAIN //\n\n/**\n* Generates an acronym for a given string.\n*\n* ## Notes\n*\n* - The acronym is generated by capitalizing the first letter of each word in the string.\n* - The function removes stop words from the string before generating the acronym.\n* - The function splits hyphenated words and uses the first character of each hyphenated part.\n*\n* @param {string} str - input string\n* @param {Options} [options] - function options\n* @param {StringArray} [options.stopwords] - custom stop words\n* @throws {TypeError} must provide a string primitive\n* @throws {TypeError} must provide valid options\n* @returns {string} generated acronym\n*\n* @example\n* var out = acronym( 'the quick brown fox' );\n* // returns 'QBF'\n*\n* @example\n* var out = acronym( 'Hard-boiled eggs' );\n* // returns 'HBE'\n*\n* @example\n* var out = acronym( 'National Association of Securities Dealers Automated Quotation' );\n* // returns 'NASDAQ'\n*/\nfunction acronym( str, options ) {\n\tvar isStopWord;\n\tvar words;\n\tvar opts;\n\tvar err;\n\tvar out;\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\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tisStopWord = contains( opts.stopwords || STOPWORDS );\n\tstr = removePunctuation( str );\n\tstr = replace( str, RE_HYPHEN, ' ' );\n\twords = tokenize( str );\n\tout = '';\n\tfor ( i = 0; i < words.length; i++ ) {\n\t\tif ( isStopWord( lowercase( words[ i ] ) ) === false ) {\n\t\t\tout += uppercase( words[ i ].charAt( 0 ) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default acronym;\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// MAIN //\n\nvar main = ( typeof atob === 'function' ) ? atob : null;\n\n\n// EXPORTS //\n\nexport default main;\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// EXPORTS //\n\nexport default atob;\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 Buffer === 'function' ) ? Buffer : 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 = require( 'buffer' ).Buffer;\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* Buffer constructor.\n*\n* @module @stdlib/buffer/ctor\n*\n* @example\n* import ctor from '@stdlib/buffer/ctor';\n*\n* var b = new ctor( [ 1, 2, 3, 4 ] );\n* // returns \n*/\n\n// MODULES //\n\nimport hasNodeBufferSupport from '@stdlib/assert/has-node-buffer-support';\nimport main from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasNodeBufferSupport() ) {\n\tctor = main;\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 isBuffer from './../../is-buffer';\nimport GlobalBuffer from './buffer.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Buffer` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Buffer` support\n*\n* @example\n* var bool = hasNodeBufferSupport();\n* // returns \n*/\nfunction hasNodeBufferSupport() {\n\tvar bool;\n\tvar b;\n\n\tif ( typeof GlobalBuffer !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tif ( typeof GlobalBuffer.from === 'function' ) {\n\t\t\tb = GlobalBuffer.from( [ 1, 2, 3, 4 ] );\n\t\t} else {\n\t\t\tb = new GlobalBuffer( [ 1, 2, 3, 4 ] ); // Note: this is deprecated behavior starting in Node v6 (see https://nodejs.org/api/buffer.html#buffer_new_buffer_array)\n\t\t}\n\t\tbool = (\n\t\t\tisBuffer( b ) &&\n\t\t\tb[ 0 ] === 1 &&\n\t\t\tb[ 1 ] === 2 &&\n\t\t\tb[ 2 ] === 3 &&\n\t\t\tb[ 3 ] === 4\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 hasNodeBufferSupport;\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 (browser) polyfill\n\n// MAIN //\n\n/**\n* Buffer constructor.\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) 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* Allocate a buffer containing a provided string.\n*\n* @module @stdlib/buffer/from-string\n*\n* @example\n* import string2buffer from '@stdlib/buffer/from-string';\n*\n* var buf = string2buffer( 'beep boop' );\n* // returns \n*/\n\n// MODULES //\n\nimport hasFrom from './has_from.js';\nimport main from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar string2buffer;\nif ( hasFrom ) {\n\tstring2buffer = main;\n} else {\n\tstring2buffer = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default string2buffer;\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 isFunction from '@stdlib/assert/is-function';\nimport Buffer from './../../ctor';\n\n\n// MAIN //\n\nvar bool = isFunction( Buffer.from );\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// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\nimport Buffer from './../../ctor';\n\n\n// MAIN //\n\n/**\n* Allocates a buffer containing a provided string.\n*\n* @param {string} str - input string\n* @param {string} [encoding=\"utf8\"] - character encoding\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} second argument must be a valid encoding\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var buf = fromString( 'beep boop' );\n* // returns \n*/\nfunction fromString( str, encoding ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isString( encoding ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', encoding ) );\n\t\t}\n\t\treturn Buffer.from( str, encoding );\n\t}\n\treturn Buffer.from( str, 'utf8' );\n}\n\n\n// EXPORTS //\n\nexport default fromString;\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 isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\nimport Buffer from './../../ctor';\n\n\n// MAIN //\n\n/**\n* Allocates a buffer containing a provided string.\n*\n* @param {string} str - input string\n* @param {string} [encoding=\"utf8\"] - character encoding\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} second argument must be a valid encoding\n* @returns {Buffer} new `Buffer` instance\n*\n* @example\n* var buf = fromString( 'beep boop' );\n* // returns \n*/\nfunction fromString( str, encoding ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tif ( !isString( encoding ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', encoding ) );\n\t\t}\n\t\treturn new Buffer( str, encoding );\n\t}\n\treturn new Buffer( str, 'utf8' );\n}\n\n\n// EXPORTS //\n\nexport default fromString;\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* Decode a string of data which has been encoded using Base64 encoding.\n*\n* @module @stdlib/string/base/atob\n*\n* @example\n* import atob from '@stdlib/string/base/atob';\n*\n* var out = atob( 'SGVsbG8sIHdvcmxk' );\n* // returns 'Hello, world'\n*/\n\n// MODULES //\n\nimport hasAtobSupport from '@stdlib/assert/has-atob-support';\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( hasAtobSupport() ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default main;\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// MAIN //\n\nvar RE_NON_ASCII = /[^\\u0000-\\u007F]/; // eslint-disable-line no-control-regex\n\n\n// EXPORTS //\n\nexport default RE_NON_ASCII;\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 globalAtob from './atob.js';\n\n\n// VARIABLES //\n\nvar BASE64 = 'SGVsbG8sIHdvcmxk';\nvar EXPECTED = 'Hello, world';\n\n\n// MAIN //\n\n/**\n* Tests for native `atob` support.\n*\n* @returns {boolean} boolean indicating if an environment has `atob` support\n*\n* @example\n* var bool = hasAtobSupport();\n* // returns \n*/\nfunction hasAtobSupport() {\n\tvar bool;\n\tvar str;\n\n\tif ( typeof globalAtob !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tstr = globalAtob( BASE64 );\n\t\tbool = ( str === EXPECTED );\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 hasAtobSupport;\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 globalAtob from './global.js';\n\n\n// MAIN //\n\n/**\n* Decodes a string of data which has been encoded using Base64 encoding.\n*\n* @param {string} str - binary string containing base64-encoded data\n* @returns {(string|null)} an ASCII string containing decoded data\n*\n* @example\n* var out = atob( 'SGVsbG8sIHdvcmxk' );\n* // returns 'Hello, world'\n*/\nfunction atob( str ) { // eslint-disable-line stdlib/no-redeclare\n\ttry {\n\t\treturn globalAtob( str );\n\t} catch ( err ) { // eslint-disable-line no-unused-vars\n\t\treturn null;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default atob;\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 string2buffer from '@stdlib/buffer/from-string';\nimport RE_NON_ASCII from './re_non_ascii.js';\n\n\n// MAIN //\n\n/**\n* Decodes a string of data which has been encoded using Base64 encoding.\n*\n* ## Notes\n*\n* - Alternative (non-Buffer-based) implementations exist. For example,\n*\n* - jsdom: \n* - base64: \n*\n* However, having a polyfill is really only required for older Node.js versions `<16.0.0` (see the browser compatibility table at ). Hence, we can use a Node.js-oriented polyfill leveraging `Buffer` with the expectation that bundle size is not an overarching concern.\n*\n* @private\n* @param {string} str - binary string containing base64-encoded data\n* @returns {(string|null)} an ASCII string containing decoded data\n*\n* @example\n* var out = atob( 'SGVsbG8sIHdvcmxk' );\n* // returns 'Hello, world'\n*/\nfunction atob( str ) { // eslint-disable-line stdlib/no-redeclare\n\t// `atob` only allows converting ASCII characters to Base64, and, when Node.js's `Buffer` tries converting a non-ASCII character, it simply ignores it. Accordingly, we need to explicitly check whether the input string contains non-ASCII characters in order to ensure consistency with the non-polyfilled implementation...\n\tif ( RE_NON_ASCII.test( str ) ) {\n\t\treturn null;\n\t}\n\treturn string2buffer( str, 'base64' ).toString( 'utf8' );\n}\n\n\n// EXPORTS //\n\nexport default atob;\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* Capitalizes the first character in a string.\n*\n* @param {string} str - input string\n* @returns {string} capitalized string\n*\n* @example\n* var out = capitalize( 'last man standing' );\n* // returns 'Last man standing'\n*\n* @example\n* var out = capitalize( 'presidential election' );\n* // returns 'Presidential election'\n*\n* @example\n* var out = capitalize( 'javaScript' );\n* // returns 'JavaScript'\n*\n* @example\n* var out = capitalize( 'Hidden Treasures' );\n* // returns 'Hidden Treasures'\n*/\nfunction capitalize( str ) {\n\tif ( str === '' ) {\n\t\treturn '';\n\t}\n\treturn str.charAt( 0 ).toUpperCase() + str.slice( 1 );\n}\n\n\n// EXPORTS //\n\nexport default capitalize;\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 bool = ( typeof String.prototype.trim !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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 trim = String.prototype.trim;\n\n\n// EXPORTS //\n\nexport default trim;\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 replace from './../../../base/replace';\n\n\n// VARIABLES //\n\n// The following regular expression should suffice to polyfill (most?) all environments.\nvar RE = /^[\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*([\\S\\s]*?)[\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]*$/;\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning and end of a string.\n*\n* @private\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = trim( ' Whitespace ' );\n* // returns 'Whitespace'\n*\n* @example\n* var out = trim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs'\n*\n* @example\n* var out = trim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines'\n*/\nfunction trim( str ) {\n\treturn replace( str, RE, '$1' );\n}\n\n\n// EXPORTS //\n\nexport default trim;\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* Trim whitespace characters from the beginning and end of a string.\n*\n* @module @stdlib/string/base/trim\n*\n* @example\n* import trim from '@stdlib/string/base/trim';\n*\n* var out = trim( ' Whitespace ' );\n* // returns 'Whitespace'\n*\n* out = trim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs'\n*\n* out = trim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines'\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport check from './check.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar trim;\nif ( HAS_BUILTIN && check() ) {\n\ttrim = main;\n} else {\n\ttrim = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default trim;\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 trim from './builtin.js';\n\n\n// VARIABLES //\n\nvar str1 = ' \\n\\t\\r\\n\\f\\v\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff';\nvar str2 = '\\u180e';\n\n\n// MAIN //\n\n/**\n* Tests the built-in `String.prototype.trim()` implementation when provided whitespace.\n*\n* ## Notes\n*\n* - For context, see . In short, we can only rely on the built-in `trim` method when it does not consider the Mongolian space separator as whitespace.\n*\n* @private\n* @returns {boolean} boolean indicating whether the built-in implementation returns the expected value\n*\n* @example\n* var b = test();\n* // returns \n*/\nfunction test() {\n\treturn ( trim.call( str1 ) === '' ) && ( trim.call( str2 ) === str2 );\n}\n\n\n// EXPORTS //\n\nexport default test;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning and end of a string.\n*\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = trim( ' Whitespace ' );\n* // returns 'Whitespace'\n*\n* @example\n* var out = trim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs'\n*\n* @example\n* var out = trim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines'\n*/\nfunction trim( str ) {\n\treturn builtin.call( str );\n}\n\n\n// EXPORTS //\n\nexport default trim;\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 capitalize from './../../../base/capitalize';\nimport lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_TO_CAMEL = /(?:\\s|^)([^\\s]+)(?=\\s|$)/g;\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Converts first capture group to uppercase.\n*\n* @private\n* @param {string} match - entire match\n* @param {string} p1 - first capture group\n* @param {number} offset - offset of the matched substring in entire string\n* @returns {string} uppercased capture group\n*/\nfunction replacer( match, p1, offset ) {\n\tp1 = lowercase( p1 );\n\treturn ( offset === 0 ) ? p1 : capitalize( p1 );\n}\n\n\n// MAIN //\n\n/**\n* Converts a string to camel case.\n*\n* @param {string} str - string to convert\n* @returns {string} camel-cased string\n*\n* @example\n* var out = camelcase( 'foo bar' );\n* // returns 'fooBar'\n*\n* @example\n* var out = camelcase( 'IS_MOBILE' );\n* // returns 'isMobile'\n*\n* @example\n* var out = camelcase( 'Hello World!' );\n* // returns 'helloWorld'\n*\n* @example\n* var out = camelcase( '--foo-bar--' );\n* // returns 'fooBar'\n*/\nfunction camelcase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_WHITESPACE, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\treturn replace( str, RE_TO_CAMEL, replacer );\n}\n\n\n// EXPORTS //\n\nexport default camelcase;\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\n// Factors for converting individual surrogates...\nvar Ox10000 = 0x10000|0; // 65536\nvar Ox400 = 0x400|0; // 1024\n\n// Range for a high surrogate\nvar OxD800 = 0xD800|0; // 55296\nvar OxDBFF = 0xDBFF|0; // 56319\n\n// Range for a low surrogate\nvar OxDC00 = 0xDC00|0; // 56320\nvar OxDFFF = 0xDFFF|0; // 57343\n\n\n// MAIN //\n\n/**\n* Returns a Unicode code point from a string at a specified position.\n*\n* ## Notes\n*\n* - UTF-16 encoding uses one 16-bit unit for non-surrogates (U+0000 to U+D7FF and U+E000 to U+FFFF).\n* - UTF-16 encoding uses two 16-bit units (surrogate pairs) for U+10000 to U+10FFFF and encodes U+10000-U+10FFFF by subtracting 0x10000 from the code point, expressing the result as a 20-bit binary, and splitting the 20 bits of 0x0-0xFFFFF as upper and lower 10-bits. The respective 10-bits are stored in two 16-bit words: a high and a low surrogate.\n*\n* @param {string} str - input string\n* @param {integer} idx - position\n* @param {boolean} backward - backward iteration for low surrogates\n* @returns {NonNegativeInteger} code point\n*\n* @example\n* var out = codePointAt( 'last man standing', 4, false );\n* // returns 32\n*\n* @example\n* var out = codePointAt( 'presidential election', 8, true );\n* // returns 116\n*\n* @example\n* var out = codePointAt( 'अनुच्छेद', 2, false );\n* // returns 2369\n*\n* @example\n* var out = codePointAt( '🌷', 1, true );\n* // returns 127799\n*/\nfunction codePointAt( str, idx, backward ) {\n\tvar code;\n\tvar low;\n\tvar hi;\n\n\tif ( idx < 0 ) {\n\t\tidx += str.length;\n\t}\n\tcode = str.charCodeAt( idx );\n\n\t// High surrogate\n\tif ( code >= OxD800 && code <= OxDBFF && idx < str.length - 1 ) {\n\t\thi = code;\n\t\tlow = str.charCodeAt( idx+1 );\n\t\tif ( OxDC00 <= low && low <= OxDFFF ) {\n\t\t\treturn ( ( hi - OxD800 ) * Ox400 ) + ( low - OxDC00 ) + Ox10000;\n\t\t}\n\t\treturn hi;\n\t}\n\t// Low surrogate - support only if backward iteration is desired\n\tif ( backward ) {\n\t\tif ( code >= OxDC00 && code <= OxDFFF && idx >= 1 ) {\n\t\t\thi = str.charCodeAt( idx-1 );\n\t\t\tlow = code;\n\t\t\tif ( OxD800 <= hi && hi <= OxDBFF ) {\n\t\t\t\treturn ( ( hi - OxD800 ) * Ox400 ) + ( low - OxDC00 ) + Ox10000;\n\t\t\t}\n\t\t\treturn low;\n\t\t}\n\t}\n\treturn code;\n}\n\n\n// EXPORTS //\n\nexport default codePointAt;\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 uppercase from './../../../base/uppercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[\\-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// MAIN //\n\n/**\n* Converts a string to constant case.\n*\n* @param {string} str - string to convert\n* @returns {string} constant-cased string\n*\n* @example\n* var str = constantcase( 'beep' );\n* // returns 'BEEP'\n*\n* @example\n* var str = constantcase( 'beep boop' );\n* // returns 'BEEP_BOOP'\n*\n* @example\n* var str = constantcase( 'isMobile' );\n* // returns 'IS_MOBILE'\n*\n* @example\n* var str = constantcase( 'Hello World!' );\n* // returns 'HELLO_WORLD'\n*/\nfunction constantcase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\tstr = replace( str, RE_WHITESPACE, '_' );\n\treturn uppercase( str );\n}\n\n\n// EXPORTS //\n\nexport default constantcase;\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 if a double-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 7.0 );\n* // returns false\n*/\nfunction isnan( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 isNegativeZero from './../../../../base/assert/is-negative-zero';\nimport isnan from './../../../../base/assert/is-nan';\nimport NINF from '@stdlib/constants/float64/ninf';\n\n\n// MAIN //\n\n/**\n* Returns the minimum value.\n*\n* @param {number} x - first number\n* @param {number} y - second number\n* @returns {number} minimum value\n*\n* @example\n* var v = min( 3.14, 4.2 );\n* // returns 3.14\n*\n* @example\n* var v = min( 3.14, NaN );\n* // returns NaN\n*\n* @example\n* var v = min( +0.0, -0.0 );\n* // returns -0.0\n*/\nfunction min( x, y ) {\n\tif ( isnan( x ) || isnan( y ) ) {\n\t\treturn NaN;\n\t}\n\tif ( x === NINF || y === NINF ) {\n\t\treturn NINF;\n\t}\n\tif ( x === y && x === 0.0 ) {\n\t\tif ( isNegativeZero( x ) ) {\n\t\t\treturn x;\n\t\t}\n\t\treturn y;\n\t}\n\tif ( x < y ) {\n\t\treturn x;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default min;\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 NINF from '@stdlib/constants/float64/ninf';\n\n\n// MAIN //\n\n/**\n* Tests if a double-precision floating-point numeric value is negative zero.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is negative zero\n*\n* @example\n* var bool = isNegativeZero( -0.0 );\n* // returns true\n*\n* @example\n* var bool = isNegativeZero( 0.0 );\n* // returns false\n*/\nfunction isNegativeZero( x ) {\n\treturn (x === 0.0 && 1.0/x === NINF);\n}\n\n\n// EXPORTS //\n\nexport default isNegativeZero;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/*\n* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace ns\n*/\nvar ns = {};\n\n/**\n* @name hammingDistance\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/distances/hamming}\n*/\nimport hammingDistance from './../../../base/distances/hamming';\nsetReadOnly( ns, 'hammingDistance', hammingDistance );\n\n/**\n* @name levenshteinDistance\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/distances/levenshtein}\n*/\nimport levenshteinDistance from './../../../base/distances/levenshtein';\nsetReadOnly( ns, 'levenshteinDistance', levenshteinDistance );\n\n\n// EXPORTS //\n\nexport default ns;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../../../format';\n\n\n// MAIN //\n\n/**\n* Calculates the Hamming distance between two equal-length strings.\n*\n* ## Notes\n*\n* - The function returns a sentinel value of `-1` if the input string lengths differ.\n*\n* @param {string} s1 - first input string\n* @param {string} s2 - second input string\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @returns {integer} Hamming distance\n*\n* @example\n* var distance = hammingDistance( 'algorithm', 'altruistic' );\n* // returns -1\n*/\nfunction hammingDistance( s1, s2 ) {\n\tvar out;\n\tvar i;\n\n\tif ( !isString( s1 ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', s1 ) );\n\t}\n\tif ( !isString( s2 ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', s2 ) );\n\t}\n\tif ( s1.length !== s2.length ) {\n\t\treturn -1;\n\t}\n\tout = 0;\n\tfor ( i = 0; i < s1.length; i++ ) {\n\t\tif (s1[ i ] !== s2[ i ] ) {\n\t\t\tout += 1;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default hammingDistance;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../../../format';\nimport min from '@stdlib/math/base/special/min';\n\n\n// MAIN //\n\n/**\n* Calculates the Levenshtein (edit) distance between two strings.\n*\n* @param {string} s1 - first string value\n* @param {string} s2 - second string value\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @returns {NonNegativeInteger} Levenshtein distance\n*\n* @example\n* var distance = levenshteinDistance( 'algorithm', 'altruistic' );\n* // returns 6\n*/\nfunction levenshteinDistance( s1, s2 ) {\n\tvar temp;\n\tvar row;\n\tvar pre;\n\tvar m;\n\tvar n;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\tif ( !isString( s1 ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', s1 ) );\n\t}\n\tif ( !isString( s2 ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', s2 ) );\n\t}\n\tn = s1.length;\n\tm = s2.length;\n\n\t// If either string is empty, the edit distance is equal to the number of characters in the non-empty string...\n\tif ( n === 0 ) {\n\t\treturn m;\n\t}\n\tif ( m === 0 ) {\n\t\treturn n;\n\t}\n\n\trow = [];\n\tfor ( i = 0; i <= m; i++ ) {\n\t\trow.push( i );\n\t}\n\n\tfor ( i = 0; i < n; i++ ) {\n\t\tpre = row[ 0 ];\n\t\trow[ 0 ] = i + 1;\n\t\tfor ( j = 0; j < m; j++ ) {\n\t\t\tk = j + 1;\n\t\t\ttemp = row[ k ];\n\t\t\tif ( s1[ i ] === s2[ j ] ) {\n\t\t\t\trow[ k ] = pre;\n\t\t\t} else {\n\t\t\t\trow[ k ] = min( pre, min( row[ j ], row[ k ] ) ) + 1;\n\t\t\t}\n\t\t\tpre = temp;\n\t\t}\n\t}\n\treturn row[ m ];\n}\n\n\n// EXPORTS //\n\nexport default levenshteinDistance;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[\\-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// MAIN //\n\n/**\n* Converts a string to dot case.\n*\n* @param {string} str - string to convert\n* @returns {string} dot-cased string\n*\n* @example\n* var str = dotcase( 'beep' );\n* // returns 'beep'\n*\n* @example\n* var str = dotcase( 'beep boop' );\n* // returns 'beep.boop'\n*\n* @example\n* var str = dotcase( 'isMobile' );\n* // returns 'is.mobile'\n*\n* @example\n* var str = dotcase( 'Hello World!' );\n* // returns 'hello.world'\n*/\nfunction dotcase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\tstr = replace( str, RE_WHITESPACE, '.' );\n\treturn lowercase( str );\n}\n\n\n// EXPORTS //\n\nexport default dotcase;\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 bool = ( typeof String.prototype.endsWith !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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 endsWith = String.prototype.endsWith;\n\n\n// EXPORTS //\n\nexport default endsWith;\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* Test if a string ends with the characters of another string.\n*\n* @module @stdlib/string/base/ends-with\n*\n* @example\n* import endsWith from '@stdlib/string/base/ends-with';\n*\n* var str = 'Fair is foul, and foul is fair, hover through fog and filthy air';\n*\n* var bool = endsWith( str, 'air', str.length );\n* // returns true\n*\n* bool = endsWith( str, 'fair', str.length );\n* // returns false\n*\n* bool = endsWith( str, 'fair', 30 );\n* // returns true\n*\n* bool = endsWith( str, 'fair', -34 );\n* // returns true\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar endsWith;\nif ( HAS_BUILTIN ) {\n\tendsWith = main;\n} else {\n\tendsWith = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default endsWith;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Tests if a string ends with the characters of another string.\n*\n* ## Notes\n*\n* - The last parameter restricts the search to a substring within the input string beginning from the leftmost character. If provided a negative value, `len` indicates to ignore the last `len` characters, and is thus equivalent to `str.length + len`.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} len - substring length\n* @returns {boolean} boolean indicating if the input string ends with the search string\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 );\n* // returns true\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 );\n* // returns true\n*/\nfunction endsWith( str, search, len ) {\n\tvar idx;\n\tvar N;\n\n\tN = search.length;\n\tif ( len === 0 ) {\n\t\treturn ( N === 0 );\n\t}\n\tif ( len < 0 ) {\n\t\tidx = str.length + len;\n\t} else {\n\t\tidx = len;\n\t}\n\tif ( N === 0 ) {\n\t\t// Based on the premise that every string can be \"surrounded\" by empty strings (e.g., \"\" + \"a\" + \"\" + \"b\" + \"\" === \"ab\"):\n\t\treturn true;\n\t}\n\tif ( idx - N < 0 || idx > str.length ) {\n\t\treturn false;\n\t}\n\treturn builtin.call( str, search, idx );\n}\n\n\n// EXPORTS //\n\nexport default endsWith;\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* Tests if a string ends with the characters of another string.\n*\n* ## Notes\n*\n* - The last parameter restricts the search to a substring within the input string beginning from the leftmost character. If provided a negative value, `len` indicates to ignore the last `len` characters, and is thus equivalent to `str.length + len`.\n*\n* @private\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} len - substring length\n* @returns {boolean} boolean indicating if the input string ends with the search string\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 );\n* // returns true\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 );\n* // returns true\n*/\nfunction endsWith( str, search, len ) {\n\tvar idx;\n\tvar N;\n\tvar i;\n\n\tN = search.length;\n\tif ( len === 0 ) {\n\t\treturn ( N === 0 );\n\t}\n\tif ( len < 0 ) {\n\t\tidx = str.length + len;\n\t} else {\n\t\tidx = len;\n\t}\n\tif ( N === 0 ) {\n\t\t// Based on the premise that every string can be \"surrounded\" by empty strings (e.g., \"\" + \"a\" + \"\" + \"b\" + \"\" === \"ab\"):\n\t\treturn true;\n\t}\n\tidx -= N;\n\tif ( idx < 0 ) {\n\t\treturn false;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\tif ( str.charCodeAt( idx + i ) !== search.charCodeAt( i ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// EXPORTS //\n\nexport default endsWith;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Returns the first `n` UTF-16 code units of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of UTF-16 code units to return\n* @returns {string} output string\n*\n* @example\n* var out = first( 'last man standing', 1 );\n* // returns 'l'\n*\n* @example\n* var out = first( 'presidential election', 1 );\n* // returns 'p'\n*\n* @example\n* var out = first( 'JavaScript', 1 );\n* // returns 'J'\n*\n* @example\n* var out = first( 'Hidden Treasures', 1 );\n* // returns 'H'\n*/\nfunction first( str, n ) {\n\treturn str.substring( 0, n );\n}\n\n\n// EXPORTS //\n\nexport default first;\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 match a UTF-16 surrogate pair.\n*\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_UTF16_SURROGATE_PAIR = reUtf16SurrogatePair();\n*\n* var bool = RE_UTF16_SURROGATE_PAIR.test( '\\uD800\\uDC00' );\n* // returns true\n*\n* bool = RE_UTF16_SURROGATE_PAIR.test( 'abc\\uD800\\uDC00def' );\n* // returns true\n*\n* bool = RE_UTF16_SURROGATE_PAIR.test( 'abc' );\n* // returns false\n*/\nfunction reUtf16SurrogatePair() {\n\treturn /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/;\n}\n\n\n// EXPORTS //\n\nexport default reUtf16SurrogatePair;\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 reUtf16SurrogatePair from './main.js';\n\n\n// MAIN //\n\n/**\n* Matches a UTF-16 surrogate pair.\n*\n* Regular expression: `/[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/`\n*\n* - `[\\uD800-\\uDBFF]`\n* - match a high surrogate\n*\n* - `[\\uDC00-\\uDFFF]`\n* - match a low surrogate\n*\n* @constant\n* @type {RegExp}\n* @default /[\\uD800-\\uDBFF][\\uDC00-\\uDFFF]/\n*/\nvar RE_UTF16_SURROGATE_PAIR = reUtf16SurrogatePair();\n\n\n// EXPORTS //\n\nexport default RE_UTF16_SURROGATE_PAIR;\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* Return a regular expression to match a UTF-16 surrogate pair.\n*\n* @module @stdlib/regexp/utf16-surrogate-pair\n*\n* @example\n* import reUtf16SurrogatePair from '@stdlib/regexp/utf16-surrogate-pair';\n*\n* var RE_UTF16_SURROGATE_PAIR = reUtf16SurrogatePair();\n*\n* var bool = RE_UTF16_SURROGATE_PAIR.test( '\\uD800\\uDC00' );\n* // returns true\n*\n* bool = RE_UTF16_SURROGATE_PAIR.test( 'abc\\uD800\\uDC00def' );\n* // returns true\n*\n* bool = RE_UTF16_SURROGATE_PAIR.test( 'abc' );\n* // returns false\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) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { REGEXP as RE_UTF16_SURROGATE_PAIR } from '@stdlib/regexp/utf16-surrogate-pair';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Returns the first `n` Unicode code points of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of Unicode code points to return\n* @returns {string} output string\n*\n* @example\n* var out = first( 'last man standing', 1 );\n* // returns 'l'\n*\n* @example\n* var out = first( 'presidential election', 1 );\n* // returns 'p'\n*\n* @example\n* var out = first( 'JavaScript', 1 );\n* // returns 'J'\n*\n* @example\n* var out = first( 'Hidden Treasures', 1 );\n* // returns 'H'\n*/\nfunction first( str, n ) {\n\tvar len;\n\tvar out;\n\tvar ch1;\n\tvar ch2;\n\tvar cnt;\n\tvar i;\n\tif ( str === '' || n === 0 ) {\n\t\treturn '';\n\t}\n\tif ( n === 1 ) {\n\t\tstr = str.substring( 0, 2 );\n\t\tif ( RE_UTF16_SURROGATE_PAIR.test( str ) ) {\n\t\t\treturn str;\n\t\t}\n\t\treturn str[ 0 ];\n\t}\n\tlen = str.length;\n\tout = '';\n\tcnt = 0;\n\n\t// Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tch1 = str[ i ];\n\t\tout += ch1;\n\t\tcnt += 1;\n\n\t\t// Check for a high UTF-16 surrogate...\n\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check for an unpaired surrogate at the end of the input string...\n\t\t\tif ( i === len-1 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i+1 ];\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tout += ch2;\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Check whether we've found the desired number of code points...\n\t\tif ( cnt === n ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default first;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport format from './../../format';\nimport base from './../../base/code-point-at';\n\n\n// MAIN //\n\n/**\n* Returns a Unicode code point from a string at a specified position.\n*\n* @param {string} str - input string\n* @param {integer} idx - position\n* @param {boolean} [backward=false] - backward iteration for low surrogates\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be a boolean\n* @throws {RangeError} position must be a valid index in string\n* @returns {NonNegativeInteger} code point\n*\n* @example\n* var out = codePointAt( 'last man standing', 4 );\n* // returns 32\n*\n* @example\n* var out = codePointAt( 'presidential election', 8, true );\n* // returns 116\n*\n* @example\n* var out = codePointAt( 'अनुच्छेद', 2 );\n* // returns 2369\n*\n* @example\n* var out = codePointAt( '🌷', 1, true );\n* // returns 127799\n*/\nfunction codePointAt( str, idx, backward ) {\n\tvar FLG;\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\tif ( !isInteger( idx ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', idx ) );\n\t}\n\tif ( idx < 0 ) {\n\t\tidx += str.length;\n\t}\n\tif ( idx < 0 || idx >= str.length ) {\n\t\tthrow new RangeError( format( 'invalid argument. Second argument must be a valid position (i.e., be within string bounds). Value: `%d`.', idx ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isBoolean( backward ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a boolean. Value: `%s`.', backward ) );\n\t\t}\n\t\tFLG = backward;\n\t} else {\n\t\tFLG = false;\n\t}\n\treturn base( str, idx, FLG );\n}\n\n\n// EXPORTS //\n\nexport default codePointAt;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from './../../is-string';\nimport { isPrimitive as isNonNegativeInteger } from './../../is-nonnegative-integer';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\n// Range for a high surrogate\nvar OxD800 = 0xD800|0; // 55296\nvar OxDBFF = 0xDBFF|0; // 56319\n\n// Range for a low surrogate\nvar OxDC00 = 0xDC00|0; // 56320\nvar OxDFFF = 0xDFFF|0; // 57343\n\n\n// MAIN //\n\n/**\n* Tests if a position in a string marks the start of a UTF-16 surrogate pair.\n*\n* @private\n* @param {string} str - input string\n* @param {NonNegativeInteger} pos - position in string\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} position must be a valid index in string\n* @returns {boolean} boolean indicating whether the string has a surrogate pair at a position\n*\n* @example\n* var out = hasUTF16SurrogatePairAt( '🌷', 0 );\n* // returns true\n*\n* @example\n* var out = hasUTF16SurrogatePairAt( '🌷', 1 );\n* // returns false\n*/\nfunction hasUTF16SurrogatePairAt( str, pos ) {\n\tvar ch1;\n\tvar ch2;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( pos ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a valid position (i.e., a nonnegative integer). Value: `%s`.', pos ) );\n\t}\n\tif ( pos >= str.length ) {\n\t\tthrow new RangeError( format( 'invalid argument. Must provide a valid position (i.e., within string bounds). Value: `%u`.', pos ) );\n\t}\n\tch1 = str.charCodeAt( pos );\n\tch2 = str.charCodeAt( pos + 1 );\n\treturn ch1 >= OxD800 && ch1 <= OxDBFF && ch2 >= OxDC00 && ch2 <= OxDFFF;\n}\n\n\n// EXPORTS //\n\nexport default hasUTF16SurrogatePairAt;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 consts = {\n\t'CR': 0,\n\t'LF': 1,\n\t'Control': 2,\n\t'Extend': 3,\n\t'RegionalIndicator': 4,\n\t'SpacingMark': 5,\n\t'L': 6,\n\t'V': 7,\n\t'T': 8,\n\t'LV': 9,\n\t'LVT': 10,\n\t'Other': 11,\n\t'Prepend': 12,\n\t'ZWJ': 13,\n\t'NotBreak': 0,\n\t'BreakStart': 1,\n\t'Break': 2,\n\t'BreakLastRegional': 3,\n\t'BreakPenultimateRegional': 4,\n\t'ExtendedPictographic': 101\n};\n\n\n// EXPORTS //\n\nexport default consts;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 constants from './constants.js';\n\n\n// FUNCTIONS //\n\n/**\n* Returns number of elements in array equal to a provided value.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} start - starting search index (inclusive)\n* @param {NonNegativeInteger} end - ending search index (inclusive)\n* @param {*} value - input value\n* @returns {NonNegativeInteger} number of elements in array equal to a provided value\n*/\nfunction count( arr, start, end, value ) {\n\tvar cnt;\n\tvar i;\n\n\tif ( end >= arr.length ) {\n\t\tend = arr.length - 1;\n\t}\n\tcnt = 0;\n\tfor ( i = start; i <= end; i++ ) {\n\t\tif ( arr[ i ] === value ) {\n\t\t\tcnt += 1;\n\t\t}\n\t}\n\treturn cnt;\n}\n\n/**\n* Returns whether every indexed array element is equal to a provided value.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} start - starting search index (inclusive)\n* @param {NonNegativeInteger} end - ending search index (inclusive)\n* @param {*} value - search value\n* @returns {boolean} boolean indicating whether all the values in array in the given range are equal to the provided value\n*/\nfunction every( arr, start, end, value ) {\n\tvar i;\n\n\tif ( end >= arr.length ) {\n\t\tend = arr.length - 1;\n\t}\n\tfor ( i = start; i <= end; i++ ) {\n\t\tif ( arr[ i ] !== value ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n/**\n* Returns the index of the first occurrence of a value in a provided array.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} start - starting search index (inclusive)\n* @param {NonNegativeInteger} end - ending search index (inclusive)\n* @param {*} value - search value\n* @returns {integer} index of the first occurrence\n*/\nfunction indexOf( arr, start, end, value ) {\n\tvar i;\n\n\tif ( end >= arr.length ) {\n\t\tend = arr.length - 1;\n\t}\n\tfor ( i = start; i <= end; i++ ) {\n\t\tif ( arr[ i ] === value ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n/**\n* Returns the index of the last occurrence of a value in a provided array.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} start - starting search index at which to start searching backwards (inclusive)\n* @param {NonNegativeInteger} end - ending search index (inclusive)\n* @param {*} value - search value\n* @returns {integer} index of the last occurrence\n*/\nfunction lastIndexOf( arr, start, end, value ) {\n\tvar i;\n\n\tif ( start >= arr.length-1 ) {\n\t\tstart = arr.length - 1;\n\t}\n\tfor ( i = start; i >= end; i-- ) {\n\t\tif ( arr[ i ] === value ) {\n\t\t\treturn i;\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// MAIN //\n\n/**\n* Returns the break type between grapheme breaking classes according to _UAX #29 3.1.1 Grapheme Cluster Boundary Rules_ on extended grapheme clusters.\n*\n* @private\n* @param {Array} breaks - list of grapheme break properties\n* @param {Array} emoji - list of emoji properties\n* @returns {NonNegativeInteger} break type\n*\n* @example\n* var out = breakType( [ 11, 3, 11 ], [ 11, 11, 11 ] );\n* // returns 1\n*/\nfunction breakType( breaks, emoji ) {\n\tvar nextEmoji;\n\tvar next;\n\tvar prev;\n\tvar idx;\n\tvar N;\n\tvar M;\n\n\tN = breaks.length;\n\tM = N - 1;\n\n\tprev = breaks[ M-1 ];\n\tnext = breaks[ M ];\n\tnextEmoji = emoji[ M ];\n\n\tidx = lastIndexOf( breaks, M, 0, constants.RegionalIndicator );\n\tif (\n\t\tidx > 0 &&\n\t\tprev !== constants.Prepend &&\n\t\tprev !== constants.RegionalIndicator &&\n\t\tevery( breaks, 1, idx-1, constants.RegionalIndicator )\n\t) {\n\t\tif ( count( breaks, 0, M, constants.RegionalIndicator ) % 2 === 1 ) {\n\t\t\treturn constants.BreakLastRegional;\n\t\t}\n\t\treturn constants.BreakPenultimateRegional;\n\t}\n\t// GB3: CR × LF\n\tif (\n\t\tprev === constants.CR &&\n\t\tnext === constants.LF\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB4: (Control|CR|LF) ÷\n\tif (\n\t\tprev === constants.Control ||\n\t\tprev === constants.CR ||\n\t\tprev === constants.LF\n\t) {\n\t\treturn constants.BreakStart;\n\t}\n\t// GB5: ÷ (Control|CR|LF)\n\tif (\n\t\tnext === constants.Control ||\n\t\tnext === constants.CR ||\n\t\tnext === constants.LF\n\t) {\n\t\treturn constants.BreakStart;\n\t}\n\t// GB6: L × (L|V|LV|LVT)\n\tif (\n\t\tprev === constants.L &&\n\t\t(\n\t\t\tnext === constants.L ||\n\t\t\tnext === constants.V ||\n\t\t\tnext === constants.LV ||\n\t\t\tnext === constants.LVT\n\t\t)\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB7: (LV|V) × (V|T)\n\tif (\n\t\t( prev === constants.LV || prev === constants.V ) &&\n\t\t( next === constants.V || next === constants.T )\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB8: (LVT|T) × (T)\n\tif (\n\t\t( prev === constants.LVT || prev === constants.T ) &&\n\t\tnext === constants.T\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB9: × (Extend|ZWJ)\n\tif (\n\t\tnext === constants.Extend ||\n\t\tnext === constants.ZWJ\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB9a: × SpacingMark\n\tif ( next === constants.SpacingMark ) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB9b: Prepend ×\n\tif ( prev === constants.Prepend ) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB11: \\p{Extended_Pictographic} Extend* ZWJ × \\p{Extended_Pictographic}\n\tidx = lastIndexOf( emoji, M-1, 0, constants.ExtendedPictographic );\n\tif (\n\t\tidx >= 0 &&\n\t\tprev === constants.ZWJ &&\n\t\tnextEmoji === constants.ExtendedPictographic &&\n\t\temoji[ idx ] === constants.ExtendedPictographic &&\n\t\tevery( breaks, idx+1, M-2, constants.Extend )\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB12: ^ (RI RI)* RI × RI\n\t// GB13: [^RI] (RI RI)* RI × RI\n\tif ( indexOf( breaks, 1, M-1, constants.RegionalIndicator ) >= 0 ) {\n\t\treturn constants.Break;\n\t}\n\tif (\n\t\tprev === constants.RegionalIndicator &&\n\t\tnext === constants.RegionalIndicator\n\t) {\n\t\treturn constants.NotBreak;\n\t}\n\t// GB999: Any ? Any\n\treturn constants.BreakStart;\n}\n\n\n// EXPORTS //\n\nexport default breakType;\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* Grapheme cluster break tooling.\n*\n* @module @stdlib/string/tools/grapheme-cluster-break\n*\n* @example\n* import grapheme from '@stdlib/string/tools/grapheme-cluster-break';\n*\n* var out = grapheme.emojiProperty( 0x23EC );\n* // returns 101\n*\n* out = grapheme.breakProperty( 0x008f );\n* // returns 2\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport constants from './constants.js';\nimport breakType from './break_type.js';\nimport emojiProperty from './emoji_property.js';\nimport breakProperty from './break_property.js';\n\n\n// MAIN //\n\nvar main = {};\nsetReadOnly( main, 'constants', constants );\nsetReadOnly( main, 'breakType', breakType );\nsetReadOnly( main, 'emojiProperty', emojiProperty );\nsetReadOnly( main, 'breakProperty', breakProperty );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY 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 @cspell/spellchecker, max-lines-per-function, max-lines */\n\n'use strict';\n\n// MODULES //\n\nimport constants from './constants.js';\n\n\n// MAIN //\n\n/**\n* Returns the emoji property from the [Unicode Standard][1].\n*\n* [1]: https://www.unicode.org/Public/13.0.0/ucd/emoji/emoji-data.txt\n*\n* @private\n* @param {NonNegativeInteger} code - Unicode code point\n* @returns {NonNegativeInteger} emoji property\n*\n* @example\n* var out = emojiProperty( 0x23EC );\n* // returns 101\n*\n* @example\n* var out = emojiProperty( 0x1FFFE );\n* // returns 11\n*/\nfunction emojiProperty( code ) {\n\tif (\n\t\tcode === 0x00A9 || // E0.6 [1] (©️) copyright\n\t\tcode === 0x00AE || // E0.6 [1] (®️) registered\n\t\tcode === 0x203C || // E0.6 [1] (‼️) double exclamation mark\n\t\tcode === 0x2049 || // E0.6 [1] (⁉️) exclamation question mark\n\t\tcode === 0x2122 || // E0.6 [1] (™️) trade mark\n\t\tcode === 0x2139 || // E0.6 [1] (ℹ️) information\n\t\t( 0x2194 <= code && code <= 0x2199 ) || // E0.6 [6] (↔️..↙️) left-right arrow..down-left arrow\n\t\t( 0x21A9 <= code && code <= 0x21AA ) || // E0.6 [2] (↩️..↪️) right arrow curving left..left arrow curving right\n\t\t( 0x231A <= code && code <= 0x231B ) || // E0.6 [2] (⌚..⌛) watch..hourglass done\n\t\tcode === 0x2328 || // E1.0 [1] (⌨️) keyboard\n\t\tcode === 0x2388 || // E0.0 [1] (⎈) HELM SYMBOL\n\t\tcode === 0x23CF || // E1.0 [1] (⏏️) eject button\n\t\t( 0x23E9 <= code && code <= 0x23EC ) || // E0.6 [4] (⏩..⏬) fast-forward button..fast down button\n\t\t( 0x23ED <= code && code <= 0x23EE ) || // E0.7 [2] (⏭️..⏮️) next track button..last track button\n\t\tcode === 0x23EF || // E1.0 [1] (⏯️) play or pause button\n\t\tcode === 0x23F0 || // E0.6 [1] (⏰) alarm clock\n\t\t( 0x23F1 <= code && code <= 0x23F2 ) || // E1.0 [2] (⏱️..⏲️) stopwatch..timer clock\n\t\tcode === 0x23F3 || // E0.6 [1] (⏳) hourglass not done\n\t\t( 0x23F8 <= code && code <= 0x23FA ) || // E0.7 [3] (⏸️..⏺️) pause button..record button\n\t\tcode === 0x24C2 || // E0.6 [1] (Ⓜ️) circled M\n\t\t( 0x25AA <= code && code <= 0x25AB ) || // E0.6 [2] (▪️..▫️) black small square..white small square\n\t\tcode === 0x25B6 || // E0.6 [1] (▶️) play button\n\t\tcode === 0x25C0 || // E0.6 [1] (◀️) reverse button\n\t\t( 0x25FB <= code && code <= 0x25FE ) || // E0.6 [4] (◻️..◾) white medium square..black medium-small square\n\t\t( 0x2600 <= code && code <= 0x2601 ) || // E0.6 [2] (☀️..☁️) sun..cloud\n\t\t( 0x2602 <= code && code <= 0x2603 ) || // E0.7 [2] (☂️..☃️) umbrella..snowman\n\t\tcode === 0x2604 || // E1.0 [1] (☄️) comet\n\t\tcode === 0x2605 || // E0.0 [1] (★) BLACK STAR\n\t\t( 0x2607 <= code && code <= 0x260D ) || // E0.0 [7] (☇..☍) LIGHTNING..OPPOSITION\n\t\tcode === 0x260E || // E0.6 [1] (☎️) telephone\n\t\t( 0x260F <= code && code <= 0x2610 ) || // E0.0 [2] (☏..☐) WHITE TELEPHONE..BALLOT BOX\n\t\tcode === 0x2611 || // E0.6 [1] (☑️) check box with check\n\t\tcode === 0x2612 || // E0.0 [1] (☒) BALLOT BOX WITH X\n\t\t( 0x2614 <= code && code <= 0x2615 ) || // E0.6 [2] (☔..☕) umbrella with rain drops..hot beverage\n\t\t( 0x2616 <= code && code <= 0x2617 ) || // E0.0 [2] (☖..☗) WHITE SHOGI PIECE..BLACK SHOGI PIECE\n\t\tcode === 0x2618 || // E1.0 [1] (☘️) shamrock\n\t\t( 0x2619 <= code && code <= 0x261C ) || // E0.0 [4] (☙..☜) REVERSED ROTATED FLORAL HEART BULLET..WHITE LEFT POINTING INDEX\n\t\tcode === 0x261D || // E0.6 [1] (☝️) index pointing up\n\t\t( 0x261E <= code && code <= 0x261F ) || // E0.0 [2] (☞..☟) WHITE RIGHT POINTING INDEX..WHITE DOWN POINTING INDEX\n\t\tcode === 0x2620 || // E1.0 [1] (☠️) skull and crossbones\n\t\tcode === 0x2621 || // E0.0 [1] (☡) CAUTION SIGN\n\t\t( 0x2622 <= code && code <= 0x2623 ) || // E1.0 [2] (☢️..☣️) radioactive..biohazard\n\t\t( 0x2624 <= code && code <= 0x2625 ) || // E0.0 [2] (☤..☥) CADUCEUS..ANKH\n\t\tcode === 0x2626 || // E1.0 [1] (☦️) orthodox cross\n\t\t( 0x2627 <= code && code <= 0x2629 ) || // E0.0 [3] (☧..☩) CHI RHO..CROSS OF JERUSALEM\n\t\tcode === 0x262A || // E0.7 [1] (☪️) star and crescent\n\t\t( 0x262B <= code && code <= 0x262D ) || // E0.0 [3] (☫..☭) FARSI SYMBOL..HAMMER AND SICKLE\n\t\tcode === 0x262E || // E1.0 [1] (☮️) peace symbol\n\t\tcode === 0x262F || // E0.7 [1] (☯️) yin yang\n\t\t( 0x2630 <= code && code <= 0x2637 ) || // E0.0 [8] (☰..☷) TRIGRAM FOR HEAVEN..TRIGRAM FOR EARTH\n\t\t( 0x2638 <= code && code <= 0x2639 ) || // E0.7 [2] (☸️..☹️) wheel of dharma..frowning face\n\t\tcode === 0x263A || // E0.6 [1] (☺️) smiling face\n\t\t( 0x263B <= code && code <= 0x263F ) || // E0.0 [5] (☻..☿) BLACK SMILING FACE..MERCURY\n\t\tcode === 0x2640 || // E4.0 [1] (♀️) female sign\n\t\tcode === 0x2641 || // E0.0 [1] (♁) EARTH\n\t\tcode === 0x2642 || // E4.0 [1] (♂️) male sign\n\t\t( 0x2643 <= code && code <= 0x2647 ) || // E0.0 [5] (♃..♇) JUPITER..PLUTO\n\t\t( 0x2648 <= code && code <= 0x2653 ) || // E0.6 [12] (♈..♓) Aries..Pisces\n\t\t( 0x2654 <= code && code <= 0x265E ) || // E0.0 [11] (♔..♞) WHITE CHESS KING..BLACK CHESS KNIGHT\n\t\tcode === 0x265F || // E11.0 [1] (♟️) chess pawn\n\t\tcode === 0x2660 || // E0.6 [1] (♠️) spade suit\n\t\t( 0x2661 <= code && code <= 0x2662 ) || // E0.0 [2] (♡..♢) WHITE HEART SUIT..WHITE DIAMOND SUIT\n\t\tcode === 0x2663 || // E0.6 [1] (♣️) club suit\n\t\tcode === 0x2664 || // E0.0 [1] (♤) WHITE SPADE SUIT\n\t\t( 0x2665 <= code && code <= 0x2666 ) || // E0.6 [2] (♥️..♦️) heart suit..diamond suit\n\t\tcode === 0x2667 || // E0.0 [1] (♧) WHITE CLUB SUIT\n\t\tcode === 0x2668 || // E0.6 [1] (♨️) hot springs\n\t\t( 0x2669 <= code && code <= 0x267A ) || // E0.0 [18] (♩..♺) QUARTER NOTE..RECYCLING SYMBOL FOR GENERIC MATERIALS\n\t\tcode === 0x267B || // E0.6 [1] (♻️) recycling symbol\n\t\t( 0x267C <= code && code <= 0x267D ) || // E0.0 [2] (♼..♽) RECYCLED PAPER SYMBOL..PARTIALLY-RECYCLED PAPER SYMBOL\n\t\tcode === 0x267E || // E11.0 [1] (♾️) infinity\n\t\tcode === 0x267F || // E0.6 [1] (♿) wheelchair symbol\n\t\t( 0x2680 <= code && code <= 0x2685 ) || // E0.0 [6] (⚀..⚅) DIE FACE-1..DIE FACE-6\n\t\t( 0x2690 <= code && code <= 0x2691 ) || // E0.0 [2] (⚐..⚑) WHITE FLAG..BLACK FLAG\n\t\tcode === 0x2692 || // E1.0 [1] (⚒️) hammer and pick\n\t\tcode === 0x2693 || // E0.6 [1] (⚓) anchor\n\t\tcode === 0x2694 || // E1.0 [1] (⚔️) crossed swords\n\t\tcode === 0x2695 || // E4.0 [1] (⚕️) medical symbol\n\t\t( 0x2696 <= code && code <= 0x2697 ) || // E1.0 [2] (⚖️..⚗️) balance scale..alembic\n\t\tcode === 0x2698 || // E0.0 [1] (⚘) FLOWER\n\t\tcode === 0x2699 || // E1.0 [1] (⚙️) gear\n\t\tcode === 0x269A || // E0.0 [1] (⚚) STAFF OF HERMES\n\t\t( 0x269B <= code && code <= 0x269C ) || // E1.0 [2] (⚛️..⚜️) atom symbol..fleur-de-lis\n\t\t( 0x269D <= code && code <= 0x269F ) || // E0.0 [3] (⚝..⚟) OUTLINED WHITE STAR..THREE LINES CONVERGING LEFT\n\t\t( 0x26A0 <= code && code <= 0x26A1 ) || // E0.6 [2] (⚠️..⚡) warning..high voltage\n\t\t( 0x26A2 <= code && code <= 0x26A6 ) || // E0.0 [5] (⚢..⚦) DOUBLED FEMALE SIGN..MALE WITH STROKE SIGN\n\t\tcode === 0x26A7 || // E13.0 [1] (⚧️) transgender symbol\n\t\t( 0x26A8 <= code && code <= 0x26A9 ) || // E0.0 [2] (⚨..⚩) VERTICAL MALE WITH STROKE SIGN..HORIZONTAL MALE WITH STROKE SIGN\n\t\t( 0x26AA <= code && code <= 0x26AB ) || // E0.6 [2] (⚪..⚫) white circle..black circle\n\t\t( 0x26AC <= code && code <= 0x26AF ) || // E0.0 [4] (⚬..⚯) MEDIUM SMALL WHITE CIRCLE..UNMARRIED PARTNERSHIP SYMBOL\n\t\t( 0x26B0 <= code && code <= 0x26B1 ) || // E1.0 [2] (⚰️..⚱️) coffin..funeral urn\n\t\t( 0x26B2 <= code && code <= 0x26BC ) || // E0.0 [11] (⚲..⚼) NEUTER..SESQUIQUADRATE\n\t\t( 0x26BD <= code && code <= 0x26BE ) || // E0.6 [2] (⚽..⚾) soccer ball..baseball\n\t\t( 0x26BF <= code && code <= 0x26C3 ) || // E0.0 [5] (⚿..⛃) SQUARED KEY..BLACK DRAUGHTS KING\n\t\t( 0x26C4 <= code && code <= 0x26C5 ) || // E0.6 [2] (⛄..⛅) snowman without snow..sun behind cloud\n\t\t( 0x26C6 <= code && code <= 0x26C7 ) || // E0.0 [2] (⛆..⛇) RAIN..BLACK SNOWMAN\n\t\tcode === 0x26C8 || // E0.7 [1] (⛈️) cloud with lightning and rain\n\t\t( 0x26C9 <= code && code <= 0x26CD ) || // E0.0 [5] (⛉..⛍) TURNED WHITE SHOGI PIECE..DISABLED CAR\n\t\tcode === 0x26CE || // E0.6 [1] (⛎) Ophiuchus\n\t\tcode === 0x26CF || // E0.7 [1] (⛏️) pick\n\t\tcode === 0x26D0 || // E0.0 [1] (⛐) CAR SLIDING\n\t\tcode === 0x26D1 || // E0.7 [1] (⛑️) rescue worker’s helmet\n\t\tcode === 0x26D2 || // E0.0 [1] (⛒) CIRCLED CROSSING LANES\n\t\tcode === 0x26D3 || // E0.7 [1] (⛓️) chains\n\t\tcode === 0x26D4 || // E0.6 [1] (⛔) no entry\n\t\t( 0x26D5 <= code && code <= 0x26E8 ) || // E0.0 [20] (⛕..⛨) ALTERNATE ONE-WAY LEFT WAY TRAFFIC..BLACK CROSS ON SHIELD\n\t\tcode === 0x26E9 || // E0.7 [1] (⛩️) shinto shrine\n\t\tcode === 0x26EA || // E0.6 [1] (⛪) church\n\t\t( 0x26EB <= code && code <= 0x26EF ) || // E0.0 [5] (⛫..⛯) CASTLE..MAP SYMBOL FOR LIGHTHOUSE\n\t\t( 0x26F0 <= code && code <= 0x26F1 ) || // E0.7 [2] (⛰️..⛱️) mountain..umbrella on ground\n\t\t( 0x26F2 <= code && code <= 0x26F3 ) || // E0.6 [2] (⛲..⛳) fountain..flag in hole\n\t\tcode === 0x26F4 || // E0.7 [1] (⛴️) ferry\n\t\tcode === 0x26F5 || // E0.6 [1] (⛵) sailboat\n\t\tcode === 0x26F6 || // E0.0 [1] (⛶) SQUARE FOUR CORNERS\n\t\t( 0x26F7 <= code && code <= 0x26F9 ) || // E0.7 [3] (⛷️..⛹️) skier..person bouncing ball\n\t\tcode === 0x26FA || // E0.6 [1] (⛺) tent\n\t\t( 0x26FB <= code && code <= 0x26FC ) || // E0.0 [2] (⛻..⛼) JAPANESE BANK SYMBOL..HEADSTONE GRAVEYARD SYMBOL\n\t\tcode === 0x26FD || // E0.6 [1] (⛽) fuel pump\n\t\t( 0x26FE <= code && code <= 0x2701 ) || // E0.0 [4] (⛾..✁) CUP ON BLACK SQUARE..UPPER BLADE SCISSORS\n\t\tcode === 0x2702 || // E0.6 [1] (✂️) scissors\n\t\t( 0x2703 <= code && code <= 0x2704 ) || // E0.0 [2] (✃..✄) LOWER BLADE SCISSORS..WHITE SCISSORS\n\t\tcode === 0x2705 || // E0.6 [1] (✅) check mark button\n\t\t( 0x2708 <= code && code <= 0x270C ) || // E0.6 [5] (✈️..✌️) airplane..victory hand\n\t\tcode === 0x270D || // E0.7 [1] (✍️) writing hand\n\t\tcode === 0x270E || // E0.0 [1] (✎) LOWER RIGHT PENCIL\n\t\tcode === 0x270F || // E0.6 [1] (✏️) pencil\n\t\t( 0x2710 <= code && code <= 0x2711 ) || // E0.0 [2] (✐..✑) UPPER RIGHT PENCIL..WHITE NIB\n\t\tcode === 0x2712 || // E0.6 [1] (✒️) black nib\n\t\tcode === 0x2714 || // E0.6 [1] (✔️) check mark\n\t\tcode === 0x2716 || // E0.6 [1] (✖️) multiply\n\t\tcode === 0x271D || // E0.7 [1] (✝️) latin cross\n\t\tcode === 0x2721 || // E0.7 [1] (✡️) star of David\n\t\tcode === 0x2728 || // E0.6 [1] (✨) sparkles\n\t\t( 0x2733 <= code && code <= 0x2734 ) || // E0.6 [2] (✳️..✴️) eight-spoked asterisk..eight-pointed star\n\t\tcode === 0x2744 || // E0.6 [1] (❄️) snowflake\n\t\tcode === 0x2747 || // E0.6 [1] (❇️) sparkle\n\t\tcode === 0x274C || // E0.6 [1] (❌) cross mark\n\t\tcode === 0x274E || // E0.6 [1] (❎) cross mark button\n\t\t( 0x2753 <= code && code <= 0x2755 ) || // E0.6 [3] (❓..❕) question mark..white exclamation mark\n\t\tcode === 0x2757 || // E0.6 [1] (❗) exclamation mark\n\t\tcode === 0x2763 || // E1.0 [1] (❣️) heart exclamation\n\t\tcode === 0x2764 || // E0.6 [1] (❤️) red heart\n\t\t( 0x2765 <= code && code <= 0x2767 ) || // E0.0 [3] (❥..❧) ROTATED HEAVY BLACK HEART BULLET..ROTATED FLORAL HEART BULLET\n\t\t( 0x2795 <= code && code <= 0x2797 ) || // E0.6 [3] (➕..➗) plus..divide\n\t\tcode === 0x27A1 || // E0.6 [1] (➡️) right arrow\n\t\tcode === 0x27B0 || // E0.6 [1] (➰) curly loop\n\t\tcode === 0x27BF || // E1.0 [1] (➿) double curly loop\n\t\t( 0x2934 <= code && code <= 0x2935 ) || // E0.6 [2] (⤴️..⤵️) right arrow curving up..right arrow curving down\n\t\t( 0x2B05 <= code && code <= 0x2B07 ) || // E0.6 [3] (⬅️..⬇️) left arrow..down arrow\n\t\t( 0x2B1B <= code && code <= 0x2B1C ) || // E0.6 [2] (⬛..⬜) black large square..white large square\n\t\tcode === 0x2B50 || // E0.6 [1] (⭐) star\n\t\tcode === 0x2B55 || // E0.6 [1] (⭕) hollow red circle\n\t\tcode === 0x3030 || // E0.6 [1] (〰️) wavy dash\n\t\tcode === 0x303D || // E0.6 [1] (〽️) part alternation mark\n\t\tcode === 0x3297 || // E0.6 [1] (㊗️) Japanese “congratulations” button\n\t\tcode === 0x3299 || // E0.6 [1] (㊙️) Japanese “secret” button\n\t\t( 0x1F000 <= code && code <= 0x1F003 ) || // E0.0 [4] (🀀..🀃) MAHJONG TILE EAST WIND..MAHJONG TILE NORTH WIND\n\t\tcode === 0x1F004 || // E0.6 [1] (🀄) mahjong red dragon\n\t\t( 0x1F005 <= code && code <= 0x1F0CE ) || // E0.0 [202] (🀅..🃎) MAHJONG TILE GREEN DRAGON..PLAYING CARD KING OF DIAMONDS\n\t\tcode === 0x1F0CF || // E0.6 [1] (🃏) joker\n\t\t( 0x1F0D0 <= code && code <= 0x1F0FF ) || // E0.0 [48] (🃐..🃿) ..\n\t\t( 0x1F10D <= code && code <= 0x1F10F ) || // E0.0 [3] (🄍..🄏) CIRCLED ZERO WITH SLASH..CIRCLED DOLLAR SIGN WITH OVERLAID BACKSLASH\n\t\tcode === 0x1F12F || // E0.0 [1] (🄯) COPYLEFT SYMBOL\n\t\t( 0x1F16C <= code && code <= 0x1F16F ) || // E0.0 [4] (🅬..🅯) RAISED MR SIGN..CIRCLED HUMAN FIGURE\n\t\t( 0x1F170 <= code && code <= 0x1F171 ) || // E0.6 [2] (🅰️..🅱️) A button (blood type)..B button (blood type)\n\t\t( 0x1F17E <= code && code <= 0x1F17F ) || // E0.6 [2] (🅾️..🅿️) O button (blood type)..P button\n\t\tcode === 0x1F18E || // E0.6 [1] (🆎) AB button (blood type)\n\t\t( 0x1F191 <= code && code <= 0x1F19A ) || // E0.6 [10] (🆑..🆚) CL button..VS button\n\t\t( 0x1F1AD <= code && code <= 0x1F1E5 ) || // E0.0 [57] (🆭..🇥) MASK WORK SYMBOL..\n\t\t( 0x1F201 <= code && code <= 0x1F202 ) || // E0.6 [2] (🈁..🈂️) Japanese “here” button..Japanese “service charge” button\n\t\t( 0x1F203 <= code && code <= 0x1F20F ) || // E0.0 [13] (🈃..🈏) ..\n\t\tcode === 0x1F21A || // E0.6 [1] (🈚) Japanese “free of charge” button\n\t\tcode === 0x1F22F || // E0.6 [1] (🈯) Japanese “reserved” button\n\t\t( 0x1F232 <= code && code <= 0x1F23A ) || // E0.6 [9] (🈲..🈺) Japanese “prohibited” button..Japanese “open for business” button\n\t\t( 0x1F23C <= code && code <= 0x1F23F ) || // E0.0 [4] (🈼..🈿) ..\n\t\t( 0x1F249 <= code && code <= 0x1F24F ) || // E0.0 [7] (🉉..🉏) ..\n\t\t( 0x1F250 <= code && code <= 0x1F251 ) || // E0.6 [2] (🉐..🉑) Japanese “bargain” button..Japanese “acceptable” button\n\t\t( 0x1F252 <= code && code <= 0x1F2FF ) || // E0.0 [174] (🉒..🋿) ..\n\t\t( 0x1F300 <= code && code <= 0x1F30C ) || // E0.6 [13] (🌀..🌌) cyclone..milky way\n\t\t( 0x1F30D <= code && code <= 0x1F30E ) || // E0.7 [2] (🌍..🌎) globe showing Europe-Africa..globe showing Americas\n\t\tcode === 0x1F30F || // E0.6 [1] (🌏) globe showing Asia-Australia\n\t\tcode === 0x1F310 || // E1.0 [1] (🌐) globe with meridians\n\t\tcode === 0x1F311 || // E0.6 [1] (🌑) new moon\n\t\tcode === 0x1F312 || // E1.0 [1] (🌒) waxing crescent moon\n\t\t( 0x1F313 <= code && code <= 0x1F315 ) || // E0.6 [3] (🌓..🌕) first quarter moon..full moon\n\t\t( 0x1F316 <= code && code <= 0x1F318 ) || // E1.0 [3] (🌖..🌘) waning gibbous moon..waning crescent moon\n\t\tcode === 0x1F319 || // E0.6 [1] (🌙) crescent moon\n\t\tcode === 0x1F31A || // E1.0 [1] (🌚) new moon face\n\t\tcode === 0x1F31B || // E0.6 [1] (🌛) first quarter moon face\n\t\tcode === 0x1F31C || // E0.7 [1] (🌜) last quarter moon face\n\t\t( 0x1F31D <= code && code <= 0x1F31E ) || // E1.0 [2] (🌝..🌞) full moon face..sun with face\n\t\t( 0x1F31F <= code && code <= 0x1F320 ) || // E0.6 [2] (🌟..🌠) glowing star..shooting star\n\t\tcode === 0x1F321 || // E0.7 [1] (🌡️) thermometer\n\t\t( 0x1F322 <= code && code <= 0x1F323 ) || // E0.0 [2] (🌢..🌣) BLACK DROPLET..WHITE SUN\n\t\t( 0x1F324 <= code && code <= 0x1F32C ) || // E0.7 [9] (🌤️..🌬️) sun behind small cloud..wind face\n\t\t( 0x1F32D <= code && code <= 0x1F32F ) || // E1.0 [3] (🌭..🌯) hot dog..burrito\n\t\t( 0x1F330 <= code && code <= 0x1F331 ) || // E0.6 [2] (🌰..🌱) chestnut..seedling\n\t\t( 0x1F332 <= code && code <= 0x1F333 ) || // E1.0 [2] (🌲..🌳) evergreen tree..deciduous tree\n\t\t( 0x1F334 <= code && code <= 0x1F335 ) || // E0.6 [2] (🌴..🌵) palm tree..cactus\n\t\tcode === 0x1F336 || // E0.7 [1] (🌶️) hot pepper\n\t\t( 0x1F337 <= code && code <= 0x1F34A ) || // E0.6 [20] (🌷..🍊) tulip..tangerine\n\t\tcode === 0x1F34B || // E1.0 [1] (🍋) lemon\n\t\t( 0x1F34C <= code && code <= 0x1F34F ) || // E0.6 [4] (🍌..🍏) banana..green apple\n\t\tcode === 0x1F350 || // E1.0 [1] (🍐) pear\n\t\t( 0x1F351 <= code && code <= 0x1F37B ) || // E0.6 [43] (🍑..🍻) peach..clinking beer mugs\n\t\tcode === 0x1F37C || // E1.0 [1] (🍼) baby bottle\n\t\tcode === 0x1F37D || // E0.7 [1] (🍽️) fork and knife with plate\n\t\t( 0x1F37E <= code && code <= 0x1F37F ) || // E1.0 [2] (🍾..🍿) bottle with popping cork..popcorn\n\t\t( 0x1F380 <= code && code <= 0x1F393 ) || // E0.6 [20] (🎀..🎓) ribbon..graduation cap\n\t\t( 0x1F394 <= code && code <= 0x1F395 ) || // E0.0 [2] (🎔..🎕) HEART WITH TIP ON THE LEFT..BOUQUET OF FLOWERS\n\t\t( 0x1F396 <= code && code <= 0x1F397 ) || // E0.7 [2] (🎖️..🎗️) military medal..reminder ribbon\n\t\tcode === 0x1F398 || // E0.0 [1] (🎘) MUSICAL KEYBOARD WITH JACKS\n\t\t( 0x1F399 <= code && code <= 0x1F39B ) || // E0.7 [3] (🎙️..🎛️) studio microphone..control knobs\n\t\t( 0x1F39C <= code && code <= 0x1F39D ) || // E0.0 [2] (🎜..🎝) BEAMED ASCENDING MUSICAL NOTES..BEAMED DESCENDING MUSICAL NOTES\n\t\t( 0x1F39E <= code && code <= 0x1F39F ) || // E0.7 [2] (🎞️..🎟️) film frames..admission tickets\n\t\t( 0x1F3A0 <= code && code <= 0x1F3C4 ) || // E0.6 [37] (🎠..🏄) carousel horse..person surfing\n\t\tcode === 0x1F3C5 || // E1.0 [1] (🏅) sports medal\n\t\tcode === 0x1F3C6 || // E0.6 [1] (🏆) trophy\n\t\tcode === 0x1F3C7 || // E1.0 [1] (🏇) horse racing\n\t\tcode === 0x1F3C8 || // E0.6 [1] (🏈) american football\n\t\tcode === 0x1F3C9 || // E1.0 [1] (🏉) rugby football\n\t\tcode === 0x1F3CA || // E0.6 [1] (🏊) person swimming\n\t\t( 0x1F3CB <= code && code <= 0x1F3CE ) || // E0.7 [4] (🏋️..🏎️) person lifting weights..racing car\n\t\t( 0x1F3CF <= code && code <= 0x1F3D3 ) || // E1.0 [5] (🏏..🏓) cricket game..ping pong\n\t\t( 0x1F3D4 <= code && code <= 0x1F3DF ) || // E0.7 [12] (🏔️..🏟️) snow-capped mountain..stadium\n\t\t( 0x1F3E0 <= code && code <= 0x1F3E3 ) || // E0.6 [4] (🏠..🏣) house..Japanese post office\n\t\tcode === 0x1F3E4 || // E1.0 [1] (🏤) post office\n\t\t( 0x1F3E5 <= code && code <= 0x1F3F0 ) || // E0.6 [12] (🏥..🏰) hospital..castle\n\t\t( 0x1F3F1 <= code && code <= 0x1F3F2 ) || // E0.0 [2] (🏱..🏲) WHITE PENNANT..BLACK PENNANT\n\t\tcode === 0x1F3F3 || // E0.7 [1] (🏳️) white flag\n\t\tcode === 0x1F3F4 || // E1.0 [1] (🏴) black flag\n\t\tcode === 0x1F3F5 || // E0.7 [1] (🏵️) rosette\n\t\tcode === 0x1F3F6 || // E0.0 [1] (🏶) BLACK ROSETTE\n\t\tcode === 0x1F3F7 || // E0.7 [1] (🏷️) label\n\t\t( 0x1F3F8 <= code && code <= 0x1F3FA ) || // E1.0 [3] (🏸..🏺) badminton..amphora\n\t\t( 0x1F400 <= code && code <= 0x1F407 ) || // E1.0 [8] (🐀..🐇) rat..rabbit\n\t\tcode === 0x1F408 || // E0.7 [1] (🐈) cat\n\t\t( 0x1F409 <= code && code <= 0x1F40B ) || // E1.0 [3] (🐉..🐋) dragon..whale\n\t\t( 0x1F40C <= code && code <= 0x1F40E ) || // E0.6 [3] (🐌..🐎) snail..horse\n\t\t( 0x1F40F <= code && code <= 0x1F410 ) || // E1.0 [2] (🐏..🐐) ram..goat\n\t\t( 0x1F411 <= code && code <= 0x1F412 ) || // E0.6 [2] (🐑..🐒) ewe..monkey\n\t\tcode === 0x1F413 || // E1.0 [1] (🐓) rooster\n\t\tcode === 0x1F414 || // E0.6 [1] (🐔) chicken\n\t\tcode === 0x1F415 || // E0.7 [1] (🐕) dog\n\t\tcode === 0x1F416 || // E1.0 [1] (🐖) pig\n\t\t( 0x1F417 <= code && code <= 0x1F429 ) || // E0.6 [19] (🐗..🐩) boar..poodle\n\t\tcode === 0x1F42A || // E1.0 [1] (🐪) camel\n\t\t( 0x1F42B <= code && code <= 0x1F43E ) || // E0.6 [20] (🐫..🐾) two-hump camel..paw prints\n\t\tcode === 0x1F43F || // E0.7 [1] (🐿️) chipmunk\n\t\tcode === 0x1F440 || // E0.6 [1] (👀) eyes\n\t\tcode === 0x1F441 || // E0.7 [1] (👁️) eye\n\t\t( 0x1F442 <= code && code <= 0x1F464 ) || // E0.6 [35] (👂..👤) ear..bust in silhouette\n\t\tcode === 0x1F465 || // E1.0 [1] (👥) busts in silhouette\n\t\t( 0x1F466 <= code && code <= 0x1F46B ) || // E0.6 [6] (👦..👫) boy..woman and man holding hands\n\t\t( 0x1F46C <= code && code <= 0x1F46D ) || // E1.0 [2] (👬..👭) men holding hands..women holding hands\n\t\t( 0x1F46E <= code && code <= 0x1F4AC ) || // E0.6 [63] (👮..💬) police officer..speech balloon\n\t\tcode === 0x1F4AD || // E1.0 [1] (💭) thought balloon\n\t\t( 0x1F4AE <= code && code <= 0x1F4B5 ) || // E0.6 [8] (💮..💵) white flower..dollar banknote\n\t\t( 0x1F4B6 <= code && code <= 0x1F4B7 ) || // E1.0 [2] (💶..💷) euro banknote..pound banknote\n\t\t( 0x1F4B8 <= code && code <= 0x1F4EB ) || // E0.6 [52] (💸..📫) money with wings..closed mailbox with raised flag\n\t\t( 0x1F4EC <= code && code <= 0x1F4ED ) || // E0.7 [2] (📬..📭) open mailbox with raised flag..open mailbox with lowered flag\n\t\tcode === 0x1F4EE || // E0.6 [1] (📮) postbox\n\t\tcode === 0x1F4EF || // E1.0 [1] (📯) postal horn\n\t\t( 0x1F4F0 <= code && code <= 0x1F4F4 ) || // E0.6 [5] (📰..📴) newspaper..mobile phone off\n\t\tcode === 0x1F4F5 || // E1.0 [1] (📵) no mobile phones\n\t\t( 0x1F4F6 <= code && code <= 0x1F4F7 ) || // E0.6 [2] (📶..📷) antenna bars..camera\n\t\tcode === 0x1F4F8 || // E1.0 [1] (📸) camera with flash\n\t\t( 0x1F4F9 <= code && code <= 0x1F4FC ) || // E0.6 [4] (📹..📼) video camera..videocassette\n\t\tcode === 0x1F4FD || // E0.7 [1] (📽️) film projector\n\t\tcode === 0x1F4FE || // E0.0 [1] (📾) PORTABLE STEREO\n\t\t( 0x1F4FF <= code && code <= 0x1F502 ) || // E1.0 [4] (📿..🔂) prayer beads..repeat single button\n\t\tcode === 0x1F503 || // E0.6 [1] (🔃) clockwise vertical arrows\n\t\t( 0x1F504 <= code && code <= 0x1F507 ) || // E1.0 [4] (🔄..🔇) counterclockwise arrows button..muted speaker\n\t\tcode === 0x1F508 || // E0.7 [1] (🔈) speaker low volume\n\t\tcode === 0x1F509 || // E1.0 [1] (🔉) speaker medium volume\n\t\t( 0x1F50A <= code && code <= 0x1F514 ) || // E0.6 [11] (🔊..🔔) speaker high volume..bell\n\t\tcode === 0x1F515 || // E1.0 [1] (🔕) bell with slash\n\t\t( 0x1F516 <= code && code <= 0x1F52B ) || // E0.6 [22] (🔖..🔫) bookmark..pistol\n\t\t( 0x1F52C <= code && code <= 0x1F52D ) || // E1.0 [2] (🔬..🔭) microscope..telescope\n\t\t( 0x1F52E <= code && code <= 0x1F53D ) || // E0.6 [16] (🔮..🔽) crystal ball..downwards button\n\t\t( 0x1F546 <= code && code <= 0x1F548 ) || // E0.0 [3] (🕆..🕈) WHITE LATIN CROSS..CELTIC CROSS\n\t\t( 0x1F549 <= code && code <= 0x1F54A ) || // E0.7 [2] (🕉️..🕊️) om..dove\n\t\t( 0x1F54B <= code && code <= 0x1F54E ) || // E1.0 [4] (🕋..🕎) kaaba..menorah\n\t\tcode === 0x1F54F || // E0.0 [1] (🕏) BOWL OF HYGIEIA\n\t\t( 0x1F550 <= code && code <= 0x1F55B ) || // E0.6 [12] (🕐..🕛) one o’clock..twelve o’clock\n\t\t( 0x1F55C <= code && code <= 0x1F567 ) || // E0.7 [12] (🕜..🕧) one-thirty..twelve-thirty\n\t\t( 0x1F568 <= code && code <= 0x1F56E ) || // E0.0 [7] (🕨..🕮) RIGHT SPEAKER..BOOK\n\t\t( 0x1F56F <= code && code <= 0x1F570 ) || // E0.7 [2] (🕯️..🕰️) candle..mantelpiece clock\n\t\t( 0x1F571 <= code && code <= 0x1F572 ) || // E0.0 [2] (🕱..🕲) BLACK SKULL AND CROSSBONES..NO PIRACY\n\t\t( 0x1F573 <= code && code <= 0x1F579 ) || // E0.7 [7] (🕳️..🕹️) hole..joystick\n\t\tcode === 0x1F57A || // E3.0 [1] (🕺) man dancing\n\t\t( 0x1F57B <= code && code <= 0x1F586 ) || // E0.0 [12] (🕻..🖆) LEFT HAND TELEPHONE RECEIVER..PEN OVER STAMPED ENVELOPE\n\t\tcode === 0x1F587 || // E0.7 [1] (🖇️) linked paperclips\n\t\t( 0x1F588 <= code && code <= 0x1F589 ) || // E0.0 [2] (🖈..🖉) BLACK PUSHPIN..LOWER LEFT PENCIL\n\t\t( 0x1F58A <= code && code <= 0x1F58D ) || // E0.7 [4] (🖊️..🖍️) pen..crayon\n\t\t( 0x1F58E <= code && code <= 0x1F58F ) || // E0.0 [2] (🖎..🖏) LEFT WRITING HAND..TURNED OK HAND SIGN\n\t\tcode === 0x1F590 || // E0.7 [1] (🖐️) hand with fingers splayed\n\t\t( 0x1F591 <= code && code <= 0x1F594 ) || // E0.0 [4] (🖑..🖔) REVERSED RAISED HAND WITH FINGERS SPLAYED..REVERSED VICTORY HAND\n\t\t( 0x1F595 <= code && code <= 0x1F596 ) || // E1.0 [2] (🖕..🖖) middle finger..vulcan salute\n\t\t( 0x1F597 <= code && code <= 0x1F5A3 ) || // E0.0 [13] (🖗..🖣) WHITE DOWN POINTING LEFT HAND INDEX..BLACK DOWN POINTING BACKHAND INDEX\n\t\tcode === 0x1F5A4 || // E3.0 [1] (🖤) black heart\n\t\tcode === 0x1F5A5 || // E0.7 [1] (🖥️) desktop computer\n\t\t( 0x1F5A6 <= code && code <= 0x1F5A7 ) || // E0.0 [2] (🖦..🖧) KEYBOARD AND MOUSE..THREE NETWORKED COMPUTERS\n\t\tcode === 0x1F5A8 || // E0.7 [1] (🖨️) printer\n\t\t( 0x1F5A9 <= code && code <= 0x1F5B0 ) || // E0.0 [8] (🖩..🖰) POCKET CALCULATOR..TWO BUTTON MOUSE\n\t\t( 0x1F5B1 <= code && code <= 0x1F5B2 ) || // E0.7 [2] (🖱️..🖲️) computer mouse..trackball\n\t\t( 0x1F5B3 <= code && code <= 0x1F5BB ) || // E0.0 [9] (🖳..🖻) OLD PERSONAL COMPUTER..DOCUMENT WITH PICTURE\n\t\tcode === 0x1F5BC || // E0.7 [1] (🖼️) framed picture\n\t\t( 0x1F5BD <= code && code <= 0x1F5C1 ) || // E0.0 [5] (🖽..🗁) FRAME WITH TILES..OPEN FOLDER\n\t\t( 0x1F5C2 <= code && code <= 0x1F5C4 ) || // E0.7 [3] (🗂️..🗄️) card index dividers..file cabinet\n\t\t( 0x1F5C5 <= code && code <= 0x1F5D0 ) || // E0.0 [12] (🗅..🗐) EMPTY NOTE..PAGES\n\t\t( 0x1F5D1 <= code && code <= 0x1F5D3 ) || // E0.7 [3] (🗑️..🗓️) wastebasket..spiral calendar\n\t\t( 0x1F5D4 <= code && code <= 0x1F5DB ) || // E0.0 [8] (🗔..🗛) DESKTOP WINDOW..DECREASE FONT SIZE SYMBOL\n\t\t( 0x1F5DC <= code && code <= 0x1F5DE ) || // E0.7 [3] (🗜️..🗞️) clamp..rolled-up newspaper\n\t\t( 0x1F5DF <= code && code <= 0x1F5E0 ) || // E0.0 [2] (🗟..🗠) PAGE WITH CIRCLED TEXT..STOCK CHART\n\t\tcode === 0x1F5E1 || // E0.7 [1] (🗡️) dagger\n\t\tcode === 0x1F5E2 || // E0.0 [1] (🗢) LIPS\n\t\tcode === 0x1F5E3 || // E0.7 [1] (🗣️) speaking head\n\t\t( 0x1F5E4 <= code && code <= 0x1F5E7 ) || // E0.0 [4] (🗤..🗧) THREE RAYS ABOVE..THREE RAYS RIGHT\n\t\tcode === 0x1F5E8 || // E2.0 [1] (🗨️) left speech bubble\n\t\t( 0x1F5E9 <= code && code <= 0x1F5EE ) || // E0.0 [6] (🗩..🗮) RIGHT SPEECH BUBBLE..LEFT ANGER BUBBLE\n\t\tcode === 0x1F5EF || // E0.7 [1] (🗯️) right anger bubble\n\t\t( 0x1F5F0 <= code && code <= 0x1F5F2 ) || // E0.0 [3] (🗰..🗲) MOOD BUBBLE..LIGHTNING MOOD\n\t\tcode === 0x1F5F3 || // E0.7 [1] (🗳️) ballot box with ballot\n\t\t( 0x1F5F4 <= code && code <= 0x1F5F9 ) || // E0.0 [6] (🗴..🗹) BALLOT SCRIPT X..BALLOT BOX WITH BOLD CHECK\n\t\tcode === 0x1F5FA || // E0.7 [1] (🗺️) world map\n\t\t( 0x1F5FB <= code && code <= 0x1F5FF ) || // E0.6 [5] (🗻..🗿) mount fuji..moai\n\t\tcode === 0x1F600 || // E1.0 [1] (😀) grinning face\n\t\t( 0x1F601 <= code && code <= 0x1F606 ) || // E0.6 [6] (😁..😆) beaming face with smiling eyes..grinning squinting face\n\t\t( 0x1F607 <= code && code <= 0x1F608 ) || // E1.0 [2] (😇..😈) smiling face with halo..smiling face with horns\n\t\t( 0x1F609 <= code && code <= 0x1F60D ) || // E0.6 [5] (😉..😍) winking face..smiling face with heart-eyes\n\t\tcode === 0x1F60E || // E1.0 [1] (😎) smiling face with sunglasses\n\t\tcode === 0x1F60F || // E0.6 [1] (😏) smirking face\n\t\tcode === 0x1F610 || // E0.7 [1] (😐) neutral face\n\t\tcode === 0x1F611 || // E1.0 [1] (😑) expressionless face\n\t\t( 0x1F612 <= code && code <= 0x1F614 ) || // E0.6 [3] (😒..😔) unamused face..pensive face\n\t\tcode === 0x1F615 || // E1.0 [1] (😕) confused face\n\t\tcode === 0x1F616 || // E0.6 [1] (😖) confounded face\n\t\tcode === 0x1F617 || // E1.0 [1] (😗) kissing face\n\t\tcode === 0x1F618 || // E0.6 [1] (😘) face blowing a kiss\n\t\tcode === 0x1F619 || // E1.0 [1] (😙) kissing face with smiling eyes\n\t\tcode === 0x1F61A || // E0.6 [1] (😚) kissing face with closed eyes\n\t\tcode === 0x1F61B || // E1.0 [1] (😛) face with tongue\n\t\t( 0x1F61C <= code && code <= 0x1F61E ) || // E0.6 [3] (😜..😞) winking face with tongue..disappointed face\n\t\tcode === 0x1F61F || // E1.0 [1] (😟) worried face\n\t\t( 0x1F620 <= code && code <= 0x1F625 ) || // E0.6 [6] (😠..😥) angry face..sad but relieved face\n\t\t( 0x1F626 <= code && code <= 0x1F627 ) || // E1.0 [2] (😦..😧) frowning face with open mouth..anguished face\n\t\t( 0x1F628 <= code && code <= 0x1F62B ) || // E0.6 [4] (😨..😫) fearful face..tired face\n\t\tcode === 0x1F62C || // E1.0 [1] (😬) grimacing face\n\t\tcode === 0x1F62D || // E0.6 [1] (😭) loudly crying face\n\t\t( 0x1F62E <= code && code <= 0x1F62F ) || // E1.0 [2] (😮..😯) face with open mouth..hushed face\n\t\t( 0x1F630 <= code && code <= 0x1F633 ) || // E0.6 [4] (😰..😳) anxious face with sweat..flushed face\n\t\tcode === 0x1F634 || // E1.0 [1] (😴) sleeping face\n\t\tcode === 0x1F635 || // E0.6 [1] (😵) dizzy face\n\t\tcode === 0x1F636 || // E1.0 [1] (😶) face without mouth\n\t\t( 0x1F637 <= code && code <= 0x1F640 ) || // E0.6 [10] (😷..🙀) face with medical mask..weary cat\n\t\t( 0x1F641 <= code && code <= 0x1F644 ) || // E1.0 [4] (🙁..🙄) slightly frowning face..face with rolling eyes\n\t\t( 0x1F645 <= code && code <= 0x1F64F ) || // E0.6 [11] (🙅..🙏) person gesturing NO..folded hands\n\t\tcode === 0x1F680 || // E0.6 [1] (🚀) rocket\n\t\t( 0x1F681 <= code && code <= 0x1F682 ) || // E1.0 [2] (🚁..🚂) helicopter..locomotive\n\t\t( 0x1F683 <= code && code <= 0x1F685 ) || // E0.6 [3] (🚃..🚅) railway car..bullet train\n\t\tcode === 0x1F686 || // E1.0 [1] (🚆) train\n\t\tcode === 0x1F687 || // E0.6 [1] (🚇) metro\n\t\tcode === 0x1F688 || // E1.0 [1] (🚈) light rail\n\t\tcode === 0x1F689 || // E0.6 [1] (🚉) station\n\t\t( 0x1F68A <= code && code <= 0x1F68B ) || // E1.0 [2] (🚊..🚋) tram..tram car\n\t\tcode === 0x1F68C || // E0.6 [1] (🚌) bus\n\t\tcode === 0x1F68D || // E0.7 [1] (🚍) oncoming bus\n\t\tcode === 0x1F68E || // E1.0 [1] (🚎) trolleybus\n\t\tcode === 0x1F68F || // E0.6 [1] (🚏) bus stop\n\t\tcode === 0x1F690 || // E1.0 [1] (🚐) minibus\n\t\t( 0x1F691 <= code && code <= 0x1F693 ) || // E0.6 [3] (🚑..🚓) ambulance..police car\n\t\tcode === 0x1F694 || // E0.7 [1] (🚔) oncoming police car\n\t\tcode === 0x1F695 || // E0.6 [1] (🚕) taxi\n\t\tcode === 0x1F696 || // E1.0 [1] (🚖) oncoming taxi\n\t\tcode === 0x1F697 || // E0.6 [1] (🚗) automobile\n\t\tcode === 0x1F698 || // E0.7 [1] (🚘) oncoming automobile\n\t\t( 0x1F699 <= code && code <= 0x1F69A ) || // E0.6 [2] (🚙..🚚) sport utility vehicle..delivery truck\n\t\t( 0x1F69B <= code && code <= 0x1F6A1 ) || // E1.0 [7] (🚛..🚡) articulated lorry..aerial tramway\n\t\tcode === 0x1F6A2 || // E0.6 [1] (🚢) ship\n\t\tcode === 0x1F6A3 || // E1.0 [1] (🚣) person rowing boat\n\t\t( 0x1F6A4 <= code && code <= 0x1F6A5 ) || // E0.6 [2] (🚤..🚥) speedboat..horizontal traffic light\n\t\tcode === 0x1F6A6 || // E1.0 [1] (🚦) vertical traffic light\n\t\t( 0x1F6A7 <= code && code <= 0x1F6AD ) || // E0.6 [7] (🚧..🚭) construction..no smoking\n\t\t( 0x1F6AE <= code && code <= 0x1F6B1 ) || // E1.0 [4] (🚮..🚱) litter in bin sign..non-potable water\n\t\tcode === 0x1F6B2 || // E0.6 [1] (🚲) bicycle\n\t\t( 0x1F6B3 <= code && code <= 0x1F6B5 ) || // E1.0 [3] (🚳..🚵) no bicycles..person mountain biking\n\t\tcode === 0x1F6B6 || // E0.6 [1] (🚶) person walking\n\t\t( 0x1F6B7 <= code && code <= 0x1F6B8 ) || // E1.0 [2] (🚷..🚸) no pedestrians..children crossing\n\t\t( 0x1F6B9 <= code && code <= 0x1F6BE ) || // E0.6 [6] (🚹..🚾) men’s room..water closet\n\t\tcode === 0x1F6BF || // E1.0 [1] (🚿) shower\n\t\tcode === 0x1F6C0 || // E0.6 [1] (🛀) person taking bath\n\t\t( 0x1F6C1 <= code && code <= 0x1F6C5 ) || // E1.0 [5] (🛁..🛅) bathtub..left luggage\n\t\t( 0x1F6C6 <= code && code <= 0x1F6CA ) || // E0.0 [5] (🛆..🛊) TRIANGLE WITH ROUNDED CORNERS..GIRLS SYMBOL\n\t\tcode === 0x1F6CB || // E0.7 [1] (🛋️) couch and lamp\n\t\tcode === 0x1F6CC || // E1.0 [1] (🛌) person in bed\n\t\t( 0x1F6CD <= code && code <= 0x1F6CF ) || // E0.7 [3] (🛍️..🛏️) shopping bags..bed\n\t\tcode === 0x1F6D0 || // E1.0 [1] (🛐) place of worship\n\t\t( 0x1F6D1 <= code && code <= 0x1F6D2 ) || // E3.0 [2] (🛑..🛒) stop sign..shopping cart\n\t\t( 0x1F6D3 <= code && code <= 0x1F6D4 ) || // E0.0 [2] (🛓..🛔) STUPA..PAGODA\n\t\tcode === 0x1F6D5 || // E12.0 [1] (🛕) hindu temple\n\t\t( 0x1F6D6 <= code && code <= 0x1F6D7 ) || // E13.0 [2] (🛖..🛗) hut..elevator\n\t\t( 0x1F6D8 <= code && code <= 0x1F6DF ) || // E0.0 [8] (🛘..🛟) ..\n\t\t( 0x1F6E0 <= code && code <= 0x1F6E5 ) || // E0.7 [6] (🛠️..🛥️) hammer and wrench..motor boat\n\t\t( 0x1F6E6 <= code && code <= 0x1F6E8 ) || // E0.0 [3] (🛦..🛨) UP-POINTING MILITARY AIRPLANE..UP-POINTING SMALL AIRPLANE\n\t\tcode === 0x1F6E9 || // E0.7 [1] (🛩️) small airplane\n\t\tcode === 0x1F6EA || // E0.0 [1] (🛪) NORTHEAST-POINTING AIRPLANE\n\t\t( 0x1F6EB <= code && code <= 0x1F6EC ) || // E1.0 [2] (🛫..🛬) airplane departure..airplane arrival\n\t\t( 0x1F6ED <= code && code <= 0x1F6EF ) || // E0.0 [3] (🛭..🛯) ..\n\t\tcode === 0x1F6F0 || // E0.7 [1] (🛰️) satellite\n\t\t( 0x1F6F1 <= code && code <= 0x1F6F2 ) || // E0.0 [2] (🛱..🛲) ONCOMING FIRE ENGINE..DIESEL LOCOMOTIVE\n\t\tcode === 0x1F6F3 || // E0.7 [1] (🛳️) passenger ship\n\t\t( 0x1F6F4 <= code && code <= 0x1F6F6 ) || // E3.0 [3] (🛴..🛶) kick scooter..canoe\n\t\t( 0x1F6F7 <= code && code <= 0x1F6F8 ) || // E5.0 [2] (🛷..🛸) sled..flying saucer\n\t\tcode === 0x1F6F9 || // E11.0 [1] (🛹) skateboard\n\t\tcode === 0x1F6FA || // E12.0 [1] (🛺) auto rickshaw\n\t\t( 0x1F6FB <= code && code <= 0x1F6FC ) || // E13.0 [2] (🛻..🛼) pickup truck..roller skate\n\t\t( 0x1F6FD <= code && code <= 0x1F6FF ) || // E0.0 [3] (🛽..🛿) ..\n\t\t( 0x1F774 <= code && code <= 0x1F77F ) || // E0.0 [12] (🝴..🝿) ..\n\t\t( 0x1F7D5 <= code && code <= 0x1F7DF ) || // E0.0 [11] (🟕..🟟) CIRCLED TRIANGLE..\n\t\t( 0x1F7E0 <= code && code <= 0x1F7EB ) || // E12.0 [12] (🟠..🟫) orange circle..brown square\n\t\t( 0x1F7EC <= code && code <= 0x1F7FF ) || // E0.0 [20] (🟬..🟿) ..\n\t\t( 0x1F80C <= code && code <= 0x1F80F ) || // E0.0 [4] (🠌..🠏) ..\n\t\t( 0x1F848 <= code && code <= 0x1F84F ) || // E0.0 [8] (🡈..🡏) ..\n\t\t( 0x1F85A <= code && code <= 0x1F85F ) || // E0.0 [6] (🡚..🡟) ..\n\t\t( 0x1F888 <= code && code <= 0x1F88F ) || // E0.0 [8] (🢈..🢏) ..\n\t\t( 0x1F8AE <= code && code <= 0x1F8FF ) || // E0.0 [82] (🢮..🣿) ..\n\t\tcode === 0x1F90C || // E13.0 [1] (🤌) pinched fingers\n\t\t( 0x1F90D <= code && code <= 0x1F90F ) || // E12.0 [3] (🤍..🤏) white heart..pinching hand\n\t\t( 0x1F910 <= code && code <= 0x1F918 ) || // E1.0 [9] (🤐..🤘) zipper-mouth face..sign of the horns\n\t\t( 0x1F919 <= code && code <= 0x1F91E ) || // E3.0 [6] (🤙..🤞) call me hand..crossed fingers\n\t\tcode === 0x1F91F || // E5.0 [1] (🤟) love-you gesture\n\t\t( 0x1F920 <= code && code <= 0x1F927 ) || // E3.0 [8] (🤠..🤧) cowboy hat face..sneezing face\n\t\t( 0x1F928 <= code && code <= 0x1F92F ) || // E5.0 [8] (🤨..🤯) face with raised eyebrow..exploding head\n\t\tcode === 0x1F930 || // E3.0 [1] (🤰) pregnant woman\n\t\t( 0x1F931 <= code && code <= 0x1F932 ) || // E5.0 [2] (🤱..🤲) breast-feeding..palms up together\n\t\t( 0x1F933 <= code && code <= 0x1F93A ) || // E3.0 [8] (🤳..🤺) selfie..person fencing\n\t\t( 0x1F93C <= code && code <= 0x1F93E ) || // E3.0 [3] (🤼..🤾) people wrestling..person playing handball\n\t\tcode === 0x1F93F || // E12.0 [1] (🤿) diving mask\n\t\t( 0x1F940 <= code && code <= 0x1F945 ) || // E3.0 [6] (🥀..🥅) wilted flower..goal net\n\t\t( 0x1F947 <= code && code <= 0x1F94B ) || // E3.0 [5] (🥇..🥋) 1st place medal..martial arts uniform\n\t\tcode === 0x1F94C || // E5.0 [1] (🥌) curling stone\n\t\t( 0x1F94D <= code && code <= 0x1F94F ) || // E11.0 [3] (🥍..🥏) lacrosse..flying disc\n\t\t( 0x1F950 <= code && code <= 0x1F95E ) || // E3.0 [15] (🥐..🥞) croissant..pancakes\n\t\t( 0x1F95F <= code && code <= 0x1F96B ) || // E5.0 [13] (🥟..🥫) dumpling..canned food\n\t\t( 0x1F96C <= code && code <= 0x1F970 ) || // E11.0 [5] (🥬..🥰) leafy green..smiling face with hearts\n\t\tcode === 0x1F971 || // E12.0 [1] (🥱) yawning face\n\t\tcode === 0x1F972 || // E13.0 [1] (🥲) smiling face with tear\n\t\t( 0x1F973 <= code && code <= 0x1F976 ) || // E11.0 [4] (🥳..🥶) partying face..cold face\n\t\t( 0x1F977 <= code && code <= 0x1F978 ) || // E13.0 [2] (🥷..🥸) ninja..disguised face\n\t\tcode === 0x1F979 || // E0.0 [1] (🥹) \n\t\tcode === 0x1F97A || // E11.0 [1] (🥺) pleading face\n\t\tcode === 0x1F97B || // E12.0 [1] (🥻) sari\n\t\t( 0x1F97C <= code && code <= 0x1F97F ) || // E11.0 [4] (🥼..🥿) lab coat..flat shoe\n\t\t( 0x1F980 <= code && code <= 0x1F984 ) || // E1.0 [5] (🦀..🦄) crab..unicorn\n\t\t( 0x1F985 <= code && code <= 0x1F991 ) || // E3.0 [13] (🦅..🦑) eagle..squid\n\t\t( 0x1F992 <= code && code <= 0x1F997 ) || // E5.0 [6] (🦒..🦗) giraffe..cricket\n\t\t( 0x1F998 <= code && code <= 0x1F9A2 ) || // E11.0 [11] (🦘..🦢) kangaroo..swan\n\t\t( 0x1F9A3 <= code && code <= 0x1F9A4 ) || // E13.0 [2] (🦣..🦤) mammoth..dodo\n\t\t( 0x1F9A5 <= code && code <= 0x1F9AA ) || // E12.0 [6] (🦥..🦪) sloth..oyster\n\t\t( 0x1F9AB <= code && code <= 0x1F9AD ) || // E13.0 [3] (🦫..🦭) beaver..seal\n\t\t( 0x1F9AE <= code && code <= 0x1F9AF ) || // E12.0 [2] (🦮..🦯) guide dog..white cane\n\t\t( 0x1F9B0 <= code && code <= 0x1F9B9 ) || // E11.0 [10] (🦰..🦹) red hair..supervillain\n\t\t( 0x1F9BA <= code && code <= 0x1F9BF ) || // E12.0 [6] (🦺..🦿) safety vest..mechanical leg\n\t\tcode === 0x1F9C0 || // E1.0 [1] (🧀) cheese wedge\n\t\t( 0x1F9C1 <= code && code <= 0x1F9C2 ) || // E11.0 [2] (🧁..🧂) cupcake..salt\n\t\t( 0x1F9C3 <= code && code <= 0x1F9CA ) || // E12.0 [8] (🧃..🧊) beverage box..ice\n\t\tcode === 0x1F9CB || // E13.0 [1] (🧋) bubble tea\n\t\tcode === 0x1F9CC || // E0.0 [1] (🧌) \n\t\t( 0x1F9CD <= code && code <= 0x1F9CF ) || // E12.0 [3] (🧍..🧏) person standing..deaf person\n\t\t( 0x1F9D0 <= code && code <= 0x1F9E6 ) || // E5.0 [23] (🧐..🧦) face with monocle..socks\n\t\t( 0x1F9E7 <= code && code <= 0x1F9FF ) || // E11.0 [25] (🧧..🧿) red envelope..nazar amulet\n\t\t( 0x1FA00 <= code && code <= 0x1FA6F ) || // E0.0 [112] (🨀..🩯) NEUTRAL CHESS KING..\n\t\t( 0x1FA70 <= code && code <= 0x1FA73 ) || // E12.0 [4] (🩰..🩳) ballet shoes..shorts\n\t\tcode === 0x1FA74 || // E13.0 [1] (🩴) thong sandal\n\t\t( 0x1FA75 <= code && code <= 0x1FA77 ) || // E0.0 [3] (🩵..🩷) ..\n\t\t( 0x1FA78 <= code && code <= 0x1FA7A ) || // E12.0 [3] (🩸..🩺) drop of blood..stethoscope\n\t\t( 0x1FA7B <= code && code <= 0x1FA7F ) || // E0.0 [5] (🩻..🩿) ..\n\t\t( 0x1FA80 <= code && code <= 0x1FA82 ) || // E12.0 [3] (🪀..🪂) yo-yo..parachute\n\t\t( 0x1FA83 <= code && code <= 0x1FA86 ) || // E13.0 [4] (🪃..🪆) boomerang..nesting dolls\n\t\t( 0x1FA87 <= code && code <= 0x1FA8F ) || // E0.0 [9] (🪇..🪏) ..\n\t\t( 0x1FA90 <= code && code <= 0x1FA95 ) || // E12.0 [6] (🪐..🪕) ringed planet..banjo\n\t\t( 0x1FA96 <= code && code <= 0x1FAA8 ) || // E13.0 [19] (🪖..🪨) military helmet..rock\n\t\t( 0x1FAA9 <= code && code <= 0x1FAAF ) || // E0.0 [7] (🪩..🪯) ..\n\t\t( 0x1FAB0 <= code && code <= 0x1FAB6 ) || // E13.0 [7] (🪰..🪶) fly..feather\n\t\t( 0x1FAB7 <= code && code <= 0x1FABF ) || // E0.0 [9] (🪷..🪿) ..\n\t\t( 0x1FAC0 <= code && code <= 0x1FAC2 ) || // E13.0 [3] (🫀..🫂) anatomical heart..people hugging\n\t\t( 0x1FAC3 <= code && code <= 0x1FACF ) || // E0.0 [13] (🫃..🫏) ..\n\t\t( 0x1FAD0 <= code && code <= 0x1FAD6 ) || // E13.0 [7] (🫐..🫖) blueberries..teapot\n\t\t( 0x1FAD7 <= code && code <= 0x1FAFF ) || // E0.0 [41] (🫗..🫿) ..\n\t\t( 0x1FC00 <= code && code <= 0x1FFFD ) // E0.0[1022] (🰀..🿽) ..\n\t) {\n\t\treturn constants.ExtendedPictographic;\n\t}\n\treturn constants.Other;\n}\n\n\n// EXPORTS //\n\nexport default emojiProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY 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 max-lines-per-function, max-lines */\n\n'use strict';\n\n// MODULES //\n\nimport constants from './constants.js';\n\n\n// MAIN //\n\n/**\n* Returns the grapheme break property from the [Unicode Standard][1].\n*\n* [1]: https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt\n*\n* @private\n* @param {NonNegativeInteger} code - Unicode code point\n* @returns {NonNegativeInteger} grapheme break property\n*\n* @example\n* var out = graphemeBreakProperty( 0x008f );\n* // returns 2\n*\n* @example\n* var out = graphemeBreakProperty( 0x111C2 );\n* // returns 12\n*\n* @example\n* var out = graphemeBreakProperty( 0x1F3FC );\n* // returns 3\n*/\nfunction graphemeBreakProperty( code ) {\n\tif (\n\t\t( 0x0600 <= code && code <= 0x0605 ) || // Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER MARK ABOVE\n\t\tcode === 0x06DD || // Cf ARABIC END OF AYAH\n\t\tcode === 0x070F || // Cf SYRIAC ABBREVIATION MARK\n\t\tcode === 0x08E2 || // Cf ARABIC DISPUTED END OF AYAH\n\t\tcode === 0x0D4E || // Lo MALAYALAM LETTER DOT REPH\n\t\tcode === 0x110BD || // Cf KAITHI NUMBER SIGN\n\t\tcode === 0x110CD || // Cf KAITHI NUMBER SIGN ABOVE\n\t\t( 0x111C2 <= code && code <= 0x111C3 ) || // Lo [2] SHARADA SIGN JIHVAMULIYA..SHARADA SIGN UPADHMANIYA\n\t\tcode === 0x1193F || // Lo DIVES AKURU PREFIXED NASAL SIGN\n\t\tcode === 0x11941 || // Lo DIVES AKURU INITIAL RA\n\t\tcode === 0x11A3A || // Lo ZANABAZAR SQUARE CLUSTER-INITIAL LETTER RA\n\t\t( 0x11A84 <= code && code <= 0x11A89 ) || // Lo [6] SOYOMBO SIGN JIHVAMULIYA..SOYOMBO CLUSTER-INITIAL LETTER SA\n\t\tcode === 0x11D46 // Lo MASARAM GONDI REPHA\n\t) {\n\t\treturn constants.Prepend;\n\t}\n\tif (\n\t\tcode === 0x000D // Cc \n\t) {\n\t\treturn constants.CR;\n\t}\n\tif (\n\t\tcode === 0x000A // Cc \n\t) {\n\t\treturn constants.LF;\n\t}\n\tif (\n\t\t( 0x0000 <= code && code <= 0x0009 ) || // Cc [10] ..\n\t\t( 0x000B <= code && code <= 0x000C ) || // Cc [2] ..\n\t\t( 0x000E <= code && code <= 0x001F ) || // Cc [18] ..\n\t\t( 0x007F <= code && code <= 0x009F ) || // Cc [33] ..\n\t\tcode === 0x00AD || // Cf SOFT HYPHEN\n\t\tcode === 0x061C || // Cf ARABIC LETTER MARK\n\t\tcode === 0x180E || // Cf MONGOLIAN VOWEL SEPARATOR\n\t\tcode === 0x200B || // Cf ZERO WIDTH SPACE\n\t\t( 0x200E <= code && code <= 0x200F ) || // Cf [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT MARK\n\t\tcode === 0x2028 || // Zl LINE SEPARATOR\n\t\tcode === 0x2029 || // Zp PARAGRAPH SEPARATOR\n\t\t( 0x202A <= code && code <= 0x202E ) || // Cf [5] LEFT-TO-RIGHT EMBEDDING..RIGHT-TO-LEFT OVERRIDE\n\t\t( 0x2060 <= code && code <= 0x2064 ) || // Cf [5] WORD JOINER..INVISIBLE PLUS\n\t\tcode === 0x2065 || // Cn \n\t\t( 0x2066 <= code && code <= 0x206F ) || // Cf [10] LEFT-TO-RIGHT ISOLATE..NOMINAL DIGIT SHAPES\n\t\tcode === 0xFEFF || // Cf ZERO WIDTH NO-BREAK SPACE\n\t\t( 0xFFF0 <= code && code <= 0xFFF8 ) || // Cn [9] ..\n\t\t( 0xFFF9 <= code && code <= 0xFFFB ) || // Cf [3] INTERLINEAR ANNOTATION ANCHOR..INTERLINEAR ANNOTATION TERMINATOR\n\t\t( 0x13430 <= code && code <= 0x13438 ) || // Cf [9] EGYPTIAN HIEROGLYPH VERTICAL JOINER..EGYPTIAN HIEROGLYPH END SEGMENT\n\t\t( 0x1BCA0 <= code && code <= 0x1BCA3 ) || // Cf [4] SHORTHAND FORMAT LETTER OVERLAP..SHORTHAND FORMAT UP STEP\n\t\t( 0x1D173 <= code && code <= 0x1D17A ) || // Cf [8] MUSICAL SYMBOL BEGIN BEAM..MUSICAL SYMBOL END PHRASE\n\t\tcode === 0xE0000 || // Cn \n\t\tcode === 0xE0001 || // Cf LANGUAGE TAG\n\t\t( 0xE0002 <= code && code <= 0xE001F ) || // Cn [30] ..\n\t\t( 0xE0080 <= code && code <= 0xE00FF ) || // Cn [128] ..\n\t\t( 0xE01F0 <= code && code <= 0xE0FFF ) // Cn [3600] ..\n\t) {\n\t\treturn constants.Control;\n\t}\n\tif (\n\t\t( 0x0300 <= code && code <= 0x036F ) || // Mn [112] COMBINING GRAVE ACCENT..COMBINING LATIN SMALL LETTER X\n\t\t( 0x0483 <= code && code <= 0x0487 ) || // Mn [5] COMBINING CYRILLIC TITLO..COMBINING CYRILLIC POKRYTIE\n\t\t( 0x0488 <= code && code <= 0x0489 ) || // Me [2] COMBINING CYRILLIC HUNDRED THOUSANDS SIGN..COMBINING CYRILLIC MILLIONS SIGN\n\t\t( 0x0591 <= code && code <= 0x05BD ) || // Mn [45] HEBREW ACCENT ETNAHTA..HEBREW POINT METEG\n\t\tcode === 0x05BF || // Mn HEBREW POINT RAFE\n\t\t( 0x05C1 <= code && code <= 0x05C2 ) || // Mn [2] HEBREW POINT SHIN DOT..HEBREW POINT SIN DOT\n\t\t( 0x05C4 <= code && code <= 0x05C5 ) || // Mn [2] HEBREW MARK UPPER DOT..HEBREW MARK LOWER DOT\n\t\tcode === 0x05C7 || // Mn HEBREW POINT QAMATS QATAN\n\t\t( 0x0610 <= code && code <= 0x061A ) || // Mn [11] ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM..ARABIC SMALL KASRA\n\t\t( 0x064B <= code && code <= 0x065F ) || // Mn [21] ARABIC FATHATAN..ARABIC WAVY HAMZA BELOW\n\t\tcode === 0x0670 || // Mn ARABIC LETTER SUPERSCRIPT ALEF\n\t\t( 0x06D6 <= code && code <= 0x06DC ) || // Mn [7] ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA..ARABIC SMALL HIGH SEEN\n\t\t( 0x06DF <= code && code <= 0x06E4 ) || // Mn [6] ARABIC SMALL HIGH ROUNDED ZERO..ARABIC SMALL HIGH MADDA\n\t\t( 0x06E7 <= code && code <= 0x06E8 ) || // Mn [2] ARABIC SMALL HIGH YEH..ARABIC SMALL HIGH NOON\n\t\t( 0x06EA <= code && code <= 0x06ED ) || // Mn [4] ARABIC EMPTY CENTRE LOW STOP..ARABIC SMALL LOW MEEM\n\t\tcode === 0x0711 || // Mn SYRIAC LETTER SUPERSCRIPT ALAPH\n\t\t( 0x0730 <= code && code <= 0x074A ) || // Mn [27] SYRIAC PTHAHA ABOVE..SYRIAC BARREKH\n\t\t( 0x07A6 <= code && code <= 0x07B0 ) || // Mn [11] THAANA ABAFILI..THAANA SUKUN\n\t\t( 0x07EB <= code && code <= 0x07F3 ) || // Mn [9] NKO COMBINING SHORT HIGH TONE..NKO COMBINING DOUBLE DOT ABOVE\n\t\tcode === 0x07FD || // Mn NKO DANTAYALAN\n\t\t( 0x0816 <= code && code <= 0x0819 ) || // Mn [4] SAMARITAN MARK IN..SAMARITAN MARK DAGESH\n\t\t( 0x081B <= code && code <= 0x0823 ) || // Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAMARITAN VOWEL SIGN A\n\t\t( 0x0825 <= code && code <= 0x0827 ) || // Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMARITAN VOWEL SIGN U\n\t\t( 0x0829 <= code && code <= 0x082D ) || // Mn [5] SAMARITAN VOWEL SIGN LONG I..SAMARITAN MARK NEQUDAA\n\t\t( 0x0859 <= code && code <= 0x085B ) || // Mn [3] MANDAIC AFFRICATION MARK..MANDAIC GEMINATION MARK\n\t\t( 0x08D3 <= code && code <= 0x08E1 ) || // Mn [15] ARABIC SMALL LOW WAW..ARABIC SMALL HIGH SIGN SAFHA\n\t\t( 0x08E3 <= code && code <= 0x0902 ) || // Mn [32] ARABIC TURNED DAMMA BELOW..DEVANAGARI SIGN ANUSVARA\n\t\tcode === 0x093A || // Mn DEVANAGARI VOWEL SIGN OE\n\t\tcode === 0x093C || // Mn DEVANAGARI SIGN NUKTA\n\t\t( 0x0941 <= code && code <= 0x0948 ) || // Mn [8] DEVANAGARI VOWEL SIGN U..DEVANAGARI VOWEL SIGN AI\n\t\tcode === 0x094D || // Mn DEVANAGARI SIGN VIRAMA\n\t\t( 0x0951 <= code && code <= 0x0957 ) || // Mn [7] DEVANAGARI STRESS SIGN UDATTA..DEVANAGARI VOWEL SIGN UUE\n\t\t( 0x0962 <= code && code <= 0x0963 ) || // Mn [2] DEVANAGARI VOWEL SIGN VOCALIC L..DEVANAGARI VOWEL SIGN VOCALIC LL\n\t\tcode === 0x0981 || // Mn BENGALI SIGN CANDRABINDU\n\t\tcode === 0x09BC || // Mn BENGALI SIGN NUKTA\n\t\tcode === 0x09BE || // Mc BENGALI VOWEL SIGN AA\n\t\t( 0x09C1 <= code && code <= 0x09C4 ) || // Mn [4] BENGALI VOWEL SIGN U..BENGALI VOWEL SIGN VOCALIC RR\n\t\tcode === 0x09CD || // Mn BENGALI SIGN VIRAMA\n\t\tcode === 0x09D7 || // Mc BENGALI AU LENGTH MARK\n\t\t( 0x09E2 <= code && code <= 0x09E3 ) || // Mn [2] BENGALI VOWEL SIGN VOCALIC L..BENGALI VOWEL SIGN VOCALIC LL\n\t\tcode === 0x09FE || // Mn BENGALI SANDHI MARK\n\t\t( 0x0A01 <= code && code <= 0x0A02 ) || // Mn [2] GURMUKHI SIGN ADAK BINDI..GURMUKHI SIGN BINDI\n\t\tcode === 0x0A3C || // Mn GURMUKHI SIGN NUKTA\n\t\t( 0x0A41 <= code && code <= 0x0A42 ) || // Mn [2] GURMUKHI VOWEL SIGN U..GURMUKHI VOWEL SIGN UU\n\t\t( 0x0A47 <= code && code <= 0x0A48 ) || // Mn [2] GURMUKHI VOWEL SIGN EE..GURMUKHI VOWEL SIGN AI\n\t\t( 0x0A4B <= code && code <= 0x0A4D ) || // Mn [3] GURMUKHI VOWEL SIGN OO..GURMUKHI SIGN VIRAMA\n\t\tcode === 0x0A51 || // Mn GURMUKHI SIGN UDAAT\n\t\t( 0x0A70 <= code && code <= 0x0A71 ) || // Mn [2] GURMUKHI TIPPI..GURMUKHI ADDAK\n\t\tcode === 0x0A75 || // Mn GURMUKHI SIGN YAKASH\n\t\t( 0x0A81 <= code && code <= 0x0A82 ) || // Mn [2] GUJARATI SIGN CANDRABINDU..GUJARATI SIGN ANUSVARA\n\t\tcode === 0x0ABC || // Mn GUJARATI SIGN NUKTA\n\t\t( 0x0AC1 <= code && code <= 0x0AC5 ) || // Mn [5] GUJARATI VOWEL SIGN U..GUJARATI VOWEL SIGN CANDRA E\n\t\t( 0x0AC7 <= code && code <= 0x0AC8 ) || // Mn [2] GUJARATI VOWEL SIGN E..GUJARATI VOWEL SIGN AI\n\t\tcode === 0x0ACD || // Mn GUJARATI SIGN VIRAMA\n\t\t( 0x0AE2 <= code && code <= 0x0AE3 ) || // Mn [2] GUJARATI VOWEL SIGN VOCALIC L..GUJARATI VOWEL SIGN VOCALIC LL\n\t\t( 0x0AFA <= code && code <= 0x0AFF ) || // Mn [6] GUJARATI SIGN SUKUN..GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE\n\t\tcode === 0x0B01 || // Mn ORIYA SIGN CANDRABINDU\n\t\tcode === 0x0B3C || // Mn ORIYA SIGN NUKTA\n\t\tcode === 0x0B3E || // Mc ORIYA VOWEL SIGN AA\n\t\tcode === 0x0B3F || // Mn ORIYA VOWEL SIGN I\n\t\t( 0x0B41 <= code && code <= 0x0B44 ) || // Mn [4] ORIYA VOWEL SIGN U..ORIYA VOWEL SIGN VOCALIC RR\n\t\tcode === 0x0B4D || // Mn ORIYA SIGN VIRAMA\n\t\t( 0x0B55 <= code && code <= 0x0B56 ) || // Mn [2] ORIYA SIGN OVERLINE..ORIYA AI LENGTH MARK\n\t\tcode === 0x0B57 || // Mc ORIYA AU LENGTH MARK\n\t\t( 0x0B62 <= code && code <= 0x0B63 ) || // Mn [2] ORIYA VOWEL SIGN VOCALIC L..ORIYA VOWEL SIGN VOCALIC LL\n\t\tcode === 0x0B82 || // Mn TAMIL SIGN ANUSVARA\n\t\tcode === 0x0BBE || // Mc TAMIL VOWEL SIGN AA\n\t\tcode === 0x0BC0 || // Mn TAMIL VOWEL SIGN II\n\t\tcode === 0x0BCD || // Mn TAMIL SIGN VIRAMA\n\t\tcode === 0x0BD7 || // Mc TAMIL AU LENGTH MARK\n\t\tcode === 0x0C00 || // Mn TELUGU SIGN COMBINING CANDRABINDU ABOVE\n\t\tcode === 0x0C04 || // Mn TELUGU SIGN COMBINING ANUSVARA ABOVE\n\t\t( 0x0C3E <= code && code <= 0x0C40 ) || // Mn [3] TELUGU VOWEL SIGN AA..TELUGU VOWEL SIGN II\n\t\t( 0x0C46 <= code && code <= 0x0C48 ) || // Mn [3] TELUGU VOWEL SIGN E..TELUGU VOWEL SIGN AI\n\t\t( 0x0C4A <= code && code <= 0x0C4D ) || // Mn [4] TELUGU VOWEL SIGN O..TELUGU SIGN VIRAMA\n\t\t( 0x0C55 <= code && code <= 0x0C56 ) || // Mn [2] TELUGU LENGTH MARK..TELUGU AI LENGTH MARK\n\t\t( 0x0C62 <= code && code <= 0x0C63 ) || // Mn [2] TELUGU VOWEL SIGN VOCALIC L..TELUGU VOWEL SIGN VOCALIC LL\n\t\tcode === 0x0C81 || // Mn KANNADA SIGN CANDRABINDU\n\t\tcode === 0x0CBC || // Mn KANNADA SIGN NUKTA\n\t\tcode === 0x0CBF || // Mn KANNADA VOWEL SIGN I\n\t\tcode === 0x0CC2 || // Mc KANNADA VOWEL SIGN UU\n\t\tcode === 0x0CC6 || // Mn KANNADA VOWEL SIGN E\n\t\t( 0x0CCC <= code && code <= 0x0CCD ) || // Mn [2] KANNADA VOWEL SIGN AU..KANNADA SIGN VIRAMA\n\t\t( 0x0CD5 <= code && code <= 0x0CD6 ) || // Mc [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK\n\t\t( 0x0CE2 <= code && code <= 0x0CE3 ) || // Mn [2] KANNADA VOWEL SIGN VOCALIC L..KANNADA VOWEL SIGN VOCALIC LL\n\t\t( 0x0D00 <= code && code <= 0x0D01 ) || // Mn [2] MALAYALAM SIGN COMBINING ANUSVARA ABOVE..MALAYALAM SIGN CANDRABINDU\n\t\t( 0x0D3B <= code && code <= 0x0D3C ) || // Mn [2] MALAYALAM SIGN VERTICAL BAR VIRAMA..MALAYALAM SIGN CIRCULAR VIRAMA\n\t\tcode === 0x0D3E || // Mc MALAYALAM VOWEL SIGN AA\n\t\t( 0x0D41 <= code && code <= 0x0D44 ) || // Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM VOWEL SIGN VOCALIC RR\n\t\tcode === 0x0D4D || // Mn MALAYALAM SIGN VIRAMA\n\t\tcode === 0x0D57 || // Mc MALAYALAM AU LENGTH MARK\n\t\t( 0x0D62 <= code && code <= 0x0D63 ) || // Mn [2] MALAYALAM VOWEL SIGN VOCALIC L..MALAYALAM VOWEL SIGN VOCALIC LL\n\t\tcode === 0x0D81 || // Mn SINHALA SIGN CANDRABINDU\n\t\tcode === 0x0DCA || // Mn SINHALA SIGN AL-LAKUNA\n\t\tcode === 0x0DCF || // Mc SINHALA VOWEL SIGN AELA-PILLA\n\t\t( 0x0DD2 <= code && code <= 0x0DD4 ) || // Mn [3] SINHALA VOWEL SIGN KETTI IS-PILLA..SINHALA VOWEL SIGN KETTI PAA-PILLA\n\t\tcode === 0x0DD6 || // Mn SINHALA VOWEL SIGN DIGA PAA-PILLA\n\t\tcode === 0x0DDF || // Mc SINHALA VOWEL SIGN GAYANUKITTA\n\t\tcode === 0x0E31 || // Mn THAI CHARACTER MAI HAN-AKAT\n\t\t( 0x0E34 <= code && code <= 0x0E3A ) || // Mn [7] THAI CHARACTER SARA I..THAI CHARACTER PHINTHU\n\t\t( 0x0E47 <= code && code <= 0x0E4E ) || // Mn [8] THAI CHARACTER MAITAIKHU..THAI CHARACTER YAMAKKAN\n\t\tcode === 0x0EB1 || // Mn LAO VOWEL SIGN MAI KAN\n\t\t( 0x0EB4 <= code && code <= 0x0EBC ) || // Mn [9] LAO VOWEL SIGN I..LAO SEMIVOWEL SIGN LO\n\t\t( 0x0EC8 <= code && code <= 0x0ECD ) || // Mn [6] LAO TONE MAI EK..LAO NIGGAHITA\n\t\t( 0x0F18 <= code && code <= 0x0F19 ) || // Mn [2] TIBETAN ASTROLOGICAL SIGN -KHYUD PA..TIBETAN ASTROLOGICAL SIGN SDONG TSHUGS\n\t\tcode === 0x0F35 || // Mn TIBETAN MARK NGAS BZUNG NYI ZLA\n\t\tcode === 0x0F37 || // Mn TIBETAN MARK NGAS BZUNG SGOR RTAGS\n\t\tcode === 0x0F39 || // Mn TIBETAN MARK TSA -PHRU\n\t\t( 0x0F71 <= code && code <= 0x0F7E ) || // Mn [14] TIBETAN VOWEL SIGN AA..TIBETAN SIGN RJES SU NGA RO\n\t\t( 0x0F80 <= code && code <= 0x0F84 ) || // Mn [5] TIBETAN VOWEL SIGN REVERSED I..TIBETAN MARK HALANTA\n\t\t( 0x0F86 <= code && code <= 0x0F87 ) || // Mn [2] TIBETAN SIGN LCI RTAGS..TIBETAN SIGN YANG RTAGS\n\t\t( 0x0F8D <= code && code <= 0x0F97 ) || // Mn [11] TIBETAN SUBJOINED SIGN LCE TSA CAN..TIBETAN SUBJOINED LETTER JA\n\t\t( 0x0F99 <= code && code <= 0x0FBC ) || // Mn [36] TIBETAN SUBJOINED LETTER NYA..TIBETAN SUBJOINED LETTER FIXED-FORM RA\n\t\tcode === 0x0FC6 || // Mn TIBETAN SYMBOL PADMA GDAN\n\t\t( 0x102D <= code && code <= 0x1030 ) || // Mn [4] MYANMAR VOWEL SIGN I..MYANMAR VOWEL SIGN UU\n\t\t( 0x1032 <= code && code <= 0x1037 ) || // Mn [6] MYANMAR VOWEL SIGN AI..MYANMAR SIGN DOT BELOW\n\t\t( 0x1039 <= code && code <= 0x103A ) || // Mn [2] MYANMAR SIGN VIRAMA..MYANMAR SIGN ASAT\n\t\t( 0x103D <= code && code <= 0x103E ) || // Mn [2] MYANMAR CONSONANT SIGN MEDIAL WA..MYANMAR CONSONANT SIGN MEDIAL HA\n\t\t( 0x1058 <= code && code <= 0x1059 ) || // Mn [2] MYANMAR VOWEL SIGN VOCALIC L..MYANMAR VOWEL SIGN VOCALIC LL\n\t\t( 0x105E <= code && code <= 0x1060 ) || // Mn [3] MYANMAR CONSONANT SIGN MON MEDIAL NA..MYANMAR CONSONANT SIGN MON MEDIAL LA\n\t\t( 0x1071 <= code && code <= 0x1074 ) || // Mn [4] MYANMAR VOWEL SIGN GEBA KAREN I..MYANMAR VOWEL SIGN KAYAH EE\n\t\tcode === 0x1082 || // Mn MYANMAR CONSONANT SIGN SHAN MEDIAL WA\n\t\t( 0x1085 <= code && code <= 0x1086 ) || // Mn [2] MYANMAR VOWEL SIGN SHAN E ABOVE..MYANMAR VOWEL SIGN SHAN FINAL Y\n\t\tcode === 0x108D || // Mn MYANMAR SIGN SHAN COUNCIL EMPHATIC TONE\n\t\tcode === 0x109D || // Mn MYANMAR VOWEL SIGN AITON AI\n\t\t( 0x135D <= code && code <= 0x135F ) || // Mn [3] ETHIOPIC COMBINING GEMINATION AND VOWEL LENGTH MARK..ETHIOPIC COMBINING GEMINATION MARK\n\t\t( 0x1712 <= code && code <= 0x1714 ) || // Mn [3] TAGALOG VOWEL SIGN I..TAGALOG SIGN VIRAMA\n\t\t( 0x1732 <= code && code <= 0x1734 ) || // Mn [3] HANUNOO VOWEL SIGN I..HANUNOO SIGN PAMUDPOD\n\t\t( 0x1752 <= code && code <= 0x1753 ) || // Mn [2] BUHID VOWEL SIGN I..BUHID VOWEL SIGN U\n\t\t( 0x1772 <= code && code <= 0x1773 ) || // Mn [2] TAGBANWA VOWEL SIGN I..TAGBANWA VOWEL SIGN U\n\t\t( 0x17B4 <= code && code <= 0x17B5 ) || // Mn [2] KHMER VOWEL INHERENT AQ..KHMER VOWEL INHERENT AA\n\t\t( 0x17B7 <= code && code <= 0x17BD ) || // Mn [7] KHMER VOWEL SIGN I..KHMER VOWEL SIGN UA\n\t\tcode === 0x17C6 || // Mn KHMER SIGN NIKAHIT\n\t\t( 0x17C9 <= code && code <= 0x17D3 ) || // Mn [11] KHMER SIGN MUUSIKATOAN..KHMER SIGN BATHAMASAT\n\t\tcode === 0x17DD || // Mn KHMER SIGN ATTHACAN\n\t\t( 0x180B <= code && code <= 0x180D ) || // Mn [3] MONGOLIAN FREE VARIATION SELECTOR ONE..MONGOLIAN FREE VARIATION SELECTOR THREE\n\t\t( 0x1885 <= code && code <= 0x1886 ) || // Mn [2] MONGOLIAN LETTER ALI GALI BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA\n\t\tcode === 0x18A9 || // Mn MONGOLIAN LETTER ALI GALI DAGALGA\n\t\t( 0x1920 <= code && code <= 0x1922 ) || // Mn [3] LIMBU VOWEL SIGN A..LIMBU VOWEL SIGN U\n\t\t( 0x1927 <= code && code <= 0x1928 ) || // Mn [2] LIMBU VOWEL SIGN E..LIMBU VOWEL SIGN O\n\t\tcode === 0x1932 || // Mn LIMBU SMALL LETTER ANUSVARA\n\t\t( 0x1939 <= code && code <= 0x193B ) || // Mn [3] LIMBU SIGN MUKPHRENG..LIMBU SIGN SA-I\n\t\t( 0x1A17 <= code && code <= 0x1A18 ) || // Mn [2] BUGINESE VOWEL SIGN I..BUGINESE VOWEL SIGN U\n\t\tcode === 0x1A1B || // Mn BUGINESE VOWEL SIGN AE\n\t\tcode === 0x1A56 || // Mn TAI THAM CONSONANT SIGN MEDIAL LA\n\t\t( 0x1A58 <= code && code <= 0x1A5E ) || // Mn [7] TAI THAM SIGN MAI KANG LAI..TAI THAM CONSONANT SIGN SA\n\t\tcode === 0x1A60 || // Mn TAI THAM SIGN SAKOT\n\t\tcode === 0x1A62 || // Mn TAI THAM VOWEL SIGN MAI SAT\n\t\t( 0x1A65 <= code && code <= 0x1A6C ) || // Mn [8] TAI THAM VOWEL SIGN I..TAI THAM VOWEL SIGN OA BELOW\n\t\t( 0x1A73 <= code && code <= 0x1A7C ) || // Mn [10] TAI THAM VOWEL SIGN OA ABOVE..TAI THAM SIGN KHUEN-LUE KARAN\n\t\tcode === 0x1A7F || // Mn TAI THAM COMBINING CRYPTOGRAMMIC DOT\n\t\t( 0x1AB0 <= code && code <= 0x1ABD ) || // Mn [14] COMBINING DOUBLED CIRCUMFLEX ACCENT..COMBINING PARENTHESES BELOW\n\t\tcode === 0x1ABE || // Me COMBINING PARENTHESES OVERLAY\n\t\t( 0x1ABF <= code && code <= 0x1AC0 ) || // Mn [2] COMBINING LATIN SMALL LETTER W BELOW..COMBINING LATIN SMALL LETTER TURNED W BELOW\n\t\t( 0x1B00 <= code && code <= 0x1B03 ) || // Mn [4] BALINESE SIGN ULU RICEM..BALINESE SIGN SURANG\n\t\tcode === 0x1B34 || // Mn BALINESE SIGN REREKAN\n\t\tcode === 0x1B35 || // Mc BALINESE VOWEL SIGN TEDUNG\n\t\t( 0x1B36 <= code && code <= 0x1B3A) || // Mn [5] BALINESE VOWEL SIGN ULU..BALINESE VOWEL SIGN RA REPA\n\t\tcode === 0x1B3C || // Mn BALINESE VOWEL SIGN LA LENGA\n\t\tcode === 0x1B42 || // Mn BALINESE VOWEL SIGN PEPET\n\t\t( 0x1B6B <= code && code <= 0x1B73 ) || // Mn [9] BALINESE MUSICAL SYMBOL COMBINING TEGEH..BALINESE MUSICAL SYMBOL COMBINING GONG\n\t\t( 0x1B80 <= code && code <= 0x1B81 ) || // Mn [2] SUNDANESE SIGN PANYECEK..SUNDANESE SIGN PANGLAYAR\n\t\t( 0x1BA2 <= code && code <= 0x1BA5 ) || // Mn [4] SUNDANESE CONSONANT SIGN PANYAKRA..SUNDANESE VOWEL SIGN PANYUKU\n\t\t( 0x1BA8 <= code && code <= 0x1BA9 ) || // Mn [2] SUNDANESE VOWEL SIGN PAMEPET..SUNDANESE VOWEL SIGN PANEULEUNG\n\t\t( 0x1BAB <= code && code <= 0x1BAD ) || // Mn [3] SUNDANESE SIGN VIRAMA..SUNDANESE CONSONANT SIGN PASANGAN WA\n\t\tcode === 0x1BE6 || // Mn BATAK SIGN TOMPI\n\t\t( 0x1BE8 <= code && code <= 0x1BE9) || // Mn [2] BATAK VOWEL SIGN PAKPAK E..BATAK VOWEL SIGN EE\n\t\tcode === 0x1BED || // Mn BATAK VOWEL SIGN KARO O\n\t\t( 0x1BEF <= code && code <= 0x1BF1 ) || // Mn [3] BATAK VOWEL SIGN U FOR SIMALUNGUN SA..BATAK CONSONANT SIGN H\n\t\t( 0x1C2C <= code && code <= 0x1C33 ) || // Mn [8] LEPCHA VOWEL SIGN E..LEPCHA CONSONANT SIGN T\n\t\t( 0x1C36 <= code && code <= 0x1C37 ) || // Mn [2] LEPCHA SIGN RAN..LEPCHA SIGN NUKTA\n\t\t( 0x1CD0 <= code && code <= 0x1CD2 ) || // Mn [3] VEDIC TONE KARSHANA..VEDIC TONE PRENKHA\n\t\t( 0x1CD4 <= code && code <= 0x1CE0 ) || // Mn [13] VEDIC SIGN YAJURVEDIC MIDLINE SVARITA..VEDIC TONE RIGVEDIC KASHMIRI INDEPENDENT SVARITA\n\t\t( 0x1CE2 <= code && code <= 0x1CE8 ) || // Mn [7] VEDIC SIGN VISARGA SVARITA..VEDIC SIGN VISARGA ANUDATTA WITH TAIL\n\t\tcode === 0x1CED || // Mn VEDIC SIGN TIRYAK\n\t\tcode === 0x1CF4 || // Mn VEDIC TONE CANDRA ABOVE\n\t\t( 0x1CF8 <= code && code <= 0x1CF9 ) || // Mn [2] VEDIC TONE RING ABOVE..VEDIC TONE DOUBLE RING ABOVE\n\t\t( 0x1DC0 <= code && code <= 0x1DF9 ) || // Mn [58] COMBINING DOTTED GRAVE ACCENT..COMBINING WIDE INVERTED BRIDGE BELOW\n\t\t( 0x1DFB <= code && code <= 0x1DFF ) || // Mn [5] COMBINING DELETION MARK..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW\n\t\tcode === 0x200C || // Cf ZERO WIDTH NON-JOINER\n\t\t( 0x20D0 <= code && code <= 0x20DC ) || // Mn [13] COMBINING LEFT HARPOON ABOVE..COMBINING FOUR DOTS ABOVE\n\t\t( 0x20DD <= code && code <= 0x20E0 ) || // Me [4] COMBINING ENCLOSING CIRCLE..COMBINING ENCLOSING CIRCLE BACKSLASH\n\t\tcode === 0x20E1 || // Mn COMBINING LEFT RIGHT ARROW ABOVE\n\t\t( 0x20E2 <= code && code <= 0x20E4 ) || // Me [3] COMBINING ENCLOSING SCREEN..COMBINING ENCLOSING UPWARD POINTING TRIANGLE\n\t\t( 0x20E5 <= code && code <= 0x20F0 ) || // Mn [12] COMBINING REVERSE SOLIDUS OVERLAY..COMBINING ASTERISK ABOVE\n\t\t( 0x2CEF <= code && code <= 0x2CF1 ) || // Mn [3] COPTIC COMBINING NI ABOVE..COPTIC COMBINING SPIRITUS LENIS\n\t\tcode === 0x2D7F || // Mn TIFINAGH CONSONANT JOINER\n\t\t( 0x2DE0 <= code && code <= 0x2DFF ) || // Mn [32] COMBINING CYRILLIC LETTER BE..COMBINING CYRILLIC LETTER IOTIFIED BIG YUS\n\t\t( 0x302A <= code && code <= 0x302D ) || // Mn [4] IDEOGRAPHIC LEVEL TONE MARK..IDEOGRAPHIC ENTERING TONE MARK\n\t\t( 0x302E <= code && code <= 0x302F ) || // Mc [2] HANGUL SINGLE DOT TONE MARK..HANGUL DOUBLE DOT TONE MARK\n\t\t( 0x3099 <= code && code <= 0x309A ) || // Mn [2] COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK..COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK\n\t\tcode === 0xA66F || // Mn COMBINING CYRILLIC VZMET\n\t\t( 0xA670 <= code && code <= 0xA672 ) || // Me [3] COMBINING CYRILLIC TEN MILLIONS SIGN..COMBINING CYRILLIC THOUSAND MILLIONS SIGN\n\t\t( 0xA674 <= code && code <= 0xA67D ) || // Mn [10] COMBINING CYRILLIC LETTER UKRAINIAN IE..COMBINING CYRILLIC PAYEROK\n\t\t( 0xA69E <= code && code <= 0xA69F ) || // Mn [2] COMBINING CYRILLIC LETTER EF..COMBINING CYRILLIC LETTER IOTIFIED E\n\t\t( 0xA6F0 <= code && code <= 0xA6F1 ) || // Mn [2] BAMUM COMBINING MARK KOQNDON..BAMUM COMBINING MARK TUKWENTIS\n\t\tcode === 0xA802 || // Mn SYLOTI NAGRI SIGN DVISVARA\n\t\tcode === 0xA806 || // Mn SYLOTI NAGRI SIGN HASANTA\n\t\tcode === 0xA80B || // Mn SYLOTI NAGRI SIGN ANUSVARA\n\t\t( 0xA825 <= code && code <= 0xA826 ) || // Mn [2] SYLOTI NAGRI VOWEL SIGN U..SYLOTI NAGRI VOWEL SIGN E\n\t\tcode === 0xA82C || // Mn SYLOTI NAGRI SIGN ALTERNATE HASANTA\n\t\t( 0xA8C4 <= code && code <= 0xA8C5 ) || // Mn [2] SAURASHTRA SIGN VIRAMA..SAURASHTRA SIGN CANDRABINDU\n\t\t( 0xA8E0 <= code && code <= 0xA8F1 ) || // Mn [18] COMBINING DEVANAGARI DIGIT ZERO..COMBINING DEVANAGARI SIGN AVAGRAHA\n\t\tcode === 0xA8FF || // Mn DEVANAGARI VOWEL SIGN AY\n\t\t( 0xA926 <= code && code <= 0xA92D ) || // Mn [8] KAYAH LI VOWEL UE..KAYAH LI TONE CALYA PLOPHU\n\t\t( 0xA947 <= code && code <= 0xA951 ) || // Mn [11] REJANG VOWEL SIGN I..REJANG CONSONANT SIGN R\n\t\t( 0xA980 <= code && code <= 0xA982 ) || // Mn [3] JAVANESE SIGN PANYANGGA..JAVANESE SIGN LAYAR\n\t\tcode === 0xA9B3 || // Mn JAVANESE SIGN CECAK TELU\n\t\t( 0xA9B6 <= code && code <= 0xA9B9 ) || // Mn [4] JAVANESE VOWEL SIGN WULU..JAVANESE VOWEL SIGN SUKU MENDUT\n\t\t( 0xA9BC <= code && code <= 0xA9BD ) || // Mn [2] JAVANESE VOWEL SIGN PEPET..JAVANESE CONSONANT SIGN KERET\n\t\tcode === 0xA9E5 || // Mn MYANMAR SIGN SHAN SAW\n\t\t( 0xAA29 <= code && code <= 0xAA2E ) || // Mn [6] CHAM VOWEL SIGN AA..CHAM VOWEL SIGN OE\n\t\t( 0xAA31 <= code && code <= 0xAA32 ) || // Mn [2] CHAM VOWEL SIGN AU..CHAM VOWEL SIGN UE\n\t\t( 0xAA35 <= code && code <= 0xAA36 ) || // Mn [2] CHAM CONSONANT SIGN LA..CHAM CONSONANT SIGN WA\n\t\tcode === 0xAA43 || // Mn CHAM CONSONANT SIGN FINAL NG\n\t\tcode === 0xAA4C || // Mn CHAM CONSONANT SIGN FINAL M\n\t\tcode === 0xAA7C || // Mn MYANMAR SIGN TAI LAING TONE-2\n\t\tcode === 0xAAB0 || // Mn TAI VIET MAI KANG\n\t\t( 0xAAB2 <= code && code <= 0xAAB4 ) || // Mn [3] TAI VIET VOWEL I..TAI VIET VOWEL U\n\t\t( 0xAAB7 <= code && code <= 0xAAB8 ) || // Mn [2] TAI VIET MAI KHIT..TAI VIET VOWEL IA\n\t\t( 0xAABE <= code && code <= 0xAABF ) || // Mn [2] TAI VIET VOWEL AM..TAI VIET TONE MAI EK\n\t\tcode === 0xAAC1 || // Mn TAI VIET TONE MAI THO\n\t\t( 0xAAEC <= code && code <= 0xAAED ) || // Mn [2] MEETEI MAYEK VOWEL SIGN UU..MEETEI MAYEK VOWEL SIGN AAI\n\t\tcode === 0xAAF6 || // Mn MEETEI MAYEK VIRAMA\n\t\tcode === 0xABE5 || // Mn MEETEI MAYEK VOWEL SIGN ANAP\n\t\tcode === 0xABE8 || // Mn MEETEI MAYEK VOWEL SIGN UNAP\n\t\tcode === 0xABED || // Mn MEETEI MAYEK APUN IYEK\n\t\tcode === 0xFB1E || // Mn HEBREW POINT JUDEO-SPANISH VARIKA\n\t\t( 0xFE00 <= code && code <= 0xFE0F ) || // Mn [16] VARIATION SELECTOR-1..VARIATION SELECTOR-16\n\t\t( 0xFE20 <= code && code <= 0xFE2F ) || // Mn [16] COMBINING LIGATURE LEFT HALF..COMBINING CYRILLIC TITLO RIGHT HALF\n\t\t( 0xFF9E <= code && code <= 0xFF9F ) || // Lm [2] HALFWIDTH KATAKANA VOICED SOUND MARK..HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK\n\t\tcode === 0x101FD || // Mn PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE\n\t\tcode === 0x102E0 || // Mn COPTIC EPACT THOUSANDS MARK\n\t\t( 0x10376 <= code && code <= 0x1037A ) || // Mn [5] COMBINING OLD PERMIC LETTER AN..COMBINING OLD PERMIC LETTER SII\n\t\t( 0x10A01 <= code && code <= 0x10A03 ) || // Mn [3] KHAROSHTHI VOWEL SIGN I..KHAROSHTHI VOWEL SIGN VOCALIC R\n\t\t( 0x10A05 <= code && code <= 0x10A06 ) || // Mn [2] KHAROSHTHI VOWEL SIGN E..KHAROSHTHI VOWEL SIGN O\n\t\t( 0x10A0C <= code && code <= 0x10A0F ) || // Mn [4] KHAROSHTHI VOWEL LENGTH MARK..KHAROSHTHI SIGN VISARGA\n\t\t( 0x10A38 <= code && code <= 0x10A3A ) || // Mn [3] KHAROSHTHI SIGN BAR ABOVE..KHAROSHTHI SIGN DOT BELOW\n\t\tcode === 0x10A3F || // Mn KHAROSHTHI VIRAMA\n\t\t( 0x10AE5 <= code && code <= 0x10AE6 ) || // Mn [2] MANICHAEAN ABBREVIATION MARK ABOVE..MANICHAEAN ABBREVIATION MARK BELOW\n\t\t( 0x10D24 <= code && code <= 0x10D27 ) || // Mn [4] HANIFI ROHINGYA SIGN HARBAHAY..HANIFI ROHINGYA SIGN TASSI\n\t\t( 0x10EAB <= code && code <= 0x10EAC ) || // Mn [2] YEZIDI COMBINING HAMZA MARK..YEZIDI COMBINING MADDA MARK\n\t\t( 0x10F46 <= code && code <= 0x10F50 ) || // Mn [11] SOGDIAN COMBINING DOT BELOW..SOGDIAN COMBINING STROKE BELOW\n\t\tcode === 0x11001 || // Mn BRAHMI SIGN ANUSVARA\n\t\t( 0x11038 <= code && code <= 0x11046 ) || // Mn [15] BRAHMI VOWEL SIGN AA..BRAHMI VIRAMA\n\t\t( 0x1107F <= code && code <= 0x11081 ) || // Mn [3] BRAHMI NUMBER JOINER..KAITHI SIGN ANUSVARA\n\t\t( 0x110B3 <= code && code <= 0x110B6 ) || // Mn [4] KAITHI VOWEL SIGN U..KAITHI VOWEL SIGN AI\n\t\t( 0x110B9 <= code && code <= 0x110BA ) || // Mn [2] KAITHI SIGN VIRAMA..KAITHI SIGN NUKTA\n\t\t( 0x11100 <= code && code <= 0x11102 ) || // Mn [3] CHAKMA SIGN CANDRABINDU..CHAKMA SIGN VISARGA\n\t\t( 0x11127 <= code && code <= 0x1112B ) || // Mn [5] CHAKMA VOWEL SIGN A..CHAKMA VOWEL SIGN UU\n\t\t( 0x1112D <= code && code <= 0x11134 ) || // Mn [8] CHAKMA VOWEL SIGN AI..CHAKMA MAAYYAA\n\t\tcode === 0x11173 || // Mn MAHAJANI SIGN NUKTA\n\t\t( 0x11180 <= code && code <= 0x11181 ) || // Mn [2] SHARADA SIGN CANDRABINDU..SHARADA SIGN ANUSVARA\n\t\t( 0x111B6 <= code && code <= 0x111BE ) || // Mn [9] SHARADA VOWEL SIGN U..SHARADA VOWEL SIGN O\n\t\t( 0x111C9 <= code && code <= 0x111CC ) || // Mn [4] SHARADA SANDHI MARK..SHARADA EXTRA SHORT VOWEL MARK\n\t\tcode === 0x111CF || // Mn SHARADA SIGN INVERTED CANDRABINDU\n\t\t( 0x1122F <= code && code <= 0x11231 ) || // Mn [3] KHOJKI VOWEL SIGN U..KHOJKI VOWEL SIGN AI\n\t\tcode === 0x11234 || // Mn KHOJKI SIGN ANUSVARA\n\t\t( 0x11236 <= code && code <= 0x11237 ) || // Mn [2] KHOJKI SIGN NUKTA..KHOJKI SIGN SHADDA\n\t\tcode === 0x1123E || // Mn KHOJKI SIGN SUKUN\n\t\tcode === 0x112DF || // Mn KHUDAWADI SIGN ANUSVARA\n\t\t( 0x112E3 <= code && code <= 0x112EA ) || // Mn [8] KHUDAWADI VOWEL SIGN U..KHUDAWADI SIGN VIRAMA\n\t\t( 0x11300 <= code && code <= 0x11301 ) || // Mn [2] GRANTHA SIGN COMBINING ANUSVARA ABOVE..GRANTHA SIGN CANDRABINDU\n\t\t( 0x1133B <= code && code <= 0x1133C ) || // Mn [2] COMBINING BINDU BELOW..GRANTHA SIGN NUKTA\n\t\tcode === 0x1133E || // Mc GRANTHA VOWEL SIGN AA\n\t\tcode === 0x11340 || // Mn GRANTHA VOWEL SIGN II\n\t\tcode === 0x11357 || // Mc GRANTHA AU LENGTH MARK\n\t\t( 0x11366 <= code && code <= 0x1136C ) || // Mn [7] COMBINING GRANTHA DIGIT ZERO..COMBINING GRANTHA DIGIT SIX\n\t\t( 0x11370 <= code && code <= 0x11374 ) || // Mn [5] COMBINING GRANTHA LETTER A..COMBINING GRANTHA LETTER PA\n\t\t( 0x11438 <= code && code <= 0x1143F ) || // Mn [8] NEWA VOWEL SIGN U..NEWA VOWEL SIGN AI\n\t\t( 0x11442 <= code && code <= 0x11444 ) || // Mn [3] NEWA SIGN VIRAMA..NEWA SIGN ANUSVARA\n\t\tcode === 0x11446 || // Mn NEWA SIGN NUKTA\n\t\tcode === 0x1145E || // Mn NEWA SANDHI MARK\n\t\tcode === 0x114B0 || // Mc TIRHUTA VOWEL SIGN AA\n\t\t( 0x114B3 <= code && code <= 0x114B8 ) || // Mn [6] TIRHUTA VOWEL SIGN U..TIRHUTA VOWEL SIGN VOCALIC LL\n\t\tcode === 0x114BA || // Mn TIRHUTA VOWEL SIGN SHORT E\n\t\tcode === 0x114BD || // Mc TIRHUTA VOWEL SIGN SHORT O\n\t\t( 0x114BF <= code && code <= 0x114C0 ) || // Mn [2] TIRHUTA SIGN CANDRABINDU..TIRHUTA SIGN ANUSVARA\n\t\t( 0x114C2 <= code && code <= 0x114C3 ) || // Mn [2] TIRHUTA SIGN VIRAMA..TIRHUTA SIGN NUKTA\n\t\tcode === 0x115AF || // Mc SIDDHAM VOWEL SIGN AA\n\t\t( 0x115B2 <= code && code <= 0x115B5 ) || // Mn [4] SIDDHAM VOWEL SIGN U..SIDDHAM VOWEL SIGN VOCALIC RR\n\t\t( 0x115BC <= code && code <= 0x115BD ) || // Mn [2] SIDDHAM SIGN CANDRABINDU..SIDDHAM SIGN ANUSVARA\n\t\t( 0x115BF <= code && code <= 0x115C0 ) || // Mn [2] SIDDHAM SIGN VIRAMA..SIDDHAM SIGN NUKTA\n\t\t( 0x115DC <= code && code <= 0x115DD ) || // Mn [2] SIDDHAM VOWEL SIGN ALTERNATE U..SIDDHAM VOWEL SIGN ALTERNATE UU\n\t\t( 0x11633 <= code && code <= 0x1163A ) || // Mn [8] MODI VOWEL SIGN U..MODI VOWEL SIGN AI\n\t\tcode === 0x1163D || // Mn MODI SIGN ANUSVARA\n\t\t( 0x1163F <= code && code <= 0x11640 ) || // Mn [2] MODI SIGN VIRAMA..MODI SIGN ARDHACANDRA\n\t\tcode === 0x116AB || // Mn TAKRI SIGN ANUSVARA\n\t\tcode === 0x116AD || // Mn TAKRI VOWEL SIGN AA\n\t\t( 0x116B0 <= code && code <= 0x116B5 ) || // Mn [6] TAKRI VOWEL SIGN U..TAKRI VOWEL SIGN AU\n\t\tcode === 0x116B7 || // Mn TAKRI SIGN NUKTA\n\t\t( 0x1171D <= code && code <= 0x1171F ) || // Mn [3] AHOM CONSONANT SIGN MEDIAL LA..AHOM CONSONANT SIGN MEDIAL LIGATING RA\n\t\t( 0x11722 <= code && code <= 0x11725 ) || // Mn [4] AHOM VOWEL SIGN I..AHOM VOWEL SIGN UU\n\t\t( 0x11727 <= code && code <= 0x1172B ) || // Mn [5] AHOM VOWEL SIGN AW..AHOM SIGN KILLER\n\t\t( 0x1182F <= code && code <= 0x11837 ) || // Mn [9] DOGRA VOWEL SIGN U..DOGRA SIGN ANUSVARA\n\t\t( 0x11839 <= code && code <= 0x1183A ) || // Mn [2] DOGRA SIGN VIRAMA..DOGRA SIGN NUKTA\n\t\tcode === 0x11930 || // Mc DIVES AKURU VOWEL SIGN AA\n\t\t( 0x1193B <= code && code <= 0x1193C ) || // Mn [2] DIVES AKURU SIGN ANUSVARA..DIVES AKURU SIGN CANDRABINDU\n\t\tcode === 0x1193E || // Mn DIVES AKURU VIRAMA\n\t\tcode === 0x11943 || // Mn DIVES AKURU SIGN NUKTA\n\t\t( 0x119D4 <= code && code <= 0x119D7 ) || // Mn [4] NANDINAGARI VOWEL SIGN U..NANDINAGARI VOWEL SIGN VOCALIC RR\n\t\t( 0x119DA <= code && code <= 0x119DB ) || // Mn [2] NANDINAGARI VOWEL SIGN E..NANDINAGARI VOWEL SIGN AI\n\t\tcode === 0x119E0 || // Mn NANDINAGARI SIGN VIRAMA\n\t\t( 0x11A01 <= code && code <= 0x11A0A ) || // Mn [10] ZANABAZAR SQUARE VOWEL SIGN I..ZANABAZAR SQUARE VOWEL LENGTH MARK\n\t\t( 0x11A33 <= code && code <= 0x11A38 ) || // Mn [6] ZANABAZAR SQUARE FINAL CONSONANT MARK..ZANABAZAR SQUARE SIGN ANUSVARA\n\t\t( 0x11A3B <= code && code <= 0x11A3E ) || // Mn [4] ZANABAZAR SQUARE CLUSTER-FINAL LETTER YA..ZANABAZAR SQUARE CLUSTER-FINAL LETTER VA\n\t\tcode === 0x11A47 || // Mn ZANABAZAR SQUARE SUBJOINER\n\t\t( 0x11A51 <= code && code <= 0x11A56 ) || // Mn [6] SOYOMBO VOWEL SIGN I..SOYOMBO VOWEL SIGN OE\n\t\t( 0x11A59 <= code && code <= 0x11A5B ) || // Mn [3] SOYOMBO VOWEL SIGN VOCALIC R..SOYOMBO VOWEL LENGTH MARK\n\t\t( 0x11A8A <= code && code <= 0x11A96 ) || // Mn [13] SOYOMBO FINAL CONSONANT SIGN G..SOYOMBO SIGN ANUSVARA\n\t\t( 0x11A98 <= code && code <= 0x11A99 ) || // Mn [2] SOYOMBO GEMINATION MARK..SOYOMBO SUBJOINER\n\t\t( 0x11C30 <= code && code <= 0x11C36 ) || // Mn [7] BHAIKSUKI VOWEL SIGN I..BHAIKSUKI VOWEL SIGN VOCALIC L\n\t\t( 0x11C38 <= code && code <= 0x11C3D ) || // Mn [6] BHAIKSUKI VOWEL SIGN E..BHAIKSUKI SIGN ANUSVARA\n\t\tcode === 0x11C3F || // Mn BHAIKSUKI SIGN VIRAMA\n\t\t( 0x11C92 <= code && code <= 0x11CA7 ) || // Mn [22] MARCHEN SUBJOINED LETTER KA..MARCHEN SUBJOINED LETTER ZA\n\t\t( 0x11CAA <= code && code <= 0x11CB0 ) || // Mn [7] MARCHEN SUBJOINED LETTER RA..MARCHEN VOWEL SIGN AA\n\t\t( 0x11CB2 <= code && code <= 0x11CB3 ) || // Mn [2] MARCHEN VOWEL SIGN U..MARCHEN VOWEL SIGN E\n\t\t( 0x11CB5 <= code && code <= 0x11CB6 ) || // Mn [2] MARCHEN SIGN ANUSVARA..MARCHEN SIGN CANDRABINDU\n\t\t( 0x11D31 <= code && code <= 0x11D36 ) || // Mn [6] MASARAM GONDI VOWEL SIGN AA..MASARAM GONDI VOWEL SIGN VOCALIC R\n\t\tcode === 0x11D3A || // Mn MASARAM GONDI VOWEL SIGN E\n\t\t( 0x11D3C <= code && code <= 0x11D3D ) || // Mn [2] MASARAM GONDI VOWEL SIGN AI..MASARAM GONDI VOWEL SIGN O\n\t\t( 0x11D3F <= code && code <= 0x11D45 ) || // Mn [7] MASARAM GONDI VOWEL SIGN AU..MASARAM GONDI VIRAMA\n\t\tcode === 0x11D47 || // Mn MASARAM GONDI RA-KARA\n\t\t( 0x11D90 <= code && code <= 0x11D91 ) || // Mn [2] GUNJALA GONDI VOWEL SIGN EE..GUNJALA GONDI VOWEL SIGN AI\n\t\tcode === 0x11D95 || // Mn GUNJALA GONDI SIGN ANUSVARA\n\t\tcode === 0x11D97 || // Mn GUNJALA GONDI VIRAMA\n\t\t( 0x11EF3 <= code && code <= 0x11EF4 ) || // Mn [2] MAKASAR VOWEL SIGN I..MAKASAR VOWEL SIGN U\n\t\t( 0x16AF0 <= code && code <= 0x16AF4 ) || // Mn [5] BASSA VAH COMBINING HIGH TONE..BASSA VAH COMBINING HIGH-LOW TONE\n\t\t( 0x16B30 <= code && code <= 0x16B36 ) || // Mn [7] PAHAWH HMONG MARK CIM TUB..PAHAWH HMONG MARK CIM TAUM\n\t\tcode === 0x16F4F || // Mn MIAO SIGN CONSONANT MODIFIER BAR\n\t\t( 0x16F8F <= code && code <= 0x16F92 ) || // Mn [4] MIAO TONE RIGHT..MIAO TONE BELOW\n\t\tcode === 0x16FE4 || // Mn KHITAN SMALL SCRIPT FILLER\n\t\t( 0x1BC9D <= code && code <= 0x1BC9E ) || // Mn [2] DUPLOYAN THICK LETTER SELECTOR..DUPLOYAN DOUBLE MARK\n\t\tcode === 0x1D165 || // Mc MUSICAL SYMBOL COMBINING STEM\n\t\t( 0x1D167 <= code && code <= 0x1D169 ) || // Mn [3] MUSICAL SYMBOL COMBINING TREMOLO-1..MUSICAL SYMBOL COMBINING TREMOLO-3\n\t\t( 0x1D16E <= code && code <= 0x1D172 ) || // Mc [5] MUSICAL SYMBOL COMBINING FLAG-1..MUSICAL SYMBOL COMBINING FLAG-5\n\t\t( 0x1D17B <= code && code <= 0x1D182 ) || // Mn [8] MUSICAL SYMBOL COMBINING ACCENT..MUSICAL SYMBOL COMBINING LOURE\n\t\t( 0x1D185 <= code && code <= 0x1D18B ) || // Mn [7] MUSICAL SYMBOL COMBINING DOIT..MUSICAL SYMBOL COMBINING TRIPLE TONGUE\n\t\t( 0x1D1AA <= code && code <= 0x1D1AD ) || // Mn [4] MUSICAL SYMBOL COMBINING DOWN BOW..MUSICAL SYMBOL COMBINING SNAP PIZZICATO\n\t\t( 0x1D242 <= code && code <= 0x1D244 ) || // Mn [3] COMBINING GREEK MUSICAL TRISEME..COMBINING GREEK MUSICAL PENTASEME\n\t\t( 0x1DA00 <= code && code <= 0x1DA36 ) || // Mn [55] SIGNWRITING HEAD RIM..SIGNWRITING AIR SUCKING IN\n\t\t( 0x1DA3B <= code && code <= 0x1DA6C ) || // Mn [50] SIGNWRITING MOUTH CLOSED NEUTRAL..SIGNWRITING EXCITEMENT\n\t\tcode === 0x1DA75 || // Mn SIGNWRITING UPPER BODY TILTING FROM HIP JOINTS\n\t\tcode === 0x1DA84 || // Mn SIGNWRITING LOCATION HEAD NECK\n\t\t( 0x1DA9B <= code && code <= 0x1DA9F ) || // Mn [5] SIGNWRITING FILL MODIFIER-2..SIGNWRITING FILL MODIFIER-6\n\t\t( 0x1DAA1 <= code && code <= 0x1DAAF ) || // Mn [15] SIGNWRITING ROTATION MODIFIER-2..SIGNWRITING ROTATION MODIFIER-16\n\t\t( 0x1E000 <= code && code <= 0x1E006 ) || // Mn [7] COMBINING GLAGOLITIC LETTER AZU..COMBINING GLAGOLITIC LETTER ZHIVETE\n\t\t( 0x1E008 <= code && code <= 0x1E018 ) || // Mn [17] COMBINING GLAGOLITIC LETTER ZEMLJA..COMBINING GLAGOLITIC LETTER HERU\n\t\t( 0x1E01B <= code && code <= 0x1E021 ) || // Mn [7] COMBINING GLAGOLITIC LETTER SHTA..COMBINING GLAGOLITIC LETTER YATI\n\t\t( 0x1E023 <= code && code <= 0x1E024 ) || // Mn [2] COMBINING GLAGOLITIC LETTER YU..COMBINING GLAGOLITIC LETTER SMALL YUS\n\t\t( 0x1E026 <= code && code <= 0x1E02A ) || // Mn [5] COMBINING GLAGOLITIC LETTER YO..COMBINING GLAGOLITIC LETTER FITA\n\t\t( 0x1E130 <= code && code <= 0x1E136 ) || // Mn [7] NYIAKENG PUACHUE HMONG TONE-B..NYIAKENG PUACHUE HMONG TONE-D\n\t\t( 0x1E2EC <= code && code <= 0x1E2EF ) || // Mn [4] WANCHO TONE TUP..WANCHO TONE KOINI\n\t\t( 0x1E8D0 <= code && code <= 0x1E8D6 ) || // Mn [7] MENDE KIKAKUI COMBINING NUMBER TEENS..MENDE KIKAKUI COMBINING NUMBER MILLIONS\n\t\t( 0x1E944 <= code && code <= 0x1E94A ) || // Mn [7] ADLAM ALIF LENGTHENER..ADLAM NUKTA\n\t\t( 0x1F3FB <= code && code <= 0x1F3FF ) || // Sk [5] EMOJI MODIFIER FITZPATRICK TYPE-1-2..EMOJI MODIFIER FITZPATRICK TYPE-6\n\t\t( 0xE0020 <= code && code <= 0xE007F ) || // Cf [96] TAG SPACE..CANCEL TAG\n\t\t( 0xE0100 <= code && code <= 0xE01EF ) // Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-256\n\t) {\n\t\treturn constants.Extend;\n\t}\n\tif (\n\t\t( 0x1F1E6 <= code && code <= 0x1F1FF ) // So [26] REGIONAL INDICATOR SYMBOL LETTER A..REGIONAL INDICATOR SYMBOL LETTER Z\n\t) {\n\t\treturn constants.RegionalIndicator;\n\t}\n\tif (\n\t\tcode === 0x0903 || // Mc DEVANAGARI SIGN VISARGA\n\t\tcode === 0x093B || // Mc DEVANAGARI VOWEL SIGN OOE\n\t\t( 0x093E <= code && code <= 0x0940 ) || // Mc [3] DEVANAGARI VOWEL SIGN AA..DEVANAGARI VOWEL SIGN II\n\t\t( 0x0949 <= code && code <= 0x094C ) || // Mc [4] DEVANAGARI VOWEL SIGN CANDRA O..DEVANAGARI VOWEL SIGN AU\n\t\t( 0x094E <= code && code <= 0x094F ) || // Mc [2] DEVANAGARI VOWEL SIGN PRISHTHAMATRA E..DEVANAGARI VOWEL SIGN AW\n\t\t( 0x0982 <= code && code <= 0x0983 ) || // Mc [2] BENGALI SIGN ANUSVARA..BENGALI SIGN VISARGA\n\t\t( 0x09BF <= code && code <= 0x09C0 ) || // Mc [2] BENGALI VOWEL SIGN I..BENGALI VOWEL SIGN II\n\t\t( 0x09C7 <= code && code <= 0x09C8 ) || // Mc [2] BENGALI VOWEL SIGN E..BENGALI VOWEL SIGN AI\n\t\t( 0x09CB <= code && code <= 0x09CC ) || // Mc [2] BENGALI VOWEL SIGN O..BENGALI VOWEL SIGN AU\n\t\tcode === 0x0A03 || // Mc GURMUKHI SIGN VISARGA\n\t\t( 0x0A3E <= code && code <= 0x0A40 ) || // Mc [3] GURMUKHI VOWEL SIGN AA..GURMUKHI VOWEL SIGN II\n\t\tcode === 0x0A83 || // Mc GUJARATI SIGN VISARGA\n\t\t( 0x0ABE <= code && code <= 0x0AC0 ) || // Mc [3] GUJARATI VOWEL SIGN AA..GUJARATI VOWEL SIGN II\n\t\tcode === 0x0AC9 || // Mc GUJARATI VOWEL SIGN CANDRA O\n\t\t( 0x0ACB <= code && code <= 0x0ACC ) || // Mc [2] GUJARATI VOWEL SIGN O..GUJARATI VOWEL SIGN AU\n\t\t( 0x0B02 <= code && code <= 0x0B03 ) || // Mc [2] ORIYA SIGN ANUSVARA..ORIYA SIGN VISARGA\n\t\tcode === 0x0B40 || // Mc ORIYA VOWEL SIGN II\n\t\t( 0x0B47 <= code && code <= 0x0B48 ) || // Mc [2] ORIYA VOWEL SIGN E..ORIYA VOWEL SIGN AI\n\t\t( 0x0B4B <= code && code <= 0x0B4C ) || // Mc [2] ORIYA VOWEL SIGN O..ORIYA VOWEL SIGN AU\n\t\tcode === 0x0BBF || // Mc TAMIL VOWEL SIGN I\n\t\t( 0x0BC1 <= code && code <= 0x0BC2 ) || // Mc [2] TAMIL VOWEL SIGN U..TAMIL VOWEL SIGN UU\n\t\t( 0x0BC6 <= code && code <= 0x0BC8 ) || // Mc [3] TAMIL VOWEL SIGN E..TAMIL VOWEL SIGN AI\n\t\t( 0x0BCA <= code && code <= 0x0BCC ) || // Mc [3] TAMIL VOWEL SIGN O..TAMIL VOWEL SIGN AU\n\t\t( 0x0C01 <= code && code <= 0x0C03 ) || // Mc [3] TELUGU SIGN CANDRABINDU..TELUGU SIGN VISARGA\n\t\t( 0x0C41 <= code && code <= 0x0C44 ) || // Mc [4] TELUGU VOWEL SIGN U..TELUGU VOWEL SIGN VOCALIC RR\n\t\t( 0x0C82 <= code && code <= 0x0C83 ) || // Mc [2] KANNADA SIGN ANUSVARA..KANNADA SIGN VISARGA\n\t\tcode === 0x0CBE || // Mc KANNADA VOWEL SIGN AA\n\t\t( 0x0CC0 <= code && code <= 0x0CC1 ) || // Mc [2] KANNADA VOWEL SIGN II..KANNADA VOWEL SIGN U\n\t\t( 0x0CC3 <= code && code <= 0x0CC4 ) || // Mc [2] KANNADA VOWEL SIGN VOCALIC R..KANNADA VOWEL SIGN VOCALIC RR\n\t\t( 0x0CC7 <= code && code <= 0x0CC8 ) || // Mc [2] KANNADA VOWEL SIGN EE..KANNADA VOWEL SIGN AI\n\t\t( 0x0CCA <= code && code <= 0x0CCB ) || // Mc [2] KANNADA VOWEL SIGN O..KANNADA VOWEL SIGN OO\n\t\t( 0x0D02 <= code && code <= 0x0D03 ) || // Mc [2] MALAYALAM SIGN ANUSVARA..MALAYALAM SIGN VISARGA\n\t\t( 0x0D3F <= code && code <= 0x0D40 ) || // Mc [2] MALAYALAM VOWEL SIGN I..MALAYALAM VOWEL SIGN II\n\t\t( 0x0D46 <= code && code <= 0x0D48 ) || // Mc [3] MALAYALAM VOWEL SIGN E..MALAYALAM VOWEL SIGN AI\n\t\t( 0x0D4A <= code && code <= 0x0D4C ) || // Mc [3] MALAYALAM VOWEL SIGN O..MALAYALAM VOWEL SIGN AU\n\t\t( 0x0D82 <= code && code <= 0x0D83 ) || // Mc [2] SINHALA SIGN ANUSVARAYA..SINHALA SIGN VISARGAYA\n\t\t( 0x0DD0 <= code && code <= 0x0DD1 ) || // Mc [2] SINHALA VOWEL SIGN KETTI AEDA-PILLA..SINHALA VOWEL SIGN DIGA AEDA-PILLA\n\t\t( 0x0DD8 <= code && code <= 0x0DDE ) || // Mc [7] SINHALA VOWEL SIGN GAETTA-PILLA..SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA\n\t\t( 0x0DF2 <= code && code <= 0x0DF3 ) || // Mc [2] SINHALA VOWEL SIGN DIGA GAETTA-PILLA..SINHALA VOWEL SIGN DIGA GAYANUKITTA\n\t\tcode === 0x0E33 || // Lo THAI CHARACTER SARA AM\n\t\tcode === 0x0EB3 || // Lo LAO VOWEL SIGN AM\n\t\t( 0x0F3E <= code && code <= 0x0F3F ) || // Mc [2] TIBETAN SIGN YAR TSHES..TIBETAN SIGN MAR TSHES\n\t\tcode === 0x0F7F || // Mc TIBETAN SIGN RNAM BCAD\n\t\tcode === 0x1031 || // Mc MYANMAR VOWEL SIGN E\n\t\t( 0x103B <= code && code <= 0x103C ) || // Mc [2] MYANMAR CONSONANT SIGN MEDIAL YA..MYANMAR CONSONANT SIGN MEDIAL RA\n\t\t( 0x1056 <= code && code <= 0x1057 ) || // Mc [2] MYANMAR VOWEL SIGN VOCALIC R..MYANMAR VOWEL SIGN VOCALIC RR\n\t\tcode === 0x1084 || // Mc MYANMAR VOWEL SIGN SHAN E\n\t\tcode === 0x17B6 || // Mc KHMER VOWEL SIGN AA\n\t\t( 0x17BE <= code && code <= 0x17C5 ) || // Mc [8] KHMER VOWEL SIGN OE..KHMER VOWEL SIGN AU\n\t\t( 0x17C7 <= code && code <= 0x17C8 ) || // Mc [2] KHMER SIGN REAHMUK..KHMER SIGN YUUKALEAPINTU\n\t\t( 0x1923 <= code && code <= 0x1926 ) || // Mc [4] LIMBU VOWEL SIGN EE..LIMBU VOWEL SIGN AU\n\t\t( 0x1929 <= code && code <= 0x192B ) || // Mc [3] LIMBU SUBJOINED LETTER YA..LIMBU SUBJOINED LETTER WA\n\t\t( 0x1930 <= code && code <= 0x1931 ) || // Mc [2] LIMBU SMALL LETTER KA..LIMBU SMALL LETTER NGA\n\t\t( 0x1933 <= code && code <= 0x1938 ) || // Mc [6] LIMBU SMALL LETTER TA..LIMBU SMALL LETTER LA\n\t\t( 0x1A19 <= code && code <= 0x1A1A ) || // Mc [2] BUGINESE VOWEL SIGN E..BUGINESE VOWEL SIGN O\n\t\tcode === 0x1A55 || // Mc TAI THAM CONSONANT SIGN MEDIAL RA\n\t\tcode === 0x1A57 || // Mc TAI THAM CONSONANT SIGN LA TANG LAI\n\t\t( 0x1A6D <= code && code <= 0x1A72 ) || // Mc [6] TAI THAM VOWEL SIGN OY..TAI THAM VOWEL SIGN THAM AI\n\t\tcode === 0x1B04 || // Mc BALINESE SIGN BISAH\n\t\tcode === 0x1B3B || // Mc BALINESE VOWEL SIGN RA REPA TEDUNG\n\t\t( 0x1B3D <= code && code <= 0x1B41 ) || // Mc [5] BALINESE VOWEL SIGN LA LENGA TEDUNG..BALINESE VOWEL SIGN TALING REPA TEDUNG\n\t\t( 0x1B43 <= code && code <= 0x1B44 ) || // Mc [2] BALINESE VOWEL SIGN PEPET TEDUNG..BALINESE ADEG ADEG\n\t\tcode === 0x1B82 || // Mc SUNDANESE SIGN PANGWISAD\n\t\tcode === 0x1BA1 || // Mc SUNDANESE CONSONANT SIGN PAMINGKAL\n\t\t( 0x1BA6 <= code && code <= 0x1BA7 ) || // Mc [2] SUNDANESE VOWEL SIGN PANAELAENG..SUNDANESE VOWEL SIGN PANOLONG\n\t\tcode === 0x1BAA || // Mc SUNDANESE SIGN PAMAAEH\n\t\tcode === 0x1BE7 || // Mc BATAK VOWEL SIGN E\n\t\t( 0x1BEA <= code && code <= 0x1BEC ) || // Mc [3] BATAK VOWEL SIGN I..BATAK VOWEL SIGN O\n\t\tcode === 0x1BEE || // Mc BATAK VOWEL SIGN U\n\t\t( 0x1BF2 <= code && code <= 0x1BF3 ) || // Mc [2] BATAK PANGOLAT..BATAK PANONGONAN\n\t\t( 0x1C24 <= code && code <= 0x1C2B ) || // Mc [8] LEPCHA SUBJOINED LETTER YA..LEPCHA VOWEL SIGN UU\n\t\t( 0x1C34 <= code && code <= 0x1C35 ) || // Mc [2] LEPCHA CONSONANT SIGN NYIN-DO..LEPCHA CONSONANT SIGN KANG\n\t\tcode === 0x1CE1 || // Mc VEDIC TONE ATHARVAVEDIC INDEPENDENT SVARITA\n\t\tcode === 0x1CF7 || // Mc VEDIC SIGN ATIKRAMA\n\t\t( 0xA823 <= code && code <= 0xA824 ) || // Mc [2] SYLOTI NAGRI VOWEL SIGN A..SYLOTI NAGRI VOWEL SIGN I\n\t\tcode === 0xA827 || // Mc SYLOTI NAGRI VOWEL SIGN OO\n\t\t( 0xA880 <= code && code <= 0xA881 ) || // Mc [2] SAURASHTRA SIGN ANUSVARA..SAURASHTRA SIGN VISARGA\n\t\t( 0xA8B4 <= code && code <= 0xA8C3 ) || // Mc [16] SAURASHTRA CONSONANT SIGN HAARU..SAURASHTRA VOWEL SIGN AU\n\t\t( 0xA952 <= code && code <= 0xA953 ) || // Mc [2] REJANG CONSONANT SIGN H..REJANG VIRAMA\n\t\tcode === 0xA983 || // Mc JAVANESE SIGN WIGNYAN\n\t\t( 0xA9B4 <= code && code <= 0xA9B5 ) || // Mc [2] JAVANESE VOWEL SIGN TARUNG..JAVANESE VOWEL SIGN TOLONG\n\t\t( 0xA9BA <= code && code <= 0xA9BB ) || // Mc [2] JAVANESE VOWEL SIGN TALING..JAVANESE VOWEL SIGN DIRGA MURE\n\t\t( 0xA9BE <= code && code <= 0xA9C0 ) || // Mc [3] JAVANESE CONSONANT SIGN PENGKAL..JAVANESE PANGKON\n\t\t( 0xAA2F <= code && code <= 0xAA30 ) || // Mc [2] CHAM VOWEL SIGN O..CHAM VOWEL SIGN AI\n\t\t( 0xAA33 <= code && code <= 0xAA34 ) || // Mc [2] CHAM CONSONANT SIGN YA..CHAM CONSONANT SIGN RA\n\t\tcode === 0xAA4D || // Mc CHAM CONSONANT SIGN FINAL H\n\t\tcode === 0xAAEB || // Mc MEETEI MAYEK VOWEL SIGN II\n\t\t( 0xAAEE <= code && code <= 0xAAEF ) || // Mc [2] MEETEI MAYEK VOWEL SIGN AU..MEETEI MAYEK VOWEL SIGN AAU\n\t\tcode === 0xAAF5 || // Mc MEETEI MAYEK VOWEL SIGN VISARGA\n\t\t( 0xABE3 <= code && code <= 0xABE4 ) || // Mc [2] MEETEI MAYEK VOWEL SIGN ONAP..MEETEI MAYEK VOWEL SIGN INAP\n\t\t( 0xABE6 <= code && code <= 0xABE7 ) || // Mc [2] MEETEI MAYEK VOWEL SIGN YENAP..MEETEI MAYEK VOWEL SIGN SOUNAP\n\t\t( 0xABE9 <= code && code <= 0xABEA ) || // Mc [2] MEETEI MAYEK VOWEL SIGN CHEINAP..MEETEI MAYEK VOWEL SIGN NUNG\n\t\tcode === 0xABEC || // Mc MEETEI MAYEK LUM IYEK\n\t\tcode === 0x11000 || // Mc BRAHMI SIGN CANDRABINDU\n\t\tcode === 0x11002 || // Mc BRAHMI SIGN VISARGA\n\t\tcode === 0x11082 || // Mc KAITHI SIGN VISARGA\n\t\t( 0x110B0 <= code && code <= 0x110B2 ) || // Mc [3] KAITHI VOWEL SIGN AA..KAITHI VOWEL SIGN II\n\t\t( 0x110B7 <= code && code <= 0x110B8 ) || // Mc [2] KAITHI VOWEL SIGN O..KAITHI VOWEL SIGN AU\n\t\tcode === 0x1112C || // Mc CHAKMA VOWEL SIGN E\n\t\t( 0x11145 <= code && code <= 0x11146 ) || // Mc [2] CHAKMA VOWEL SIGN AA..CHAKMA VOWEL SIGN EI\n\t\tcode === 0x11182 || // Mc SHARADA SIGN VISARGA\n\t\t( 0x111B3 <= code && code <= 0x111B5 ) || // Mc [3] SHARADA VOWEL SIGN AA..SHARADA VOWEL SIGN II\n\t\t( 0x111BF <= code && code <= 0x111C0 ) || // Mc [2] SHARADA VOWEL SIGN AU..SHARADA SIGN VIRAMA\n\t\tcode === 0x111CE || // Mc SHARADA VOWEL SIGN PRISHTHAMATRA E\n\t\t( 0x1122C <= code && code <= 0x1122E ) || // Mc [3] KHOJKI VOWEL SIGN AA..KHOJKI VOWEL SIGN II\n\t\t( 0x11232 <= code && code <= 0x11233 ) || // Mc [2] KHOJKI VOWEL SIGN O..KHOJKI VOWEL SIGN AU\n\t\tcode === 0x11235 || // Mc KHOJKI SIGN VIRAMA\n\t\t( 0x112E0 <= code && code <= 0x112E2 ) || // Mc [3] KHUDAWADI VOWEL SIGN AA..KHUDAWADI VOWEL SIGN II\n\t\t( 0x11302 <= code && code <= 0x11303 ) || // Mc [2] GRANTHA SIGN ANUSVARA..GRANTHA SIGN VISARGA\n\t\tcode === 0x1133F || // Mc GRANTHA VOWEL SIGN I\n\t\t( 0x11341 <= code && code <= 0x11344 ) || // Mc [4] GRANTHA VOWEL SIGN U..GRANTHA VOWEL SIGN VOCALIC RR\n\t\t( 0x11347 <= code && code <= 0x11348 ) || // Mc [2] GRANTHA VOWEL SIGN EE..GRANTHA VOWEL SIGN AI\n\t\t( 0x1134B <= code && code <= 0x1134D ) || // Mc [3] GRANTHA VOWEL SIGN OO..GRANTHA SIGN VIRAMA\n\t\t( 0x11362 <= code && code <= 0x11363 ) || // Mc [2] GRANTHA VOWEL SIGN VOCALIC L..GRANTHA VOWEL SIGN VOCALIC LL\n\t\t( 0x11435 <= code && code <= 0x11437 ) || // Mc [3] NEWA VOWEL SIGN AA..NEWA VOWEL SIGN II\n\t\t( 0x11440 <= code && code <= 0x11441 ) || // Mc [2] NEWA VOWEL SIGN O..NEWA VOWEL SIGN AU\n\t\tcode === 0x11445 || // Mc NEWA SIGN VISARGA\n\t\t( 0x114B1 <= code && code <= 0x114B2 ) || // Mc [2] TIRHUTA VOWEL SIGN I..TIRHUTA VOWEL SIGN II\n\t\tcode === 0x114B9 || // Mc TIRHUTA VOWEL SIGN E\n\t\t( 0x114BB <= code && code <= 0x114BC ) || // Mc [2] TIRHUTA VOWEL SIGN AI..TIRHUTA VOWEL SIGN O\n\t\tcode === 0x114BE || // Mc TIRHUTA VOWEL SIGN AU\n\t\tcode === 0x114C1 || // Mc TIRHUTA SIGN VISARGA\n\t\t( 0x115B0 <= code && code <= 0x115B1 ) || // Mc [2] SIDDHAM VOWEL SIGN I..SIDDHAM VOWEL SIGN II\n\t\t( 0x115B8 <= code && code <= 0x115BB ) || // Mc [4] SIDDHAM VOWEL SIGN E..SIDDHAM VOWEL SIGN AU\n\t\tcode === 0x115BE || // Mc SIDDHAM SIGN VISARGA\n\t\t( 0x11630 <= code && code <= 0x11632 ) || // Mc [3] MODI VOWEL SIGN AA..MODI VOWEL SIGN II\n\t\t( 0x1163B <= code && code <= 0x1163C ) || // Mc [2] MODI VOWEL SIGN O..MODI VOWEL SIGN AU\n\t\tcode === 0x1163E || // Mc MODI SIGN VISARGA\n\t\tcode === 0x116AC || // Mc TAKRI SIGN VISARGA\n\t\t( 0x116AE <= code && code <= 0x116AF ) || // Mc [2] TAKRI VOWEL SIGN I..TAKRI VOWEL SIGN II\n\t\tcode === 0x116B6 || // Mc TAKRI SIGN VIRAMA\n\t\t( 0x11720 <= code && code <= 0x11721 ) || // Mc [2] AHOM VOWEL SIGN A..AHOM VOWEL SIGN AA\n\t\tcode === 0x11726 || // Mc AHOM VOWEL SIGN E\n\t\t( 0x1182C <= code && code <= 0x1182E ) || // Mc [3] DOGRA VOWEL SIGN AA..DOGRA VOWEL SIGN II\n\t\tcode === 0x11838 || // Mc DOGRA SIGN VISARGA\n\t\t( 0x11931 <= code && code <= 0x11935 ) || // Mc [5] DIVES AKURU VOWEL SIGN I..DIVES AKURU VOWEL SIGN E\n\t\t( 0x11937 <= code && code <= 0x11938 ) || // Mc [2] DIVES AKURU VOWEL SIGN AI..DIVES AKURU VOWEL SIGN O\n\t\tcode === 0x1193D || // Mc DIVES AKURU SIGN HALANTA\n\t\tcode === 0x11940 || // Mc DIVES AKURU MEDIAL YA\n\t\tcode === 0x11942 || // Mc DIVES AKURU MEDIAL RA\n\t\t( 0x119D1 <= code && code <= 0x119D3 ) || // Mc [3] NANDINAGARI VOWEL SIGN AA..NANDINAGARI VOWEL SIGN II\n\t\t( 0x119DC <= code && code <= 0x119DF ) || // Mc [4] NANDINAGARI VOWEL SIGN O..NANDINAGARI SIGN VISARGA\n\t\tcode === 0x119E4 || // Mc NANDINAGARI VOWEL SIGN PRISHTHAMATRA E\n\t\tcode === 0x11A39 || // Mc ZANABAZAR SQUARE SIGN VISARGA\n\t\t( 0x11A57 <= code && code <= 0x11A58 ) || // Mc [2] SOYOMBO VOWEL SIGN AI..SOYOMBO VOWEL SIGN AU\n\t\tcode === 0x11A97 || // Mc SOYOMBO SIGN VISARGA\n\t\tcode === 0x11C2F || // Mc BHAIKSUKI VOWEL SIGN AA\n\t\tcode === 0x11C3E || // Mc BHAIKSUKI SIGN VISARGA\n\t\tcode === 0x11CA9 || // Mc MARCHEN SUBJOINED LETTER YA\n\t\tcode === 0x11CB1 || // Mc MARCHEN VOWEL SIGN I\n\t\tcode === 0x11CB4 || // Mc MARCHEN VOWEL SIGN O\n\t\t( 0x11D8A <= code && code <= 0x11D8E ) || // Mc [5] GUNJALA GONDI VOWEL SIGN AA..GUNJALA GONDI VOWEL SIGN UU\n\t\t( 0x11D93 <= code && code <= 0x11D94 ) || // Mc [2] GUNJALA GONDI VOWEL SIGN OO..GUNJALA GONDI VOWEL SIGN AU\n\t\tcode === 0x11D96 || // Mc GUNJALA GONDI SIGN VISARGA\n\t\t( 0x11EF5 <= code && code <= 0x11EF6 ) || // Mc [2] MAKASAR VOWEL SIGN E..MAKASAR VOWEL SIGN O\n\t\t( 0x16F51 <= code && code <= 0x16F87 ) || // Mc [55] MIAO SIGN ASPIRATION..MIAO VOWEL SIGN UI\n\t\t( 0x16FF0 <= code && code <= 0x16FF1 ) || // Mc [2] VIETNAMESE ALTERNATE READING MARK CA..VIETNAMESE ALTERNATE READING MARK NHAY\n\t\tcode === 0x1D166 || // Mc MUSICAL SYMBOL COMBINING SPRECHGESANG STEM\n\t\tcode === 0x1D16D // Mc MUSICAL SYMBOL COMBINING AUGMENTATION DOT\n\t) {\n\t\treturn constants.SpacingMark;\n\t}\n\tif (\n\t\t( 0x1100 <= code && code <= 0x115F ) || // Lo [96] HANGUL CHOSEONG KIYEOK..HANGUL CHOSEONG FILLER\n\t\t( 0xA960 <= code && code <= 0xA97C ) // Lo [29] HANGUL CHOSEONG TIKEUT-MIEUM..HANGUL CHOSEONG SSANGYEORINHIEUH\n\t) {\n\t\treturn constants.L;\n\t}\n\tif (\n\t\t( 0x1160 <= code && code <= 0x11A7 ) || // Lo [72] HANGUL JUNGSEONG FILLER..HANGUL JUNGSEONG O-YAE\n\t\t( 0xD7B0 <= code && code <= 0xD7C6 ) // Lo [23] HANGUL JUNGSEONG O-YEO..HANGUL JUNGSEONG ARAEA-E\n\t) {\n\t\treturn constants.V;\n\t}\n\tif (\n\t\t( 0x11A8 <= code && code <= 0x11FF ) || // Lo [88] HANGUL JONGSEONG KIYEOK..HANGUL JONGSEONG SSANGNIEUN\n\t\t( 0xD7CB <= code && code <= 0xD7FB ) // Lo [49] HANGUL JONGSEONG NIEUN-RIEUL..HANGUL JONGSEONG PHIEUPH-THIEUTH\n\t) {\n\t\treturn constants.T;\n\t}\n\tif (\n\t\tcode === 0xAC00 || // Lo HANGUL SYLLABLE GA\n\t\tcode === 0xAC1C || // Lo HANGUL SYLLABLE GAE\n\t\tcode === 0xAC38 || // Lo HANGUL SYLLABLE GYA\n\t\tcode === 0xAC54 || // Lo HANGUL SYLLABLE GYAE\n\t\tcode === 0xAC70 || // Lo HANGUL SYLLABLE GEO\n\t\tcode === 0xAC8C || // Lo HANGUL SYLLABLE GE\n\t\tcode === 0xACA8 || // Lo HANGUL SYLLABLE GYEO\n\t\tcode === 0xACC4 || // Lo HANGUL SYLLABLE GYE\n\t\tcode === 0xACE0 || // Lo HANGUL SYLLABLE GO\n\t\tcode === 0xACFC || // Lo HANGUL SYLLABLE GWA\n\t\tcode === 0xAD18 || // Lo HANGUL SYLLABLE GWAE\n\t\tcode === 0xAD34 || // Lo HANGUL SYLLABLE GOE\n\t\tcode === 0xAD50 || // Lo HANGUL SYLLABLE GYO\n\t\tcode === 0xAD6C || // Lo HANGUL SYLLABLE GU\n\t\tcode === 0xAD88 || // Lo HANGUL SYLLABLE GWEO\n\t\tcode === 0xADA4 || // Lo HANGUL SYLLABLE GWE\n\t\tcode === 0xADC0 || // Lo HANGUL SYLLABLE GWI\n\t\tcode === 0xADDC || // Lo HANGUL SYLLABLE GYU\n\t\tcode === 0xADF8 || // Lo HANGUL SYLLABLE GEU\n\t\tcode === 0xAE14 || // Lo HANGUL SYLLABLE GYI\n\t\tcode === 0xAE30 || // Lo HANGUL SYLLABLE GI\n\t\tcode === 0xAE4C || // Lo HANGUL SYLLABLE GGA\n\t\tcode === 0xAE68 || // Lo HANGUL SYLLABLE GGAE\n\t\tcode === 0xAE84 || // Lo HANGUL SYLLABLE GGYA\n\t\tcode === 0xAEA0 || // Lo HANGUL SYLLABLE GGYAE\n\t\tcode === 0xAEBC || // Lo HANGUL SYLLABLE GGEO\n\t\tcode === 0xAED8 || // Lo HANGUL SYLLABLE GGE\n\t\tcode === 0xAEF4 || // Lo HANGUL SYLLABLE GGYEO\n\t\tcode === 0xAF10 || // Lo HANGUL SYLLABLE GGYE\n\t\tcode === 0xAF2C || // Lo HANGUL SYLLABLE GGO\n\t\tcode === 0xAF48 || // Lo HANGUL SYLLABLE GGWA\n\t\tcode === 0xAF64 || // Lo HANGUL SYLLABLE GGWAE\n\t\tcode === 0xAF80 || // Lo HANGUL SYLLABLE GGOE\n\t\tcode === 0xAF9C || // Lo HANGUL SYLLABLE GGYO\n\t\tcode === 0xAFB8 || // Lo HANGUL SYLLABLE GGU\n\t\tcode === 0xAFD4 || // Lo HANGUL SYLLABLE GGWEO\n\t\tcode === 0xAFF0 || // Lo HANGUL SYLLABLE GGWE\n\t\tcode === 0xB00C || // Lo HANGUL SYLLABLE GGWI\n\t\tcode === 0xB028 || // Lo HANGUL SYLLABLE GGYU\n\t\tcode === 0xB044 || // Lo HANGUL SYLLABLE GGEU\n\t\tcode === 0xB060 || // Lo HANGUL SYLLABLE GGYI\n\t\tcode === 0xB07C || // Lo HANGUL SYLLABLE GGI\n\t\tcode === 0xB098 || // Lo HANGUL SYLLABLE NA\n\t\tcode === 0xB0B4 || // Lo HANGUL SYLLABLE NAE\n\t\tcode === 0xB0D0 || // Lo HANGUL SYLLABLE NYA\n\t\tcode === 0xB0EC || // Lo HANGUL SYLLABLE NYAE\n\t\tcode === 0xB108 || // Lo HANGUL SYLLABLE NEO\n\t\tcode === 0xB124 || // Lo HANGUL SYLLABLE NE\n\t\tcode === 0xB140 || // Lo HANGUL SYLLABLE NYEO\n\t\tcode === 0xB15C || // Lo HANGUL SYLLABLE NYE\n\t\tcode === 0xB178 || // Lo HANGUL SYLLABLE NO\n\t\tcode === 0xB194 || // Lo HANGUL SYLLABLE NWA\n\t\tcode === 0xB1B0 || // Lo HANGUL SYLLABLE NWAE\n\t\tcode === 0xB1CC || // Lo HANGUL SYLLABLE NOE\n\t\tcode === 0xB1E8 || // Lo HANGUL SYLLABLE NYO\n\t\tcode === 0xB204 || // Lo HANGUL SYLLABLE NU\n\t\tcode === 0xB220 || // Lo HANGUL SYLLABLE NWEO\n\t\tcode === 0xB23C || // Lo HANGUL SYLLABLE NWE\n\t\tcode === 0xB258 || // Lo HANGUL SYLLABLE NWI\n\t\tcode === 0xB274 || // Lo HANGUL SYLLABLE NYU\n\t\tcode === 0xB290 || // Lo HANGUL SYLLABLE NEU\n\t\tcode === 0xB2AC || // Lo HANGUL SYLLABLE NYI\n\t\tcode === 0xB2C8 || // Lo HANGUL SYLLABLE NI\n\t\tcode === 0xB2E4 || // Lo HANGUL SYLLABLE DA\n\t\tcode === 0xB300 || // Lo HANGUL SYLLABLE DAE\n\t\tcode === 0xB31C || // Lo HANGUL SYLLABLE DYA\n\t\tcode === 0xB338 || // Lo HANGUL SYLLABLE DYAE\n\t\tcode === 0xB354 || // Lo HANGUL SYLLABLE DEO\n\t\tcode === 0xB370 || // Lo HANGUL SYLLABLE DE\n\t\tcode === 0xB38C || // Lo HANGUL SYLLABLE DYEO\n\t\tcode === 0xB3A8 || // Lo HANGUL SYLLABLE DYE\n\t\tcode === 0xB3C4 || // Lo HANGUL SYLLABLE DO\n\t\tcode === 0xB3E0 || // Lo HANGUL SYLLABLE DWA\n\t\tcode === 0xB3FC || // Lo HANGUL SYLLABLE DWAE\n\t\tcode === 0xB418 || // Lo HANGUL SYLLABLE DOE\n\t\tcode === 0xB434 || // Lo HANGUL SYLLABLE DYO\n\t\tcode === 0xB450 || // Lo HANGUL SYLLABLE DU\n\t\tcode === 0xB46C || // Lo HANGUL SYLLABLE DWEO\n\t\tcode === 0xB488 || // Lo HANGUL SYLLABLE DWE\n\t\tcode === 0xB4A4 || // Lo HANGUL SYLLABLE DWI\n\t\tcode === 0xB4C0 || // Lo HANGUL SYLLABLE DYU\n\t\tcode === 0xB4DC || // Lo HANGUL SYLLABLE DEU\n\t\tcode === 0xB4F8 || // Lo HANGUL SYLLABLE DYI\n\t\tcode === 0xB514 || // Lo HANGUL SYLLABLE DI\n\t\tcode === 0xB530 || // Lo HANGUL SYLLABLE DDA\n\t\tcode === 0xB54C || // Lo HANGUL SYLLABLE DDAE\n\t\tcode === 0xB568 || // Lo HANGUL SYLLABLE DDYA\n\t\tcode === 0xB584 || // Lo HANGUL SYLLABLE DDYAE\n\t\tcode === 0xB5A0 || // Lo HANGUL SYLLABLE DDEO\n\t\tcode === 0xB5BC || // Lo HANGUL SYLLABLE DDE\n\t\tcode === 0xB5D8 || // Lo HANGUL SYLLABLE DDYEO\n\t\tcode === 0xB5F4 || // Lo HANGUL SYLLABLE DDYE\n\t\tcode === 0xB610 || // Lo HANGUL SYLLABLE DDO\n\t\tcode === 0xB62C || // Lo HANGUL SYLLABLE DDWA\n\t\tcode === 0xB648 || // Lo HANGUL SYLLABLE DDWAE\n\t\tcode === 0xB664 || // Lo HANGUL SYLLABLE DDOE\n\t\tcode === 0xB680 || // Lo HANGUL SYLLABLE DDYO\n\t\tcode === 0xB69C || // Lo HANGUL SYLLABLE DDU\n\t\tcode === 0xB6B8 || // Lo HANGUL SYLLABLE DDWEO\n\t\tcode === 0xB6D4 || // Lo HANGUL SYLLABLE DDWE\n\t\tcode === 0xB6F0 || // Lo HANGUL SYLLABLE DDWI\n\t\tcode === 0xB70C || // Lo HANGUL SYLLABLE DDYU\n\t\tcode === 0xB728 || // Lo HANGUL SYLLABLE DDEU\n\t\tcode === 0xB744 || // Lo HANGUL SYLLABLE DDYI\n\t\tcode === 0xB760 || // Lo HANGUL SYLLABLE DDI\n\t\tcode === 0xB77C || // Lo HANGUL SYLLABLE RA\n\t\tcode === 0xB798 || // Lo HANGUL SYLLABLE RAE\n\t\tcode === 0xB7B4 || // Lo HANGUL SYLLABLE RYA\n\t\tcode === 0xB7D0 || // Lo HANGUL SYLLABLE RYAE\n\t\tcode === 0xB7EC || // Lo HANGUL SYLLABLE REO\n\t\tcode === 0xB808 || // Lo HANGUL SYLLABLE RE\n\t\tcode === 0xB824 || // Lo HANGUL SYLLABLE RYEO\n\t\tcode === 0xB840 || // Lo HANGUL SYLLABLE RYE\n\t\tcode === 0xB85C || // Lo HANGUL SYLLABLE RO\n\t\tcode === 0xB878 || // Lo HANGUL SYLLABLE RWA\n\t\tcode === 0xB894 || // Lo HANGUL SYLLABLE RWAE\n\t\tcode === 0xB8B0 || // Lo HANGUL SYLLABLE ROE\n\t\tcode === 0xB8CC || // Lo HANGUL SYLLABLE RYO\n\t\tcode === 0xB8E8 || // Lo HANGUL SYLLABLE RU\n\t\tcode === 0xB904 || // Lo HANGUL SYLLABLE RWEO\n\t\tcode === 0xB920 || // Lo HANGUL SYLLABLE RWE\n\t\tcode === 0xB93C || // Lo HANGUL SYLLABLE RWI\n\t\tcode === 0xB958 || // Lo HANGUL SYLLABLE RYU\n\t\tcode === 0xB974 || // Lo HANGUL SYLLABLE REU\n\t\tcode === 0xB990 || // Lo HANGUL SYLLABLE RYI\n\t\tcode === 0xB9AC || // Lo HANGUL SYLLABLE RI\n\t\tcode === 0xB9C8 || // Lo HANGUL SYLLABLE MA\n\t\tcode === 0xB9E4 || // Lo HANGUL SYLLABLE MAE\n\t\tcode === 0xBA00 || // Lo HANGUL SYLLABLE MYA\n\t\tcode === 0xBA1C || // Lo HANGUL SYLLABLE MYAE\n\t\tcode === 0xBA38 || // Lo HANGUL SYLLABLE MEO\n\t\tcode === 0xBA54 || // Lo HANGUL SYLLABLE ME\n\t\tcode === 0xBA70 || // Lo HANGUL SYLLABLE MYEO\n\t\tcode === 0xBA8C || // Lo HANGUL SYLLABLE MYE\n\t\tcode === 0xBAA8 || // Lo HANGUL SYLLABLE MO\n\t\tcode === 0xBAC4 || // Lo HANGUL SYLLABLE MWA\n\t\tcode === 0xBAE0 || // Lo HANGUL SYLLABLE MWAE\n\t\tcode === 0xBAFC || // Lo HANGUL SYLLABLE MOE\n\t\tcode === 0xBB18 || // Lo HANGUL SYLLABLE MYO\n\t\tcode === 0xBB34 || // Lo HANGUL SYLLABLE MU\n\t\tcode === 0xBB50 || // Lo HANGUL SYLLABLE MWEO\n\t\tcode === 0xBB6C || // Lo HANGUL SYLLABLE MWE\n\t\tcode === 0xBB88 || // Lo HANGUL SYLLABLE MWI\n\t\tcode === 0xBBA4 || // Lo HANGUL SYLLABLE MYU\n\t\tcode === 0xBBC0 || // Lo HANGUL SYLLABLE MEU\n\t\tcode === 0xBBDC || // Lo HANGUL SYLLABLE MYI\n\t\tcode === 0xBBF8 || // Lo HANGUL SYLLABLE MI\n\t\tcode === 0xBC14 || // Lo HANGUL SYLLABLE BA\n\t\tcode === 0xBC30 || // Lo HANGUL SYLLABLE BAE\n\t\tcode === 0xBC4C || // Lo HANGUL SYLLABLE BYA\n\t\tcode === 0xBC68 || // Lo HANGUL SYLLABLE BYAE\n\t\tcode === 0xBC84 || // Lo HANGUL SYLLABLE BEO\n\t\tcode === 0xBCA0 || // Lo HANGUL SYLLABLE BE\n\t\tcode === 0xBCBC || // Lo HANGUL SYLLABLE BYEO\n\t\tcode === 0xBCD8 || // Lo HANGUL SYLLABLE BYE\n\t\tcode === 0xBCF4 || // Lo HANGUL SYLLABLE BO\n\t\tcode === 0xBD10 || // Lo HANGUL SYLLABLE BWA\n\t\tcode === 0xBD2C || // Lo HANGUL SYLLABLE BWAE\n\t\tcode === 0xBD48 || // Lo HANGUL SYLLABLE BOE\n\t\tcode === 0xBD64 || // Lo HANGUL SYLLABLE BYO\n\t\tcode === 0xBD80 || // Lo HANGUL SYLLABLE BU\n\t\tcode === 0xBD9C || // Lo HANGUL SYLLABLE BWEO\n\t\tcode === 0xBDB8 || // Lo HANGUL SYLLABLE BWE\n\t\tcode === 0xBDD4 || // Lo HANGUL SYLLABLE BWI\n\t\tcode === 0xBDF0 || // Lo HANGUL SYLLABLE BYU\n\t\tcode === 0xBE0C || // Lo HANGUL SYLLABLE BEU\n\t\tcode === 0xBE28 || // Lo HANGUL SYLLABLE BYI\n\t\tcode === 0xBE44 || // Lo HANGUL SYLLABLE BI\n\t\tcode === 0xBE60 || // Lo HANGUL SYLLABLE BBA\n\t\tcode === 0xBE7C || // Lo HANGUL SYLLABLE BBAE\n\t\tcode === 0xBE98 || // Lo HANGUL SYLLABLE BBYA\n\t\tcode === 0xBEB4 || // Lo HANGUL SYLLABLE BBYAE\n\t\tcode === 0xBED0 || // Lo HANGUL SYLLABLE BBEO\n\t\tcode === 0xBEEC || // Lo HANGUL SYLLABLE BBE\n\t\tcode === 0xBF08 || // Lo HANGUL SYLLABLE BBYEO\n\t\tcode === 0xBF24 || // Lo HANGUL SYLLABLE BBYE\n\t\tcode === 0xBF40 || // Lo HANGUL SYLLABLE BBO\n\t\tcode === 0xBF5C || // Lo HANGUL SYLLABLE BBWA\n\t\tcode === 0xBF78 || // Lo HANGUL SYLLABLE BBWAE\n\t\tcode === 0xBF94 || // Lo HANGUL SYLLABLE BBOE\n\t\tcode === 0xBFB0 || // Lo HANGUL SYLLABLE BBYO\n\t\tcode === 0xBFCC || // Lo HANGUL SYLLABLE BBU\n\t\tcode === 0xBFE8 || // Lo HANGUL SYLLABLE BBWEO\n\t\tcode === 0xC004 || // Lo HANGUL SYLLABLE BBWE\n\t\tcode === 0xC020 || // Lo HANGUL SYLLABLE BBWI\n\t\tcode === 0xC03C || // Lo HANGUL SYLLABLE BBYU\n\t\tcode === 0xC058 || // Lo HANGUL SYLLABLE BBEU\n\t\tcode === 0xC074 || // Lo HANGUL SYLLABLE BBYI\n\t\tcode === 0xC090 || // Lo HANGUL SYLLABLE BBI\n\t\tcode === 0xC0AC || // Lo HANGUL SYLLABLE SA\n\t\tcode === 0xC0C8 || // Lo HANGUL SYLLABLE SAE\n\t\tcode === 0xC0E4 || // Lo HANGUL SYLLABLE SYA\n\t\tcode === 0xC100 || // Lo HANGUL SYLLABLE SYAE\n\t\tcode === 0xC11C || // Lo HANGUL SYLLABLE SEO\n\t\tcode === 0xC138 || // Lo HANGUL SYLLABLE SE\n\t\tcode === 0xC154 || // Lo HANGUL SYLLABLE SYEO\n\t\tcode === 0xC170 || // Lo HANGUL SYLLABLE SYE\n\t\tcode === 0xC18C || // Lo HANGUL SYLLABLE SO\n\t\tcode === 0xC1A8 || // Lo HANGUL SYLLABLE SWA\n\t\tcode === 0xC1C4 || // Lo HANGUL SYLLABLE SWAE\n\t\tcode === 0xC1E0 || // Lo HANGUL SYLLABLE SOE\n\t\tcode === 0xC1FC || // Lo HANGUL SYLLABLE SYO\n\t\tcode === 0xC218 || // Lo HANGUL SYLLABLE SU\n\t\tcode === 0xC234 || // Lo HANGUL SYLLABLE SWEO\n\t\tcode === 0xC250 || // Lo HANGUL SYLLABLE SWE\n\t\tcode === 0xC26C || // Lo HANGUL SYLLABLE SWI\n\t\tcode === 0xC288 || // Lo HANGUL SYLLABLE SYU\n\t\tcode === 0xC2A4 || // Lo HANGUL SYLLABLE SEU\n\t\tcode === 0xC2C0 || // Lo HANGUL SYLLABLE SYI\n\t\tcode === 0xC2DC || // Lo HANGUL SYLLABLE SI\n\t\tcode === 0xC2F8 || // Lo HANGUL SYLLABLE SSA\n\t\tcode === 0xC314 || // Lo HANGUL SYLLABLE SSAE\n\t\tcode === 0xC330 || // Lo HANGUL SYLLABLE SSYA\n\t\tcode === 0xC34C || // Lo HANGUL SYLLABLE SSYAE\n\t\tcode === 0xC368 || // Lo HANGUL SYLLABLE SSEO\n\t\tcode === 0xC384 || // Lo HANGUL SYLLABLE SSE\n\t\tcode === 0xC3A0 || // Lo HANGUL SYLLABLE SSYEO\n\t\tcode === 0xC3BC || // Lo HANGUL SYLLABLE SSYE\n\t\tcode === 0xC3D8 || // Lo HANGUL SYLLABLE SSO\n\t\tcode === 0xC3F4 || // Lo HANGUL SYLLABLE SSWA\n\t\tcode === 0xC410 || // Lo HANGUL SYLLABLE SSWAE\n\t\tcode === 0xC42C || // Lo HANGUL SYLLABLE SSOE\n\t\tcode === 0xC448 || // Lo HANGUL SYLLABLE SSYO\n\t\tcode === 0xC464 || // Lo HANGUL SYLLABLE SSU\n\t\tcode === 0xC480 || // Lo HANGUL SYLLABLE SSWEO\n\t\tcode === 0xC49C || // Lo HANGUL SYLLABLE SSWE\n\t\tcode === 0xC4B8 || // Lo HANGUL SYLLABLE SSWI\n\t\tcode === 0xC4D4 || // Lo HANGUL SYLLABLE SSYU\n\t\tcode === 0xC4F0 || // Lo HANGUL SYLLABLE SSEU\n\t\tcode === 0xC50C || // Lo HANGUL SYLLABLE SSYI\n\t\tcode === 0xC528 || // Lo HANGUL SYLLABLE SSI\n\t\tcode === 0xC544 || // Lo HANGUL SYLLABLE A\n\t\tcode === 0xC560 || // Lo HANGUL SYLLABLE AE\n\t\tcode === 0xC57C || // Lo HANGUL SYLLABLE YA\n\t\tcode === 0xC598 || // Lo HANGUL SYLLABLE YAE\n\t\tcode === 0xC5B4 || // Lo HANGUL SYLLABLE EO\n\t\tcode === 0xC5D0 || // Lo HANGUL SYLLABLE E\n\t\tcode === 0xC5EC || // Lo HANGUL SYLLABLE YEO\n\t\tcode === 0xC608 || // Lo HANGUL SYLLABLE YE\n\t\tcode === 0xC624 || // Lo HANGUL SYLLABLE O\n\t\tcode === 0xC640 || // Lo HANGUL SYLLABLE WA\n\t\tcode === 0xC65C || // Lo HANGUL SYLLABLE WAE\n\t\tcode === 0xC678 || // Lo HANGUL SYLLABLE OE\n\t\tcode === 0xC694 || // Lo HANGUL SYLLABLE YO\n\t\tcode === 0xC6B0 || // Lo HANGUL SYLLABLE U\n\t\tcode === 0xC6CC || // Lo HANGUL SYLLABLE WEO\n\t\tcode === 0xC6E8 || // Lo HANGUL SYLLABLE WE\n\t\tcode === 0xC704 || // Lo HANGUL SYLLABLE WI\n\t\tcode === 0xC720 || // Lo HANGUL SYLLABLE YU\n\t\tcode === 0xC73C || // Lo HANGUL SYLLABLE EU\n\t\tcode === 0xC758 || // Lo HANGUL SYLLABLE YI\n\t\tcode === 0xC774 || // Lo HANGUL SYLLABLE I\n\t\tcode === 0xC790 || // Lo HANGUL SYLLABLE JA\n\t\tcode === 0xC7AC || // Lo HANGUL SYLLABLE JAE\n\t\tcode === 0xC7C8 || // Lo HANGUL SYLLABLE JYA\n\t\tcode === 0xC7E4 || // Lo HANGUL SYLLABLE JYAE\n\t\tcode === 0xC800 || // Lo HANGUL SYLLABLE JEO\n\t\tcode === 0xC81C || // Lo HANGUL SYLLABLE JE\n\t\tcode === 0xC838 || // Lo HANGUL SYLLABLE JYEO\n\t\tcode === 0xC854 || // Lo HANGUL SYLLABLE JYE\n\t\tcode === 0xC870 || // Lo HANGUL SYLLABLE JO\n\t\tcode === 0xC88C || // Lo HANGUL SYLLABLE JWA\n\t\tcode === 0xC8A8 || // Lo HANGUL SYLLABLE JWAE\n\t\tcode === 0xC8C4 || // Lo HANGUL SYLLABLE JOE\n\t\tcode === 0xC8E0 || // Lo HANGUL SYLLABLE JYO\n\t\tcode === 0xC8FC || // Lo HANGUL SYLLABLE JU\n\t\tcode === 0xC918 || // Lo HANGUL SYLLABLE JWEO\n\t\tcode === 0xC934 || // Lo HANGUL SYLLABLE JWE\n\t\tcode === 0xC950 || // Lo HANGUL SYLLABLE JWI\n\t\tcode === 0xC96C || // Lo HANGUL SYLLABLE JYU\n\t\tcode === 0xC988 || // Lo HANGUL SYLLABLE JEU\n\t\tcode === 0xC9A4 || // Lo HANGUL SYLLABLE JYI\n\t\tcode === 0xC9C0 || // Lo HANGUL SYLLABLE JI\n\t\tcode === 0xC9DC || // Lo HANGUL SYLLABLE JJA\n\t\tcode === 0xC9F8 || // Lo HANGUL SYLLABLE JJAE\n\t\tcode === 0xCA14 || // Lo HANGUL SYLLABLE JJYA\n\t\tcode === 0xCA30 || // Lo HANGUL SYLLABLE JJYAE\n\t\tcode === 0xCA4C || // Lo HANGUL SYLLABLE JJEO\n\t\tcode === 0xCA68 || // Lo HANGUL SYLLABLE JJE\n\t\tcode === 0xCA84 || // Lo HANGUL SYLLABLE JJYEO\n\t\tcode === 0xCAA0 || // Lo HANGUL SYLLABLE JJYE\n\t\tcode === 0xCABC || // Lo HANGUL SYLLABLE JJO\n\t\tcode === 0xCAD8 || // Lo HANGUL SYLLABLE JJWA\n\t\tcode === 0xCAF4 || // Lo HANGUL SYLLABLE JJWAE\n\t\tcode === 0xCB10 || // Lo HANGUL SYLLABLE JJOE\n\t\tcode === 0xCB2C || // Lo HANGUL SYLLABLE JJYO\n\t\tcode === 0xCB48 || // Lo HANGUL SYLLABLE JJU\n\t\tcode === 0xCB64 || // Lo HANGUL SYLLABLE JJWEO\n\t\tcode === 0xCB80 || // Lo HANGUL SYLLABLE JJWE\n\t\tcode === 0xCB9C || // Lo HANGUL SYLLABLE JJWI\n\t\tcode === 0xCBB8 || // Lo HANGUL SYLLABLE JJYU\n\t\tcode === 0xCBD4 || // Lo HANGUL SYLLABLE JJEU\n\t\tcode === 0xCBF0 || // Lo HANGUL SYLLABLE JJYI\n\t\tcode === 0xCC0C || // Lo HANGUL SYLLABLE JJI\n\t\tcode === 0xCC28 || // Lo HANGUL SYLLABLE CA\n\t\tcode === 0xCC44 || // Lo HANGUL SYLLABLE CAE\n\t\tcode === 0xCC60 || // Lo HANGUL SYLLABLE CYA\n\t\tcode === 0xCC7C || // Lo HANGUL SYLLABLE CYAE\n\t\tcode === 0xCC98 || // Lo HANGUL SYLLABLE CEO\n\t\tcode === 0xCCB4 || // Lo HANGUL SYLLABLE CE\n\t\tcode === 0xCCD0 || // Lo HANGUL SYLLABLE CYEO\n\t\tcode === 0xCCEC || // Lo HANGUL SYLLABLE CYE\n\t\tcode === 0xCD08 || // Lo HANGUL SYLLABLE CO\n\t\tcode === 0xCD24 || // Lo HANGUL SYLLABLE CWA\n\t\tcode === 0xCD40 || // Lo HANGUL SYLLABLE CWAE\n\t\tcode === 0xCD5C || // Lo HANGUL SYLLABLE COE\n\t\tcode === 0xCD78 || // Lo HANGUL SYLLABLE CYO\n\t\tcode === 0xCD94 || // Lo HANGUL SYLLABLE CU\n\t\tcode === 0xCDB0 || // Lo HANGUL SYLLABLE CWEO\n\t\tcode === 0xCDCC || // Lo HANGUL SYLLABLE CWE\n\t\tcode === 0xCDE8 || // Lo HANGUL SYLLABLE CWI\n\t\tcode === 0xCE04 || // Lo HANGUL SYLLABLE CYU\n\t\tcode === 0xCE20 || // Lo HANGUL SYLLABLE CEU\n\t\tcode === 0xCE3C || // Lo HANGUL SYLLABLE CYI\n\t\tcode === 0xCE58 || // Lo HANGUL SYLLABLE CI\n\t\tcode === 0xCE74 || // Lo HANGUL SYLLABLE KA\n\t\tcode === 0xCE90 || // Lo HANGUL SYLLABLE KAE\n\t\tcode === 0xCEAC || // Lo HANGUL SYLLABLE KYA\n\t\tcode === 0xCEC8 || // Lo HANGUL SYLLABLE KYAE\n\t\tcode === 0xCEE4 || // Lo HANGUL SYLLABLE KEO\n\t\tcode === 0xCF00 || // Lo HANGUL SYLLABLE KE\n\t\tcode === 0xCF1C || // Lo HANGUL SYLLABLE KYEO\n\t\tcode === 0xCF38 || // Lo HANGUL SYLLABLE KYE\n\t\tcode === 0xCF54 || // Lo HANGUL SYLLABLE KO\n\t\tcode === 0xCF70 || // Lo HANGUL SYLLABLE KWA\n\t\tcode === 0xCF8C || // Lo HANGUL SYLLABLE KWAE\n\t\tcode === 0xCFA8 || // Lo HANGUL SYLLABLE KOE\n\t\tcode === 0xCFC4 || // Lo HANGUL SYLLABLE KYO\n\t\tcode === 0xCFE0 || // Lo HANGUL SYLLABLE KU\n\t\tcode === 0xCFFC || // Lo HANGUL SYLLABLE KWEO\n\t\tcode === 0xD018 || // Lo HANGUL SYLLABLE KWE\n\t\tcode === 0xD034 || // Lo HANGUL SYLLABLE KWI\n\t\tcode === 0xD050 || // Lo HANGUL SYLLABLE KYU\n\t\tcode === 0xD06C || // Lo HANGUL SYLLABLE KEU\n\t\tcode === 0xD088 || // Lo HANGUL SYLLABLE KYI\n\t\tcode === 0xD0A4 || // Lo HANGUL SYLLABLE KI\n\t\tcode === 0xD0C0 || // Lo HANGUL SYLLABLE TA\n\t\tcode === 0xD0DC || // Lo HANGUL SYLLABLE TAE\n\t\tcode === 0xD0F8 || // Lo HANGUL SYLLABLE TYA\n\t\tcode === 0xD114 || // Lo HANGUL SYLLABLE TYAE\n\t\tcode === 0xD130 || // Lo HANGUL SYLLABLE TEO\n\t\tcode === 0xD14C || // Lo HANGUL SYLLABLE TE\n\t\tcode === 0xD168 || // Lo HANGUL SYLLABLE TYEO\n\t\tcode === 0xD184 || // Lo HANGUL SYLLABLE TYE\n\t\tcode === 0xD1A0 || // Lo HANGUL SYLLABLE TO\n\t\tcode === 0xD1BC || // Lo HANGUL SYLLABLE TWA\n\t\tcode === 0xD1D8 || // Lo HANGUL SYLLABLE TWAE\n\t\tcode === 0xD1F4 || // Lo HANGUL SYLLABLE TOE\n\t\tcode === 0xD210 || // Lo HANGUL SYLLABLE TYO\n\t\tcode === 0xD22C || // Lo HANGUL SYLLABLE TU\n\t\tcode === 0xD248 || // Lo HANGUL SYLLABLE TWEO\n\t\tcode === 0xD264 || // Lo HANGUL SYLLABLE TWE\n\t\tcode === 0xD280 || // Lo HANGUL SYLLABLE TWI\n\t\tcode === 0xD29C || // Lo HANGUL SYLLABLE TYU\n\t\tcode === 0xD2B8 || // Lo HANGUL SYLLABLE TEU\n\t\tcode === 0xD2D4 || // Lo HANGUL SYLLABLE TYI\n\t\tcode === 0xD2F0 || // Lo HANGUL SYLLABLE TI\n\t\tcode === 0xD30C || // Lo HANGUL SYLLABLE PA\n\t\tcode === 0xD328 || // Lo HANGUL SYLLABLE PAE\n\t\tcode === 0xD344 || // Lo HANGUL SYLLABLE PYA\n\t\tcode === 0xD360 || // Lo HANGUL SYLLABLE PYAE\n\t\tcode === 0xD37C || // Lo HANGUL SYLLABLE PEO\n\t\tcode === 0xD398 || // Lo HANGUL SYLLABLE PE\n\t\tcode === 0xD3B4 || // Lo HANGUL SYLLABLE PYEO\n\t\tcode === 0xD3D0 || // Lo HANGUL SYLLABLE PYE\n\t\tcode === 0xD3EC || // Lo HANGUL SYLLABLE PO\n\t\tcode === 0xD408 || // Lo HANGUL SYLLABLE PWA\n\t\tcode === 0xD424 || // Lo HANGUL SYLLABLE PWAE\n\t\tcode === 0xD440 || // Lo HANGUL SYLLABLE POE\n\t\tcode === 0xD45C || // Lo HANGUL SYLLABLE PYO\n\t\tcode === 0xD478 || // Lo HANGUL SYLLABLE PU\n\t\tcode === 0xD494 || // Lo HANGUL SYLLABLE PWEO\n\t\tcode === 0xD4B0 || // Lo HANGUL SYLLABLE PWE\n\t\tcode === 0xD4CC || // Lo HANGUL SYLLABLE PWI\n\t\tcode === 0xD4E8 || // Lo HANGUL SYLLABLE PYU\n\t\tcode === 0xD504 || // Lo HANGUL SYLLABLE PEU\n\t\tcode === 0xD520 || // Lo HANGUL SYLLABLE PYI\n\t\tcode === 0xD53C || // Lo HANGUL SYLLABLE PI\n\t\tcode === 0xD558 || // Lo HANGUL SYLLABLE HA\n\t\tcode === 0xD574 || // Lo HANGUL SYLLABLE HAE\n\t\tcode === 0xD590 || // Lo HANGUL SYLLABLE HYA\n\t\tcode === 0xD5AC || // Lo HANGUL SYLLABLE HYAE\n\t\tcode === 0xD5C8 || // Lo HANGUL SYLLABLE HEO\n\t\tcode === 0xD5E4 || // Lo HANGUL SYLLABLE HE\n\t\tcode === 0xD600 || // Lo HANGUL SYLLABLE HYEO\n\t\tcode === 0xD61C || // Lo HANGUL SYLLABLE HYE\n\t\tcode === 0xD638 || // Lo HANGUL SYLLABLE HO\n\t\tcode === 0xD654 || // Lo HANGUL SYLLABLE HWA\n\t\tcode === 0xD670 || // Lo HANGUL SYLLABLE HWAE\n\t\tcode === 0xD68C || // Lo HANGUL SYLLABLE HOE\n\t\tcode === 0xD6A8 || // Lo HANGUL SYLLABLE HYO\n\t\tcode === 0xD6C4 || // Lo HANGUL SYLLABLE HU\n\t\tcode === 0xD6E0 || // Lo HANGUL SYLLABLE HWEO\n\t\tcode === 0xD6FC || // Lo HANGUL SYLLABLE HWE\n\t\tcode === 0xD718 || // Lo HANGUL SYLLABLE HWI\n\t\tcode === 0xD734 || // Lo HANGUL SYLLABLE HYU\n\t\tcode === 0xD750 || // Lo HANGUL SYLLABLE HEU\n\t\tcode === 0xD76C || // Lo HANGUL SYLLABLE HYI\n\t\tcode === 0xD788 // Lo HANGUL SYLLABLE HI\n\t) {\n\t\treturn constants.LV;\n\t}\n\tif (\n\t\t( 0xAC01 <= code && code <= 0xAC1B ) || // Lo [27] HANGUL SYLLABLE GAG..HANGUL SYLLABLE GAH\n\t\t( 0xAC1D <= code && code <= 0xAC37 ) || // Lo [27] HANGUL SYLLABLE GAEG..HANGUL SYLLABLE GAEH\n\t\t( 0xAC39 <= code && code <= 0xAC53 ) || // Lo [27] HANGUL SYLLABLE GYAG..HANGUL SYLLABLE GYAH\n\t\t( 0xAC55 <= code && code <= 0xAC6F ) || // Lo [27] HANGUL SYLLABLE GYAEG..HANGUL SYLLABLE GYAEH\n\t\t( 0xAC71 <= code && code <= 0xAC8B ) || // Lo [27] HANGUL SYLLABLE GEOG..HANGUL SYLLABLE GEOH\n\t\t( 0xAC8D <= code && code <= 0xACA7 ) || // Lo [27] HANGUL SYLLABLE GEG..HANGUL SYLLABLE GEH\n\t\t( 0xACA9 <= code && code <= 0xACC3 ) || // Lo [27] HANGUL SYLLABLE GYEOG..HANGUL SYLLABLE GYEOH\n\t\t( 0xACC5 <= code && code <= 0xACDF ) || // Lo [27] HANGUL SYLLABLE GYEG..HANGUL SYLLABLE GYEH\n\t\t( 0xACE1 <= code && code <= 0xACFB ) || // Lo [27] HANGUL SYLLABLE GOG..HANGUL SYLLABLE GOH\n\t\t( 0xACFD <= code && code <= 0xAD17 ) || // Lo [27] HANGUL SYLLABLE GWAG..HANGUL SYLLABLE GWAH\n\t\t( 0xAD19 <= code && code <= 0xAD33 ) || // Lo [27] HANGUL SYLLABLE GWAEG..HANGUL SYLLABLE GWAEH\n\t\t( 0xAD35 <= code && code <= 0xAD4F ) || // Lo [27] HANGUL SYLLABLE GOEG..HANGUL SYLLABLE GOEH\n\t\t( 0xAD51 <= code && code <= 0xAD6B ) || // Lo [27] HANGUL SYLLABLE GYOG..HANGUL SYLLABLE GYOH\n\t\t( 0xAD6D <= code && code <= 0xAD87 ) || // Lo [27] HANGUL SYLLABLE GUG..HANGUL SYLLABLE GUH\n\t\t( 0xAD89 <= code && code <= 0xADA3 ) || // Lo [27] HANGUL SYLLABLE GWEOG..HANGUL SYLLABLE GWEOH\n\t\t( 0xADA5 <= code && code <= 0xADBF ) || // Lo [27] HANGUL SYLLABLE GWEG..HANGUL SYLLABLE GWEH\n\t\t( 0xADC1 <= code && code <= 0xADDB ) || // Lo [27] HANGUL SYLLABLE GWIG..HANGUL SYLLABLE GWIH\n\t\t( 0xADDD <= code && code <= 0xADF7 ) || // Lo [27] HANGUL SYLLABLE GYUG..HANGUL SYLLABLE GYUH\n\t\t( 0xADF9 <= code && code <= 0xAE13 ) || // Lo [27] HANGUL SYLLABLE GEUG..HANGUL SYLLABLE GEUH\n\t\t( 0xAE15 <= code && code <= 0xAE2F ) || // Lo [27] HANGUL SYLLABLE GYIG..HANGUL SYLLABLE GYIH\n\t\t( 0xAE31 <= code && code <= 0xAE4B ) || // Lo [27] HANGUL SYLLABLE GIG..HANGUL SYLLABLE GIH\n\t\t( 0xAE4D <= code && code <= 0xAE67 ) || // Lo [27] HANGUL SYLLABLE GGAG..HANGUL SYLLABLE GGAH\n\t\t( 0xAE69 <= code && code <= 0xAE83 ) || // Lo [27] HANGUL SYLLABLE GGAEG..HANGUL SYLLABLE GGAEH\n\t\t( 0xAE85 <= code && code <= 0xAE9F ) || // Lo [27] HANGUL SYLLABLE GGYAG..HANGUL SYLLABLE GGYAH\n\t\t( 0xAEA1 <= code && code <= 0xAEBB ) || // Lo [27] HANGUL SYLLABLE GGYAEG..HANGUL SYLLABLE GGYAEH\n\t\t( 0xAEBD <= code && code <= 0xAED7 ) || // Lo [27] HANGUL SYLLABLE GGEOG..HANGUL SYLLABLE GGEOH\n\t\t( 0xAED9 <= code && code <= 0xAEF3 ) || // Lo [27] HANGUL SYLLABLE GGEG..HANGUL SYLLABLE GGEH\n\t\t( 0xAEF5 <= code && code <= 0xAF0F ) || // Lo [27] HANGUL SYLLABLE GGYEOG..HANGUL SYLLABLE GGYEOH\n\t\t( 0xAF11 <= code && code <= 0xAF2B ) || // Lo [27] HANGUL SYLLABLE GGYEG..HANGUL SYLLABLE GGYEH\n\t\t( 0xAF2D <= code && code <= 0xAF47 ) || // Lo [27] HANGUL SYLLABLE GGOG..HANGUL SYLLABLE GGOH\n\t\t( 0xAF49 <= code && code <= 0xAF63 ) || // Lo [27] HANGUL SYLLABLE GGWAG..HANGUL SYLLABLE GGWAH\n\t\t( 0xAF65 <= code && code <= 0xAF7F ) || // Lo [27] HANGUL SYLLABLE GGWAEG..HANGUL SYLLABLE GGWAEH\n\t\t( 0xAF81 <= code && code <= 0xAF9B ) || // Lo [27] HANGUL SYLLABLE GGOEG..HANGUL SYLLABLE GGOEH\n\t\t( 0xAF9D <= code && code <= 0xAFB7 ) || // Lo [27] HANGUL SYLLABLE GGYOG..HANGUL SYLLABLE GGYOH\n\t\t( 0xAFB9 <= code && code <= 0xAFD3 ) || // Lo [27] HANGUL SYLLABLE GGUG..HANGUL SYLLABLE GGUH\n\t\t( 0xAFD5 <= code && code <= 0xAFEF ) || // Lo [27] HANGUL SYLLABLE GGWEOG..HANGUL SYLLABLE GGWEOH\n\t\t( 0xAFF1 <= code && code <= 0xB00B ) || // Lo [27] HANGUL SYLLABLE GGWEG..HANGUL SYLLABLE GGWEH\n\t\t( 0xB00D <= code && code <= 0xB027 ) || // Lo [27] HANGUL SYLLABLE GGWIG..HANGUL SYLLABLE GGWIH\n\t\t( 0xB029 <= code && code <= 0xB043 ) || // Lo [27] HANGUL SYLLABLE GGYUG..HANGUL SYLLABLE GGYUH\n\t\t( 0xB045 <= code && code <= 0xB05F ) || // Lo [27] HANGUL SYLLABLE GGEUG..HANGUL SYLLABLE GGEUH\n\t\t( 0xB061 <= code && code <= 0xB07B ) || // Lo [27] HANGUL SYLLABLE GGYIG..HANGUL SYLLABLE GGYIH\n\t\t( 0xB07D <= code && code <= 0xB097 ) || // Lo [27] HANGUL SYLLABLE GGIG..HANGUL SYLLABLE GGIH\n\t\t( 0xB099 <= code && code <= 0xB0B3 ) || // Lo [27] HANGUL SYLLABLE NAG..HANGUL SYLLABLE NAH\n\t\t( 0xB0B5 <= code && code <= 0xB0CF ) || // Lo [27] HANGUL SYLLABLE NAEG..HANGUL SYLLABLE NAEH\n\t\t( 0xB0D1 <= code && code <= 0xB0EB ) || // Lo [27] HANGUL SYLLABLE NYAG..HANGUL SYLLABLE NYAH\n\t\t( 0xB0ED <= code && code <= 0xB107 ) || // Lo [27] HANGUL SYLLABLE NYAEG..HANGUL SYLLABLE NYAEH\n\t\t( 0xB109 <= code && code <= 0xB123 ) || // Lo [27] HANGUL SYLLABLE NEOG..HANGUL SYLLABLE NEOH\n\t\t( 0xB125 <= code && code <= 0xB13F ) || // Lo [27] HANGUL SYLLABLE NEG..HANGUL SYLLABLE NEH\n\t\t( 0xB141 <= code && code <= 0xB15B ) || // Lo [27] HANGUL SYLLABLE NYEOG..HANGUL SYLLABLE NYEOH\n\t\t( 0xB15D <= code && code <= 0xB177 ) || // Lo [27] HANGUL SYLLABLE NYEG..HANGUL SYLLABLE NYEH\n\t\t( 0xB179 <= code && code <= 0xB193 ) || // Lo [27] HANGUL SYLLABLE NOG..HANGUL SYLLABLE NOH\n\t\t( 0xB195 <= code && code <= 0xB1AF ) || // Lo [27] HANGUL SYLLABLE NWAG..HANGUL SYLLABLE NWAH\n\t\t( 0xB1B1 <= code && code <= 0xB1CB ) || // Lo [27] HANGUL SYLLABLE NWAEG..HANGUL SYLLABLE NWAEH\n\t\t( 0xB1CD <= code && code <= 0xB1E7 ) || // Lo [27] HANGUL SYLLABLE NOEG..HANGUL SYLLABLE NOEH\n\t\t( 0xB1E9 <= code && code <= 0xB203 ) || // Lo [27] HANGUL SYLLABLE NYOG..HANGUL SYLLABLE NYOH\n\t\t( 0xB205 <= code && code <= 0xB21F ) || // Lo [27] HANGUL SYLLABLE NUG..HANGUL SYLLABLE NUH\n\t\t( 0xB221 <= code && code <= 0xB23B ) || // Lo [27] HANGUL SYLLABLE NWEOG..HANGUL SYLLABLE NWEOH\n\t\t( 0xB23D <= code && code <= 0xB257 ) || // Lo [27] HANGUL SYLLABLE NWEG..HANGUL SYLLABLE NWEH\n\t\t( 0xB259 <= code && code <= 0xB273 ) || // Lo [27] HANGUL SYLLABLE NWIG..HANGUL SYLLABLE NWIH\n\t\t( 0xB275 <= code && code <= 0xB28F ) || // Lo [27] HANGUL SYLLABLE NYUG..HANGUL SYLLABLE NYUH\n\t\t( 0xB291 <= code && code <= 0xB2AB ) || // Lo [27] HANGUL SYLLABLE NEUG..HANGUL SYLLABLE NEUH\n\t\t( 0xB2AD <= code && code <= 0xB2C7 ) || // Lo [27] HANGUL SYLLABLE NYIG..HANGUL SYLLABLE NYIH\n\t\t( 0xB2C9 <= code && code <= 0xB2E3 ) || // Lo [27] HANGUL SYLLABLE NIG..HANGUL SYLLABLE NIH\n\t\t( 0xB2E5 <= code && code <= 0xB2FF ) || // Lo [27] HANGUL SYLLABLE DAG..HANGUL SYLLABLE DAH\n\t\t( 0xB301 <= code && code <= 0xB31B ) || // Lo [27] HANGUL SYLLABLE DAEG..HANGUL SYLLABLE DAEH\n\t\t( 0xB31D <= code && code <= 0xB337 ) || // Lo [27] HANGUL SYLLABLE DYAG..HANGUL SYLLABLE DYAH\n\t\t( 0xB339 <= code && code <= 0xB353 ) || // Lo [27] HANGUL SYLLABLE DYAEG..HANGUL SYLLABLE DYAEH\n\t\t( 0xB355 <= code && code <= 0xB36F ) || // Lo [27] HANGUL SYLLABLE DEOG..HANGUL SYLLABLE DEOH\n\t\t( 0xB371 <= code && code <= 0xB38B ) || // Lo [27] HANGUL SYLLABLE DEG..HANGUL SYLLABLE DEH\n\t\t( 0xB38D <= code && code <= 0xB3A7 ) || // Lo [27] HANGUL SYLLABLE DYEOG..HANGUL SYLLABLE DYEOH\n\t\t( 0xB3A9 <= code && code <= 0xB3C3 ) || // Lo [27] HANGUL SYLLABLE DYEG..HANGUL SYLLABLE DYEH\n\t\t( 0xB3C5 <= code && code <= 0xB3DF ) || // Lo [27] HANGUL SYLLABLE DOG..HANGUL SYLLABLE DOH\n\t\t( 0xB3E1 <= code && code <= 0xB3FB ) || // Lo [27] HANGUL SYLLABLE DWAG..HANGUL SYLLABLE DWAH\n\t\t( 0xB3FD <= code && code <= 0xB417 ) || // Lo [27] HANGUL SYLLABLE DWAEG..HANGUL SYLLABLE DWAEH\n\t\t( 0xB419 <= code && code <= 0xB433 ) || // Lo [27] HANGUL SYLLABLE DOEG..HANGUL SYLLABLE DOEH\n\t\t( 0xB435 <= code && code <= 0xB44F ) || // Lo [27] HANGUL SYLLABLE DYOG..HANGUL SYLLABLE DYOH\n\t\t( 0xB451 <= code && code <= 0xB46B ) || // Lo [27] HANGUL SYLLABLE DUG..HANGUL SYLLABLE DUH\n\t\t( 0xB46D <= code && code <= 0xB487 ) || // Lo [27] HANGUL SYLLABLE DWEOG..HANGUL SYLLABLE DWEOH\n\t\t( 0xB489 <= code && code <= 0xB4A3 ) || // Lo [27] HANGUL SYLLABLE DWEG..HANGUL SYLLABLE DWEH\n\t\t( 0xB4A5 <= code && code <= 0xB4BF ) || // Lo [27] HANGUL SYLLABLE DWIG..HANGUL SYLLABLE DWIH\n\t\t( 0xB4C1 <= code && code <= 0xB4DB ) || // Lo [27] HANGUL SYLLABLE DYUG..HANGUL SYLLABLE DYUH\n\t\t( 0xB4DD <= code && code <= 0xB4F7 ) || // Lo [27] HANGUL SYLLABLE DEUG..HANGUL SYLLABLE DEUH\n\t\t( 0xB4F9 <= code && code <= 0xB513 ) || // Lo [27] HANGUL SYLLABLE DYIG..HANGUL SYLLABLE DYIH\n\t\t( 0xB515 <= code && code <= 0xB52F ) || // Lo [27] HANGUL SYLLABLE DIG..HANGUL SYLLABLE DIH\n\t\t( 0xB531 <= code && code <= 0xB54B ) || // Lo [27] HANGUL SYLLABLE DDAG..HANGUL SYLLABLE DDAH\n\t\t( 0xB54D <= code && code <= 0xB567 ) || // Lo [27] HANGUL SYLLABLE DDAEG..HANGUL SYLLABLE DDAEH\n\t\t( 0xB569 <= code && code <= 0xB583 ) || // Lo [27] HANGUL SYLLABLE DDYAG..HANGUL SYLLABLE DDYAH\n\t\t( 0xB585 <= code && code <= 0xB59F ) || // Lo [27] HANGUL SYLLABLE DDYAEG..HANGUL SYLLABLE DDYAEH\n\t\t( 0xB5A1 <= code && code <= 0xB5BB ) || // Lo [27] HANGUL SYLLABLE DDEOG..HANGUL SYLLABLE DDEOH\n\t\t( 0xB5BD <= code && code <= 0xB5D7 ) || // Lo [27] HANGUL SYLLABLE DDEG..HANGUL SYLLABLE DDEH\n\t\t( 0xB5D9 <= code && code <= 0xB5F3 ) || // Lo [27] HANGUL SYLLABLE DDYEOG..HANGUL SYLLABLE DDYEOH\n\t\t( 0xB5F5 <= code && code <= 0xB60F ) || // Lo [27] HANGUL SYLLABLE DDYEG..HANGUL SYLLABLE DDYEH\n\t\t( 0xB611 <= code && code <= 0xB62B ) || // Lo [27] HANGUL SYLLABLE DDOG..HANGUL SYLLABLE DDOH\n\t\t( 0xB62D <= code && code <= 0xB647 ) || // Lo [27] HANGUL SYLLABLE DDWAG..HANGUL SYLLABLE DDWAH\n\t\t( 0xB649 <= code && code <= 0xB663 ) || // Lo [27] HANGUL SYLLABLE DDWAEG..HANGUL SYLLABLE DDWAEH\n\t\t( 0xB665 <= code && code <= 0xB67F ) || // Lo [27] HANGUL SYLLABLE DDOEG..HANGUL SYLLABLE DDOEH\n\t\t( 0xB681 <= code && code <= 0xB69B ) || // Lo [27] HANGUL SYLLABLE DDYOG..HANGUL SYLLABLE DDYOH\n\t\t( 0xB69D <= code && code <= 0xB6B7 ) || // Lo [27] HANGUL SYLLABLE DDUG..HANGUL SYLLABLE DDUH\n\t\t( 0xB6B9 <= code && code <= 0xB6D3 ) || // Lo [27] HANGUL SYLLABLE DDWEOG..HANGUL SYLLABLE DDWEOH\n\t\t( 0xB6D5 <= code && code <= 0xB6EF ) || // Lo [27] HANGUL SYLLABLE DDWEG..HANGUL SYLLABLE DDWEH\n\t\t( 0xB6F1 <= code && code <= 0xB70B ) || // Lo [27] HANGUL SYLLABLE DDWIG..HANGUL SYLLABLE DDWIH\n\t\t( 0xB70D <= code && code <= 0xB727 ) || // Lo [27] HANGUL SYLLABLE DDYUG..HANGUL SYLLABLE DDYUH\n\t\t( 0xB729 <= code && code <= 0xB743 ) || // Lo [27] HANGUL SYLLABLE DDEUG..HANGUL SYLLABLE DDEUH\n\t\t( 0xB745 <= code && code <= 0xB75F ) || // Lo [27] HANGUL SYLLABLE DDYIG..HANGUL SYLLABLE DDYIH\n\t\t( 0xB761 <= code && code <= 0xB77B ) || // Lo [27] HANGUL SYLLABLE DDIG..HANGUL SYLLABLE DDIH\n\t\t( 0xB77D <= code && code <= 0xB797 ) || // Lo [27] HANGUL SYLLABLE RAG..HANGUL SYLLABLE RAH\n\t\t( 0xB799 <= code && code <= 0xB7B3 ) || // Lo [27] HANGUL SYLLABLE RAEG..HANGUL SYLLABLE RAEH\n\t\t( 0xB7B5 <= code && code <= 0xB7CF ) || // Lo [27] HANGUL SYLLABLE RYAG..HANGUL SYLLABLE RYAH\n\t\t( 0xB7D1 <= code && code <= 0xB7EB ) || // Lo [27] HANGUL SYLLABLE RYAEG..HANGUL SYLLABLE RYAEH\n\t\t( 0xB7ED <= code && code <= 0xB807 ) || // Lo [27] HANGUL SYLLABLE REOG..HANGUL SYLLABLE REOH\n\t\t( 0xB809 <= code && code <= 0xB823 ) || // Lo [27] HANGUL SYLLABLE REG..HANGUL SYLLABLE REH\n\t\t( 0xB825 <= code && code <= 0xB83F ) || // Lo [27] HANGUL SYLLABLE RYEOG..HANGUL SYLLABLE RYEOH\n\t\t( 0xB841 <= code && code <= 0xB85B ) || // Lo [27] HANGUL SYLLABLE RYEG..HANGUL SYLLABLE RYEH\n\t\t( 0xB85D <= code && code <= 0xB877 ) || // Lo [27] HANGUL SYLLABLE ROG..HANGUL SYLLABLE ROH\n\t\t( 0xB879 <= code && code <= 0xB893 ) || // Lo [27] HANGUL SYLLABLE RWAG..HANGUL SYLLABLE RWAH\n\t\t( 0xB895 <= code && code <= 0xB8AF ) || // Lo [27] HANGUL SYLLABLE RWAEG..HANGUL SYLLABLE RWAEH\n\t\t( 0xB8B1 <= code && code <= 0xB8CB ) || // Lo [27] HANGUL SYLLABLE ROEG..HANGUL SYLLABLE ROEH\n\t\t( 0xB8CD <= code && code <= 0xB8E7 ) || // Lo [27] HANGUL SYLLABLE RYOG..HANGUL SYLLABLE RYOH\n\t\t( 0xB8E9 <= code && code <= 0xB903 ) || // Lo [27] HANGUL SYLLABLE RUG..HANGUL SYLLABLE RUH\n\t\t( 0xB905 <= code && code <= 0xB91F ) || // Lo [27] HANGUL SYLLABLE RWEOG..HANGUL SYLLABLE RWEOH\n\t\t( 0xB921 <= code && code <= 0xB93B ) || // Lo [27] HANGUL SYLLABLE RWEG..HANGUL SYLLABLE RWEH\n\t\t( 0xB93D <= code && code <= 0xB957 ) || // Lo [27] HANGUL SYLLABLE RWIG..HANGUL SYLLABLE RWIH\n\t\t( 0xB959 <= code && code <= 0xB973 ) || // Lo [27] HANGUL SYLLABLE RYUG..HANGUL SYLLABLE RYUH\n\t\t( 0xB975 <= code && code <= 0xB98F ) || // Lo [27] HANGUL SYLLABLE REUG..HANGUL SYLLABLE REUH\n\t\t( 0xB991 <= code && code <= 0xB9AB ) || // Lo [27] HANGUL SYLLABLE RYIG..HANGUL SYLLABLE RYIH\n\t\t( 0xB9AD <= code && code <= 0xB9C7 ) || // Lo [27] HANGUL SYLLABLE RIG..HANGUL SYLLABLE RIH\n\t\t( 0xB9C9 <= code && code <= 0xB9E3 ) || // Lo [27] HANGUL SYLLABLE MAG..HANGUL SYLLABLE MAH\n\t\t( 0xB9E5 <= code && code <= 0xB9FF ) || // Lo [27] HANGUL SYLLABLE MAEG..HANGUL SYLLABLE MAEH\n\t\t( 0xBA01 <= code && code <= 0xBA1B ) || // Lo [27] HANGUL SYLLABLE MYAG..HANGUL SYLLABLE MYAH\n\t\t( 0xBA1D <= code && code <= 0xBA37 ) || // Lo [27] HANGUL SYLLABLE MYAEG..HANGUL SYLLABLE MYAEH\n\t\t( 0xBA39 <= code && code <= 0xBA53 ) || // Lo [27] HANGUL SYLLABLE MEOG..HANGUL SYLLABLE MEOH\n\t\t( 0xBA55 <= code && code <= 0xBA6F ) || // Lo [27] HANGUL SYLLABLE MEG..HANGUL SYLLABLE MEH\n\t\t( 0xBA71 <= code && code <= 0xBA8B ) || // Lo [27] HANGUL SYLLABLE MYEOG..HANGUL SYLLABLE MYEOH\n\t\t( 0xBA8D <= code && code <= 0xBAA7 ) || // Lo [27] HANGUL SYLLABLE MYEG..HANGUL SYLLABLE MYEH\n\t\t( 0xBAA9 <= code && code <= 0xBAC3 ) || // Lo [27] HANGUL SYLLABLE MOG..HANGUL SYLLABLE MOH\n\t\t( 0xBAC5 <= code && code <= 0xBADF ) || // Lo [27] HANGUL SYLLABLE MWAG..HANGUL SYLLABLE MWAH\n\t\t( 0xBAE1 <= code && code <= 0xBAFB ) || // Lo [27] HANGUL SYLLABLE MWAEG..HANGUL SYLLABLE MWAEH\n\t\t( 0xBAFD <= code && code <= 0xBB17 ) || // Lo [27] HANGUL SYLLABLE MOEG..HANGUL SYLLABLE MOEH\n\t\t( 0xBB19 <= code && code <= 0xBB33 ) || // Lo [27] HANGUL SYLLABLE MYOG..HANGUL SYLLABLE MYOH\n\t\t( 0xBB35 <= code && code <= 0xBB4F ) || // Lo [27] HANGUL SYLLABLE MUG..HANGUL SYLLABLE MUH\n\t\t( 0xBB51 <= code && code <= 0xBB6B ) || // Lo [27] HANGUL SYLLABLE MWEOG..HANGUL SYLLABLE MWEOH\n\t\t( 0xBB6D <= code && code <= 0xBB87 ) || // Lo [27] HANGUL SYLLABLE MWEG..HANGUL SYLLABLE MWEH\n\t\t( 0xBB89 <= code && code <= 0xBBA3 ) || // Lo [27] HANGUL SYLLABLE MWIG..HANGUL SYLLABLE MWIH\n\t\t( 0xBBA5 <= code && code <= 0xBBBF ) || // Lo [27] HANGUL SYLLABLE MYUG..HANGUL SYLLABLE MYUH\n\t\t( 0xBBC1 <= code && code <= 0xBBDB ) || // Lo [27] HANGUL SYLLABLE MEUG..HANGUL SYLLABLE MEUH\n\t\t( 0xBBDD <= code && code <= 0xBBF7 ) || // Lo [27] HANGUL SYLLABLE MYIG..HANGUL SYLLABLE MYIH\n\t\t( 0xBBF9 <= code && code <= 0xBC13 ) || // Lo [27] HANGUL SYLLABLE MIG..HANGUL SYLLABLE MIH\n\t\t( 0xBC15 <= code && code <= 0xBC2F ) || // Lo [27] HANGUL SYLLABLE BAG..HANGUL SYLLABLE BAH\n\t\t( 0xBC31 <= code && code <= 0xBC4B ) || // Lo [27] HANGUL SYLLABLE BAEG..HANGUL SYLLABLE BAEH\n\t\t( 0xBC4D <= code && code <= 0xBC67 ) || // Lo [27] HANGUL SYLLABLE BYAG..HANGUL SYLLABLE BYAH\n\t\t( 0xBC69 <= code && code <= 0xBC83 ) || // Lo [27] HANGUL SYLLABLE BYAEG..HANGUL SYLLABLE BYAEH\n\t\t( 0xBC85 <= code && code <= 0xBC9F ) || // Lo [27] HANGUL SYLLABLE BEOG..HANGUL SYLLABLE BEOH\n\t\t( 0xBCA1 <= code && code <= 0xBCBB ) || // Lo [27] HANGUL SYLLABLE BEG..HANGUL SYLLABLE BEH\n\t\t( 0xBCBD <= code && code <= 0xBCD7 ) || // Lo [27] HANGUL SYLLABLE BYEOG..HANGUL SYLLABLE BYEOH\n\t\t( 0xBCD9 <= code && code <= 0xBCF3 ) || // Lo [27] HANGUL SYLLABLE BYEG..HANGUL SYLLABLE BYEH\n\t\t( 0xBCF5 <= code && code <= 0xBD0F ) || // Lo [27] HANGUL SYLLABLE BOG..HANGUL SYLLABLE BOH\n\t\t( 0xBD11 <= code && code <= 0xBD2B ) || // Lo [27] HANGUL SYLLABLE BWAG..HANGUL SYLLABLE BWAH\n\t\t( 0xBD2D <= code && code <= 0xBD47 ) || // Lo [27] HANGUL SYLLABLE BWAEG..HANGUL SYLLABLE BWAEH\n\t\t( 0xBD49 <= code && code <= 0xBD63 ) || // Lo [27] HANGUL SYLLABLE BOEG..HANGUL SYLLABLE BOEH\n\t\t( 0xBD65 <= code && code <= 0xBD7F ) || // Lo [27] HANGUL SYLLABLE BYOG..HANGUL SYLLABLE BYOH\n\t\t( 0xBD81 <= code && code <= 0xBD9B ) || // Lo [27] HANGUL SYLLABLE BUG..HANGUL SYLLABLE BUH\n\t\t( 0xBD9D <= code && code <= 0xBDB7 ) || // Lo [27] HANGUL SYLLABLE BWEOG..HANGUL SYLLABLE BWEOH\n\t\t( 0xBDB9 <= code && code <= 0xBDD3 ) || // Lo [27] HANGUL SYLLABLE BWEG..HANGUL SYLLABLE BWEH\n\t\t( 0xBDD5 <= code && code <= 0xBDEF ) || // Lo [27] HANGUL SYLLABLE BWIG..HANGUL SYLLABLE BWIH\n\t\t( 0xBDF1 <= code && code <= 0xBE0B ) || // Lo [27] HANGUL SYLLABLE BYUG..HANGUL SYLLABLE BYUH\n\t\t( 0xBE0D <= code && code <= 0xBE27 ) || // Lo [27] HANGUL SYLLABLE BEUG..HANGUL SYLLABLE BEUH\n\t\t( 0xBE29 <= code && code <= 0xBE43 ) || // Lo [27] HANGUL SYLLABLE BYIG..HANGUL SYLLABLE BYIH\n\t\t( 0xBE45 <= code && code <= 0xBE5F ) || // Lo [27] HANGUL SYLLABLE BIG..HANGUL SYLLABLE BIH\n\t\t( 0xBE61 <= code && code <= 0xBE7B ) || // Lo [27] HANGUL SYLLABLE BBAG..HANGUL SYLLABLE BBAH\n\t\t( 0xBE7D <= code && code <= 0xBE97 ) || // Lo [27] HANGUL SYLLABLE BBAEG..HANGUL SYLLABLE BBAEH\n\t\t( 0xBE99 <= code && code <= 0xBEB3 ) || // Lo [27] HANGUL SYLLABLE BBYAG..HANGUL SYLLABLE BBYAH\n\t\t( 0xBEB5 <= code && code <= 0xBECF ) || // Lo [27] HANGUL SYLLABLE BBYAEG..HANGUL SYLLABLE BBYAEH\n\t\t( 0xBED1 <= code && code <= 0xBEEB ) || // Lo [27] HANGUL SYLLABLE BBEOG..HANGUL SYLLABLE BBEOH\n\t\t( 0xBEED <= code && code <= 0xBF07 ) || // Lo [27] HANGUL SYLLABLE BBEG..HANGUL SYLLABLE BBEH\n\t\t( 0xBF09 <= code && code <= 0xBF23 ) || // Lo [27] HANGUL SYLLABLE BBYEOG..HANGUL SYLLABLE BBYEOH\n\t\t( 0xBF25 <= code && code <= 0xBF3F ) || // Lo [27] HANGUL SYLLABLE BBYEG..HANGUL SYLLABLE BBYEH\n\t\t( 0xBF41 <= code && code <= 0xBF5B ) || // Lo [27] HANGUL SYLLABLE BBOG..HANGUL SYLLABLE BBOH\n\t\t( 0xBF5D <= code && code <= 0xBF77 ) || // Lo [27] HANGUL SYLLABLE BBWAG..HANGUL SYLLABLE BBWAH\n\t\t( 0xBF79 <= code && code <= 0xBF93 ) || // Lo [27] HANGUL SYLLABLE BBWAEG..HANGUL SYLLABLE BBWAEH\n\t\t( 0xBF95 <= code && code <= 0xBFAF ) || // Lo [27] HANGUL SYLLABLE BBOEG..HANGUL SYLLABLE BBOEH\n\t\t( 0xBFB1 <= code && code <= 0xBFCB ) || // Lo [27] HANGUL SYLLABLE BBYOG..HANGUL SYLLABLE BBYOH\n\t\t( 0xBFCD <= code && code <= 0xBFE7 ) || // Lo [27] HANGUL SYLLABLE BBUG..HANGUL SYLLABLE BBUH\n\t\t( 0xBFE9 <= code && code <= 0xC003 ) || // Lo [27] HANGUL SYLLABLE BBWEOG..HANGUL SYLLABLE BBWEOH\n\t\t( 0xC005 <= code && code <= 0xC01F ) || // Lo [27] HANGUL SYLLABLE BBWEG..HANGUL SYLLABLE BBWEH\n\t\t( 0xC021 <= code && code <= 0xC03B ) || // Lo [27] HANGUL SYLLABLE BBWIG..HANGUL SYLLABLE BBWIH\n\t\t( 0xC03D <= code && code <= 0xC057 ) || // Lo [27] HANGUL SYLLABLE BBYUG..HANGUL SYLLABLE BBYUH\n\t\t( 0xC059 <= code && code <= 0xC073 ) || // Lo [27] HANGUL SYLLABLE BBEUG..HANGUL SYLLABLE BBEUH\n\t\t( 0xC075 <= code && code <= 0xC08F ) || // Lo [27] HANGUL SYLLABLE BBYIG..HANGUL SYLLABLE BBYIH\n\t\t( 0xC091 <= code && code <= 0xC0AB ) || // Lo [27] HANGUL SYLLABLE BBIG..HANGUL SYLLABLE BBIH\n\t\t( 0xC0AD <= code && code <= 0xC0C7 ) || // Lo [27] HANGUL SYLLABLE SAG..HANGUL SYLLABLE SAH\n\t\t( 0xC0C9 <= code && code <= 0xC0E3 ) || // Lo [27] HANGUL SYLLABLE SAEG..HANGUL SYLLABLE SAEH\n\t\t( 0xC0E5 <= code && code <= 0xC0FF ) || // Lo [27] HANGUL SYLLABLE SYAG..HANGUL SYLLABLE SYAH\n\t\t( 0xC101 <= code && code <= 0xC11B ) || // Lo [27] HANGUL SYLLABLE SYAEG..HANGUL SYLLABLE SYAEH\n\t\t( 0xC11D <= code && code <= 0xC137 ) || // Lo [27] HANGUL SYLLABLE SEOG..HANGUL SYLLABLE SEOH\n\t\t( 0xC139 <= code && code <= 0xC153 ) || // Lo [27] HANGUL SYLLABLE SEG..HANGUL SYLLABLE SEH\n\t\t( 0xC155 <= code && code <= 0xC16F ) || // Lo [27] HANGUL SYLLABLE SYEOG..HANGUL SYLLABLE SYEOH\n\t\t( 0xC171 <= code && code <= 0xC18B ) || // Lo [27] HANGUL SYLLABLE SYEG..HANGUL SYLLABLE SYEH\n\t\t( 0xC18D <= code && code <= 0xC1A7 ) || // Lo [27] HANGUL SYLLABLE SOG..HANGUL SYLLABLE SOH\n\t\t( 0xC1A9 <= code && code <= 0xC1C3 ) || // Lo [27] HANGUL SYLLABLE SWAG..HANGUL SYLLABLE SWAH\n\t\t( 0xC1C5 <= code && code <= 0xC1DF ) || // Lo [27] HANGUL SYLLABLE SWAEG..HANGUL SYLLABLE SWAEH\n\t\t( 0xC1E1 <= code && code <= 0xC1FB ) || // Lo [27] HANGUL SYLLABLE SOEG..HANGUL SYLLABLE SOEH\n\t\t( 0xC1FD <= code && code <= 0xC217 ) || // Lo [27] HANGUL SYLLABLE SYOG..HANGUL SYLLABLE SYOH\n\t\t( 0xC219 <= code && code <= 0xC233 ) || // Lo [27] HANGUL SYLLABLE SUG..HANGUL SYLLABLE SUH\n\t\t( 0xC235 <= code && code <= 0xC24F ) || // Lo [27] HANGUL SYLLABLE SWEOG..HANGUL SYLLABLE SWEOH\n\t\t( 0xC251 <= code && code <= 0xC26B ) || // Lo [27] HANGUL SYLLABLE SWEG..HANGUL SYLLABLE SWEH\n\t\t( 0xC26D <= code && code <= 0xC287 ) || // Lo [27] HANGUL SYLLABLE SWIG..HANGUL SYLLABLE SWIH\n\t\t( 0xC289 <= code && code <= 0xC2A3 ) || // Lo [27] HANGUL SYLLABLE SYUG..HANGUL SYLLABLE SYUH\n\t\t( 0xC2A5 <= code && code <= 0xC2BF ) || // Lo [27] HANGUL SYLLABLE SEUG..HANGUL SYLLABLE SEUH\n\t\t( 0xC2C1 <= code && code <= 0xC2DB ) || // Lo [27] HANGUL SYLLABLE SYIG..HANGUL SYLLABLE SYIH\n\t\t( 0xC2DD <= code && code <= 0xC2F7 ) || // Lo [27] HANGUL SYLLABLE SIG..HANGUL SYLLABLE SIH\n\t\t( 0xC2F9 <= code && code <= 0xC313 ) || // Lo [27] HANGUL SYLLABLE SSAG..HANGUL SYLLABLE SSAH\n\t\t( 0xC315 <= code && code <= 0xC32F ) || // Lo [27] HANGUL SYLLABLE SSAEG..HANGUL SYLLABLE SSAEH\n\t\t( 0xC331 <= code && code <= 0xC34B ) || // Lo [27] HANGUL SYLLABLE SSYAG..HANGUL SYLLABLE SSYAH\n\t\t( 0xC34D <= code && code <= 0xC367 ) || // Lo [27] HANGUL SYLLABLE SSYAEG..HANGUL SYLLABLE SSYAEH\n\t\t( 0xC369 <= code && code <= 0xC383 ) || // Lo [27] HANGUL SYLLABLE SSEOG..HANGUL SYLLABLE SSEOH\n\t\t( 0xC385 <= code && code <= 0xC39F ) || // Lo [27] HANGUL SYLLABLE SSEG..HANGUL SYLLABLE SSEH\n\t\t( 0xC3A1 <= code && code <= 0xC3BB ) || // Lo [27] HANGUL SYLLABLE SSYEOG..HANGUL SYLLABLE SSYEOH\n\t\t( 0xC3BD <= code && code <= 0xC3D7 ) || // Lo [27] HANGUL SYLLABLE SSYEG..HANGUL SYLLABLE SSYEH\n\t\t( 0xC3D9 <= code && code <= 0xC3F3 ) || // Lo [27] HANGUL SYLLABLE SSOG..HANGUL SYLLABLE SSOH\n\t\t( 0xC3F5 <= code && code <= 0xC40F ) || // Lo [27] HANGUL SYLLABLE SSWAG..HANGUL SYLLABLE SSWAH\n\t\t( 0xC411 <= code && code <= 0xC42B ) || // Lo [27] HANGUL SYLLABLE SSWAEG..HANGUL SYLLABLE SSWAEH\n\t\t( 0xC42D <= code && code <= 0xC447 ) || // Lo [27] HANGUL SYLLABLE SSOEG..HANGUL SYLLABLE SSOEH\n\t\t( 0xC449 <= code && code <= 0xC463 ) || // Lo [27] HANGUL SYLLABLE SSYOG..HANGUL SYLLABLE SSYOH\n\t\t( 0xC465 <= code && code <= 0xC47F ) || // Lo [27] HANGUL SYLLABLE SSUG..HANGUL SYLLABLE SSUH\n\t\t( 0xC481 <= code && code <= 0xC49B ) || // Lo [27] HANGUL SYLLABLE SSWEOG..HANGUL SYLLABLE SSWEOH\n\t\t( 0xC49D <= code && code <= 0xC4B7 ) || // Lo [27] HANGUL SYLLABLE SSWEG..HANGUL SYLLABLE SSWEH\n\t\t( 0xC4B9 <= code && code <= 0xC4D3 ) || // Lo [27] HANGUL SYLLABLE SSWIG..HANGUL SYLLABLE SSWIH\n\t\t( 0xC4D5 <= code && code <= 0xC4EF ) || // Lo [27] HANGUL SYLLABLE SSYUG..HANGUL SYLLABLE SSYUH\n\t\t( 0xC4F1 <= code && code <= 0xC50B ) || // Lo [27] HANGUL SYLLABLE SSEUG..HANGUL SYLLABLE SSEUH\n\t\t( 0xC50D <= code && code <= 0xC527 ) || // Lo [27] HANGUL SYLLABLE SSYIG..HANGUL SYLLABLE SSYIH\n\t\t( 0xC529 <= code && code <= 0xC543 ) || // Lo [27] HANGUL SYLLABLE SSIG..HANGUL SYLLABLE SSIH\n\t\t( 0xC545 <= code && code <= 0xC55F ) || // Lo [27] HANGUL SYLLABLE AG..HANGUL SYLLABLE AH\n\t\t( 0xC561 <= code && code <= 0xC57B ) || // Lo [27] HANGUL SYLLABLE AEG..HANGUL SYLLABLE AEH\n\t\t( 0xC57D <= code && code <= 0xC597 ) || // Lo [27] HANGUL SYLLABLE YAG..HANGUL SYLLABLE YAH\n\t\t( 0xC599 <= code && code <= 0xC5B3 ) || // Lo [27] HANGUL SYLLABLE YAEG..HANGUL SYLLABLE YAEH\n\t\t( 0xC5B5 <= code && code <= 0xC5CF ) || // Lo [27] HANGUL SYLLABLE EOG..HANGUL SYLLABLE EOH\n\t\t( 0xC5D1 <= code && code <= 0xC5EB ) || // Lo [27] HANGUL SYLLABLE EG..HANGUL SYLLABLE EH\n\t\t( 0xC5ED <= code && code <= 0xC607 ) || // Lo [27] HANGUL SYLLABLE YEOG..HANGUL SYLLABLE YEOH\n\t\t( 0xC609 <= code && code <= 0xC623 ) || // Lo [27] HANGUL SYLLABLE YEG..HANGUL SYLLABLE YEH\n\t\t( 0xC625 <= code && code <= 0xC63F ) || // Lo [27] HANGUL SYLLABLE OG..HANGUL SYLLABLE OH\n\t\t( 0xC641 <= code && code <= 0xC65B ) || // Lo [27] HANGUL SYLLABLE WAG..HANGUL SYLLABLE WAH\n\t\t( 0xC65D <= code && code <= 0xC677 ) || // Lo [27] HANGUL SYLLABLE WAEG..HANGUL SYLLABLE WAEH\n\t\t( 0xC679 <= code && code <= 0xC693 ) || // Lo [27] HANGUL SYLLABLE OEG..HANGUL SYLLABLE OEH\n\t\t( 0xC695 <= code && code <= 0xC6AF ) || // Lo [27] HANGUL SYLLABLE YOG..HANGUL SYLLABLE YOH\n\t\t( 0xC6B1 <= code && code <= 0xC6CB ) || // Lo [27] HANGUL SYLLABLE UG..HANGUL SYLLABLE UH\n\t\t( 0xC6CD <= code && code <= 0xC6E7 ) || // Lo [27] HANGUL SYLLABLE WEOG..HANGUL SYLLABLE WEOH\n\t\t( 0xC6E9 <= code && code <= 0xC703 ) || // Lo [27] HANGUL SYLLABLE WEG..HANGUL SYLLABLE WEH\n\t\t( 0xC705 <= code && code <= 0xC71F ) || // Lo [27] HANGUL SYLLABLE WIG..HANGUL SYLLABLE WIH\n\t\t( 0xC721 <= code && code <= 0xC73B ) || // Lo [27] HANGUL SYLLABLE YUG..HANGUL SYLLABLE YUH\n\t\t( 0xC73D <= code && code <= 0xC757 ) || // Lo [27] HANGUL SYLLABLE EUG..HANGUL SYLLABLE EUH\n\t\t( 0xC759 <= code && code <= 0xC773 ) || // Lo [27] HANGUL SYLLABLE YIG..HANGUL SYLLABLE YIH\n\t\t( 0xC775 <= code && code <= 0xC78F ) || // Lo [27] HANGUL SYLLABLE IG..HANGUL SYLLABLE IH\n\t\t( 0xC791 <= code && code <= 0xC7AB ) || // Lo [27] HANGUL SYLLABLE JAG..HANGUL SYLLABLE JAH\n\t\t( 0xC7AD <= code && code <= 0xC7C7 ) || // Lo [27] HANGUL SYLLABLE JAEG..HANGUL SYLLABLE JAEH\n\t\t( 0xC7C9 <= code && code <= 0xC7E3 ) || // Lo [27] HANGUL SYLLABLE JYAG..HANGUL SYLLABLE JYAH\n\t\t( 0xC7E5 <= code && code <= 0xC7FF ) || // Lo [27] HANGUL SYLLABLE JYAEG..HANGUL SYLLABLE JYAEH\n\t\t( 0xC801 <= code && code <= 0xC81B ) || // Lo [27] HANGUL SYLLABLE JEOG..HANGUL SYLLABLE JEOH\n\t\t( 0xC81D <= code && code <= 0xC837 ) || // Lo [27] HANGUL SYLLABLE JEG..HANGUL SYLLABLE JEH\n\t\t( 0xC839 <= code && code <= 0xC853 ) || // Lo [27] HANGUL SYLLABLE JYEOG..HANGUL SYLLABLE JYEOH\n\t\t( 0xC855 <= code && code <= 0xC86F ) || // Lo [27] HANGUL SYLLABLE JYEG..HANGUL SYLLABLE JYEH\n\t\t( 0xC871 <= code && code <= 0xC88B ) || // Lo [27] HANGUL SYLLABLE JOG..HANGUL SYLLABLE JOH\n\t\t( 0xC88D <= code && code <= 0xC8A7 ) || // Lo [27] HANGUL SYLLABLE JWAG..HANGUL SYLLABLE JWAH\n\t\t( 0xC8A9 <= code && code <= 0xC8C3 ) || // Lo [27] HANGUL SYLLABLE JWAEG..HANGUL SYLLABLE JWAEH\n\t\t( 0xC8C5 <= code && code <= 0xC8DF ) || // Lo [27] HANGUL SYLLABLE JOEG..HANGUL SYLLABLE JOEH\n\t\t( 0xC8E1 <= code && code <= 0xC8FB ) || // Lo [27] HANGUL SYLLABLE JYOG..HANGUL SYLLABLE JYOH\n\t\t( 0xC8FD <= code && code <= 0xC917 ) || // Lo [27] HANGUL SYLLABLE JUG..HANGUL SYLLABLE JUH\n\t\t( 0xC919 <= code && code <= 0xC933 ) || // Lo [27] HANGUL SYLLABLE JWEOG..HANGUL SYLLABLE JWEOH\n\t\t( 0xC935 <= code && code <= 0xC94F ) || // Lo [27] HANGUL SYLLABLE JWEG..HANGUL SYLLABLE JWEH\n\t\t( 0xC951 <= code && code <= 0xC96B ) || // Lo [27] HANGUL SYLLABLE JWIG..HANGUL SYLLABLE JWIH\n\t\t( 0xC96D <= code && code <= 0xC987 ) || // Lo [27] HANGUL SYLLABLE JYUG..HANGUL SYLLABLE JYUH\n\t\t( 0xC989 <= code && code <= 0xC9A3 ) || // Lo [27] HANGUL SYLLABLE JEUG..HANGUL SYLLABLE JEUH\n\t\t( 0xC9A5 <= code && code <= 0xC9BF ) || // Lo [27] HANGUL SYLLABLE JYIG..HANGUL SYLLABLE JYIH\n\t\t( 0xC9C1 <= code && code <= 0xC9DB ) || // Lo [27] HANGUL SYLLABLE JIG..HANGUL SYLLABLE JIH\n\t\t( 0xC9DD <= code && code <= 0xC9F7 ) || // Lo [27] HANGUL SYLLABLE JJAG..HANGUL SYLLABLE JJAH\n\t\t( 0xC9F9 <= code && code <= 0xCA13 ) || // Lo [27] HANGUL SYLLABLE JJAEG..HANGUL SYLLABLE JJAEH\n\t\t( 0xCA15 <= code && code <= 0xCA2F ) || // Lo [27] HANGUL SYLLABLE JJYAG..HANGUL SYLLABLE JJYAH\n\t\t( 0xCA31 <= code && code <= 0xCA4B ) || // Lo [27] HANGUL SYLLABLE JJYAEG..HANGUL SYLLABLE JJYAEH\n\t\t( 0xCA4D <= code && code <= 0xCA67 ) || // Lo [27] HANGUL SYLLABLE JJEOG..HANGUL SYLLABLE JJEOH\n\t\t( 0xCA69 <= code && code <= 0xCA83 ) || // Lo [27] HANGUL SYLLABLE JJEG..HANGUL SYLLABLE JJEH\n\t\t( 0xCA85 <= code && code <= 0xCA9F ) || // Lo [27] HANGUL SYLLABLE JJYEOG..HANGUL SYLLABLE JJYEOH\n\t\t( 0xCAA1 <= code && code <= 0xCABB ) || // Lo [27] HANGUL SYLLABLE JJYEG..HANGUL SYLLABLE JJYEH\n\t\t( 0xCABD <= code && code <= 0xCAD7 ) || // Lo [27] HANGUL SYLLABLE JJOG..HANGUL SYLLABLE JJOH\n\t\t( 0xCAD9 <= code && code <= 0xCAF3 ) || // Lo [27] HANGUL SYLLABLE JJWAG..HANGUL SYLLABLE JJWAH\n\t\t( 0xCAF5 <= code && code <= 0xCB0F ) || // Lo [27] HANGUL SYLLABLE JJWAEG..HANGUL SYLLABLE JJWAEH\n\t\t( 0xCB11 <= code && code <= 0xCB2B ) || // Lo [27] HANGUL SYLLABLE JJOEG..HANGUL SYLLABLE JJOEH\n\t\t( 0xCB2D <= code && code <= 0xCB47 ) || // Lo [27] HANGUL SYLLABLE JJYOG..HANGUL SYLLABLE JJYOH\n\t\t( 0xCB49 <= code && code <= 0xCB63 ) || // Lo [27] HANGUL SYLLABLE JJUG..HANGUL SYLLABLE JJUH\n\t\t( 0xCB65 <= code && code <= 0xCB7F ) || // Lo [27] HANGUL SYLLABLE JJWEOG..HANGUL SYLLABLE JJWEOH\n\t\t( 0xCB81 <= code && code <= 0xCB9B ) || // Lo [27] HANGUL SYLLABLE JJWEG..HANGUL SYLLABLE JJWEH\n\t\t( 0xCB9D <= code && code <= 0xCBB7 ) || // Lo [27] HANGUL SYLLABLE JJWIG..HANGUL SYLLABLE JJWIH\n\t\t( 0xCBB9 <= code && code <= 0xCBD3 ) || // Lo [27] HANGUL SYLLABLE JJYUG..HANGUL SYLLABLE JJYUH\n\t\t( 0xCBD5 <= code && code <= 0xCBEF ) || // Lo [27] HANGUL SYLLABLE JJEUG..HANGUL SYLLABLE JJEUH\n\t\t( 0xCBF1 <= code && code <= 0xCC0B ) || // Lo [27] HANGUL SYLLABLE JJYIG..HANGUL SYLLABLE JJYIH\n\t\t( 0xCC0D <= code && code <= 0xCC27 ) || // Lo [27] HANGUL SYLLABLE JJIG..HANGUL SYLLABLE JJIH\n\t\t( 0xCC29 <= code && code <= 0xCC43 ) || // Lo [27] HANGUL SYLLABLE CAG..HANGUL SYLLABLE CAH\n\t\t( 0xCC45 <= code && code <= 0xCC5F ) || // Lo [27] HANGUL SYLLABLE CAEG..HANGUL SYLLABLE CAEH\n\t\t( 0xCC61 <= code && code <= 0xCC7B ) || // Lo [27] HANGUL SYLLABLE CYAG..HANGUL SYLLABLE CYAH\n\t\t( 0xCC7D <= code && code <= 0xCC97 ) || // Lo [27] HANGUL SYLLABLE CYAEG..HANGUL SYLLABLE CYAEH\n\t\t( 0xCC99 <= code && code <= 0xCCB3 ) || // Lo [27] HANGUL SYLLABLE CEOG..HANGUL SYLLABLE CEOH\n\t\t( 0xCCB5 <= code && code <= 0xCCCF ) || // Lo [27] HANGUL SYLLABLE CEG..HANGUL SYLLABLE CEH\n\t\t( 0xCCD1 <= code && code <= 0xCCEB ) || // Lo [27] HANGUL SYLLABLE CYEOG..HANGUL SYLLABLE CYEOH\n\t\t( 0xCCED <= code && code <= 0xCD07 ) || // Lo [27] HANGUL SYLLABLE CYEG..HANGUL SYLLABLE CYEH\n\t\t( 0xCD09 <= code && code <= 0xCD23 ) || // Lo [27] HANGUL SYLLABLE COG..HANGUL SYLLABLE COH\n\t\t( 0xCD25 <= code && code <= 0xCD3F ) || // Lo [27] HANGUL SYLLABLE CWAG..HANGUL SYLLABLE CWAH\n\t\t( 0xCD41 <= code && code <= 0xCD5B ) || // Lo [27] HANGUL SYLLABLE CWAEG..HANGUL SYLLABLE CWAEH\n\t\t( 0xCD5D <= code && code <= 0xCD77 ) || // Lo [27] HANGUL SYLLABLE COEG..HANGUL SYLLABLE COEH\n\t\t( 0xCD79 <= code && code <= 0xCD93 ) || // Lo [27] HANGUL SYLLABLE CYOG..HANGUL SYLLABLE CYOH\n\t\t( 0xCD95 <= code && code <= 0xCDAF ) || // Lo [27] HANGUL SYLLABLE CUG..HANGUL SYLLABLE CUH\n\t\t( 0xCDB1 <= code && code <= 0xCDCB ) || // Lo [27] HANGUL SYLLABLE CWEOG..HANGUL SYLLABLE CWEOH\n\t\t( 0xCDCD <= code && code <= 0xCDE7 ) || // Lo [27] HANGUL SYLLABLE CWEG..HANGUL SYLLABLE CWEH\n\t\t( 0xCDE9 <= code && code <= 0xCE03 ) || // Lo [27] HANGUL SYLLABLE CWIG..HANGUL SYLLABLE CWIH\n\t\t( 0xCE05 <= code && code <= 0xCE1F ) || // Lo [27] HANGUL SYLLABLE CYUG..HANGUL SYLLABLE CYUH\n\t\t( 0xCE21 <= code && code <= 0xCE3B ) || // Lo [27] HANGUL SYLLABLE CEUG..HANGUL SYLLABLE CEUH\n\t\t( 0xCE3D <= code && code <= 0xCE57 ) || // Lo [27] HANGUL SYLLABLE CYIG..HANGUL SYLLABLE CYIH\n\t\t( 0xCE59 <= code && code <= 0xCE73 ) || // Lo [27] HANGUL SYLLABLE CIG..HANGUL SYLLABLE CIH\n\t\t( 0xCE75 <= code && code <= 0xCE8F ) || // Lo [27] HANGUL SYLLABLE KAG..HANGUL SYLLABLE KAH\n\t\t( 0xCE91 <= code && code <= 0xCEAB ) || // Lo [27] HANGUL SYLLABLE KAEG..HANGUL SYLLABLE KAEH\n\t\t( 0xCEAD <= code && code <= 0xCEC7 ) || // Lo [27] HANGUL SYLLABLE KYAG..HANGUL SYLLABLE KYAH\n\t\t( 0xCEC9 <= code && code <= 0xCEE3 ) || // Lo [27] HANGUL SYLLABLE KYAEG..HANGUL SYLLABLE KYAEH\n\t\t( 0xCEE5 <= code && code <= 0xCEFF ) || // Lo [27] HANGUL SYLLABLE KEOG..HANGUL SYLLABLE KEOH\n\t\t( 0xCF01 <= code && code <= 0xCF1B ) || // Lo [27] HANGUL SYLLABLE KEG..HANGUL SYLLABLE KEH\n\t\t( 0xCF1D <= code && code <= 0xCF37 ) || // Lo [27] HANGUL SYLLABLE KYEOG..HANGUL SYLLABLE KYEOH\n\t\t( 0xCF39 <= code && code <= 0xCF53 ) || // Lo [27] HANGUL SYLLABLE KYEG..HANGUL SYLLABLE KYEH\n\t\t( 0xCF55 <= code && code <= 0xCF6F ) || // Lo [27] HANGUL SYLLABLE KOG..HANGUL SYLLABLE KOH\n\t\t( 0xCF71 <= code && code <= 0xCF8B ) || // Lo [27] HANGUL SYLLABLE KWAG..HANGUL SYLLABLE KWAH\n\t\t( 0xCF8D <= code && code <= 0xCFA7 ) || // Lo [27] HANGUL SYLLABLE KWAEG..HANGUL SYLLABLE KWAEH\n\t\t( 0xCFA9 <= code && code <= 0xCFC3 ) || // Lo [27] HANGUL SYLLABLE KOEG..HANGUL SYLLABLE KOEH\n\t\t( 0xCFC5 <= code && code <= 0xCFDF ) || // Lo [27] HANGUL SYLLABLE KYOG..HANGUL SYLLABLE KYOH\n\t\t( 0xCFE1 <= code && code <= 0xCFFB ) || // Lo [27] HANGUL SYLLABLE KUG..HANGUL SYLLABLE KUH\n\t\t( 0xCFFD <= code && code <= 0xD017 ) || // Lo [27] HANGUL SYLLABLE KWEOG..HANGUL SYLLABLE KWEOH\n\t\t( 0xD019 <= code && code <= 0xD033 ) || // Lo [27] HANGUL SYLLABLE KWEG..HANGUL SYLLABLE KWEH\n\t\t( 0xD035 <= code && code <= 0xD04F ) || // Lo [27] HANGUL SYLLABLE KWIG..HANGUL SYLLABLE KWIH\n\t\t( 0xD051 <= code && code <= 0xD06B ) || // Lo [27] HANGUL SYLLABLE KYUG..HANGUL SYLLABLE KYUH\n\t\t( 0xD06D <= code && code <= 0xD087 ) || // Lo [27] HANGUL SYLLABLE KEUG..HANGUL SYLLABLE KEUH\n\t\t( 0xD089 <= code && code <= 0xD0A3 ) || // Lo [27] HANGUL SYLLABLE KYIG..HANGUL SYLLABLE KYIH\n\t\t( 0xD0A5 <= code && code <= 0xD0BF ) || // Lo [27] HANGUL SYLLABLE KIG..HANGUL SYLLABLE KIH\n\t\t( 0xD0C1 <= code && code <= 0xD0DB ) || // Lo [27] HANGUL SYLLABLE TAG..HANGUL SYLLABLE TAH\n\t\t( 0xD0DD <= code && code <= 0xD0F7 ) || // Lo [27] HANGUL SYLLABLE TAEG..HANGUL SYLLABLE TAEH\n\t\t( 0xD0F9 <= code && code <= 0xD113 ) || // Lo [27] HANGUL SYLLABLE TYAG..HANGUL SYLLABLE TYAH\n\t\t( 0xD115 <= code && code <= 0xD12F ) || // Lo [27] HANGUL SYLLABLE TYAEG..HANGUL SYLLABLE TYAEH\n\t\t( 0xD131 <= code && code <= 0xD14B ) || // Lo [27] HANGUL SYLLABLE TEOG..HANGUL SYLLABLE TEOH\n\t\t( 0xD14D <= code && code <= 0xD167 ) || // Lo [27] HANGUL SYLLABLE TEG..HANGUL SYLLABLE TEH\n\t\t( 0xD169 <= code && code <= 0xD183 ) || // Lo [27] HANGUL SYLLABLE TYEOG..HANGUL SYLLABLE TYEOH\n\t\t( 0xD185 <= code && code <= 0xD19F ) || // Lo [27] HANGUL SYLLABLE TYEG..HANGUL SYLLABLE TYEH\n\t\t( 0xD1A1 <= code && code <= 0xD1BB ) || // Lo [27] HANGUL SYLLABLE TOG..HANGUL SYLLABLE TOH\n\t\t( 0xD1BD <= code && code <= 0xD1D7 ) || // Lo [27] HANGUL SYLLABLE TWAG..HANGUL SYLLABLE TWAH\n\t\t( 0xD1D9 <= code && code <= 0xD1F3 ) || // Lo [27] HANGUL SYLLABLE TWAEG..HANGUL SYLLABLE TWAEH\n\t\t( 0xD1F5 <= code && code <= 0xD20F ) || // Lo [27] HANGUL SYLLABLE TOEG..HANGUL SYLLABLE TOEH\n\t\t( 0xD211 <= code && code <= 0xD22B ) || // Lo [27] HANGUL SYLLABLE TYOG..HANGUL SYLLABLE TYOH\n\t\t( 0xD22D <= code && code <= 0xD247 ) || // Lo [27] HANGUL SYLLABLE TUG..HANGUL SYLLABLE TUH\n\t\t( 0xD249 <= code && code <= 0xD263 ) || // Lo [27] HANGUL SYLLABLE TWEOG..HANGUL SYLLABLE TWEOH\n\t\t( 0xD265 <= code && code <= 0xD27F ) || // Lo [27] HANGUL SYLLABLE TWEG..HANGUL SYLLABLE TWEH\n\t\t( 0xD281 <= code && code <= 0xD29B ) || // Lo [27] HANGUL SYLLABLE TWIG..HANGUL SYLLABLE TWIH\n\t\t( 0xD29D <= code && code <= 0xD2B7 ) || // Lo [27] HANGUL SYLLABLE TYUG..HANGUL SYLLABLE TYUH\n\t\t( 0xD2B9 <= code && code <= 0xD2D3 ) || // Lo [27] HANGUL SYLLABLE TEUG..HANGUL SYLLABLE TEUH\n\t\t( 0xD2D5 <= code && code <= 0xD2EF ) || // Lo [27] HANGUL SYLLABLE TYIG..HANGUL SYLLABLE TYIH\n\t\t( 0xD2F1 <= code && code <= 0xD30B ) || // Lo [27] HANGUL SYLLABLE TIG..HANGUL SYLLABLE TIH\n\t\t( 0xD30D <= code && code <= 0xD327 ) || // Lo [27] HANGUL SYLLABLE PAG..HANGUL SYLLABLE PAH\n\t\t( 0xD329 <= code && code <= 0xD343 ) || // Lo [27] HANGUL SYLLABLE PAEG..HANGUL SYLLABLE PAEH\n\t\t( 0xD345 <= code && code <= 0xD35F ) || // Lo [27] HANGUL SYLLABLE PYAG..HANGUL SYLLABLE PYAH\n\t\t( 0xD361 <= code && code <= 0xD37B ) || // Lo [27] HANGUL SYLLABLE PYAEG..HANGUL SYLLABLE PYAEH\n\t\t( 0xD37D <= code && code <= 0xD397 ) || // Lo [27] HANGUL SYLLABLE PEOG..HANGUL SYLLABLE PEOH\n\t\t( 0xD399 <= code && code <= 0xD3B3 ) || // Lo [27] HANGUL SYLLABLE PEG..HANGUL SYLLABLE PEH\n\t\t( 0xD3B5 <= code && code <= 0xD3CF ) || // Lo [27] HANGUL SYLLABLE PYEOG..HANGUL SYLLABLE PYEOH\n\t\t( 0xD3D1 <= code && code <= 0xD3EB ) || // Lo [27] HANGUL SYLLABLE PYEG..HANGUL SYLLABLE PYEH\n\t\t( 0xD3ED <= code && code <= 0xD407 ) || // Lo [27] HANGUL SYLLABLE POG..HANGUL SYLLABLE POH\n\t\t( 0xD409 <= code && code <= 0xD423 ) || // Lo [27] HANGUL SYLLABLE PWAG..HANGUL SYLLABLE PWAH\n\t\t( 0xD425 <= code && code <= 0xD43F ) || // Lo [27] HANGUL SYLLABLE PWAEG..HANGUL SYLLABLE PWAEH\n\t\t( 0xD441 <= code && code <= 0xD45B ) || // Lo [27] HANGUL SYLLABLE POEG..HANGUL SYLLABLE POEH\n\t\t( 0xD45D <= code && code <= 0xD477 ) || // Lo [27] HANGUL SYLLABLE PYOG..HANGUL SYLLABLE PYOH\n\t\t( 0xD479 <= code && code <= 0xD493 ) || // Lo [27] HANGUL SYLLABLE PUG..HANGUL SYLLABLE PUH\n\t\t( 0xD495 <= code && code <= 0xD4AF ) || // Lo [27] HANGUL SYLLABLE PWEOG..HANGUL SYLLABLE PWEOH\n\t\t( 0xD4B1 <= code && code <= 0xD4CB ) || // Lo [27] HANGUL SYLLABLE PWEG..HANGUL SYLLABLE PWEH\n\t\t( 0xD4CD <= code && code <= 0xD4E7 ) || // Lo [27] HANGUL SYLLABLE PWIG..HANGUL SYLLABLE PWIH\n\t\t( 0xD4E9 <= code && code <= 0xD503 ) || // Lo [27] HANGUL SYLLABLE PYUG..HANGUL SYLLABLE PYUH\n\t\t( 0xD505 <= code && code <= 0xD51F ) || // Lo [27] HANGUL SYLLABLE PEUG..HANGUL SYLLABLE PEUH\n\t\t( 0xD521 <= code && code <= 0xD53B ) || // Lo [27] HANGUL SYLLABLE PYIG..HANGUL SYLLABLE PYIH\n\t\t( 0xD53D <= code && code <= 0xD557 ) || // Lo [27] HANGUL SYLLABLE PIG..HANGUL SYLLABLE PIH\n\t\t( 0xD559 <= code && code <= 0xD573 ) || // Lo [27] HANGUL SYLLABLE HAG..HANGUL SYLLABLE HAH\n\t\t( 0xD575 <= code && code <= 0xD58F ) || // Lo [27] HANGUL SYLLABLE HAEG..HANGUL SYLLABLE HAEH\n\t\t( 0xD591 <= code && code <= 0xD5AB ) || // Lo [27] HANGUL SYLLABLE HYAG..HANGUL SYLLABLE HYAH\n\t\t( 0xD5AD <= code && code <= 0xD5C7 ) || // Lo [27] HANGUL SYLLABLE HYAEG..HANGUL SYLLABLE HYAEH\n\t\t( 0xD5C9 <= code && code <= 0xD5E3 ) || // Lo [27] HANGUL SYLLABLE HEOG..HANGUL SYLLABLE HEOH\n\t\t( 0xD5E5 <= code && code <= 0xD5FF ) || // Lo [27] HANGUL SYLLABLE HEG..HANGUL SYLLABLE HEH\n\t\t( 0xD601 <= code && code <= 0xD61B ) || // Lo [27] HANGUL SYLLABLE HYEOG..HANGUL SYLLABLE HYEOH\n\t\t( 0xD61D <= code && code <= 0xD637 ) || // Lo [27] HANGUL SYLLABLE HYEG..HANGUL SYLLABLE HYEH\n\t\t( 0xD639 <= code && code <= 0xD653 ) || // Lo [27] HANGUL SYLLABLE HOG..HANGUL SYLLABLE HOH\n\t\t( 0xD655 <= code && code <= 0xD66F ) || // Lo [27] HANGUL SYLLABLE HWAG..HANGUL SYLLABLE HWAH\n\t\t( 0xD671 <= code && code <= 0xD68B ) || // Lo [27] HANGUL SYLLABLE HWAEG..HANGUL SYLLABLE HWAEH\n\t\t( 0xD68D <= code && code <= 0xD6A7 ) || // Lo [27] HANGUL SYLLABLE HOEG..HANGUL SYLLABLE HOEH\n\t\t( 0xD6A9 <= code && code <= 0xD6C3 ) || // Lo [27] HANGUL SYLLABLE HYOG..HANGUL SYLLABLE HYOH\n\t\t( 0xD6C5 <= code && code <= 0xD6DF ) || // Lo [27] HANGUL SYLLABLE HUG..HANGUL SYLLABLE HUH\n\t\t( 0xD6E1 <= code && code <= 0xD6FB ) || // Lo [27] HANGUL SYLLABLE HWEOG..HANGUL SYLLABLE HWEOH\n\t\t( 0xD6FD <= code && code <= 0xD717 ) || // Lo [27] HANGUL SYLLABLE HWEG..HANGUL SYLLABLE HWEH\n\t\t( 0xD719 <= code && code <= 0xD733 ) || // Lo [27] HANGUL SYLLABLE HWIG..HANGUL SYLLABLE HWIH\n\t\t( 0xD735 <= code && code <= 0xD74F ) || // Lo [27] HANGUL SYLLABLE HYUG..HANGUL SYLLABLE HYUH\n\t\t( 0xD751 <= code && code <= 0xD76B ) || // Lo [27] HANGUL SYLLABLE HEUG..HANGUL SYLLABLE HEUH\n\t\t( 0xD76D <= code && code <= 0xD787 ) || // Lo [27] HANGUL SYLLABLE HYIG..HANGUL SYLLABLE HYIH\n\t\t( 0xD789 <= code && code <= 0xD7A3 ) // Lo [27] HANGUL SYLLABLE HIG..HANGUL SYLLABLE HIH\n\t) {\n\t\treturn constants.LVT;\n\t}\n\tif (\n\t\tcode === 0x200D // Cf ZERO WIDTH JOINER\n\t) {\n\t\treturn constants.ZWJ;\n\t}\n\t// All unlisted characters have a grapheme break property of \"Other\":\n\treturn constants.Other;\n}\n\n\n// EXPORTS //\n\nexport default graphemeBreakProperty;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport codePointAt from './../../code-point-at';\nimport hasUTF16SurrogatePairAt from '@stdlib/assert/has-utf16-surrogate-pair-at';\nimport grapheme from './../../tools/grapheme-cluster-break';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar breakType = grapheme.breakType;\nvar breakProperty = grapheme.breakProperty;\nvar emojiProperty = grapheme.emojiProperty;\n\n\n// MAIN //\n\n/**\n* Returns the next extended grapheme cluster break in a string after a specified position.\n*\n* @param {string} str - input string\n* @param {integer} [fromIndex=0] - position\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be an integer\n* @returns {NonNegativeInteger} next grapheme break position\n*\n* @example\n* var out = nextGraphemeClusterBreak( 'last man standing', 4 );\n* // returns 5\n*\n* @example\n* var out = nextGraphemeClusterBreak( 'presidential election', 8 );\n* // returns 9\n*\n* @example\n* var out = nextGraphemeClusterBreak( 'अनुच्छेद', 1 );\n* // returns 3\n*\n* @example\n* var out = nextGraphemeClusterBreak( '🌷' );\n* // returns -1\n*/\nfunction nextGraphemeClusterBreak( str, fromIndex ) {\n\tvar breaks;\n\tvar emoji;\n\tvar len;\n\tvar idx;\n\tvar cp;\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\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\tidx = fromIndex;\n\t} else {\n\t\tidx = 0;\n\t}\n\tlen = str.length;\n\tif ( idx < 0 ) {\n\t\tidx += len;\n\t\tif ( idx < 0 ) {\n\t\t\tidx = 0;\n\t\t}\n\t}\n\tif ( len === 0 || idx >= len ) {\n\t\treturn -1;\n\t}\n\t// Initialize caches for storing grapheme break and emoji properties:\n\tbreaks = [];\n\temoji = [];\n\n\t// Get the code point for the starting index:\n\tcp = codePointAt( str, idx );\n\n\t// Get the corresponding grapheme break and emoji properties:\n\tbreaks.push( breakProperty( cp ) );\n\temoji.push( emojiProperty( cp ) );\n\n\t// Begin searching for the next grapheme cluster break...\n\tfor ( i = idx+1; i < len; i++ ) {\n\t\t// If the current character is part of a surrogate pair, move along...\n\t\tif ( hasUTF16SurrogatePairAt( str, i-1 ) ) {\n\t\t\tcontinue;\n\t\t}\n\t\t// Get the next code point:\n\t\tcp = codePointAt( str, i );\n\n\t\t// Get the corresponding grapheme break and emoji properties:\n\t\tbreaks.push( breakProperty( cp ) );\n\t\temoji.push( emojiProperty( cp ) );\n\n\t\t// Determine if we've encountered a grapheme cluster break...\n\t\tif ( breakType( breaks, emoji ) > 0 ) {\n\t\t\t// We've found a break!\n\t\t\treturn i;\n\t\t}\n\t}\n\t// Unable to find a grapheme cluster break:\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nexport default nextGraphemeClusterBreak;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\n\n\n// MAIN //\n\n/**\n* Returns the first `n` grapheme clusters (i.e., user-perceived characters) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of grapheme clusters to return\n* @returns {string} output string\n*\n* @example\n* var out = first( 'last man standing', 1 );\n* // returns 'l'\n*\n* @example\n* var out = first( 'presidential election', 1 );\n* // returns 'p'\n*\n* @example\n* var out = first( 'JavaScript', 1 );\n* // returns 'J'\n*\n* @example\n* var out = first( 'Hidden Treasures', 1 );\n* // returns 'H'\n*\n* @example\n* var out = first( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐶🐮'\n*\n* @example\n* var out = first( 'foo bar', 5 );\n* // returns 'foo b'\n*/\nfunction first( str, n ) {\n\tvar i = 0;\n\twhile ( n > 0 ) {\n\t\ti = nextGraphemeClusterBreak( str, i );\n\t\tn -= 1;\n\t}\n\t// Value of `i` will be -1 if and only if `str` is an empty string or `str` has only 1 extended grapheme cluster...\n\tif ( str === '' || i === -1 ) {\n\t\treturn str;\n\t}\n\treturn str.substring( 0, i );\n}\n\n\n// EXPORTS //\n\nexport default first;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Invokes a function for each UTF-16 code unit in a string.\n*\n* @param {string} str - input string\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEach( 'Hello', log );\n*/\nfunction forEach( str, clbk, thisArg ) {\n\tvar i;\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tclbk.call( thisArg, str[ i ], i, str );\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEach;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Invokes a function for each Unicode code point in a string.\n*\n* @param {string} str - input string\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEach( 'Hello', log );\n*/\nfunction forEach( str, clbk, thisArg ) {\n\tvar len;\n\tvar ch1;\n\tvar ch2;\n\tvar idx;\n\tvar ch;\n\tvar i;\n\n\tlen = str.length;\n\n\t// Process the string one Unicode code unit at a time and handle UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tch1 = str[ i ];\n\t\tidx = i;\n\t\tch = ch1;\n\n\t\t// Check for a UTF-16 surrogate pair...\n\t\tif ( i < len-1 && RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i+1 ];\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tch += ch2;\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Note: `ch` may be a lone surrogate (e.g., a low surrogate without a preceding high surrogate or a high surrogate at the end of the input string).\n\n\t\t// Invoke the callback with the code point:\n\t\tclbk.call( thisArg, ch, idx, str );\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEach;\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// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Invokes a function for each Unicode code point in a string, iterating from right to left.\n*\n* @param {string} str - input string\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEachRight( 'Hello', log );\n*/\nfunction forEachRight( str, clbk, thisArg ) {\n\tvar len;\n\tvar ch1;\n\tvar ch2;\n\tvar idx;\n\tvar ch;\n\tvar i;\n\n\tlen = str.length;\n\n\t// Process the string one Unicode code unit at a time and handle UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = len-1; i >= 0; i-- ) {\n\t\tch1 = str[ i ];\n\t\tidx = i;\n\t\tch = ch1;\n\n\t\t// Check for a UTF-16 surrogate pair...\n\t\tif ( i > 0 && RE_UTF16_LOW_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check whether the low surrogate is preceded by a high surrogate...\n\t\t\tch2 = str[ i-1 ];\n\t\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tch = ch2 + ch1;\n\t\t\t\ti -= 1; // decrement the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Note: `ch` may be a lone surrogate (e.g., a high surrogate without a following low surrogate or a low surrogate at the start of the input string).\n\n\t\t// Invoke the callback with the code point:\n\t\tclbk.call( thisArg, ch, idx, str );\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEachRight;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\n\n\n// MAIN //\n\n/**\n* Invokes a function for each grapheme cluster (i.e., user-perceived character) in a string.\n*\n* @param {string} str - input string\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEach( 'Hello', log );\n*/\nfunction forEach( str, clbk, thisArg ) {\n\tvar len;\n\tvar idx;\n\tvar brk;\n\n\tlen = str.length;\n\tidx = 0;\n\twhile ( idx < len ) {\n\t\tbrk = nextGraphemeClusterBreak( str, idx );\n\t\tif ( brk === -1 ) {\n\t\t\tbrk = len;\n\t\t}\n\t\tclbk.call( thisArg, str.substring( idx, brk ), idx, str );\n\t\tidx = brk;\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEach;\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 validate from './validate.js';\n\n\n// VARIABLES //\n\nvar REGEXP_STRING = '[\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]';\n\n\n// MAIN //\n\n/**\n* Returns a regular expression to match a white space character.\n*\n* @param {Options} [options] - function options\n* @param {string} [options.flags=''] - regular expression flags\n* @param {boolean} [options.capture=false] - boolean indicating whether to wrap a regular expression matching white space characters with a capture group\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {RegExp} regular expression\n*\n* @example\n* var RE_WHITESPACE = reWhitespace();\n*\n* var bool = RE_WHITESPACE.test( ' ' );\n* // returns true\n*\n* bool = RE_WHITESPACE.test( '\\t' );\n* // returns true\n*\n* @example\n* import replace from '@stdlib/string/replace';\n* var RE_WHITESPACE = reWhitespace({\n* 'capture': true\n* });\n*\n* var str = 'Duplicate capture';\n* var out = replace( str, RE_WHITESPACE, '$1$1' );\n* // returns 'Duplicate capture'\n*/\nfunction reWhitespace( options ) {\n\tvar opts;\n\tvar err;\n\tif ( arguments.length > 0 ) {\n\t\topts = {};\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tif ( opts.capture ) {\n\t\t\treturn new RegExp( '('+REGEXP_STRING+')', opts.flags );\n\t\t}\n\t\treturn new RegExp( REGEXP_STRING, opts.flags );\n\t}\n\treturn /[\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]/; // eslint-disable-line no-control-regex\n}\n\n\n// EXPORTS //\n\nexport default reWhitespace;\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 isObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - function options\n* @param {string} [options.flags] - regular expression flags\n* @param {boolean} [options.capture] - boolean indicating whether to wrap a regular expression matching white space characters with a capture group\n* @returns {(Error|null)} null or an error object\n*\n* @example\n* var opts = {};\n* var options = {\n* 'flags': 'gm'\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'flags' ) ) {\n\t\topts.flags = options.flags;\n\t\tif ( !isString( opts.flags ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'flags', opts.flags ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'capture' ) ) {\n\t\topts.capture = options.capture;\n\t\tif ( !isBoolean( opts.capture ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'capture', opts.capture ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\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 reWhitespace from './main.js';\n\n\n// MAIN //\n\n/**\n* Matches a white space character.\n*\n* Regular expression: `/([\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF])/`\n*\n* - `()`\n* - create a capture group\n*\n* - `[]`\n* - match any one of the listed characters\n*\n* - `\\u0009`\n* - character tabulation (horizontal tab; `\\t`)\n*\n* - `\\u000A`\n* - line feed (LF; `\\n`)\n*\n* - `\\u000B`\n* - line tabulation (vertical tab; `\\v`)\n*\n* - `\\u000C`\n* - form feed (`\\f`)\n*\n* - `\\u000D`\n* - carriage return (CR; `\\r`)\n*\n* - `\\u0020`\n* - space (most common)\n*\n* - `\\u0085`\n* - next line (NEL)\n*\n* - `\\u00A0`\n* - non-breaking space\n*\n* - `\\u1680`\n* - Ogham space mark\n*\n* - `\\u2000`\n* - en quad\n*\n* - `\\u2001`\n* - em quad\n*\n* - `\\u2002`\n* - en space\n*\n* - `\\u2003`\n* - em space\n*\n* - `\\u2004`\n*\n* - three-per-em space (thick space)\n*\n* - `\\u2005`\n* - four-per-em space (mid space)\n*\n* - `\\u2006`\n* - six-per-em space\n*\n* - `\\u2007`\n* - figure space\n*\n* - `\\u2008`\n* - punctuation space\n*\n* - `\\u2009`\n* - thin space\n*\n* - `\\u200A`\n* - hair space\n*\n* - `\\u2028`\n* - line separator\n*\n* - `\\u2029`\n* - paragraph separator\n*\n* - `\\u202F`\n* - narrow no-break space\n*\n* - `\\u205F`\n* - medium mathematical space\n*\n* - `\\u3000`\n* - ideographic space\n*\n* - `\\uFEFF`\n* - zero width non-breaking space\n*\n* ## Notes\n*\n* - Matches the 25 characters defined as white space (\"WSpace=Y\",\"WS\") characters in the Unicode 9.0 character database.\n* - Matches one related white space character without the Unicode character property \"WSpace=Y\" (zero width non-breaking space which was deprecated as of Unicode 3.2).\n*\n* @constant\n* @type {RegExp}\n* @default /([\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF])/\n* @see [whitespace]{@link https://en.wikipedia.org/wiki/Whitespace_character}\n*/\nvar REGEXP_CAPTURE = reWhitespace({\n\t'capture': true\n});\n\n\n// EXPORTS //\n\nexport default REGEXP_CAPTURE;\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 reWhitespace from './main.js';\n\n\n// MAIN //\n\n/**\n* Matches a white space character.\n*\n* Regular expression: `/[\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]/`\n*\n* - `[]`\n* - match any one of the listed characters\n*\n* - `\\u0009`\n* - character tabulation (horizontal tab; `\\t`)\n*\n* - `\\u000A`\n* - line feed (LF; `\\n`)\n*\n* - `\\u000B`\n* - line tabulation (vertical tab; `\\v`)\n*\n* - `\\u000C`\n* - form feed (`\\f`)\n*\n* - `\\u000D`\n* - carriage return (CR; `\\r`)\n*\n* - `\\u0020`\n* - space (most common)\n*\n* - `\\u0085`\n* - next line (NEL)\n*\n* - `\\u00A0`\n* - non-breaking space\n*\n* - `\\u1680`\n* - Ogham space mark\n*\n* - `\\u2000`\n* - en quad\n*\n* - `\\u2001`\n* - em quad\n*\n* - `\\u2002`\n* - en space\n*\n* - `\\u2003`\n* - em space\n*\n* - `\\u2004`\n*\n* - three-per-em space (thick space)\n*\n* - `\\u2005`\n* - four-per-em space (mid space)\n*\n* - `\\u2006`\n* - six-per-em space\n*\n* - `\\u2007`\n* - figure space\n*\n* - `\\u2008`\n* - punctuation space\n*\n* - `\\u2009`\n* - thin space\n*\n* - `\\u200A`\n* - hair space\n*\n* - `\\u2028`\n* - line separator\n*\n* - `\\u2029`\n* - paragraph separator\n*\n* - `\\u202F`\n* - narrow no-break space\n*\n* - `\\u205F`\n* - medium mathematical space\n*\n* - `\\u3000`\n* - ideographic space\n*\n* - `\\uFEFF`\n* - zero width non-breaking space\n*\n* ## Notes\n*\n* - Matches the 25 characters defined as white space (\"WSpace=Y\",\"WS\") characters in the Unicode 9.0 character database.\n* - Matches one related white space character without the Unicode character property \"WSpace=Y\" (zero width non-breaking space which was deprecated as of Unicode 3.2).\n*\n* @constant\n* @type {RegExp}\n* @default /[\\u0009\\u000A\\u000B\\u000C\\u000D\\u0020\\u0085\\u00A0\\u1680\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200A\\u2028\\u2029\\u202F\\u205F\\u3000\\uFEFF]/\n* @see [whitespace]{@link https://en.wikipedia.org/wiki/Whitespace_character}\n*/\nvar REGEXP = reWhitespace();\n\n\n// EXPORTS //\n\nexport default REGEXP;\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 { REGEXP as reWhitespace } from '@stdlib/regexp/whitespace';\n\n\n// MAIN //\n\n/**\n* Capitalizes the first letter of each word in an input string.\n*\n* @param {string} str - string to convert\n* @returns {string} start case string\n*\n* @example\n* var str = startcase( 'beep boop foo bar' );\n* // returns 'Beep Boop Foo Bar'\n*/\nfunction startcase( str ) {\n\tvar cap;\n\tvar out;\n\tvar ch;\n\tvar i;\n\n\tcap = true;\n\tout = '';\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tch = str.charAt( i );\n\t\tif ( reWhitespace.test( ch ) ) {\n\t\t\tcap = true;\n\t\t} else if ( cap ) {\n\t\t\tch = ch.toUpperCase();\n\t\t\tcap = false;\n\t\t}\n\t\tout += ch;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default startcase;\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 regular expression to match a white space character.\n*\n* @module @stdlib/regexp/whitespace\n*\n* @example\n* import reWhitespace from '@stdlib/regexp/whitespace';\n*\n* var RE_WHITESPACE = reWhitespace();\n*\n* var bool = RE_WHITESPACE.test( ' ' );\n* // returns true\n*\n* @example\n* import reWhitespace from '@stdlib/regexp/whitespace';\n*\n* var RE_WHITESPACE = reWhitespace({\n* 'flags': 'gm'\n* });\n*\n* var bool = RE_WHITESPACE.test( '\\t' );\n* // returns true\n*\n* @example\n* import { REGEXP as RE_WHITESPACE } from '@stdlib/regexp/whitespace';\n*\n* var bool = RE_WHITESPACE.test( 'a' );\n* // returns false\n*\n* @example\n* import replace from '@stdlib/string/replace';\n* var RE_WHITESPACE = require( '@stdlib/regexp/whitespace' ).REGEXP_CAPTURE;\n*\n* var str = 'Duplicate capture';\n* var out = replace( str, RE_WHITESPACE, '$1$1' );\n* // returns 'Duplicate capture'\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport REGEXP_CAPTURE from './regexp_capture.js';\nimport REGEXP from './regexp.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'REGEXP', REGEXP );\nsetReadOnly( main, 'REGEXP_CAPTURE', REGEXP_CAPTURE );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport startcase from './../../../base/startcase';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// MAIN //\n\n/**\n* Converts a string to HTTP header case.\n*\n* @param {string} str - string to convert\n* @returns {string} HTTP header-cased string\n*\n* @example\n* var out = headercase( 'foo bar' );\n* // returns 'Foo-Bar'\n*\n* @example\n* var out = headercase( 'IS_MOBILE' );\n* // returns 'Is-Mobile'\n*\n* @example\n* var out = headercase( 'Hello World!' );\n* // returns 'Hello-World'\n*\n* @example\n* var out = headercase( '--foo-bar--' );\n* // returns 'Foo-Bar'\n*/\nfunction headercase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\tstr = lowercase( str );\n\tstr = startcase( str );\n\treturn replace( str, RE_WHITESPACE, '-' );\n}\n\n\n// EXPORTS //\n\nexport default headercase;\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 lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// MAIN //\n\n/**\n* Converts a string to kebab case.\n*\n* @param {string} str - string to convert\n* @returns {string} kebab-cased string\n*\n* @example\n* var str = kebabCase( 'Hello World!' );\n* // returns 'hello-world'\n*\n* @example\n* var str = kebabCase( 'foo bar' );\n* // returns 'foo-bar'\n*\n* @example\n* var str = kebabCase( 'I am a tiny little teapot' );\n* // returns 'i-am-a-tiny-little-teapot'\n*\n* @example\n* var str = kebabCase( 'BEEP boop' );\n* // returns 'beep-boop'\n*\n* @example\n* var str = kebabCase( 'isMobile' );\n* // returns 'is-mobile'\n*/\nfunction kebabCase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\tstr = replace( str, RE_WHITESPACE, '-' );\n\treturn lowercase( str );\n}\n\n\n// EXPORTS //\n\nexport default kebabCase;\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// MAIN //\n\n/**\n* Returns the last `n` UTF-16 code units of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of UTF-16 code units to return\n* @returns {string} output string\n*\n* @example\n* var s = last( 'hello world', 1 );\n* // returns 'd'\n*\n* @example\n* var s = last( 'this is stdlib', 1 );\n* // returns 'b'\n*\n* @example\n* var out = last( 'JavaScript', 6 );\n* // returns 'Script'\n*\n* @example\n* var out = last( 'New', 6 );\n* // returns 'New'\n*/\nfunction last( str, n ) {\n\tvar len = str.length;\n\treturn str.substring( len - n, len );\n}\n\n\n// EXPORTS //\n\nexport default last;\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 { REGEXP as RE_UTF16_SURROGATE_PAIR } from '@stdlib/regexp/utf16-surrogate-pair';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Returns the last `n` Unicode code points of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of Unicode code points to return\n* @returns {string} output string\n*\n* @example\n* var out = last( 'Hello World', 1 );\n* // returns 'd'\n*\n* @example\n* var out = last( 'ASCII', 2 );\n* // returns 'II'\n*\n* @example\n* var out = last( 'JavaScript', 6 );\n* // returns 'Script'\n*/\nfunction last( str, n ) {\n\tvar len;\n\tvar out;\n\tvar ch1;\n\tvar ch2;\n\tvar cnt;\n\tvar i;\n\tlen = str.length;\n\tout = '';\n\tcnt = 0;\n\tif ( str === '' || n === 0 ) {\n\t\treturn '';\n\t}\n\tif ( n === 1 ) {\n\t\tstr = str.substring( len-2, len );\n\t\tif ( RE_UTF16_SURROGATE_PAIR.test( str ) ) {\n\t\t\treturn str;\n\t\t}\n\t\treturn str[1];\n\t}\n\n\t// Process the string backwards one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = len-1; i >= 0; i-- ) {\n\t\tch1 = str[ i ];\n\t\tout = ch1 + out;\n\t\tcnt += 1;\n\n\t\t// Check for a low UTF-16 surrogate...\n\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check for an unpaired surrogate at the start of the input string...\n\t\t\tif ( i === 0 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the low surrogate is paired with a high surrogate...\n\t\t\tch2 = str[ i-1 ];\n\t\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tout = ch2 + out;\n\t\t\t\ti -= 1; // decrement the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Check whether we've found the desired number of code points...\n\t\tif ( cnt === n ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default last;\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 './../../is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a positive integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a positive integer value\n*\n* @example\n* var bool = isPositiveInteger( 3.0 );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns false\n*/\nfunction isPositiveInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue > 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\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 './../../is-integer';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a positive integer value.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a positive integer value\n*\n* @example\n* var bool = isPositiveInteger( 3.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns true\n*/\nfunction isPositiveInteger( value ) {\n\treturn (\n\t\tisInteger( value ) &&\n\t\tvalue.valueOf() > 0.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\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 positive integer.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a positive integer\n*\n* @example\n* var bool = isPositiveInteger( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( new Number( 5.0 ) );\n* // returns true\n*\n* @example\n* var bool = isPositiveInteger( 0.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isPositiveInteger( null );\n* // returns false\n*/\nfunction isPositiveInteger( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isPositiveInteger;\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 positive integer.\n*\n* @module @stdlib/assert/is-positive-integer\n*\n* @example\n* import isPositiveInteger from '@stdlib/assert/is-positive-integer';\n*\n* var bool = isPositiveInteger( 5.0 );\n* // returns true\n*\n* bool = isPositiveInteger( new Number( 5.0 ) );\n* // returns true\n*\n* bool = isPositiveInteger( -5.0 );\n* // returns false\n*\n* bool = isPositiveInteger( 3.14 );\n* // returns false\n*\n* bool = isPositiveInteger( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isPositiveInteger } from '@stdlib/assert/is-positive-integer';\n*\n* var bool = isPositiveInteger( 3.0 );\n* // returns true\n*\n* bool = isPositiveInteger( new Number( 3.0 ) );\n* // returns false\n*\n* @example\n* import { isObject as isPositiveInteger } from '@stdlib/assert/is-positive-integer';\n*\n* var bool = isPositiveInteger( 3.0 );\n* // returns false\n*\n* bool = isPositiveInteger( 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 double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/max\n* @type {number}\n*\n* @example\n* import FLOAT64_MAX from '@stdlib/constants/float64/max';\n* // returns 1.7976931348623157e+308\n*/\n\n\n// MAIN //\n\n/**\n* Maximum double-precision floating-point number.\n*\n* ## Notes\n*\n* The maximum is given by\n*\n* ```tex\n* 2^{1023} (2 - 2^{-52})\n* ```\n*\n* @constant\n* @type {number}\n* @default 1.7976931348623157e+308\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MAX = 1.7976931348623157e+308;\n\n\n// EXPORTS //\n\nexport default FLOAT64_MAX;\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 SETTERS = {\n\t'float64': setFloat64,\n\t'float32': setFloat32,\n\t'int32': setInt32,\n\t'int16': setInt16,\n\t'int8': setInt8,\n\t'uint32': setUint32,\n\t'uint16': setUint16,\n\t'uint8': setUint8,\n\t'uint8c': setUint8c,\n\t'generic': setGeneric,\n\t'default': setArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Sets an element in a `Float64Array`.\n*\n* @private\n* @param {Float64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Float64Array from '@stdlib/array/float64';\n*\n* var arr = new Float64Array( 4 );\n*\n* setFloat64( arr, 2, 3.0 );\n*\n* var v = arr[ 2 ];\n* // returns 3.0\n*/\nfunction setFloat64( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a `Float32Array`.\n*\n* @private\n* @param {Float32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Float32Array from '@stdlib/array/float32';\n*\n* var arr = new Float32Array( 4 );\n*\n* setFloat32( arr, 2, 3.0 );\n*\n* var v = arr[ 2 ];\n* // returns 3.0\n*/\nfunction setFloat32( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in an `Int32Array`.\n*\n* @private\n* @param {Int32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Int32Array from '@stdlib/array/int32';\n*\n* var arr = new Int32Array( 4 );\n*\n* setInt32( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setInt32( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in an `Int16Array`.\n*\n* @private\n* @param {Int16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Int16Array from '@stdlib/array/int16';\n*\n* var arr = new Int16Array( 4 );\n*\n* setInt16( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setInt16( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in an `Int8Array`.\n*\n* @private\n* @param {Int8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Int8Array from '@stdlib/array/int8';\n*\n* var arr = new Int8Array( 4 );\n*\n* setInt8( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setInt8( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a `Uint32Array`.\n*\n* @private\n* @param {Uint32Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Uint32Array from '@stdlib/array/uint32';\n*\n* var arr = new Uint32Array( 4 );\n*\n* setUint32( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setUint32( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a `Uint16Array`.\n*\n* @private\n* @param {Uint16Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Uint16Array from '@stdlib/array/uint16';\n*\n* var arr = new Uint16Array( 4 );\n*\n* setUint16( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setUint16( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a `Uint8Array`.\n*\n* @private\n* @param {Uint8Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Uint8Array from '@stdlib/array/uint8';\n*\n* var arr = new Uint8Array( 4 );\n*\n* setUint8( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setUint8( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a `Uint8ClampedArray`.\n*\n* @private\n* @param {Uint8ClampedArray} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {number} value - value to set\n*\n* @example\n* import Uint8ClampedArray from '@stdlib/array/uint8c';\n*\n* var arr = new Uint8ClampedArray( 4 );\n*\n* setUint8c( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setUint8c( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in a generic `Array`.\n*\n* @private\n* @param {Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {*} value - value to set\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* setGeneric( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setGeneric( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n/**\n* Sets an element in an indexed array-like object.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {*} value - value to set\n*\n* @example\n* var arr = [ 1, 2, 3, 4 ];\n*\n* setArrayLike( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setArrayLike( arr, idx, value ) {\n\tarr[ idx ] = value;\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for setting an element in 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 set = setter( dtype( arr ) );\n* set( arr, 2, 3 );\n*\n* var v = arr[ 2 ];\n* // returns 3\n*/\nfunction setter( dtype ) {\n\tvar f = SETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn SETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default setter;\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 SETTERS = {\n\t'complex128': setComplex128,\n\t'complex64': setComplex64,\n\t'default': setArrayLike\n};\n\n\n// FUNCTIONS //\n\n/**\n* Sets an element in a `Complex128Array`.\n*\n* @private\n* @param {Complex128Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n*\n* @example\n* import Complex128Array from '@stdlib/array/complex128';\n* import Complex128 from '@stdlib/complex/float64/ctor';\n*\n* var arr = new Complex128Array( [ 1, 2, 3, 4 ] );\n*\n* setComplex128( arr, 1, new Complex128( 10.0, 11.0 ) );\n* var v = arr.get( 1 );\n* // returns [ 10.0, 11.0 ]\n*/\nfunction setComplex128( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n/**\n* Sets an element in a `Complex64Array`.\n*\n* @private\n* @param {Complex64Array} arr - input array\n* @param {NonNegativeInteger} idx - element index\n* @param {(Collection|Complex|ComplexArray)} value - value(s)\n*\n* @example\n* import Complex64Array from '@stdlib/array/complex64';\n* import Complex64 from '@stdlib/complex/float32/ctor';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* setComplex64( arr, 1, new Complex64( 10.0, 11.0 ) );\n* var v = arr.get( 1 );\n* // returns [ 10.0, 11.0 ]\n*/\nfunction setComplex64( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n/**\n* Sets an element in 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* @param {(Collection|Complex|ComplexArray)} value - value(s)\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* setArrayLike( arr, 2, 10 );\n*\n* var v = arr[ 2 ];\n* // returns 10\n*/\nfunction setArrayLike( arr, idx, value ) {\n\tarr.set( value, idx );\n}\n\n\n// MAIN //\n\n/**\n* Returns an accessor function for setting an element in 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 Complex64 from '@stdlib/complex/float32/ctor';\n* import dtype from '@stdlib/array/dtype';\n*\n* var arr = new Complex64Array( [ 1, 2, 3, 4 ] );\n*\n* var set = setter( dtype( arr ) );\n* set( arr, 1, new Complex64( 10.0, 11.0 ) );\n*\n* var v = arr.get( 1 );\n* // returns [ 10.0, 11.0 ]\n*/\nfunction setter( dtype ) {\n\tvar f = SETTERS[ dtype ];\n\tif ( typeof f === 'function' ) {\n\t\treturn f;\n\t}\n\treturn SETTERS.default;\n}\n\n\n// EXPORTS //\n\nexport default setter;\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 isAccessorArray from './../../../base/assert/is-accessor-array';\nimport getter from './../../../base/getter';\nimport setter from './../../../base/setter';\nimport accessorGetter from './../../../base/accessor-getter';\nimport accessorSetter from './../../../base/accessor-setter';\nimport dtype from './../../../dtype';\n\n\n// MAIN //\n\n/**\n* Converts an array-like to an object likely to have the same \"shape\".\n*\n* ## Notes\n*\n* - This function is intended as a potential performance optimization. In V8, for example, even if two objects share common properties, if those properties were added in different orders or if one object has additional properties not shared by the other object, then those objects will have different \"hidden\" classes. If a function is provided many objects having different \"shapes\", some JavaScript VMs (e.g., V8) will consider the function \"megamorphic\" and fail to perform various runtime optimizations. Accordingly, the intent of this function is to standardize the \"shape\" of the object holding array meta data to ensure that internal functions operating on arrays are provided consistent argument \"shapes\".\n*\n* - The returned object has the following properties:\n*\n* - **data**: reference to the input array.\n* - **dtype**: array data type.\n* - **accessorProtocol**: `boolean` indicating whether the input array uses accessors for getting and setting elements.\n* - **accessors**: a two-element array whose first element is an accessor for retrieving an array element and whose second element is an accessor for setting an array element.\n*\n* @param {Collection} x - array-like object\n* @returns {Object} object containing array meta data\n*\n* @example\n* var obj = arraylike2object( [ 1, 2, 3, 4 ] );\n* // returns {...}\n*/\nfunction arraylike2object( x ) {\n\tvar dt = dtype( x );\n\tif ( isAccessorArray( x ) ) {\n\t\treturn {\n\t\t\t'data': x,\n\t\t\t'dtype': dt,\n\t\t\t'accessorProtocol': true,\n\t\t\t'accessors': [\n\t\t\t\taccessorGetter( dt ),\n\t\t\t\taccessorSetter( dt )\n\t\t\t]\n\t\t};\n\t}\n\treturn {\n\t\t'data': x,\n\t\t'dtype': dt,\n\t\t'accessorProtocol': false,\n\t\t'accessors': [\n\t\t\tgetter( dt ),\n\t\t\tsetter( dt )\n\t\t]\n\t};\n}\n\n\n// EXPORTS //\n\nexport default arraylike2object;\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-restricted-syntax, no-invalid-this */\n\n'use strict';\n\n// MODULES //\n\nimport isCollection from '@stdlib/assert/is-collection';\nimport { isPrimitive as isPositiveInteger } from '@stdlib/assert/is-positive-integer';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils/define-nonenumerable-read-only-accessor';\nimport iteratorSymbol from '@stdlib/symbol/iterator';\nimport MAX_ITERATIONS from '@stdlib/constants/float64/max';\nimport arraylike2object from '@stdlib/array/base/arraylike2object';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Circular buffer constructor.\n*\n* @constructor\n* @param {(PositiveInteger|Collection)} buffer - buffer size or an array-like object to use as the underlying buffer\n* @throws {TypeError} must provide either a valid buffer size or an array-like object\n* @returns {CircularBuffer} circular buffer instance\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Fill the buffer...\n* var v = b.push( 'foo' );\n* // returns undefined\n*\n* v = b.push( 'bar' );\n* // returns undefined\n*\n* v = b.push( 'beep' );\n* // returns undefined\n*\n* // Add another value to the buffer and return the removed element:\n* v = b.push( 'boop' );\n* // returns 'foo'\n*/\nfunction CircularBuffer( buffer ) {\n\tvar buf;\n\tvar i;\n\tif ( !(this instanceof CircularBuffer) ) {\n\t\treturn new CircularBuffer( buffer );\n\t}\n\tif ( isPositiveInteger( buffer ) ) {\n\t\tbuf = [];\n\t\tfor ( i = 0; i < buffer; i++ ) {\n\t\t\tbuf.push( 0.0 ); // initialize with zeros, but could be any value (we're just ensuring a contiguous block of memory)\n\t\t}\n\t} else if ( isCollection( buffer ) ) {\n\t\tbuf = buffer;\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide either a valid buffer size (i.e., a positive integer) or an array-like object which can serve as the underlying buffer. Value: `%s`.', buffer ) );\n\t}\n\tthis._buffer = arraylike2object( buf );\n\tthis._length = buf.length;\n\tthis._count = 0;\n\tthis._i = -1;\n\treturn this;\n}\n\n/**\n* Clears the buffer.\n*\n* @name clear\n* @memberof CircularBuffer.prototype\n* @type {Function}\n* @returns {CircularBuffer} circular buffer instance\n*\n* @example\n* var b = new CircularBuffer( 2 );\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n* b.push( 'beep' );\n* b.push( 'boop' );\n*\n* // Get the number of elements currently in the buffer:\n* var n = b.count;\n* // returns 2\n*\n* // Clear the buffer:\n* b.clear();\n*\n* // Get the number of buffer values:\n* n = b.count;\n* // returns 0\n*/\nsetReadOnly( CircularBuffer.prototype, 'clear', function clear() {\n\tthis._count = 0;\n\tthis._i = -1; // this ensures that we always fill the buffer starting at index `0`.\n\treturn this;\n});\n\n/**\n* Number of elements currently in the buffer.\n*\n* @name count\n* @memberof CircularBuffer.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var b = new CircularBuffer( 4 );\n*\n* // Get the value count:\n* var n = b.count;\n* // returns 0\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n*\n* // Get the value count:\n* n = b.count;\n* // returns 2\n*/\nsetReadOnlyAccessor( CircularBuffer.prototype, 'count', function get() {\n\treturn this._count;\n});\n\n/**\n* Boolean indicating whether a circular buffer is full.\n*\n* @name full\n* @memberof CircularBuffer.prototype\n* @readonly\n* @type {boolean}\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Determine if the buffer is full:\n* var bool = b.full;\n* // returns false\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n* b.push( 'beep' );\n* b.push( 'boop' );\n*\n* // Determine if the buffer is full:\n* bool = b.full;\n* // returns true\n*/\nsetReadOnlyAccessor( CircularBuffer.prototype, 'full', function get() {\n\treturn this._count === this._length;\n});\n\n/**\n* Returns an iterator for iterating over a circular buffer.\n*\n* ## Notes\n*\n* - An iterator does not iterate over partially full buffers.\n*\n* @name iterator\n* @memberof CircularBuffer.prototype\n* @type {Function}\n* @param {NonNegativeInteger} [niters] - number of iterations\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {Iterator} iterator\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n* b.push( 'beep' );\n* b.push( 'boop' );\n*\n* // Create an iterator:\n* var it = b.iterator( b.length );\n*\n* // Iterate over the buffer...\n* var v = it.next().value;\n* // returns 'bar'\n*\n* v = it.next().value;\n* // returns 'beep'\n*\n* v = it.next().value;\n* // returns 'boop'\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( CircularBuffer.prototype, 'iterator', function iterator( niters ) {\n\tvar iter;\n\tvar self;\n\tvar FLG;\n\tvar N;\n\tvar n;\n\tvar i;\n\n\tif ( arguments.length ) {\n\t\tif ( !isNonNegativeInteger( niters ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', niters ) );\n\t\t}\n\t\tN = niters;\n\t} else {\n\t\tN = MAX_ITERATIONS;\n\t}\n\tself = this;\n\n\t// Initialize the iteration index and counter:\n\ti = this._i;\n\tn = 0;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tsetReadOnly( iter, 'next', next );\n\tsetReadOnly( iter, 'return', end );\n\tif ( iteratorSymbol ) {\n\t\tsetReadOnly( iter, iteratorSymbol, 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\t/* eslint-disable no-underscore-dangle */\n\t\tn += 1;\n\t\tif ( FLG || n > N ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\t// If the buffer is only partially full, don't allow iteration over \"undefined\" elements (this ensures similar behavior with `toArray()`)...\n\t\tif ( self._count !== self._length ) {\n\t\t\tFLG = true;\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\ti = (i+1) % self._length;\n\t\treturn {\n\t\t\t'value': self._buffer.accessors[ 0 ]( self._buffer.data, i ),\n\t\t\t'done': false\n\t\t};\n\n\t\t/* eslint-enable no-underscore-dangle */\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.iterator( N );\n\t}\n});\n\n/**\n* Circular buffer length (i.e., capacity).\n*\n* @name length\n* @memberof CircularBuffer.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var b = new CircularBuffer( 4 );\n*\n* // Get the buffer capacity:\n* var len = b.length;\n* // returns 4\n*/\nsetReadOnlyAccessor( CircularBuffer.prototype, 'length', function get() {\n\treturn this._length;\n});\n\n/**\n* Adds a value to the circular buffer.\n*\n* @name push\n* @memberof CircularBuffer.prototype\n* @type {Function}\n* @param {*} value - value to add\n* @returns {(*|void)} removed element or undefined\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Fill the buffer:\n* var v = b.push( 'foo' );\n* // returns undefined\n*\n* v = b.push( 'bar' );\n* // returns undefined\n*\n* v = b.push( 'beep' );\n* // returns undefined\n*\n* // Add another value to the buffer and return the removed element:\n* v = b.push( 'boop' );\n* // returns 'foo'\n*/\nsetReadOnly( CircularBuffer.prototype, 'push', function push( value ) {\n\tvar set;\n\tvar get;\n\tvar buf;\n\tvar v;\n\n\tbuf = this._buffer.data;\n\tget = this._buffer.accessors[ 0 ];\n\tset = this._buffer.accessors[ 1 ];\n\n\t// Compute the next buffer index:\n\tthis._i = (this._i+1) % this._length;\n\n\t// Check if we are still filling the buffer...\n\tif ( this._count < this._length ) {\n\t\tset( buf, this._i, value );\n\t\tthis._count += 1;\n\t\treturn;\n\t}\n\t// Replace an existing buffer element...\n\tv = get( buf, this._i );\n\tset( buf, this._i, value );\n\treturn v;\n});\n\n/**\n* Returns an array of circular buffer values.\n*\n* @name toArray\n* @memberof CircularBuffer.prototype\n* @type {Function}\n* @returns {Array} circular buffer values\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n* b.push( 'beep' );\n* b.push( 'boop' );\n*\n* // Get an array of buffer values:\n* var vals = b.toArray();\n* // returns [ 'bar', 'beep', 'boop' ]\n*/\nsetReadOnly( CircularBuffer.prototype, 'toArray', function toArray() {\n\tvar buf;\n\tvar get;\n\tvar out;\n\tvar k;\n\tvar i;\n\n\tbuf = this._buffer.data;\n\tget = this._buffer.accessors[ 0 ];\n\n\tout = [];\n\tfor ( i = 1; i <= this._count; i++ ) {\n\t\t// Note: in a full buffer, `count == length`; in a partially full buffer, we need to ensure we always start at index `0`\n\t\tk = (this._i+i) % this._count;\n\t\tout.push( get( buf, k ) );\n\t}\n\treturn out;\n});\n\n/**\n* Serializes a circular buffer as JSON.\n*\n* ## Notes\n*\n* - `JSON.stringify()` implicitly calls this method when stringifying a `CircularBuffer` instance.\n*\n* @name toJSON\n* @memberof CircularBuffer.prototype\n* @type {Function}\n* @returns {Object} serialized circular buffer\n*\n* @example\n* var b = new CircularBuffer( 3 );\n*\n* // Add values to the buffer:\n* b.push( 'foo' );\n* b.push( 'bar' );\n* b.push( 'beep' );\n* b.push( 'boop' );\n*\n* // Serialize to JSON:\n* var o = b.toJSON();\n* // returns { 'type': 'circular-buffer', 'length': 3, 'data': [ 'bar', 'beep', 'boop' ] }\n*/\nsetReadOnly( CircularBuffer.prototype, 'toJSON', function toJSON() {\n\tvar out = {};\n\tout.type = 'circular-buffer';\n\tout.length = this._length;\n\tout.data = this.toArray();\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default CircularBuffer;\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 nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\nimport CircularBuffer from '@stdlib/dstructs/circular-buffer';\nimport zeros from '@stdlib/array/base/zeros';\n\n\n// MAIN //\n\n/**\n* Returns the last `n` grapheme clusters (i.e., user-perceived characters) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of grapheme clusters to return\n* @returns {string} output string\n*\n* @example\n* var out = last( 'Hello World', 1 );\n* // returns 'd'\n*\n* @example\n* var out = last( 'Evening', 3 );\n* // returns 'ing'\n*\n* @example\n* var out = last( 'JavaScript', 6 );\n* // returns 'Script'\n*\n* @example\n* var out = last( '六书/六書', 1 );\n* // returns '書'\n*\n* @example\n* var out = last( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐰🐸'\n*/\nfunction last( str, n ) {\n\tvar count;\n\tvar cbuf;\n\tvar buf;\n\tvar i;\n\n\tif ( n === 0 || str === '' ) {\n\t\treturn '';\n\t}\n\t// Resolve the first cluster break:\n\ti = nextGraphemeClusterBreak( str, 0 );\n\n\t// If we received a sentinel value, return the input string, as there are no more cluster breaks to iterate over...\n\tif ( i === -1 ) {\n\t\treturn str;\n\t}\n\t// Initialize a buffer for keeping track of cluster break indices:\n\tbuf = zeros( n );\n\n\t// Wrap the buffer to create a circular buffer serving as a FIFO stack where we can keep at most `n` indices as we iterate from left-to-right:\n\tcbuf = new CircularBuffer( buf );\n\n\t// Add the first character index:\n\tcbuf.push( 0 );\n\n\t// Add the index of the first grapheme cluster break to our buffer:\n\tcbuf.push( i );\n\n\t// Slide a window over the string from left-to-right...\n\tcount = 0;\n\twhile ( true ) {\n\t\tcount += 1;\n\t\ti = nextGraphemeClusterBreak( str, i );\n\t\tif ( i === -1 ) {\n\t\t\tbreak;\n\t\t}\n\t\tcbuf.push( i );\n\t}\n\t// Resolve the leftmost index:\n\ti = buf[ (count+1)%n ]; // count+1 as count%n corresponds to the index of the \"newest\" element in the circular buffer and count+1 is the next element to replace (i.e., the \"oldest\" index)\n\n\t// Return the last `n` grapheme clusters:\n\treturn str.substring( i );\n}\n\n\n// EXPORTS //\n\nexport default last;\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 filled \"generic\" array.\n*\n* @param {*} value - fill value\n* @param {NonNegativeInteger} len - array length\n* @returns {Array} filled array\n*\n* @example\n* var out = filled( 0.0, 3 );\n* // returns [ 0.0, 0.0, 0.0 ]\n*\n* @example\n* var out = filled( 'beep', 3 );\n* // returns [ 'beep', 'beep', 'beep' ]\n*/\nfunction filled( value, len ) {\n\tvar arr;\n\tvar i;\n\n\t// Manually push elements in order to ensure \"fast\" elements...\n\tarr = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\tarr.push( value );\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nexport default filled;\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 filled from './../../../base/filled';\n\n\n// MAIN //\n\n/**\n* Returns a zero-filled \"generic\" array.\n*\n* @param {NonNegativeInteger} len - array length\n* @returns {Array} output array\n*\n* @example\n* var out = zeros( 3 );\n* // returns [ 0.0, 0.0, 0.0 ]\n*/\nfunction zeros( len ) {\n\treturn filled( 0.0, len );\n}\n\n\n// EXPORTS //\n\nexport default zeros;\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 bool = ( typeof String.prototype.repeat !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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 repeat = String.prototype.repeat;\n\n\n// EXPORTS //\n\nexport default repeat;\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* Repeat a string a specified number of times and return the concatenated result.\n*\n* @module @stdlib/string/base/repeat\n*\n* @example\n* import replace from '@stdlib/string/base/repeat';\n*\n* var str = repeat( 'a', 5 );\n* // returns 'aaaaa'\n*\n* str = repeat( '', 100 );\n* // returns ''\n*\n* str = repeat( 'beep', 0 );\n* // returns ''\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar repeat;\nif ( HAS_BUILTIN ) {\n\trepeat = main;\n} else {\n\trepeat = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default repeat;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Repeats a string a specified number of times and returns the concatenated result.\n*\n* @param {string} str - string to repeat\n* @param {NonNegativeInteger} n - number of times to repeat the string\n* @returns {string} repeated string\n*\n* @example\n* var str = repeat( 'a', 5 );\n* // returns 'aaaaa'\n*\n* @example\n* var str = repeat( '', 100 );\n* // returns ''\n*\n* @example\n* var str = repeat( 'beep', 0 );\n* // returns ''\n*/\nfunction repeat( str, n ) {\n\treturn builtin.call( str, n );\n}\n\n\n// EXPORTS //\n\nexport default repeat;\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* Repeats a string a specified number of times and returns the concatenated result.\n*\n* ## Method\n*\n* The algorithmic trick used in the implementation is to treat string concatenation the same as binary addition (i.e., any natural number (nonnegative integer) can be expressed as a sum of powers of two).\n*\n* For example,\n*\n* ```text\n* n = 10 => 1010 => 2^3 + 2^0 + 2^1 + 2^0\n* ```\n*\n* We can produce a 10-repeat string by \"adding\" the results of a 8-repeat string and a 2-repeat string.\n*\n* The implementation is then as follows:\n*\n* 1. Let `s` be the string to be repeated and `o` be an output string.\n*\n* 2. Initialize an output string `o`.\n*\n* 3. Check the least significant bit to determine if the current `s` string should be \"added\" to the output \"total\".\n*\n* - if the bit is a one, add\n* - otherwise, move on\n*\n* 4. Double the string `s` by adding `s` to `s`.\n*\n* 5. Right-shift the bits of `n`.\n*\n* 6. Check if we have shifted off all bits.\n*\n* - if yes, done.\n* - otherwise, move on\n*\n* 7. Repeat 3-6.\n*\n* The result is that, as the string is repeated, we continually check to see if the doubled string is one which we want to add to our \"total\".\n*\n* The algorithm runs in `O(log_2(n))` compared to `O(n)`.\n*\n* @private\n* @param {string} str - string to repeat\n* @param {NonNegativeInteger} n - number of times to repeat the string\n* @returns {string} repeated string\n*\n* @example\n* var str = repeat( 'a', 5 );\n* // returns 'aaaaa'\n*\n* @example\n* var str = repeat( '', 100 );\n* // returns ''\n*\n* @example\n* var str = repeat( 'beep', 0 );\n* // returns ''\n*/\nfunction repeat( str, n ) {\n\tvar rpt;\n\tvar cnt;\n\tif ( str.length === 0 || n === 0 ) {\n\t\treturn '';\n\t}\n\trpt = '';\n\tcnt = n;\n\tfor ( ; ; ) {\n\t\t// If the count is odd, append the current concatenated string:\n\t\tif ( (cnt&1) === 1 ) {\n\t\t\trpt += str;\n\t\t}\n\t\t// Right-shift the bits:\n\t\tcnt >>>= 1;\n\t\tif ( cnt === 0 ) {\n\t\t\tbreak;\n\t\t}\n\t\t// Double the string:\n\t\tstr += str;\n\t}\n\treturn rpt;\n}\n\n\n// EXPORTS //\n\nexport default repeat;\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 positive infinity.\n*\n* @param {number} x - input value\n* @returns {number} rounded value\n*\n* @example\n* var v = ceil( -4.2 );\n* // returns -4.0\n*\n* @example\n* var v = ceil( 9.99999 );\n* // returns 10.0\n*\n* @example\n* var v = ceil( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = ceil( NaN );\n* // returns NaN\n*/\nvar ceil = Math.ceil; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default ceil;\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 repeat from './../../../base/repeat';\nimport ceil from '@stdlib/math/base/special/ceil';\n\n\n// MAIN //\n\n/**\n* Left pads a string such that the padded string has a length of at least `len`.\n*\n* @param {string} str - string to pad\n* @param {NonNegativeInteger} len - minimum string length\n* @param {string} pad - string used to pad\n* @returns {string} padded string\n*\n* @example\n* var str = lpad( 'a', 5, ' ' );\n* // returns ' a'\n*\n* @example\n* var str = lpad( 'beep', 10, 'b' );\n* // returns 'bbbbbbbeep'\n*\n* @example\n* var str = lpad( 'boop', 12, 'beep' );\n* // returns 'beepbeepboop'\n*/\nfunction lpad( str, len, pad ) {\n\tvar n = ( len - str.length ) / pad.length;\n\tif ( n <= 0 ) {\n\t\treturn str;\n\t}\n\tn = ceil( n );\n\treturn repeat( pad, n ) + str;\n}\n\n\n// EXPORTS //\n\nexport default lpad;\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 bool = ( typeof String.prototype.trimLeft !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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 replace from './../../../base/replace';\n\n\n// VARIABLES //\n\n// The following regular expression should suffice to polyfill (most?) all environments.\nvar RE = /^[\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+/;\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning of a string.\n*\n* @private\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = ltrim( ' Whitespace ' );\n* // returns 'Whitespace '\n*\n* @example\n* var out = ltrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs\\t\\t\\t'\n*\n* @example\n* var out = ltrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines\\n\\n\\n'\n*/\nfunction ltrim( str ) {\n\treturn replace( str, RE, '' );\n}\n\n\n// EXPORTS //\n\nexport default ltrim;\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 ltrim = String.prototype.trimLeft;\n\n\n// EXPORTS //\n\nexport default ltrim;\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* Trim whitespace characters from the beginning of a string.\n*\n* @module @stdlib/string/base/left-trim\n*\n* @example\n* import ltrim from '@stdlib/string/base/left-trim';\n*\n* var out = ltrim( ' Whitespace ' );\n* // returns 'Whitespace '\n*\n* out = ltrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs\\t\\t\\t'\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar ltrim;\nif ( HAS_BUILTIN ) {\n\tltrim = main;\n} else {\n\tltrim = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default ltrim;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning of a string.\n*\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = ltrim( ' Whitespace ' );\n* // returns 'Whitespace '\n*\n* @example\n* var out = ltrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs\\t\\t\\t'\n*\n* @example\n* var out = ltrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines\\n\\n\\n'\n*/\nfunction ltrim( str ) {\n\treturn builtin.call( str );\n}\n\n\n// EXPORTS //\n\nexport default ltrim;\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 capitalize from './../../../base/capitalize';\nimport lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_TO_PASCAL = /(?:\\s|^)([^\\s]+)(?=\\s|$)/g;\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// FUNCTIONS //\n\n/**\n* Callback invoked upon a match.\n*\n* @private\n* @param {string} match - entire match\n* @param {string} p1 - first capture group\n* @returns {string} capitalized capture group\n*/\nfunction replacer( match, p1 ) {\n\treturn capitalize( lowercase( p1 ) );\n}\n\n\n// MAIN //\n\n/**\n* Converts a string to Pascal case.\n*\n* @param {string} str - string to convert\n* @returns {string} Pascal-cased string\n*\n* @example\n* var out = pascalcase( 'foo bar' );\n* // returns 'FooBar'\n*\n* @example\n* var out = pascalcase( 'IS_MOBILE' );\n* // returns 'IsMobile'\n*\n* @example\n* var out = pascalcase( 'Hello World!' );\n* // returns 'HelloWorld'\n*\n* @example\n* var out = pascalcase( '--foo-bar--' );\n* // returns 'FooBar'\n*/\nfunction pascalcase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_WHITESPACE, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\treturn replace( str, RE_TO_PASCAL, replacer );\n}\n\n\n// EXPORTS //\n\nexport default pascalcase;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// VARIABLES //\n\n// 2^6-1 = 63 => 0x3f => 00111111\nvar Ox3F = 63|0;\n\n// 2^7 = 128 => 0x80 => 10000000\nvar Ox80 = 128|0;\n\n// 192 => 0xc0 => 11000000\nvar OxC0 = 192|0;\n\n// 224 => 0xe0 => 11100000\nvar OxE0 = 224|0;\n\n// 240 => 0xf0 => 11110000\nvar OxF0 = 240|0;\n\n// 2^10-1 = 1023 => 0x3ff => 00000011 11111111\nvar Ox3FF = 1023|0;\n\n// 2^11 = 2048 => 0x800 => 00001000 00000000\nvar Ox800 = 2048|0;\n\n// 55296 => 11011000 00000000\nvar OxD800 = 55296|0;\n\n// 57344 => 11100000 00000000\nvar OxE000 = 57344|0;\n\n// 2^16 = 65536 => 00000000 00000001 00000000 00000000\nvar Ox10000 = 65536|0;\n\n\n// MAIN //\n\n/**\n* Converts a UTF-16 encoded string to an array of integers using UTF-8 encoding.\n*\n* ## Method\n*\n* - UTF-8 is defined to encode code points in one to four bytes, depending on the number of significant bits in the numerical value of the code point.\n*\n* - UTF-16 encoding uses one 16-bit unit for non-surrogates (U+0000 to U+D7FF and U+E000 to U+FFFF).\n*\n* - UTF-16 encoding uses two 16-bit units (surrogate pairs) for U+10000 to U+10FFFF and encodes U+10000-U+10FFFF by subtracting 0x10000 from the code point, expressing the result as a 20-bit binary, and splitting the 20 bits of 0x0-0xFFFFF as upper and lower 10-bits. The respective 10-bits are stored in two 16-bit words.\n*\n* - Let `N` be the number of significant bits.\n*\n* - If `N <= 7` (i.e., U+0000 to U+007F), a code point is encoded in a single byte.\n*\n* ```text\n* 0xxxxxxx\n* ```\n*\n* where an `x` refers to a code point bit.\n*\n* - If `N <= 11` (i.e., U+0080 to U+07FF; ASCII characters), a code point is encoded in two bytes (5+6 bits).\n*\n* ```text\n* 110xxxxx 10xxxxxx\n* ```\n*\n* - If `N <= 16` (i.e., U+0800 to U+FFFF), a code point is encoded in three bytes (4+6+6 bits).\n*\n* ```text\n* 1110xxxx 10xxxxxx 10xxxxxx\n* ```\n*\n* - If `N <= 21` (i.e., U+10000 to U+10FFFF), a code point is encoded in four bytes (3+6+6+6 bits).\n*\n* ```text\n* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx\n* ```\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {Array} array of integers\n* @see [UTF-8]{@link https://en.wikipedia.org/wiki/UTF-8}\n* @see [Stack Overflow]{@link https://stackoverflow.com/questions/6240055/manually-converting-unicode-codepoints-into-utf-8-and-utf-16}\n*\n* @example\n* var str = '☃';\n* var out = utf16ToUTF8Array( str );\n* // returns [ 226, 152, 131 ]\n*/\nfunction utf16ToUTF8Array( str ) {\n\tvar code;\n\tvar out;\n\tvar len;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tlen = str.length;\n\tout = [];\n\tfor ( i = 0; i < len; i++ ) {\n\t\tcode = str.charCodeAt( i );\n\n\t\t// ASCII...\n\t\tif ( code < Ox80 ) {\n\t\t\tout.push( code );\n\t\t}\n\t\t// UTF-16 non-surrogate pair...\n\t\telse if ( code < Ox800 ) {\n\t\t\tout.push( OxC0 | (code>>6) );\n\t\t\tout.push( Ox80 | (code & Ox3F) );\n\t\t}\n\t\telse if ( code < OxD800 || code >= OxE000 ) {\n\t\t\tout.push( OxE0 | (code>>12) );\n\t\t\tout.push( Ox80 | ((code>>6) & Ox3F) );\n\t\t\tout.push( Ox80 | (code & Ox3F) );\n\t\t}\n\t\t// UTF-16 surrogate pair...\n\t\telse {\n\t\t\ti += 1;\n\n\t\t\t// eslint-disable-next-line max-len\n\t\t\tcode = Ox10000 + (((code & Ox3FF)<<10) | (str.charCodeAt(i) & Ox3FF));\n\n\t\t\tout.push( OxF0 | (code>>18) );\n\t\t\tout.push( Ox80 | ((code>>12) & Ox3F) );\n\t\t\tout.push( Ox80 | ((code>>6) & Ox3F) );\n\t\t\tout.push( Ox80 | (code & Ox3F) );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default utf16ToUTF8Array;\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 utf16ToUTF8Array from './../../../utf16-to-utf8-array';\n\n\n// VARIABLES //\n\n// Character codes:\nvar UNDERSCORE = 95|0;\nvar PERIOD = 46|0;\nvar HYPHEN = 45|0;\nvar TILDE = 126|0;\nvar ZERO = 48|0;\nvar NINE = 57|0;\nvar A = 65|0;\nvar Z = 90|0;\nvar a = 97|0;\nvar z = 122|0;\n\n\n// MAIN //\n\n/**\n* Percent-encodes a UTF-16 encoded string according to [RFC 3986][1].\n*\n* [1]: https://tools.ietf.org/html/rfc3986#section-2.1\n*\n* @param {string} str - string to percent-encode\n* @returns {string} percent-encoded string\n*\n* @example\n* var str1 = 'Ladies + Gentlemen';\n*\n* var str2 = percentEncode( str1 );\n* // returns 'Ladies%20%2B%20Gentlemen'\n*/\nfunction percentEncode( str ) {\n\tvar byte;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\n\t// Convert to an array of octets using UTF-8 encoding (see https://tools.ietf.org/html/rfc3986#section-2.5):\n\tbuf = utf16ToUTF8Array( str );\n\n\t// Encode the string...\n\tlen = buf.length;\n\tout = '';\n\tfor ( i = 0; i < len; i++ ) {\n\t\tbyte = buf[ i ];\n\t\tif (\n\t\t\t// ASCII Digits:\n\t\t\t( byte >= ZERO && byte <= NINE ) ||\n\n\t\t\t// ASCII uppercase letters:\n\t\t\t( byte >= A && byte <= Z ) ||\n\n\t\t\t// ASCII lowercase letters:\n\t\t\t( byte >= a && byte <= z ) ||\n\n\t\t\t// ASCII unreserved characters (see https://tools.ietf.org/html/rfc3986#section-2.3):\n\t\t\tbyte === HYPHEN ||\n\t\t\tbyte === PERIOD ||\n\t\t\tbyte === UNDERSCORE ||\n\t\t\tbyte === TILDE\n\t\t) {\n\t\t\tout += str.charAt( i );\n\t\t} else {\n\t\t\t// Convert an octet to hexadecimal and uppercase according to the RFC (see https://tools.ietf.org/html/rfc3986#section-2.1):\n\t\t\tout += '%' + byte.toString( 16 ).toUpperCase();\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default percentEncode;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Removes the first `n` UTF-16 code units of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of UTF-16 code units to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeFirst( 'last man standing', 1 );\n* // returns 'ast man standing'\n*\n* @example\n* var out = removeFirst( 'presidential election', 1 );\n* // returns 'residential election'\n*\n* @example\n* var out = removeFirst( 'JavaScript', 1 );\n* // returns 'avaScript'\n*\n* @example\n* var out = removeFirst( 'Hidden Treasures', 1 );\n* // returns 'idden Treasures'\n*/\nfunction removeFirst( str, n ) {\n\treturn str.substring( n, str.length );\n}\n\n\n// EXPORTS //\n\nexport default removeFirst;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Removes the first `n` Unicode code points of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of Unicode code points to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeFirst( 'last man standing', 1 );\n* // returns 'ast man standing'\n*\n* @example\n* var out = removeFirst( 'presidential election', 1 );\n* // returns 'residential election'\n*\n* @example\n* var out = removeFirst( 'JavaScript', 1 );\n* // returns 'avaScript'\n*\n* @example\n* var out = removeFirst( 'Hidden Treasures', 1 );\n* // returns 'idden Treasures'\n*/\nfunction removeFirst( str, n ) {\n\tvar len;\n\tvar ch1;\n\tvar ch2;\n\tvar cnt;\n\tvar i;\n\tif ( n === 0 ) {\n\t\treturn str;\n\t}\n\tlen = str.length;\n\tcnt = 0;\n\n\t// Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tch1 = str[ i ];\n\t\tcnt += 1;\n\n\t\t// Check for a high UTF-16 surrogate...\n\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check for an unpaired surrogate at the end of the input string...\n\t\t\tif ( i === len-1 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i+1 ];\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Check whether we've found the desired number of code points...\n\t\tif ( cnt === n ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn str.substring( i + 1, str.length );\n}\n\n\n// EXPORTS //\n\nexport default removeFirst;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\n\n\n// MAIN //\n\n/**\n* Removes the first `n` grapheme clusters (i.e., user-perceived characters) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of grapheme clusters to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeFirst( 'last man standing', 1 );\n* // returns 'ast man standing'\n*\n* @example\n* var out = removeFirst( 'presidential election', 1 );\n* // returns 'residential election'\n*\n* @example\n* var out = removeFirst( 'JavaScript', 1 );\n* // returns 'avaScript'\n*\n* @example\n* var out = removeFirst( 'Hidden Treasures', 1 );\n* // returns 'idden Treasures'\n*\n* @example\n* var out = removeFirst( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐷🐰🐸'\n*\n* @example\n* var out = removeFirst( 'foo bar', 5 );\n* // returns 'ar'\n*/\nfunction removeFirst( str, n ) {\n\tvar i = 0;\n\twhile ( n > 0 ) {\n\t\ti = nextGraphemeClusterBreak( str, i );\n\t\tn -= 1;\n\t}\n\t// Value of `i` will be -1 if and only if `str` is an empty string or `str` has only 1 extended grapheme cluster...\n\tif ( str === '' || i === -1 ) {\n\t\treturn '';\n\t}\n\treturn str.substring( i, str.length );\n}\n\n\n// EXPORTS //\n\nexport default removeFirst;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Removes the last `n` UTF-16 code units of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of UTF-16 code units to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeLast( 'last man standing', 1 );\n* // returns 'last man standin'\n*\n* @example\n* var out = removeLast( 'presidential election', 1 );\n* // returns 'presidential electio'\n*\n* @example\n* var out = removeLast( 'JavaScript', 1 );\n* // returns 'JavaScrip'\n*\n* @example\n* var out = removeLast( 'Hidden Treasures', 1 );\n* // returns 'Hidden Treasure'\n*/\nfunction removeLast( str, n ) {\n\treturn str.substring( 0, str.length - n );\n}\n\n\n// EXPORTS //\n\nexport default removeLast;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Removes the last `n` Unicode code points of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of Unicode code points to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeLast( 'last man standing', 1 );\n* // returns 'last man standin'\n*\n* @example\n* var out = removeLast( 'presidential election', 1 );\n* // returns 'presidential electio'\n*\n* @example\n* var out = removeLast( 'JavaScript', 1 );\n* // returns 'JavaScrip'\n*\n* @example\n* var out = removeLast( 'Hidden Treasures', 1 );\n* // returns 'Hidden Treasure'\n*/\nfunction removeLast( str, n ) {\n\tvar len;\n\tvar ch1;\n\tvar ch2;\n\tvar cnt;\n\tvar i;\n\tif ( n === 0 ) {\n\t\treturn str;\n\t}\n\tlen = str.length;\n\tcnt = 0;\n\n\t// Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = len - 1; i >= 0; i-- ) {\n\t\tch1 = str[ i ];\n\t\tcnt += 1;\n\n\t\t// Check for a low UTF-16 surrogate...\n\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check for an unpaired surrogate at the end of the input string...\n\t\t\tif ( i === 0 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i-1 ];\n\t\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\ti -= 1; // bump the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Check whether we've found the desired number of code points...\n\t\tif ( cnt === n ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn str.substring( 0, i );\n}\n\n\n// EXPORTS //\n\nexport default removeLast;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport nextGraphemeClusterBreak from './../../next-grapheme-cluster-break';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns the number of grapheme clusters in a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {NonNegativeInteger} number of grapheme clusters\n*\n* @example\n* var out = numGraphemeClusters( 'last man standing' );\n* // returns 17\n*\n* @example\n* var out = numGraphemeClusters( 'presidential election' );\n* // returns 21\n*\n* @example\n* var out = numGraphemeClusters( 'अनुच्छेद' );\n* // returns 5\n*\n* @example\n* var out = numGraphemeClusters( '🌷' );\n* // returns 1\n*/\nfunction numGraphemeClusters( str ) {\n\tvar count;\n\tvar idx;\n\tvar brk;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tcount = 0;\n\tidx = 0;\n\n\tbrk = nextGraphemeClusterBreak( str, idx );\n\twhile ( brk !== -1 ) {\n\t\tcount += 1;\n\t\tidx = brk;\n\t\tbrk = nextGraphemeClusterBreak( str, idx );\n\t}\n\tif ( idx < str.length ) {\n\t\tcount += 1;\n\t}\n\treturn count;\n}\n\n\n// EXPORTS //\n\nexport default numGraphemeClusters;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\nimport numGraphemeClusters from './../../../num-grapheme-clusters';\n\n\n// MAIN //\n\n/**\n* Removes the last `n` grapheme clusters (i.e., user-perceived characters) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of grapheme clusters to remove\n* @returns {string} output string\n*\n* @example\n* var out = removeLast( 'last man standing', 1 );\n* // returns 'last man standin'\n*\n* @example\n* var out = removeLast( 'presidential election', 1 );\n* // returns 'presidential electio'\n*\n* @example\n* var out = removeLast( 'JavaScript', 1 );\n* // returns 'JavaScrip'\n*\n* @example\n* var out = removeLast( 'Hidden Treasures', 1 );\n* // returns 'Hidden Treasure'\n*\n* @example\n* var out = removeLast( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐶🐮🐷'\n*\n* @example\n* var out = removeLast( 'foo bar', 5 );\n* // returns 'fo'\n*/\nfunction removeLast( str, n ) {\n\tvar total;\n\tvar num;\n\tvar i;\n\n\tif ( n === 0 ) {\n\t\treturn str;\n\t}\n\n\ttotal = numGraphemeClusters( str );\n\tif ( str === '' || total < n ) {\n\t\treturn '';\n\t}\n\n\ti = 0;\n\tnum = 0;\n\twhile ( num < total - n ) {\n\t\ti = nextGraphemeClusterBreak( str, i );\n\t\tnum += 1;\n\t}\n\treturn str.substring( 0, i );\n}\n\n\n// EXPORTS //\n\nexport default removeLast;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Replaces the substring before the first occurrence of a specified search string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {string} replacement - replacement string\n* @param {integer} fromIndex - index at which to start the search\n* @returns {string} string\n*\n* @example\n* var out = replaceBefore( 'beep boop', ' ', 'foo', 0 );\n* // returns 'foo boop'\n*\n* @example\n* var out = replaceBefore( 'beep boop', 'p', 'foo', 5 );\n* // returns 'foop'\n*\n* @example\n* var out = replaceBefore( 'Hello World!', '', 'foo', 0 );\n* // returns 'Hello World!'\n*\n* @example\n* var out = replaceBefore( 'Hello World!', 'xyz', 'foo', 0 );\n* // returns 'Hello World!'\n*/\nfunction replaceBefore( str, search, replacement, fromIndex ) {\n\tvar idx;\n\tif ( fromIndex < 0 ) {\n\t\tfromIndex += str.length;\n\t} else if ( fromIndex >= str.length ) {\n\t\treturn str;\n\t}\n\tidx = str.indexOf( search, fromIndex );\n\tif ( str === '' || search === '' || replacement === '' || idx < 0 ) {\n\t\treturn str;\n\t}\n\treturn replacement + str.substring( idx );\n}\n\n\n// EXPORTS //\n\nexport default replaceBefore;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Reverses the UTF-16 code units of a string.\n*\n* @param {string} str - input string\n* @returns {string} output string\n*\n* @example\n* var out = reverse( 'last man standing' );\n* // returns 'gnidnats nam tsal'\n*\n* @example\n* var out = reverse( 'presidential election' );\n* // returns 'noitcele laitnediserp'\n*\n* @example\n* var out = reverse( 'JavaScript' );\n* // returns 'tpircSavaJ'\n*\n* @example\n* var out = reverse( 'Hidden Treasures' );\n* // returns 'serusaerT neddiH'\n*/\nfunction reverse( str ) {\n\tvar out;\n\tvar i;\n\n\tout = '';\n\tfor ( i = str.length - 1; i >= 0; i-- ) {\n\t\tout += str[ i ];\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default reverse;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Reverses the Unicode code points of a string.\n*\n* @param {string} str - input string\n* @returns {string} output string\n*\n* @example\n* var out = reverse( 'last man standing' );\n* // returns 'gnidnats nam tsal'\n*\n* @example\n* var out = reverse( 'presidential election' );\n* // returns 'noitcele laitnediserp'\n*\n* @example\n* var out = reverse( 'JavaScript' );\n* // returns 'tpircSavaJ'\n*\n* @example\n* var out = reverse( 'Hidden Treasures' );\n* // returns 'serusaerT neddiH'\n*/\nfunction reverse( str ) {\n\tvar len;\n\tvar out;\n\tvar ch1;\n\tvar ch2;\n\tvar i;\n\n\tlen = str.length;\n\tout = '';\n\n\t// Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < len; i++ ) {\n\t\tch1 = str[ i ];\n\n\t\t// Check for a high UTF-16 surrogate...\n\t\tif ( RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check for an unpaired surrogate at the end of the input string...\n\t\t\tif ( i === len-1 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tout = ch1 + out;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i+1 ];\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tout = ch1 + ch2 + out;\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t} else {\n\t\t\t\tout = ch1 + out;\n\t\t\t}\n\t\t} else {\n\t\t\tout = ch1 + out;\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default reverse;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\n\n\n// MAIN //\n\n/**\n* Reverses the grapheme clusters (i.e., user-perceived characters) of a string.\n*\n* @param {string} str - input string\n* @returns {string} output string\n*\n* @example\n* var out = reverse( 'last man standing' );\n* // returns 'gnidnats nam tsal'\n*\n* @example\n* var out = reverse( 'presidential election' );\n* // returns 'noitcele laitnediserp'\n*\n* @example\n* var out = reverse( 'JavaScript' );\n* // returns 'tpircSavaJ'\n*\n* @example\n* var out = reverse( 'Hidden Treasures' );\n* // returns 'serusaerT neddiH'\n*\n* @example\n* var out = reverse( '🐶🐮🐷🐰🐸' );\n* // returns '🐸🐰🐷🐮🐶'\n*/\nfunction reverse( str ) {\n\tvar cluster;\n\tvar out;\n\tvar idx;\n\tvar brk;\n\tvar i;\n\n\tout = '';\n\tidx = 0;\n\twhile ( idx < str.length ) {\n\t\tbrk = nextGraphemeClusterBreak( str, idx );\n\t\tif ( brk === -1 ) {\n\t\t\tbrk = str.length;\n\t\t}\n\t\tcluster = '';\n\t\tfor ( i = idx; i < brk; i++ ) {\n\t\t\tcluster += str.charAt( i );\n\t\t}\n\t\tout = cluster + out;\n\t\tidx = brk;\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default reverse;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport repeat from './../../../base/repeat';\nimport ceil from '@stdlib/math/base/special/ceil';\n\n\n// MAIN //\n\n/**\n* Right pads a string such that the padded string has a length of at least `len`.\n*\n* @param {string} str - string to pad\n* @param {NonNegativeInteger} len - minimum string length\n* @param {string} pad - string used to pad\n* @returns {string} padded string\n*\n* @example\n* var str = rpad( 'a', 5, ' ' );\n* // returns 'a '\n*\n* @example\n* var str = rpad( 'beep', 10, 'b' );\n* // returns 'beepbbbbbb'\n*\n* @example\n* var str = rpad( 'boop', 12, 'beep' );\n* // returns 'boopbeepbeep'\n*/\nfunction rpad( str, len, pad ) {\n\tvar n = ( len - str.length ) / pad.length;\n\tif ( n <= 0 ) {\n\t\treturn str;\n\t}\n\tn = ceil( n );\n\treturn str + repeat( pad, n );\n}\n\n\n// EXPORTS //\n\nexport default rpad;\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 bool = ( typeof String.prototype.trimRight !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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 replace from './../../../base/replace';\n\n\n// VARIABLES //\n\n// The following regular expression should suffice to polyfill (most?) all environments.\nvar RE = /[\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff]+$/;\n\n\n// MAIN //\n\n/**\n* Trims whitespace from the end of a string.\n*\n* @private\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = rtrim( ' Whitespace ' );\n* // returns ' Whitespace'\n*\n* @example\n* var out = rtrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns '\\t\\t\\tTabs'\n*\n* @example\n* var out = rtrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns '\\n\\n\\nNew Lines'\n*/\nfunction rtrim( str ) {\n\treturn replace( str, RE, '' );\n}\n\n\n// EXPORTS //\n\nexport default rtrim;\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 rtrim = String.prototype.trimRight;\n\n\n// EXPORTS //\n\nexport default rtrim;\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* Trim whitespace characters from the end of a string.\n*\n* @module @stdlib/string/base/right-trim\n*\n* @example\n* import rtrim from '@stdlib/string/base/right-trim';\n*\n* var out = rtrim( ' Whitespace ' );\n* // returns ' Whitespace'\n*\n* out = rtrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns '\\t\\t\\tTabs'\n*\n* out = rtrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns '\\n\\n\\nNew Lines'\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar rtrim;\nif ( HAS_BUILTIN ) {\n\trtrim = main;\n} else {\n\trtrim = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default rtrim;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Trims whitespace from the end of a string.\n*\n* @param {string} str - input string\n* @returns {string} trimmed string\n*\n* @example\n* var out = rtrim( ' Whitespace ' );\n* // returns ' Whitespace'\n*\n* @example\n* var out = rtrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns '\\t\\t\\tTabs'\n*\n* @example\n* var out = rtrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns '\\n\\n\\nNew Lines'\n*/\nfunction rtrim( str ) {\n\treturn builtin.call( str );\n}\n\n\n// EXPORTS //\n\nexport default rtrim;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// VARIABLES //\n\n// Cache a reference to the built-in to prevent prototype mutation shenanigans:\nvar sliceString = String.prototype.slice;\n\n\n// MAIN //\n\n/**\n* Slices UTF-16 code units from a string.\n*\n* @param {string} str - input string\n* @param {integer} start - slice start index (inclusive)\n* @param {integer} end - slice end index (exclusive)\n* @returns {string} input string\n*\n* @example\n* var out = slice( 'last man standing', 1, 17 );\n* // returns 'ast man standing'\n*\n* out = slice( 'Hidden Treasures', 0, 6 );\n* // returns 'Hidden'\n*/\nfunction slice( str, start, end ) {\n\treturn sliceString.call( str, start, end );\n}\n\n\n// EXPORTS //\n\nexport default slice;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Returns the number of code points in a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {NonNegativeInteger} number of code points\n*\n* @example\n* var out = numCodePoints( 'last man standing' );\n* // returns 17\n*\n* @example\n* var out = numCodePoints( 'presidential election' );\n* // returns 21\n*\n* @example\n* var out = numCodePoints( 'अनुच्छेद' );\n* // returns 8\n*/\nfunction numCodePoints( str ) {\n\tvar count;\n\tvar i;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tcount = 0;\n\n\t// Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\t// Check for a high UTF-16 surrogate...\n\t\tif ( RE_UTF16_HIGH_SURROGATE.test( str[ i ] ) ) {\n\t\t\t// Check for an unpaired surrogate at the end of the input string...\n\t\t\tif ( i === str.length-1 ) {\n\t\t\t\t// We found an unpaired surrogate...\n\t\t\t\tcount += 1;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( str[ i+1 ] ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t\tcount += 1;\n\t\t\t}\n\t\t} else {\n\t\t\tcount += 1;\n\t\t}\n\t}\n\treturn count;\n}\n\n\n// EXPORTS //\n\nexport default numCodePoints;\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 maximum value.\n*\n* @param {number} x - first number\n* @param {number} y - second number\n* @returns {number} maximum value\n*\n* @example\n* var v = max( 3.14, 4.2 );\n* // returns 4.2\n*\n* @example\n* var v = max( 3.14, NaN );\n* // returns NaN\n*\n* @example\n* var v = max( NaN, 3.14 );\n* // returns 3.14\n*\n* @example\n* var v = max( -0.0, +0.0 );\n* // returns +0.0\n*\n* @example\n* var v = max( +0.0, -0.0 );\n* // returns -0.0\n*/\nfunction max( x, y ) {\n\tif ( x > y ) {\n\t\treturn x;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default max;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport numCodePoints from './../../../num-code-points';\nimport max from '@stdlib/math/base/special/fast/max';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Slices a string based on Unicode code points.\n*\n* @param {string} str - input string\n* @param {integer} start - the `ith` Unicode code point to start a slice (inclusive)\n* @param {integer} end - the `jth` Unicode code point to end a slice (exclusive)\n* @returns {string} output string\n*\n* @example\n* var out = sliceCodePoints( 'Hello 👋 World', 1, 3 );\n* // returns 'el'\n*\n* out = sliceCodePoints( '👋👋👋', 1, 2 );\n* // returns '👋'\n*/\nfunction sliceCodePoints( str, start, end ) {\n\tvar totalCodePoints;\n\tvar codePoints;\n\tvar len;\n\tvar ch1;\n\tvar ch2;\n\tvar idx;\n\tvar ch;\n\tvar i;\n\n\tlen = str.length;\n\tif ( len === 0 ) {\n\t\treturn '';\n\t}\n\ttotalCodePoints = numCodePoints( str );\n\tif ( start < 0 ) {\n\t\tstart = max( totalCodePoints + start, 0 );\n\t}\n\tif ( end < 0 ) {\n\t\tend = max( totalCodePoints + end, 0 );\n\t} else if ( end > totalCodePoints ) {\n\t\tend = totalCodePoints;\n\t}\n\tif ( start >= totalCodePoints || end <= start ) {\n\t\treturn '';\n\t}\n\tcodePoints = '';\n\tidx = 0;\n\n\t// Process the string one Unicode code unit at a time and handle UTF-16 surrogate pairs as a single Unicode code point...\n\tfor ( i = 0; i < len && idx < end; i++ ) {\n\t\tch1 = str[ i ];\n\t\tch = ch1;\n\n\t\t// Check for a UTF-16 surrogate pair...\n\t\tif ( i < len-1 && RE_UTF16_HIGH_SURROGATE.test( ch1 ) ) {\n\t\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\t\tch2 = str[ i+1 ];\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test( ch2 ) ) {\n\t\t\t\t// We found a surrogate pair:\n\t\t\t\tch += ch2;\n\t\t\t\ti += 1; // bump the index to process the next code unit\n\t\t\t}\n\t\t}\n\t\t// Note: `ch` may be a lone surrogate (e.g., a low surrogate without a preceding high surrogate or a high surrogate at the end of the input string).\n\n\t\tif ( idx >= start && idx < end ) {\n\t\t\tcodePoints += ch;\n\t\t}\n\t\tidx += 1;\n\t}\n\treturn codePoints;\n}\n\n\n// EXPORTS //\n\nexport default sliceCodePoints;\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 lowercase from './../../../base/lowercase';\nimport replace from './../../../base/replace';\nimport trim from './../../../base/trim';\n\n\n// VARIABLES //\n\nvar RE_WHITESPACE = /\\s+/g;\nvar RE_SPECIAL = /[\\-!\"'(),–.:;<>?`{}|~\\/\\\\\\[\\]_#$*&^@%]+/g; // eslint-disable-line no-useless-escape\nvar RE_CAMEL = /([a-z0-9])([A-Z])/g;\n\n\n// MAIN //\n\n/**\n* Converts a string to snake case.\n*\n* @param {string} str - string to convert\n* @returns {string} snake-cased string\n*\n* @example\n* var str = snakecase( 'Hello World!' );\n* // returns 'hello_world'\n*\n* @example\n* var str = snakecase( 'foo bar' );\n* // returns 'foo_bar'\n*\n* @example\n* var str = snakecase( 'I am a tiny little teapot' );\n* // returns 'i_am_a_tiny_little_teapot'\n*\n* @example\n* var str = snakecase( 'BEEP boop' );\n* // returns 'beep_boop'\n*\n* @example\n* var str = snakecase( 'isMobile' );\n* // returns 'is_mobile'\n*/\nfunction snakecase( str ) {\n\tstr = replace( str, RE_SPECIAL, ' ' );\n\tstr = replace( str, RE_CAMEL, '$1 $2' );\n\tstr = trim( str );\n\tstr = replace( str, RE_WHITESPACE, '_' );\n\treturn lowercase( str );\n}\n\n\n// EXPORTS //\n\nexport default snakecase;\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 bool = ( typeof String.prototype.startsWith !== 'undefined' );\n\n\n// EXPORTS //\n\nexport default bool;\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 startsWith = String.prototype.startsWith;\n\n\n// EXPORTS //\n\nexport default startsWith;\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* Test if a string starts with the characters of another string.\n*\n* @module @stdlib/string/base/starts-with\n*\n* @example\n* import startsWith from '@stdlib/string/base/starts-with';\n*\n* var str = 'Fair is foul, and foul is fair, hover through fog and filthy air';\n* var bool = startsWith( str, 'Fair', 0 );\n* // returns true\n*\n* bool = startsWith( str, 'fair', 0 );\n* // returns false\n*\n* bool = startsWith( str, 'foul', 8 );\n* // returns true\n*\n* bool = startsWith( str, 'filthy', -10 );\n* // returns true\n*/\n\n// MODULES //\n\nimport HAS_BUILTIN from './has_builtin.js';\nimport polyfill from './polyfill.js';\nimport main from './main.js';\n\n\n// MAIN //\n\nvar startsWith;\nif ( HAS_BUILTIN ) {\n\tstartsWith = main;\n} else {\n\tstartsWith = polyfill;\n}\n\n\n// EXPORTS //\n\nexport default startsWith;\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 builtin from './builtin.js';\n\n\n// MAIN //\n\n/**\n* Tests if a string starts with the characters of another string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} position - position at which to start searching\n* @returns {boolean} boolean indicating if the input string starts with the search string\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember', 0 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember', 0 );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be', 0 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 0 );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 );\n* // returns true\n*/\nfunction startsWith( str, search, position ) {\n\tvar pos;\n\tif ( position < 0 ) {\n\t\tpos = str.length + position;\n\t} else {\n\t\tpos = position;\n\t}\n\tif ( search.length === 0 ) {\n\t\treturn true;\n\t}\n\tif (\n\t\tpos < 0 ||\n\t\tpos + search.length > str.length\n\t) {\n\t\treturn false;\n\t}\n\treturn builtin.call( str, search, pos );\n}\n\n\n// EXPORTS //\n\nexport default startsWith;\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* Tests if a string starts with the characters of another string.\n*\n* @private\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} position - position at which to start searching\n* @returns {boolean} boolean indicating if the input string starts with the search string\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember', 0 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember', 0 );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be', 0 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 0 );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 );\n* // returns true\n*/\nfunction startsWith( str, search, position ) {\n\tvar pos;\n\tvar i;\n\tif ( position < 0 ) {\n\t\tpos = str.length + position;\n\t} else {\n\t\tpos = position;\n\t}\n\tif ( search.length === 0 ) {\n\t\treturn true;\n\t}\n\tif (\n\t\tpos < 0 ||\n\t\tpos + search.length > str.length\n\t) {\n\t\treturn false;\n\t}\n\tfor ( i = 0; i < search.length; i++ ) {\n\t\tif ( str.charCodeAt( pos + i ) !== search.charCodeAt( i ) ) {\n\t\t\treturn false;\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// EXPORTS //\n\nexport default startsWith;\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 './../../define-property';\n\n\n// MAIN //\n\n/**\n* Defines a non-enumerable read-write accessor.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Function} getter - get accessor\n* @param {Function} setter - set accessor\n*\n* @example\n* function getter() {\n* return name + ' foo';\n* }\n*\n* function setter( v ) {\n* name = v;\n* }\n*\n* var name = 'bar';\n* var obj = {};\n*\n* setNonEnumerableReadWriteAccessor( obj, 'foo', getter, setter );\n*\n* var v = obj.foo;\n* // returns 'bar foo'\n*\n* obj.foo = 'beep';\n*\n* v = obj.foo;\n* // returns 'beep foo'\n*/\nfunction setNonEnumerableReadWriteAccessor( obj, prop, getter, setter ) { // 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\t'set': setter\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setNonEnumerableReadWriteAccessor;\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 './../../is-number';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number primitive having a value which is a probability.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number primitive having a value which is a probability\n*\n* @example\n* var bool = isProbability( 0.66 );\n* // returns true\n*\n* @example\n* var bool = isProbability( new Number( 0.66 ) );\n* // returns false\n*/\nfunction isProbability( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tvalue >= 0.0 &&\n\t\tvalue <= 1.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isProbability;\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 './../../is-number';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value which is a probability.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value which is a probability\n*\n* @example\n* var bool = isProbability( 0.5 );\n* // returns false\n*\n* @example\n* var bool = isProbability( new Number( 0.5 ) );\n* // returns true\n*/\nfunction isProbability( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tvalue.valueOf() >= 0.0 &&\n\t\tvalue.valueOf() <= 1.0\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isProbability;\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 probability.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is a probability\n*\n* @example\n* var bool = isProbability( 0.5 );\n* // returns true\n*\n* @example\n* var bool = isProbability( new Number( 0.5 ) );\n* // returns true\n*\n* @example\n* var bool = isProbability( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isProbability( -5.0 );\n* // returns false\n*\n* @example\n* var bool = isProbability( null );\n* // returns false\n*/\nfunction isProbability( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isProbability;\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* Creates a function which always returns the same value.\n*\n* @param {*} [value] - value to always return\n* @returns {Function} constant function\n*\n* @example\n* var fcn = wrap( 3.14 );\n*\n* var v = fcn();\n* // returns 3.14\n*\n* v = fcn();\n* // returns 3.14\n*\n* v = fcn();\n* // returns 3.14\n*/\nfunction wrap( value ) {\n\treturn constantFunction;\n\n\t/**\n\t* Constant function.\n\t*\n\t* @private\n\t* @returns {*} constant value\n\t*/\n\tfunction constantFunction() {\n\t\treturn value;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default wrap;\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* No operation.\n*\n* @example\n* noop();\n* // ...does nothing.\n*/\nfunction noop() {\n\t// Empty function...\n}\n\n\n// EXPORTS //\n\nexport default noop;\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 probability.\n*\n* @module @stdlib/assert/is-probability\n*\n* @example\n* import isProbability from '@stdlib/assert/is-probability';\n*\n* var bool = isProbability( 0.5 );\n* // returns true\n*\n* bool = isProbability( new Number( 0.5 ) );\n* // returns true\n*\n* bool = isProbability( 3.14 );\n* // returns false\n*\n* bool = isProbability( -5.0 );\n* // returns false\n*\n* bool = isProbability( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isProbability } from '@stdlib/assert/is-probability';\n*\n* var bool = isProbability( 0.3 );\n* // returns true\n*\n* bool = isProbability( new Number( 0.3 ) );\n* // returns false\n*\n* @example\n* import { isObject as isProbability } from '@stdlib/assert/is-probability';\n*\n* var bool = isProbability( 0.77 );\n* // returns false\n*\n* bool = isProbability( new Number( 0.77 ) );\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 safe double-precision floating-point integer.\n*\n* @module @stdlib/constants/float64/max-safe-integer\n* @type {number}\n*\n* @example\n* import FLOAT64_MAX_SAFE_INTEGER from '@stdlib/constants/float64/max-safe-integer';\n* // returns 9007199254740991\n*/\n\n\n// MAIN //\n\n/**\n* Maximum safe double-precision floating-point integer.\n*\n* ## Notes\n*\n* The integer has the value\n*\n* ```tex\n* 2^{53} - 1\n* ```\n*\n* @constant\n* @type {number}\n* @default 9007199254740991\n* @see [Safe Integers]{@link http://www.2ality.com/2013/10/safe-integers.html}\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MAX_SAFE_INTEGER = 9007199254740991;\n\n\n// EXPORTS //\n\nexport default FLOAT64_MAX_SAFE_INTEGER;\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 isPositiveZero from './../../../../base/assert/is-positive-zero';\nimport isnan from './../../../../base/assert/is-nan';\nimport PINF from '@stdlib/constants/float64/pinf';\n\n\n// MAIN //\n\n/**\n* Returns the maximum value.\n*\n* @param {number} x - first number\n* @param {number} y - second number\n* @returns {number} maximum value\n*\n* @example\n* var v = max( 3.14, 4.2 );\n* // returns 4.2\n*\n* @example\n* var v = max( 3.14, NaN );\n* // returns NaN\n*\n* @example\n* var v = max( +0.0, -0.0 );\n* // returns +0.0\n*/\nfunction max( x, y ) {\n\tif ( isnan( x ) || isnan( y ) ) {\n\t\treturn NaN;\n\t}\n\tif ( x === PINF || y === PINF ) {\n\t\treturn PINF;\n\t}\n\tif ( x === y && x === 0.0 ) {\n\t\tif ( isPositiveZero( x ) ) {\n\t\t\treturn x;\n\t\t}\n\t\treturn y;\n\t}\n\tif ( x > y ) {\n\t\treturn x;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default 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// MODULES //\n\nimport PINF from '@stdlib/constants/float64/pinf';\n\n\n// MAIN //\n\n/**\n* Tests if a double-precision floating-point numeric value is positive zero.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is positive zero\n*\n* @example\n* var bool = isPositiveZero( 0.0 );\n* // returns true\n*\n* @example\n* var bool = isPositiveZero( -0.0 );\n* // returns false\n*/\nfunction isPositiveZero( x ) {\n\treturn (x === 0.0 && 1.0/x === PINF);\n}\n\n\n// EXPORTS //\n\nexport default isPositiveZero;\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 imul = ( typeof Math.imul === 'function' ) ? Math.imul : null; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default imul;\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* Perform C-like multiplication of two signed 32-bit integers.\n*\n* @module @stdlib/number/int32/base/mul\n*\n* @example\n* import imul from '@stdlib/number/int32/base/mul';\n*\n* var v = imul( -10|0, 4|0 );\n* // returns -40\n*/\n\n// MODULES //\n\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( typeof builtin === 'function' ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\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// VARIABLES //\n\n// Define a mask for the least significant 16 bits (low word): 65535 => 0x0000ffff => 00000000000000001111111111111111\nvar LOW_WORD_MASK = 0x0000ffff>>>0; // asm type annotation\n\n\n// MAIN //\n\n/**\n* Performs C-like multiplication of two signed 32-bit integers.\n*\n* ## Method\n*\n* - To emulate C-like multiplication without the aid of 64-bit integers, we recognize that a 32-bit integer can be split into two 16-bit words\n*\n* ```tex\n* a = w_h*2^{16} + w_l\n* ```\n*\n* where \\\\( w_h \\\\) is the most significant 16 bits and \\\\( w_l \\\\) is the least significant 16 bits. For example, consider the maximum signed 32-bit integer \\\\( 2^{31}-1 \\\\)\n*\n* ```binarystring\n* 01111111111111111111111111111111\n* ```\n*\n* The 16-bit high word is then\n*\n* ```binarystring\n* 0111111111111111\n* ```\n*\n* and the 16-bit low word\n*\n* ```binarystring\n* 1111111111111111\n* ```\n*\n* If we cast the high word to 32-bit precision and multiply by \\\\( 2^{16} \\\\) (equivalent to a 16-bit left shift), then the bit sequence is\n*\n* ```binarystring\n* 01111111111111110000000000000000\n* ```\n*\n* Similarly, upon casting the low word to 32-bit precision, the bit sequence is\n*\n* ```binarystring\n* 00000000000000001111111111111111\n* ```\n*\n* From the rules of binary addition, we recognize that adding the two 32-bit values for the high and low words will return our original value \\\\( 2^{31}-1 \\\\).\n*\n* - Accordingly, the multiplication of two 32-bit integers can be expressed\n*\n* ```tex\n* \\begin{align*}\n* a \\cdot b &= ( a_h \\cdot 2^{16} + a_l) \\cdot ( b_h \\cdot 2^{16} + b_l) \\\\\n* &= a_l \\cdot b_l + a_h \\cdot b_l \\cdot 2^{16} + a_l \\cdot b_h \\cdot 2^{16} + (a_h \\cdot b_h) \\cdot 2^{32} \\\\\n* &= a_l \\cdot b_l + (a_h \\cdot b_l + a_l \\cdot b_h) \\cdot 2^{16} + (a_h \\cdot b_h) \\cdot 2^{32}\n* \\end{align*}\n* ```\n*\n* - We note that multiplying (dividing) an integer by \\\\( 2^n \\\\) is equivalent to performing a left (right) shift of \\\\( n \\\\) bits.\n*\n* - Further, as we want to return an integer of the same precision, for a 32-bit integer, the return value will be modulo \\\\( 2^{32} \\\\). Stated another way, we only care about the low word of a 64-bit result.\n*\n* - Accordingly, the last term, being evenly divisible by \\\\( 2^{32} \\\\), drops from the equation leaving the remaining two terms as the remainder.\n*\n* ```tex\n* a \\cdot b = a_l \\cdot b_l + (a_h \\cdot b_l + a_l \\cdot b_h) << 16\n* ```\n*\n* - Lastly, the second term in the above equation contributes to the middle bits and may cause the product to \"overflow\". However, we can disregard (`>>>0`) overflow bits due to modulo arithmetic, as discussed earlier with regard to the term involving the partial product of high words.\n*\n* @param {integer32} a - integer\n* @param {integer32} b - integer\n* @returns {integer32} product\n*\n* @example\n* var v = imul( -10|0, 4|0 );\n* // returns -40\n*/\nfunction imul( a, b ) {\n\tvar lbits;\n\tvar mbits;\n\tvar ha;\n\tvar hb;\n\tvar la;\n\tvar lb;\n\n\ta |= 0; // asm type annotation\n\tb |= 0; // asm type annotation\n\n\t// Isolate the most significant 16-bits:\n\tha = ( a>>>16 )>>>0; // asm type annotation\n\thb = ( b>>>16 )>>>0; // asm type annotation\n\n\t// Isolate the least significant 16-bits:\n\tla = ( a&LOW_WORD_MASK )>>>0; // asm type annotation\n\tlb = ( b&LOW_WORD_MASK )>>>0; // asm type annotation\n\n\t// Shift by zero (`>>>0`) sets the sign on the high part of the low word (i.e., \"mid-bits\"):\n\tlbits = ( la*lb )>>>0; // asm type annotation; no integer overflow possible\n\tmbits = ( ((ha*lb) + (la*hb))<<16 )>>>0; // asm type annotation; possible integer overflow\n\n\t// The final `|0` converts from an \"unsigned integer\" (possible integer overflow during sum) to a signed integer:\n\treturn ( lbits + mbits )|0; // asm type annotation\n}\n\n\n// EXPORTS //\n\nexport default imul;\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 imul from './../../../../int32/base/mul';\n\n\n// MAIN //\n\n/**\n* Performs C-like multiplication of two unsigned 32-bit integers.\n*\n* @param {uinteger32} a - integer\n* @param {uinteger32} b - integer\n* @returns {uinteger32} product\n*\n* @example\n* var v = mul( 10>>>0, 4>>>0 );\n* // returns 40\n*/\nfunction mul( a, b ) {\n\treturn imul( a, b ) >>> 0;\n}\n\n\n// EXPORTS //\n\nexport default mul;\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* Copies values from `x` into `y`.\n*\n* @private\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Object} x - input array object\n* @param {Collection} x.data - input array data\n* @param {Array} x.accessors - array element accessors\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting `x` index\n* @param {Object} y - output array object\n* @param {Collection} y.data - output array data\n* @param {Array} y.accessors - array element accessors\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting `y` index\n* @returns {Object} output array object\n*\n* @example\n* import Complex64Array from '@stdlib/array/complex64';\n* import Complex64 from '@stdlib/complex/float32/ctor';\n* import reinterpret64 from '@stdlib/strided/base/reinterpret-complex64';\n*\n* function setter( data, idx, value ) {\n* data.set( value, idx );\n* }\n*\n* function getter( data, idx ) {\n* return data.get( idx );\n* }\n*\n* var x = {\n* 'data': new Complex64Array( [ 1.0, 2.0, 3.0, 4.0 ] ),\n* 'accessors': [ getter, setter ]\n* };\n*\n* var y = {\n* 'data': new Complex64Array( [ 5.0, 6.0, 7.0, 8.0 ] ),\n* 'accessors': [ getter, setter ]\n* };\n*\n* gcopy( x.data.length, x, 1, 0, y, 1, 0 );\n*\n* var view = reinterpret64( y.data, 0 );\n* // view => [ 1.0, 2.0, 3.0, 4.0 ]\n*/\nfunction gcopy( N, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar xbuf;\n\tvar ybuf;\n\tvar set;\n\tvar get;\n\tvar ix;\n\tvar iy;\n\tvar i;\n\n\t// Cache references to array data:\n\txbuf = x.data;\n\tybuf = y.data;\n\n\t// Cache a reference to the element accessors:\n\tget = x.accessors[ 0 ];\n\tset = y.accessors[ 1 ];\n\n\tix = offsetX;\n\tiy = offsetY;\n\tfor ( i = 0; i < N; i++ ) {\n\t\tset( ybuf, iy, get( xbuf, ix ) );\n\t\tix += strideX;\n\t\tiy += strideY;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default gcopy;\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 arraylike2object from '@stdlib/array/base/arraylike2object';\nimport accessors from './accessors.js';\n\n\n// VARIABLES //\n\nvar M = 8;\n\n\n// MAIN //\n\n/**\n* Copies values from `x` into `y`.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Collection} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {Collection} y - output array\n* @param {integer} strideY - `y` stride length\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];\n* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];\n*\n* gcopy( x.length, x, 1, y, 1 );\n* // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ]\n*/\nfunction gcopy( N, x, strideX, y, strideY ) {\n\tvar ix;\n\tvar iy;\n\tvar ox;\n\tvar oy;\n\tvar m;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tox = arraylike2object( x );\n\toy = arraylike2object( y );\n\tif ( ox.accessorProtocol || oy.accessorProtocol ) {\n\t\tif ( strideX < 0 ) {\n\t\t\tix = (1-N) * strideX;\n\t\t} else {\n\t\t\tix = 0;\n\t\t}\n\t\tif ( strideY < 0 ) {\n\t\t\tiy = (1-N) * strideY;\n\t\t} else {\n\t\t\tiy = 0;\n\t\t}\n\t\taccessors( N, ox, strideX, ix, oy, strideY, iy );\n\t\treturn oy.data;\n\t}\n\t// Use unrolled loops if both strides are equal to `1`...\n\tif ( strideX === 1 && strideY === 1 ) {\n\t\tm = N % M;\n\n\t\t// If we have a remainder, run a clean-up loop...\n\t\tif ( m > 0 ) {\n\t\t\tfor ( i = 0; i < m; i++ ) {\n\t\t\t\ty[ i ] = x[ i ];\n\t\t\t}\n\t\t}\n\t\tif ( N < M ) {\n\t\t\treturn y;\n\t\t}\n\t\tfor ( i = m; i < N; i += M ) {\n\t\t\ty[ i ] = x[ i ];\n\t\t\ty[ i+1 ] = x[ i+1 ];\n\t\t\ty[ i+2 ] = x[ i+2 ];\n\t\t\ty[ i+3 ] = x[ i+3 ];\n\t\t\ty[ i+4 ] = x[ i+4 ];\n\t\t\ty[ i+5 ] = x[ i+5 ];\n\t\t\ty[ i+6 ] = x[ i+6 ];\n\t\t\ty[ i+7 ] = x[ i+7 ];\n\t\t}\n\t\treturn y;\n\t}\n\tif ( strideX < 0 ) {\n\t\tix = (1-N) * strideX;\n\t} else {\n\t\tix = 0;\n\t}\n\tif ( strideY < 0 ) {\n\t\tiy = (1-N) * strideY;\n\t} else {\n\t\tiy = 0;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\ty[ iy ] = x[ ix ];\n\t\tix += strideX;\n\t\tiy += strideY;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default gcopy;\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* Dummy function.\n*\n* @private\n*/\nfunction foo() {\n\t// No-op...\n}\n\n\n// EXPORTS //\n\nexport default foo;\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* BLAS level 1 routine to copy values from `x` into `y`.\n*\n* @module @stdlib/blas/base/gcopy\n*\n* @example\n* import gcopy from '@stdlib/blas/base/gcopy';\n*\n* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];\n* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];\n*\n* gcopy( x.length, x, 1, y, 1 );\n* // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ]\n*\n* @example\n* import gcopy from '@stdlib/blas/base/gcopy';\n*\n* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];\n* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];\n*\n* gcopy.ndarray( x.length, x, 1, 0, y, 1, 0 );\n* // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ]\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport ndarray from './ndarray.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'ndarray', ndarray );\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 arraylike2object from '@stdlib/array/base/arraylike2object';\nimport accessors from './accessors.js';\n\n\n// VARIABLES //\n\nvar M = 8;\n\n\n// MAIN //\n\n/**\n* Copies values from `x` into `y`.\n*\n* @param {PositiveInteger} N - number of indexed elements\n* @param {Collection} x - input array\n* @param {integer} strideX - `x` stride length\n* @param {NonNegativeInteger} offsetX - starting `x` index\n* @param {Collection} y - output array\n* @param {integer} strideY - `y` stride length\n* @param {NonNegativeInteger} offsetY - starting `y` index\n* @returns {Collection} output array\n*\n* @example\n* var x = [ 1.0, 2.0, 3.0, 4.0, 5.0 ];\n* var y = [ 6.0, 7.0, 8.0, 9.0, 10.0 ];\n*\n* gcopy( x.length, x, 1, 0, y, 1, 0 );\n* // y => [ 1.0, 2.0, 3.0, 4.0, 5.0 ]\n*/\nfunction gcopy( N, x, strideX, offsetX, y, strideY, offsetY ) {\n\tvar ix;\n\tvar iy;\n\tvar ox;\n\tvar oy;\n\tvar m;\n\tvar i;\n\n\tif ( N <= 0 ) {\n\t\treturn y;\n\t}\n\tox = arraylike2object( x );\n\toy = arraylike2object( y );\n\tif ( ox.accessorProtocol || oy.accessorProtocol ) {\n\t\taccessors( N, ox, strideX, offsetX, oy, strideY, offsetY );\n\t\treturn oy.data;\n\t}\n\tix = offsetX;\n\tiy = offsetY;\n\n\t// Use unrolled loops if both strides are equal to `1`...\n\tif ( strideX === 1 && strideY === 1 ) {\n\t\tm = N % M;\n\n\t\t// If we have a remainder, run a clean-up loop...\n\t\tif ( m > 0 ) {\n\t\t\tfor ( i = 0; i < m; i++ ) {\n\t\t\t\ty[ iy ] = x[ ix ];\n\t\t\t\tix += strideX;\n\t\t\t\tiy += strideY;\n\t\t\t}\n\t\t}\n\t\tif ( N < M ) {\n\t\t\treturn y;\n\t\t}\n\t\tfor ( i = m; i < N; i += M ) {\n\t\t\ty[ iy ] = x[ ix ];\n\t\t\ty[ iy+1 ] = x[ ix+1 ];\n\t\t\ty[ iy+2 ] = x[ ix+2 ];\n\t\t\ty[ iy+3 ] = x[ ix+3 ];\n\t\t\ty[ iy+4 ] = x[ ix+4 ];\n\t\t\ty[ iy+5 ] = x[ ix+5 ];\n\t\t\ty[ iy+6 ] = x[ ix+6 ];\n\t\t\ty[ iy+7 ] = x[ ix+7 ];\n\t\t\tix += M;\n\t\t\tiy += M;\n\t\t}\n\t\treturn y;\n\t}\n\tfor ( i = 0; i < N; i++ ) {\n\t\ty[ iy ] = x[ ix ];\n\t\tix += strideX;\n\t\tiy += strideY;\n\t}\n\treturn y;\n}\n\n\n// EXPORTS //\n\nexport default gcopy;\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 isFunction from '@stdlib/assert/is-function';\nimport hasFunctionNameSupport from '@stdlib/assert/has-function-name-support';\nimport format from '@stdlib/string/format';\nimport { REGEXP as RE } from '@stdlib/regexp/function-name';\n\n\n// VARIABLES //\n\nvar isFunctionNameSupported = hasFunctionNameSupport();\n\n\n// MAIN //\n\n/**\n* Returns the name of a function.\n*\n* @param {Function} fcn - input function\n* @throws {TypeError} must provide a function\n* @returns {string} function name\n*\n* @example\n* var v = functionName( Math.sqrt );\n* // returns 'sqrt'\n*\n* @example\n* var v = functionName( function foo(){} );\n* // returns 'foo'\n*\n* @example\n* var v = functionName( function(){} );\n* // returns '' || 'anonymous'\n*\n* @example\n* var v = functionName( String );\n* // returns 'String'\n*/\nfunction functionName( fcn ) {\n\t// TODO: add support for generator functions?\n\tif ( isFunction( fcn ) === false ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a function. Value: `%s`.', fcn ) );\n\t}\n\tif ( isFunctionNameSupported ) {\n\t\treturn fcn.name;\n\t}\n\treturn RE.exec( fcn.toString() )[ 1 ];\n}\n\n\n// EXPORTS //\n\nexport default functionName;\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 foo from './foo.js';\n\n\n// MAIN //\n\n/**\n* Tests for native function `name` support.\n*\n* @returns {boolean} boolean indicating if an environment has function `name` support\n*\n* @example\n* var bool = hasFunctionNameSupport();\n* // returns \n*/\nfunction hasFunctionNameSupport() {\n\treturn ( foo.name === 'foo' );\n}\n\n\n// EXPORTS //\n\nexport default hasFunctionNameSupport;\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* Half-precision floating-point positive infinity.\n*\n* @module @stdlib/constants/float16/pinf\n* @type {number}\n*\n* @example\n* import FLOAT16_PINF from '@stdlib/constants/float16/pinf';\n* // returns +infinity\n*/\n\n// MODULES //\n\nimport Number from '@stdlib/number/ctor';\n\n\n// MAIN //\n\n/**\n* Half-precision floating-point positive infinity.\n*\n* ## Notes\n*\n* Half-precision floating-point positive infinity has the bit sequence\n*\n* ```binarystring\n* 0 11111 0000000000\n* ```\n*\n* This bit sequence corresponds to the unsigned 16-bit integer `31744` and to the HEX value `0x7c00`.\n*\n* @constant\n* @type {number}\n* @default infinity\n* @see [half-precision floating-point format]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n*/\nvar FLOAT16_PINF = Number.POSITIVE_INFINITY; // TODO: if, and when, float16 is natively available, assign the true constant; otherwise, fall back to float64\n\n\n// EXPORTS //\n\nexport default FLOAT16_PINF;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar main = ( typeof Float16Array === 'function' ) ? Float16Array : null; // eslint-disable-line no-undef, 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// MODULES //\n\nimport defineProperty from './../../define-property';\n\n\n// MAIN //\n\n/**\n* Defines a read-write accessor.\n*\n* @param {Object} obj - object on which to define the property\n* @param {(string|symbol)} prop - property name\n* @param {Function} getter - get accessor\n* @param {Function} setter - set accessor\n*\n* @example\n* function getter() {\n* return name + ' foo';\n* }\n*\n* function setter( v ) {\n* name = v;\n* }\n*\n* var name = 'bar';\n* var obj = {};\n*\n* setReadWriteAccessor( obj, 'foo', getter, setter );\n*\n* var v = obj.foo;\n* // returns 'bar foo'\n*\n* obj.foo = 'beep';\n*\n* v = obj.foo;\n* // returns 'beep foo'\n*/\nfunction setReadWriteAccessor( obj, prop, getter, setter ) {\n\tdefineProperty( obj, prop, {\n\t\t'configurable': false,\n\t\t'enumerable': true,\n\t\t'get': getter,\n\t\t'set': setter\n\t});\n}\n\n\n// EXPORTS //\n\nexport default setReadWriteAccessor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\nvar f16round = ( typeof Math.f16round === 'function' ) ? Math.f16round : null; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default f16round;\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';\n\n\n// MAIN //\n\n/**\n* Tests if a double-precision floating-point numeric value is finite.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is finite\n*\n* @example\n* var bool = isfinite( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isfinite( -2.0e64 );\n* // returns true\n*\n* @example\n* var bool = isfinite( Infinity );\n* // returns false\n*\n* @example\n* var bool = isfinite( -Infinity );\n* // returns false\n*/\nfunction isfinite( x ) {\n\treturn (\n\t\t// NaN check (x !== x ):\n\t\tx === x &&\n\n\t\t// +-infinity check:\n\t\tx > NINF &&\n\t\tx < PINF\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isfinite;\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* Difference between one and the smallest value greater than one that can be represented as a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/eps\n* @type {number}\n*\n* @example\n* import FLOAT16_EPSILON from '@stdlib/constants/float16/eps';\n* // returns 0.0009765625\n*/\n\n\n// MAIN //\n\n/**\n* Difference between one and the smallest value greater than one that can be represented as a half-precision floating-point number.\n*\n* ## Notes\n*\n* The difference is equal to\n*\n* ```tex\n* \\frac{1}{2^{10}}\n* ```\n*\n* @constant\n* @type {number}\n* @default 0.0009765625\n* @see [Half-precision floating-point format]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n* @see [Machine Epsilon]{@link https://en.wikipedia.org/wiki/Machine_epsilon}\n*/\nvar FLOAT16_EPSILON = 0.0009765625; // In JavaScript, can only represent as a double-precision floating-point number (float64)\n\n\n// EXPORTS //\n\nexport default FLOAT16_EPSILON;\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* Smallest positive half-precision floating-point normal number.\n*\n* @module @stdlib/constants/float16/smallest-normal\n* @type {number}\n*\n* @example\n* import FLOAT16_SMALLEST_NORMAL from '@stdlib/constants/float16/smallest-normal';\n* // returns 6.103515625e-5\n*/\n\n\n// MAIN //\n\n/**\n* Smallest positive half-precision floating-point normal number.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* \\frac{1}{2^{15-1}}\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 00001 0000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default 6.103515625e-5\n* @see [Half-precision floating-point format]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n*/\nvar FLOAT16_SMALLEST_NORMAL = 6.103515625e-5;\n\n\n// EXPORTS //\n\nexport default FLOAT16_SMALLEST_NORMAL;\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* Computes the absolute value of a double-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = abs( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = abs( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = abs( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = abs( NaN );\n* // returns NaN\n*/\nfunction abs( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default abs;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFiniteNumber from '@stdlib/math/base/assert/is-finite';\nimport FLOAT16_EPSILON from '@stdlib/constants/float16/eps';\nimport FLOAT16_MAX from '@stdlib/constants/float16/max';\nimport FLOAT16_MIN from '@stdlib/constants/float16/smallest-normal';\nimport EPS from '@stdlib/constants/float64/eps';\nimport PINF from '@stdlib/constants/float64/pinf';\nimport abs from '@stdlib/math/base/special/abs';\n\n\n// VARIABLES //\n\nvar INVERSE_EPSILON = 1.0 / EPS;\n\n\n// FUNCTIONS //\n\n/**\n* Performs banker's rounding (round-half-to-even) via floating-point arithmetic.\n*\n* @private\n* @param {number} n - input value\n* @returns {number} rounded value\n*/\nfunction roundTiesToEven( n ) {\n\treturn ( n + INVERSE_EPSILON ) - INVERSE_EPSILON;\n}\n\n\n// MAIN //\n\n/**\n* Converts a double-precision floating-point number to the nearest half-precision floating-point number.\n*\n* @param {number} x - double-precision floating-point number\n* @returns {number} nearest half-precision floating-point number\n*\n* @example\n* var y = float64ToFloat16( 1.337 );\n* // returns 1.3369140625\n*/\nfunction float64ToFloat16( x ) {\n\tvar res;\n\tvar mod;\n\tvar a;\n\tvar s;\n\n\tif ( x === 0.0 || isNaN( x ) || !isFiniteNumber( x ) ) {\n\t\treturn x;\n\t}\n\tif ( x < 0.0 ) {\n\t\ts = -1.0;\n\t} else {\n\t\ts = 1.0;\n\t}\n\tmod = abs( x );\n\tif ( mod < FLOAT16_MIN ) {\n\t\treturn s * roundTiesToEven( mod/FLOAT16_MIN/FLOAT16_EPSILON ) * FLOAT16_MIN * FLOAT16_EPSILON; // eslint-disable-line max-len\n\t}\n\t// Leverage Veltkamp's algorithm for splitting a number into two numbers to generate an approximation to `x` which fits in a smaller number of bits:\n\ta = ( 1 + ( FLOAT16_EPSILON/EPS ) ) * mod;\n\tres = a - ( a - mod );\n\tif ( res > FLOAT16_MAX || isNaN( res ) ) {\n\t\treturn s * PINF;\n\t}\n\treturn s * res;\n}\n\n\n// EXPORTS //\n\nexport default float64ToFloat16;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Convert a double-precision floating-point number to the nearest half-precision floating-point number.\n*\n* @module @stdlib/number/float64/base/to-float16\n*\n* @example\n* import float64ToFloat16 from '@stdlib/number/float64/base/to-float16';\n*\n* var y = float64ToFloat16( 1.337 );\n* // returns 1.3369140625\n*/\n\n// MODULES //\n\nimport builtin from './main.js';\nimport polyfill from './polyfill.js';\n\n\n// MAIN //\n\nvar main;\nif ( typeof builtin === 'function' ) {\n\tmain = builtin;\n} else {\n\tmain = polyfill;\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/**\n* Maximum half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/max\n* @type {number}\n*\n* @example\n* import FLOAT16_MAX from '@stdlib/constants/float16/max';\n* // returns 65504.0\n*/\n\n\n// MAIN //\n\n/**\n* The maximum half-precision floating-point number.\n*\n* ## Notes\n*\n* The maximum is given by\n*\n* ```tex\n* 2^{15} (2 - 2^{-10})\n* ```\n*\n* @constant\n* @type {number}\n* @default 65504.0\n* @see [half-precision floating-point form]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n*/\nvar FLOAT16_MAX = 65504.0;\n\n\n// EXPORTS //\n\nexport default FLOAT16_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/**\n* Half-precision floating-point negative infinity.\n*\n* @module @stdlib/constants/float16/ninf\n* @type {number}\n*\n* @example\n* import FLOAT16_NINF from '@stdlib/constants/float16/ninf';\n* // returns -Infinity\n*/\n\n// MODULES //\n\nimport Number from '@stdlib/number/ctor';\n\n\n// MAIN //\n\n/**\n* Half-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Half-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111 0000000000\n* ```\n*\n* This bit sequence corresponds to the unsigned 16-bit integer `64512` and to the HEX value `0xfc00`.\n*\n* @constant\n* @type {number}\n* @default -infinity\n* @see [half-precision floating-point format]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n*/\nvar FLOAT16_NINF = Number.NEGATIVE_INFINITY; // TODO: if, and when, float16 is natively available, assign the true constant; otherwise, fall back to float64\n\n\n// EXPORTS //\n\nexport default FLOAT16_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// MODULES //\n\nimport Float32Array from '@stdlib/array/float32';\nimport Uint32Array from '@stdlib/array/uint32';\n\n\n// VARIABLES //\n\nvar FLOAT32_VIEW = new Float32Array( 1.0 );\nvar UINT32_VIEW = new Uint32Array( FLOAT32_VIEW.buffer );\n\n\n// MAIN //\n\n/**\n* Returns an unsigned 32-bit integer corresponding to the IEEE 754 binary representation of a single-precision floating-point number.\n*\n* @param {number} x - single-precision floating-point number\n* @returns {unsigned32} unsigned 32-bit integer\n*\n* @example\n* import float64ToFloat32 from '@stdlib/number/float64/base/to-float32';\n*\n* var f32 = float64ToFloat32( 1.337 );\n* // returns 1.3370000123977661\n*\n* var w = toWordf( f32 ); // => 0 01111111 01010110010001011010001\n* // returns 1068180177\n*/\nfunction toWordf( x ) {\n\tFLOAT32_VIEW[ 0 ] = x;\n\treturn UINT32_VIEW[ 0 ];\n}\n\n\n// EXPORTS //\n\nexport default toWordf;\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* The bias of a single-precision floating-point number's exponent.\n*\n* @module @stdlib/constants/float32/exponent-bias\n* @type {integer32}\n*\n* @example\n* import FLOAT32_EXPONENT_BIAS from '@stdlib/constants/float32/exponent-bias';\n* // returns 127\n*/\n\n\n// MAIN //\n\n/**\n* The bias of a single-precision floating-point number's exponent.\n*\n* ## Notes\n*\n* The bias can be computed via\n*\n* ```tex\n* \\mathrm{bias} = 2^{k-1} - 1\n* ```\n*\n* where \\\\(k\\\\) is the number of bits in the exponent; here, \\\\(k = 8\\\\).\n*\n* @constant\n* @type {integer32}\n* @default 127\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT32_EXPONENT_BIAS = 127|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT32_EXPONENT_BIAS;\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 getWord from './../../../../float32/base/to-word';\nimport BIAS from '@stdlib/constants/float32/exponent-bias';\n\n\n// VARIABLES //\n\n// Exponent mask: 0 11111111 00000000000000000000000\nvar EXP_MASK = 0x7f800000; // TODO: consider making an external constant\n\n\n// MAIN //\n\n/**\n* Returns an integer corresponding to the unbiased exponent of a single-precision floating-point number.\n*\n* @param {number} x - single-precision floating-point number\n* @returns {integer8} unbiased exponent\n*\n* @example\n* import toFloat32 from '@stdlib/number/float64/base/to-float32';\n*\n* var exp = exponentf( toFloat32( 3.14e34 ) ); // => 2**114 ~ 2.08e34\n* // returns 114\n*\n* @example\n* import toFloat32 from '@stdlib/number/float64/base/to-float32';\n*\n* var exp = exponentf( toFloat32( 3.14e-34 ) ); // => 2**-112 ~ 1.93e-34\n* // returns -112\n*\n* @example\n* import toFloat32 from '@stdlib/number/float64/base/to-float32';\n*\n* var exp = exponentf( toFloat32( -3.14 ) );\n* // returns 1\n*\n* @example\n* var exp = exponentf( 0.0 );\n* // returns -127\n*\n* @example\n* var exp = exponentf( NaN );\n* // returns 128\n*/\nfunction exponentf( x ) {\n\t// Convert `x` to an unsigned 32-bit integer corresponding to the IEEE 754 binary representation:\n\tvar w = getWord( x );\n\n\t// Apply a mask to isolate only the exponent bits and then shift off all bits which are part of the fraction:\n\tw = ( w & EXP_MASK ) >>> 23;\n\n\t// Remove the bias and return:\n\treturn w - BIAS;\n}\n\n\n// EXPORTS //\n\nexport default exponentf;\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* Single-precision floating-point negative infinity.\n*\n* @module @stdlib/constants/float32/ninf\n* @type {number}\n*\n* @example\n* import FLOAT32_NINF from '@stdlib/constants/float32/ninf';\n* // returns -Infinity\n*/\n\n// MODULES //\n\nimport Float32Array from '@stdlib/array/float32';\nimport Uint32Array from '@stdlib/array/uint32';\n\n\n// VARIABLES //\n\nvar FLOAT32_VIEW = new Float32Array( 1 );\nvar UINT32_VIEW = new Uint32Array( FLOAT32_VIEW.buffer );\nvar v;\n\n\n// MAIN //\n\n/**\n* Single-precision floating-point negative infinity.\n*\n* ## Notes\n*\n* Single-precision floating-point negative infinity has the bit sequence\n*\n* ```binarystring\n* 1 11111111 00000000000000000000000\n* ```\n*\n* This bit sequence corresponds to the unsigned 32-bit integer `4286578688` and to the HEX value `0xff800000`.\n*\n* @constant\n* @type {number}\n* @default 0xff800000\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT32_NINF = 0xff800000;\n\n// Set the ArrayBuffer bit sequence:\nUINT32_VIEW[ 0 ] = FLOAT32_NINF;\n\nv = FLOAT32_VIEW[ 0 ];\n\n\n// EXPORTS //\n\nexport default v;\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* Mask for the significand of a single-precision floating-point number.\n*\n* @module @stdlib/constants/float32/significand-mask\n* @type {uinteger32}\n*\n* @example\n* import FLOAT32_SIGNIFICAND_MASK from '@stdlib/constants/float32/significand-mask';\n* // returns 8388607\n*/\n\n\n// MAIN //\n\n/**\n* Mask for the significand of a single-precision floating-point number.\n*\n* ## Notes\n*\n* The mask for the significand of a single-precision floating-point number is an unsigned 32-bit integer with the value \\\\( 8388607 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 00000000 11111111111111111111111\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 0x007fffff\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT32_SIGNIFICAND_MASK = 0x007fffff;\n\n\n// EXPORTS //\n\nexport default FLOAT32_SIGNIFICAND_MASK;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport NINF from '@stdlib/constants/float16/ninf';\nimport PINF from '@stdlib/constants/float16/pinf';\nimport isnanf from '@stdlib/math/base/assert/is-nanf';\nimport absf from '@stdlib/math/base/special/absf';\nimport exponent from './../../../../float32/base/exponent';\nimport isNegativeZerof from '@stdlib/math/base/assert/is-negative-zerof';\nimport FLOAT32_SIGNIFICAND_MASK from '@stdlib/constants/float32/significand-mask';\nimport toWordf from './../../../../float32/base/to-word';\n\n\n// VARIABLES //\n\nvar UINT16_NAN = 0x7E00; // 0x7E00 = 32256 => 0 11111 1000000000\nvar UINT16_PINF = 0x7C00; // 0x7C00 = 31744 => 0 11111 0000000000\nvar UINT16_NINF = 0xFC00; // 0xFC00 = 64512 => 1 11111 0000000000\nvar UINT16_POSITIVE_ZERO = 0x0000; // 0x0000 = 0 => 0 00000 0000000000\nvar UINT16_NEGATIVE_ZERO = 0x8000; // 0x8000 = 32768 => 1 00000 0000000000\nvar FLOAT32_IMPLICIT_BIT = 0x800000; // 0x800000 = 8388608 => 0 00000001 00000000000000000000000\nvar FLOAT32_SUBNORMAL_STICKY_MASK = 0x1FFF; // 0x1FFF = 8191 => 0 00000000 00000000001111111111111\nvar FLOAT32_STICKY_MASK = 0xFFF; // 0xFFF = 4095 => 0 00000000 00000000000111111111111\nvar MAX_MANTISSA = 0x3FF; // 0x3FF = 1023 => 0 00000 1111111111\n\n\n// MAIN //\n\n/**\n* Returns an unsigned 16-bit integer corresponding to the IEEE 754 binary representation of a half-precision floating-point number.\n*\n* @param {number} x - half-precision floating-point number\n* @returns {unsigned16} unsigned 16-bit integer\n*\n* @example\n* import float64ToFloat16 from '@stdlib/number/float64/base/to-float16';\n*\n* var f16 = float64ToFloat16( 1.05 );\n* // returns 1.0498046875\n*\n* var w = toWord( f16 ); // => 0 01111 0000110011\n* // returns 15411\n*/\nfunction toWord( x ) {\n\tvar f32Exponent;\n\tvar f16Exponent;\n\tvar stickyBits;\n\tvar mantissa;\n\tvar roundBit;\n\tvar shift;\n\tvar bits;\n\tvar mant;\n\tvar sign;\n\n\t// Handle special cases...\n\tif ( isnanf( x ) ) {\n\t\treturn UINT16_NAN;\n\t}\n\tif ( x === PINF ) {\n\t\treturn UINT16_PINF; // +Infinity\n\t}\n\tif ( x === NINF ) {\n\t\treturn UINT16_NINF; // -Infinity\n\t}\n\tif ( x === 0 ) {\n\t\tif ( isNegativeZerof( x ) ) {\n\t\t\treturn UINT16_NEGATIVE_ZERO;\n\t\t}\n\t\treturn UINT16_POSITIVE_ZERO;\n\t}\n\tif ( x < 0 ) {\n\t\tsign = 1;\n\t} else {\n\t\tsign = 0;\n\t}\n\tx = absf( x );\n\tbits = toWordf( x );\n\n\tmant = bits & FLOAT32_SIGNIFICAND_MASK; // 23-bit mantissa\n\n\t// Store unbiased exponent of a 32-bit floating-point number:\n\tf32Exponent = exponent( x );\n\n\t// Calculate exponent of a 16-bit floating-point number:\n\tf16Exponent = f32Exponent + 15;\n\n\t// Handle overflow (infinity in float16)...\n\tif ( f16Exponent >= 31 ) {\n\t\tif ( sign ) {\n\t\t\treturn UINT16_NINF; // -Infinity\n\t\t}\n\t\treturn UINT16_PINF; // +Infinity\n\t}\n\t// Handle underflow (subnormal or zero in float16)...\n\tif ( f16Exponent <= 0 ) {\n\t\t// Check if the value is too small to be represented even as a subnormal float16 number:\n\t\tif ( f16Exponent < -10 ) {\n\t\t\treturn sign << 15; // return zero with the appropriate sign bit\n\t\t}\n\t\t// Calculate the amount of right shift needed to denormalize the mantissa for subnormal representation:\n\t\tshift = 1 - f16Exponent;\n\n\t\t// Create an 11-bit mantissa by adding the implicit leading 1 bit and extracting the top 10 bits from mantissa:\n\t\tmantissa = ( FLOAT32_IMPLICIT_BIT | mant ) >>> 13;\n\n\t\t// Determine the round bit and sticky bits based on the shift amount to apply correct rounding...\n\t\tif ( shift < 11 ) {\n\t\t\t// Extract the round bit at the position that will be truncated after the shift:\n\t\t\troundBit = ( mantissa >>> ( shift - 1 ) ) & 1;\n\n\t\t\t// Check if any bits below the round bit position are set (sticky bits):\n\t\t\tstickyBits = ( mantissa & ( ( 1 << ( shift - 1 ) ) - 1 ) ) !== 0;\n\n\t\t\t// If no sticky bits found in the 11-bit mantissa, check the remaining bits from the original mantissa:\n\t\t\tif ( !stickyBits ) {\n\t\t\t\tstickyBits = ( mant & FLOAT32_SUBNORMAL_STICKY_MASK ) !== 0;\n\t\t\t}\n\t\t} else {\n\t\t\t// When the shift is 11 or greater, the round bit comes from original mantissa:\n\t\t\troundBit = ( mant >>> ( 13 - ( shift - 11 ) - 1 ) ) & 1;\n\n\t\t\t// Check if any bits below the round bit position in mantissa are set:\n\t\t\tstickyBits = ( mant & ( ( 1 << ( 13 - ( shift - 11 ) - 1 ) ) - 1 ) ) !== 0; // eslint-disable-line max-len\n\t\t}\n\t\t// Apply the denormalization shift to the mantissa:\n\t\tmantissa >>>= shift;\n\n\t\t// Round to nearest even:\n\t\tif ( roundBit && ( stickyBits || ( mantissa & 1 ) ) ) {\n\t\t\tmantissa += 1;\n\t\t}\n\t\treturn ( sign << 15 ) | mantissa;\n\t}\n\t// Extract the top 10 bits of the mantissa from 23 bits:\n\tmantissa = mant >>> 13;\n\n\t// Extract the round bit (the first bit that will be truncated):\n\troundBit = ( mant >>> 12 ) & 1;\n\n\t// Check sticky bits (all bits below bit 12):\n\tstickyBits = ( mant & FLOAT32_STICKY_MASK ) !== 0;\n\n\t// Round up if roundBit is 1 AND (sticky bits OR mantissa is odd):\n\tif ( roundBit && ( stickyBits || ( mantissa & 1 ) ) ) {\n\t\tmantissa += 1;\n\n\t\t// Check for mantissa overflow (carries into exponent)...\n\t\tif ( mantissa > MAX_MANTISSA ) {\n\t\t\tf16Exponent += 1;\n\t\t\tmantissa = 0;\n\n\t\t\t// Check for exponent overflow...\n\t\t\tif ( f16Exponent >= 31 ) {\n\t\t\t\tif ( sign ) {\n\t\t\t\t\treturn UINT16_NINF; // -Infinity\n\t\t\t\t}\n\t\t\t\treturn UINT16_PINF; // +Infinity\n\t\t\t}\n\t\t}\n\t}\n\t// Combine sign (1 bit), exponent (5 bits), and mantissa (10 bits):\n\treturn ( sign << 15 ) | ( f16Exponent << 10 ) | mantissa;\n}\n\n\n// EXPORTS //\n\nexport default toWord;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 if a single-precision floating-point numeric value is `NaN`.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is `NaN`\n*\n* @example\n* var bool = isnanf( NaN );\n* // returns true\n*\n* @example\n* var bool = isnanf( 7.0 );\n* // returns false\n*/\nfunction isnanf( x ) {\n\treturn ( x !== x );\n}\n\n\n// EXPORTS //\n\nexport default isnanf;\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 NINF from '@stdlib/constants/float32/ninf';\n\n\n// MAIN //\n\n/**\n* Tests if a single-precision floating-point numeric value is negative zero.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is negative zero\n*\n* @example\n* var bool = isNegativeZerof( -0.0 );\n* // returns true\n*\n* @example\n* var bool = isNegativeZerof( 0.0 );\n* // returns false\n*/\nfunction isNegativeZerof( x ) {\n\treturn (x === 0.0 && 1.0/x === NINF);\n}\n\n\n// EXPORTS //\n\nexport default isNegativeZerof;\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* Computes the absolute value of a single-precision floating-point number `x`.\n*\n* @param {number} x - input value\n* @returns {number} absolute value\n*\n* @example\n* var v = absf( -1.0 );\n* // returns 1.0\n*\n* @example\n* var v = absf( 2.0 );\n* // returns 2.0\n*\n* @example\n* var v = absf( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = absf( -0.0 );\n* // returns 0.0\n*\n* @example\n* var v = absf( NaN );\n* // returns NaN\n*/\nfunction absf( x ) {\n\treturn Math.abs( x ); // eslint-disable-line stdlib/no-builtin-math\n}\n\n\n// EXPORTS //\n\nexport default absf;\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* The maximum biased base 2 exponent for a double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/max-base2-exponent\n* @type {integer32}\n*\n* @example\n* import FLOAT64_MAX_BASE2_EXPONENT from '@stdlib/constants/float64/max-base2-exponent';\n* // returns 1023\n*/\n\n\n// MAIN //\n\n/**\n* The maximum biased base 2 exponent for a double-precision floating-point number.\n*\n* ```text\n* 11111111110 => 2046 - BIAS = 1023\n* ```\n*\n* where `BIAS = 1023`.\n*\n* @constant\n* @type {integer32}\n* @default 1023\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MAX_BASE2_EXPONENT = 1023|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT64_MAX_BASE2_EXPONENT;\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* The minimum biased base 2 exponent for a normal double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/min-base2-exponent\n* @type {integer32}\n*\n* @example\n* import FLOAT64_MIN_BASE2_EXPONENT from '@stdlib/constants/float64/min-base2-exponent';\n* // returns -1022\n*/\n\n\n// MAIN //\n\n/**\n* The minimum biased base 2 exponent for a normal double-precision floating-point number.\n*\n* ```text\n* 1 - BIAS = -1022\n* ```\n*\n* where `BIAS = 1023`.\n*\n* @constant\n* @type {integer32}\n* @default -1022\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MIN_BASE2_EXPONENT = -1022|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT64_MIN_BASE2_EXPONENT;\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* Rounds a numeric value to the nearest integer.\n*\n* @param {number} x - input value\n* @returns {number} function value\n*\n* @example\n* var v = round( -4.2 );\n* // returns -4.0\n*\n* @example\n* var v = round( -4.5 );\n* // returns -4.0\n*\n* @example\n* var v = round( -4.6 );\n* // returns -5.0\n*\n* @example\n* var v = round( 9.99999 );\n* // returns 10.0\n*\n* @example\n* var v = round( 9.5 );\n* // returns 10.0\n*\n* @example\n* var v = round( 9.2 );\n* // returns 9.0\n*\n* @example\n* var v = round( 0.0 );\n* // returns 0.0\n*\n* @example\n* var v = round( -0.0 );\n* // returns -0.0\n*\n* @example\n* var v = round( Infinity );\n* // returns Infinity\n*\n* @example\n* var v = round( -Infinity );\n* // returns -Infinity\n*\n* @example\n* var v = round( NaN );\n* // returns NaN\n*/\nvar round = Math.round; // eslint-disable-line stdlib/no-builtin-math\n\n\n// EXPORTS //\n\nexport default round;\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* The bias of a double-precision floating-point number's exponent.\n*\n* @module @stdlib/constants/float64/exponent-bias\n* @type {integer32}\n*\n* @example\n* import FLOAT64_EXPONENT_BIAS from '@stdlib/constants/float64/exponent-bias';\n* // returns 1023\n*/\n\n\n// MAIN //\n\n/**\n* Bias of a double-precision floating-point number's exponent.\n*\n* ## Notes\n*\n* The bias can be computed via\n*\n* ```tex\n* \\mathrm{bias} = 2^{k-1} - 1\n* ```\n*\n* where \\\\(k\\\\) is the number of bits in the exponent; here, \\\\(k = 11\\\\).\n*\n* @constant\n* @type {integer32}\n* @default 1023\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_EXPONENT_BIAS = 1023|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT64_EXPONENT_BIAS;\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* The maximum biased base 2 exponent for a subnormal double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/max-base2-exponent-subnormal\n* @type {integer32}\n*\n* @example\n* import FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL from '@stdlib/constants/float64/max-base2-exponent-subnormal';\n* // returns -1023\n*/\n\n\n// MAIN //\n\n/**\n* The maximum biased base 2 exponent for a subnormal double-precision floating-point number.\n*\n* ```text\n* 00000000000 => 0 - BIAS = -1023\n* ```\n*\n* where `BIAS = 1023`.\n*\n* @constant\n* @type {integer32}\n* @default -1023\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL = -1023|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL;\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* The minimum biased base 2 exponent for a subnormal double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/min-base2-exponent-subnormal\n* @type {integer32}\n*\n* @example\n* import FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL from '@stdlib/constants/float64/min-base2-exponent-subnormal';\n* // returns -1074\n*/\n\n\n// MAIN //\n\n/**\n* The minimum biased base 2 exponent for a subnormal double-precision floating-point number.\n*\n* ```text\n* -(BIAS+(52-1)) = -(1023+51) = -1074\n* ```\n*\n* where `BIAS = 1023` and `52` is the number of digits in the significand.\n*\n* @constant\n* @type {integer32}\n* @default -1074\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL = -1074|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL;\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';\n\n\n// MAIN //\n\n/**\n* Tests if a double-precision floating-point numeric value is infinite.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is infinite\n*\n* @example\n* var bool = isInfinite( Infinity );\n* // returns true\n*\n* @example\n* var bool = isInfinite( -Infinity );\n* // returns true\n*\n* @example\n* var bool = isInfinite( 5.0 );\n* // returns false\n*\n* @example\n* var bool = isInfinite( NaN );\n* // returns false\n*/\nfunction isInfinite( x ) {\n\treturn (x === PINF || x === NINF);\n}\n\n\n// EXPORTS //\n\nexport default isInfinite;\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* High word mask for the sign bit of a double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/high-word-sign-mask\n* @type {uinteger32}\n*\n* @example\n* import FLOAT64_HIGH_WORD_SIGN_MASK from '@stdlib/constants/float64/high-word-sign-mask';\n* // returns 2147483648\n*/\n\n\n// MAIN //\n\n/**\n* High word mask for the sign bit of a double-precision floating-point number.\n*\n* ## Notes\n*\n* The high word mask for the sign bit of a double-precision floating-point number is an unsigned 32-bit integer with the value \\\\( 2147483648 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 1 00000000000 00000000000000000000\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 0x80000000\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_HIGH_WORD_SIGN_MASK = 0x80000000>>>0; // eslint-disable-line id-length\n\n\n// EXPORTS //\n\nexport default FLOAT64_HIGH_WORD_SIGN_MASK;\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* High word mask for excluding the sign bit of a double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/high-word-abs-mask\n* @type {uinteger32}\n*\n* @example\n* import FLOAT64_HIGH_WORD_ABS_MASK from '@stdlib/constants/float64/high-word-abs-mask';\n* // returns 2147483647\n*/\n\n\n// MAIN //\n\n/**\n* High word mask for excluding the sign bit of a double-precision floating-point number.\n*\n* ## Notes\n*\n* The high word mask for excluding the sign bit of a double-precision floating-point number is an unsigned 32-bit integer with the value \\\\( 2147483647 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 11111111111 11111111111111111111\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 0x7fffffff\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_HIGH_WORD_ABS_MASK = 0x7fffffff>>>0; // eslint-disable-line id-length\n\n\n// EXPORTS //\n\nexport default FLOAT64_HIGH_WORD_ABS_MASK;\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 Uint8Array from '@stdlib/array/uint8';\nimport Uint16Array from '@stdlib/array/uint16';\n\n\n// MAIN //\n\nvar ctors = {\n\t'uint16': Uint16Array,\n\t'uint8': Uint8Array\n};\n\n\n// EXPORTS //\n\nexport default ctors;\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 ctors from './ctors.js';\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if an environment is little endian.\n*\n* @private\n* @returns {boolean} boolean indicating if an environment is little endian\n*\n* @example\n* var bool = isLittleEndian();\n* // returns \n*/\nfunction isLittleEndian() {\n\tvar uint16view;\n\tvar uint8view;\n\n\tuint16view = new ctors[ 'uint16' ]( 1 );\n\n\t/*\n\t* Set the uint16 view to a value having distinguishable lower and higher order words.\n\t*\n\t* 4660 => 0x1234 => 0x12 0x34 => '00010010 00110100' => (0x12,0x34) == (18,52)\n\t*/\n\tuint16view[ 0 ] = 0x1234;\n\n\t// Create a uint8 view on top of the uint16 buffer:\n\tuint8view = new ctors[ 'uint8' ]( uint16view.buffer );\n\n\t// If little endian, the least significant byte will be first...\n\treturn ( uint8view[ 0 ] === 0x34 );\n}\n\n\n// MAIN //\n\n/**\n* Boolean indicating if an environment is little endian.\n*\n* @constant\n* @type {boolean}\n*/\nvar bool = isLittleEndian(); // eslint-disable-line vars-on-top\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// MODULES //\n\nimport isLittleEndian from '@stdlib/assert/is-little-endian';\n\n\n// MAIN //\n\nvar indices;\nvar HIGH;\nvar LOW;\n\nif ( isLittleEndian === true ) {\n\tHIGH = 1; // second index\n\tLOW = 0; // first index\n} else {\n\tHIGH = 0; // first index\n\tLOW = 1; // second index\n}\nindices = {\n\t'HIGH': HIGH,\n\t'LOW': LOW\n};\n\n\n// EXPORTS //\n\nexport default indices;\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 Uint32Array from '@stdlib/array/uint32';\nimport Float64Array from '@stdlib/array/float64';\nimport indices from './indices.js';\n\n\n// VARIABLES //\n\nvar FLOAT64_VIEW = new Float64Array( 1 );\nvar UINT32_VIEW = new Uint32Array( FLOAT64_VIEW.buffer );\n\nvar HIGH = indices.HIGH;\nvar LOW = indices.LOW;\n\n\n// MAIN //\n\n/**\n* Splits a double-precision floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).\n*\n* ## Notes\n*\n* ```text\n* float64 (64 bits)\n* f := fraction (significand/mantissa) (52 bits)\n* e := exponent (11 bits)\n* s := sign bit (1 bit)\n*\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Float64 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Uint32 | Uint32 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* ```\n*\n* If little endian (more significant bits last):\n*\n* ```text\n* <-- lower higher -->\n* | f7 f6 f5 f4 f3 f2 e2 | f1 |s| e1 |\n* ```\n*\n* If big endian (more significant bits first):\n*\n* ```text\n* <-- higher lower -->\n* |s| e1 e2 | f1 f2 f3 f4 f5 f6 f7 |\n* ```\n*\n* In which Uint32 can we find the higher order bits? If little endian, the second; if big endian, the first.\n*\n* ## References\n*\n* - [Open Group][1]\n*\n* [1]: http://pubs.opengroup.org/onlinepubs/9629399/chap14.htm\n*\n* @private\n* @param {number} x - input value\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import Uint32Array from '@stdlib/array/uint32';\n*\n* var out = new Uint32Array( 2 );\n*\n* var w = toWords( 3.14e201, out, 1, 0 );\n* // returns [ 1774486211, 2479577218 ]\n*\n* var bool = ( w === out );\n* // returns true\n*/\nfunction toWords( x, out, stride, offset ) {\n\tFLOAT64_VIEW[ 0 ] = x;\n\tout[ offset ] = UINT32_VIEW[ HIGH ];\n\tout[ offset + stride ] = UINT32_VIEW[ LOW ];\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default toWords;\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 fcn from './assign.js';\n\n\n// MAIN //\n\n/**\n* Splits a double-precision floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).\n*\n* @param {number} x - input value\n* @returns {Array} output array\n*\n* @example\n* var w = toWords( 3.14e201 );\n* // returns [ 1774486211, 2479577218 ]\n*/\nfunction toWords( x ) {\n\treturn fcn( x, [ 0>>>0, 0>>>0 ], 1, 0 );\n}\n\n\n// EXPORTS //\n\nexport default toWords;\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* Split a double-precision floating-point number into a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).\n*\n* @module @stdlib/number/float64/base/to-words\n*\n* @example\n* import toWords from '@stdlib/number/float64/base/to-words';\n*\n* var w = toWords( 3.14e201 );\n* // returns [ 1774486211, 2479577218 ]\n*\n* @example\n* import Uint32Array from '@stdlib/array/uint32';\n* import toWords from '@stdlib/number/float64/base/to-words';\n*\n* var out = new Uint32Array( 2 );\n*\n* var w = toWords.assign( 3.14e201, out, 1, 0 );\n* // returns [ 1774486211, 2479577218 ]\n*\n* var bool = ( w === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\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 isLittleEndian from '@stdlib/assert/is-little-endian';\n\n\n// MAIN //\n\nvar HIGH;\nif ( isLittleEndian === true ) {\n\tHIGH = 1; // second index\n} else {\n\tHIGH = 0; // first index\n}\n\n\n// EXPORTS //\n\nexport default HIGH;\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 isLittleEndian from '@stdlib/assert/is-little-endian';\n\n\n// MAIN //\n\nvar indices;\nvar HIGH;\nvar LOW;\n\nif ( isLittleEndian === true ) {\n\tHIGH = 1; // second index\n\tLOW = 0; // first index\n} else {\n\tHIGH = 0; // first index\n\tLOW = 1; // second index\n}\nindices = {\n\t'HIGH': HIGH,\n\t'LOW': LOW\n};\n\n\n// EXPORTS //\n\nexport default indices;\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 Uint32Array from '@stdlib/array/uint32';\nimport Float64Array from '@stdlib/array/float64';\nimport HIGH from './high.js';\n\n\n// VARIABLES //\n\nvar FLOAT64_VIEW = new Float64Array( 1 );\nvar UINT32_VIEW = new Uint32Array( FLOAT64_VIEW.buffer );\n\n\n// MAIN //\n\n/**\n* Returns an unsigned 32-bit integer corresponding to the more significant 32 bits of a double-precision floating-point number.\n*\n* ## Notes\n*\n* ```text\n* float64 (64 bits)\n* f := fraction (significand/mantissa) (52 bits)\n* e := exponent (11 bits)\n* s := sign bit (1 bit)\n*\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Float64 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Uint32 | Uint32 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* ```\n*\n* If little endian (more significant bits last):\n*\n* ```text\n* <-- lower higher -->\n* | f7 f6 f5 f4 f3 f2 e2 | f1 |s| e1 |\n* ```\n*\n* If big endian (more significant bits first):\n*\n* ```text\n* <-- higher lower -->\n* |s| e1 e2 | f1 f2 f3 f4 f5 f6 f7 |\n* ```\n*\n* In which Uint32 can we find the higher order bits? If little endian, the second; if big endian, the first.\n*\n* ## References\n*\n* - [Open Group][1]\n*\n* [1]: http://pubs.opengroup.org/onlinepubs/9629399/chap14.htm\n*\n* @param {number} x - input value\n* @returns {uinteger32} higher order word\n*\n* @example\n* var w = getHighWord( 3.14e201 ); // => 01101001110001001000001011000011\n* // returns 1774486211\n*/\nfunction getHighWord( x ) {\n\tFLOAT64_VIEW[ 0 ] = x;\n\treturn UINT32_VIEW[ HIGH ];\n}\n\n\n// EXPORTS //\n\nexport default getHighWord;\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 Uint32Array from '@stdlib/array/uint32';\nimport Float64Array from '@stdlib/array/float64';\nimport indices from './indices.js';\n\n\n// VARIABLES //\n\nvar FLOAT64_VIEW = new Float64Array( 1 );\nvar UINT32_VIEW = new Uint32Array( FLOAT64_VIEW.buffer );\n\nvar HIGH = indices.HIGH;\nvar LOW = indices.LOW;\n\n\n// MAIN //\n\n/**\n* Creates a double-precision floating-point number from a higher order word (unsigned 32-bit integer) and a lower order word (unsigned 32-bit integer).\n*\n* ## Notes\n*\n* ```text\n* float64 (64 bits)\n* f := fraction (significand/mantissa) (52 bits)\n* e := exponent (11 bits)\n* s := sign bit (1 bit)\n*\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Float64 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* | Uint32 | Uint32 |\n* |-------- -------- -------- -------- -------- -------- -------- --------|\n* ```\n*\n* If little endian (more significant bits last):\n*\n* ```text\n* <-- lower higher -->\n* | f7 f6 f5 f4 f3 f2 e2 | f1 |s| e1 |\n* ```\n*\n* If big endian (more significant bits first):\n*\n* ```text\n* <-- higher lower -->\n* |s| e1 e2 | f1 f2 f3 f4 f5 f6 f7 |\n* ```\n*\n* In which Uint32 should we place the higher order bits? If little endian, the second; if big endian, the first.\n*\n* ## References\n*\n* - [Open Group][1]\n*\n* [1]: http://pubs.opengroup.org/onlinepubs/9629399/chap14.htm\n*\n* @param {uinteger32} high - higher order word (unsigned 32-bit integer)\n* @param {uinteger32} low - lower order word (unsigned 32-bit integer)\n* @returns {number} floating-point number\n*\n* @example\n* var v = fromWords( 1774486211, 2479577218 );\n* // returns 3.14e201\n*\n* @example\n* var v = fromWords( 3221823995, 1413754136 );\n* // returns -3.141592653589793\n*\n* @example\n* var v = fromWords( 0, 0 );\n* // returns 0.0\n*\n* @example\n* var v = fromWords( 2147483648, 0 );\n* // returns -0.0\n*\n* @example\n* var v = fromWords( 2146959360, 0 );\n* // returns NaN\n*\n* @example\n* var v = fromWords( 2146435072, 0 );\n* // returns Infinity\n*\n* @example\n* var v = fromWords( 4293918720, 0 );\n* // returns -Infinity\n*/\nfunction fromWords( high, low ) {\n\tUINT32_VIEW[ HIGH ] = high;\n\tUINT32_VIEW[ LOW ] = low;\n\treturn FLOAT64_VIEW[ 0 ];\n}\n\n\n// EXPORTS //\n\nexport default fromWords;\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 SIGN_MASK from '@stdlib/constants/float64/high-word-sign-mask';\nimport ABS_MASK from '@stdlib/constants/float64/high-word-abs-mask';\nimport toWords from '@stdlib/number/float64/base/to-words';\nimport getHighWord from '@stdlib/number/float64/base/get-high-word';\nimport fromWords from '@stdlib/number/float64/base/from-words';\n\n\n// VARIABLES //\n\n// High/low words workspace:\nvar WORDS = [ 0, 0 ];\n\n\n// MAIN //\n\n/**\n* Returns a double-precision floating-point number with the magnitude of `x` and the sign of `y`.\n*\n* @param {number} x - number from which to derive a magnitude\n* @param {number} y - number from which to derive a sign\n* @returns {number} a double-precision floating-point number\n*\n* @example\n* var z = copysign( -3.14, 10.0 );\n* // returns 3.14\n*\n* @example\n* var z = copysign( 3.14, -1.0 );\n* // returns -3.14\n*\n* @example\n* var z = copysign( 1.0, -0.0 );\n* // returns -1.0\n*\n* @example\n* var z = copysign( -3.14, -0.0 );\n* // returns -3.14\n*\n* @example\n* var z = copysign( -0.0, 1.0 );\n* // returns 0.0\n*/\nfunction copysign( x, y ) {\n\tvar hx;\n\tvar hy;\n\n\t// Split `x` into higher and lower order words:\n\ttoWords.assign( x, WORDS, 1, 0 );\n\thx = WORDS[ 0 ];\n\n\t// Turn off the sign bit of `x`:\n\thx &= ABS_MASK;\n\n\t// Extract the higher order word from `y`:\n\thy = getHighWord( y );\n\n\t// Leave only the sign bit of `y` turned on:\n\thy &= SIGN_MASK;\n\n\t// Copy the sign bit of `y` to `x`:\n\thx |= hy;\n\n\t// Return a new value having the same magnitude as `x`, but with the sign of `y`:\n\treturn fromWords( hx, WORDS[ 1 ] );\n}\n\n\n// EXPORTS //\n\nexport default copysign;\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* Smallest positive double-precision floating-point normal number.\n*\n* @module @stdlib/constants/float64/smallest-normal\n* @type {number}\n*\n* @example\n* import FLOAT64_SMALLEST_NORMAL from '@stdlib/constants/float64/smallest-normal';\n* // returns 2.2250738585072014e-308\n*/\n\n\n// MAIN //\n\n/**\n* The smallest positive double-precision floating-point normal number.\n*\n* ## Notes\n*\n* The number has the value\n*\n* ```tex\n* \\frac{1}{2^{1023-1}}\n* ```\n*\n* which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 00000000001 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* @constant\n* @type {number}\n* @default 2.2250738585072014e-308\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_SMALLEST_NORMAL = 2.2250738585072014e-308;\n\n\n// EXPORTS //\n\nexport default FLOAT64_SMALLEST_NORMAL;\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 FLOAT64_SMALLEST_NORMAL from '@stdlib/constants/float64/smallest-normal';\nimport isInfinite from '@stdlib/math/base/assert/is-infinite';\nimport isnan from '@stdlib/math/base/assert/is-nan';\nimport abs from '@stdlib/math/base/special/abs';\n\n\n// VARIABLES //\n\n// (1<<52)\nvar SCALAR = 4503599627370496;\n\n\n// MAIN //\n\n/**\n* Returns a normal number `y` and exponent `exp` satisfying \\\\(x = y \\cdot 2^\\mathrm{exp}\\\\) and assigns results to a provided output array.\n*\n* @param {number} x - input value\n* @param {Collection} out - output array\n* @param {integer} stride - output array stride\n* @param {NonNegativeInteger} offset - output array index offset\n* @returns {Collection} output array\n*\n* @example\n* import pow from '@stdlib/math/base/special/pow';\n*\n* var out = normalize( 3.14e-319, [ 0.0, 0 ], 1, 0 );\n* // returns [ 1.4141234400356668e-303, -52 ]\n*\n* var y = out[ 0 ];\n* var exp = out[ 1 ];\n*\n* var bool = ( y*pow(2.0,exp) === 3.14e-319 );\n* // returns true\n*\n* @example\n* var out = normalize( 0.0, [ 0.0, 0 ], 1, 0 );\n* // returns [ 0.0, 0 ];\n*\n* @example\n* import PINF from '@stdlib/constants/float64/pinf';\n*\n* var out = normalize( PINF, [ 0.0, 0 ], 1, 0 );\n* // returns [ Infinity, 0 ]\n*\n* @example\n* import NINF from '@stdlib/constants/float64/ninf';\n*\n* var out = normalize( NINF, [ 0.0, 0 ], 1, 0 );\n* // returns [ -Infinity, 0 ]\n*\n* @example\n* var out = normalize( NaN, [ 0.0, 0 ], 1, 0 );\n* // returns [ NaN, 0 ]\n*/\nfunction normalize( x, out, stride, offset ) {\n\tif ( isnan( x ) || isInfinite( x ) ) {\n\t\tout[ offset ] = x;\n\t\tout[ offset + stride ] = 0;\n\t\treturn out;\n\t}\n\tif ( x !== 0.0 && abs( x ) < FLOAT64_SMALLEST_NORMAL ) {\n\t\tout[ offset ] = x * SCALAR;\n\t\tout[ offset + stride ] = -52;\n\t\treturn out;\n\t}\n\tout[ offset ] = x;\n\tout[ offset + stride ] = 0;\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default normalize;\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 normal number `y` and exponent `exp` satisfying \\\\(x = y \\cdot 2^\\mathrm{exp}\\\\).\n*\n* @module @stdlib/number/float64/base/normalize\n*\n* @example\n* import pow from '@stdlib/math/base/special/pow';\n* import normalize from '@stdlib/number/float64/base/normalize';\n*\n* var out = normalize( 3.14e-319 );\n* // returns [ 1.4141234400356668e-303, -52 ]\n*\n* var y = out[ 0 ];\n* var exp = out[ 1 ];\n*\n* var bool = ( y*pow(2.0, exp) === 3.14e-319 );\n* // returns true\n*\n* @example\n* import Float64Array from '@stdlib/array/float64';\n* import normalize from '@stdlib/number/float64/base/normalize';\n*\n* var out = new Float64Array( 2 );\n*\n* var v = normalize.assign( 3.14e-319, out, 1, 0 );\n* // returns [ 1.4141234400356668e-303, -52 ]\n*\n* var bool = ( v === out );\n* // returns true\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport assign from './assign.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'assign', assign );\n\n\n// EXPORTS //\n\nexport default main;\n","/**\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 fcn from './assign.js';\n\n\n// MAIN //\n\n/**\n* Returns a normal number `y` and exponent `exp` satisfying \\\\(x = y \\cdot 2^\\mathrm{exp}\\\\).\n*\n* @param {number} x - input value\n* @returns {NumberArray} output array\n*\n* @example\n* import pow from '@stdlib/math/base/special/pow';\n*\n* var out = normalize( 3.14e-319 );\n* // returns [ 1.4141234400356668e-303, -52 ]\n*\n* var y = out[ 0 ];\n* var exp = out[ 1 ];\n*\n* var bool = ( y*pow(2.0,exp) === 3.14e-319 );\n* // returns true\n*\n* @example\n* var out = normalize( 0.0 );\n* // returns [ 0.0, 0 ]\n*\n* @example\n* import PINF from '@stdlib/constants/float64/pinf';\n*\n* var out = normalize( PINF );\n* // returns [ Infinity, 0 ]\n*\n* @example\n* import NINF from '@stdlib/constants/float64/ninf';\n*\n* var out = normalize( NINF );\n* // returns [ -Infinity, 0 ]\n*\n* @example\n* var out = normalize( NaN );\n* // returns [ NaN, 0 ]\n*/\nfunction normalize( x ) {\n\treturn fcn( x, [ 0.0, 0 ], 1, 0 );\n}\n\n\n// EXPORTS //\n\nexport default normalize;\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* High word mask for the exponent of a double-precision floating-point number.\n*\n* @module @stdlib/constants/float64/high-word-exponent-mask\n* @type {uinteger32}\n*\n* @example\n* import FLOAT64_HIGH_WORD_EXPONENT_MASK from '@stdlib/constants/float64/high-word-exponent-mask';\n* // returns 2146435072\n*/\n\n\n// MAIN //\n\n/**\n* High word mask for the exponent of a double-precision floating-point number.\n*\n* ## Notes\n*\n* The high word mask for the exponent of a double-precision floating-point number is an unsigned 32-bit integer with the value \\\\( 2146435072 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 11111111111 00000000000000000000\n* ```\n*\n* @constant\n* @type {uinteger32}\n* @default 0x7ff00000\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT64_HIGH_WORD_EXPONENT_MASK = 0x7ff00000;\n\n\n// EXPORTS //\n\nexport default FLOAT64_HIGH_WORD_EXPONENT_MASK;\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// NOTES //\n\n/*\n* => ldexp: load exponent (see [The Open Group]{@link http://pubs.opengroup.org/onlinepubs/9699919799/functions/ldexp.html} and [cppreference]{@link http://en.cppreference.com/w/c/numeric/math/ldexp}).\n*/\n\n\n// MODULES //\n\nimport PINF from '@stdlib/constants/float64/pinf';\nimport NINF from '@stdlib/constants/float64/ninf';\nimport BIAS from '@stdlib/constants/float64/exponent-bias';\nimport MAX_EXPONENT from '@stdlib/constants/float64/max-base2-exponent';\nimport MAX_SUBNORMAL_EXPONENT from '@stdlib/constants/float64/max-base2-exponent-subnormal';\nimport MIN_SUBNORMAL_EXPONENT from '@stdlib/constants/float64/min-base2-exponent-subnormal';\nimport isnan from './../../../../base/assert/is-nan';\nimport isInfinite from './../../../../base/assert/is-infinite';\nimport copysign from './../../../../base/special/copysign';\nimport { assign as normalize } from '@stdlib/number/float64/base/normalize';\nimport floatExp from '@stdlib/number/float64/base/exponent';\nimport toWords from '@stdlib/number/float64/base/to-words';\nimport fromWords from '@stdlib/number/float64/base/from-words';\n\n\n// VARIABLES //\n\n// 1/(1<<52) = 1/(2**52) = 1/4503599627370496\nvar TWO52_INV = 2.220446049250313e-16;\n\n// Exponent all 0s: 1 00000000000 11111111111111111111 => 2148532223\nvar CLEAR_EXP_MASK = 0x800fffff>>>0; // asm type annotation\n\n// Normalization workspace:\nvar FRAC = [ 0.0, 0.0 ];\n\n// High/low words workspace:\nvar WORDS = [ 0, 0 ];\n\n\n// MAIN //\n\n/**\n* Multiplies a double-precision floating-point number by an integer power of two.\n*\n* @param {number} frac - fraction\n* @param {integer} exp - exponent\n* @returns {number} double-precision floating-point number\n*\n* @example\n* var x = ldexp( 0.5, 3 ); // => 0.5 * 2^3 = 0.5 * 8\n* // returns 4.0\n*\n* @example\n* var x = ldexp( 4.0, -2 ); // => 4 * 2^(-2) = 4 * (1/4)\n* // returns 1.0\n*\n* @example\n* var x = ldexp( 0.0, 20 );\n* // returns 0.0\n*\n* @example\n* var x = ldexp( -0.0, 39 );\n* // returns -0.0\n*\n* @example\n* var x = ldexp( NaN, -101 );\n* // returns NaN\n*\n* @example\n* var x = ldexp( Infinity, 11 );\n* // returns Infinity\n*\n* @example\n* var x = ldexp( -Infinity, -118 );\n* // returns -Infinity\n*/\nfunction ldexp( frac, exp ) {\n\tvar high;\n\tvar m;\n\tif (\n\t\texp === 0 ||\n\t\tfrac === 0.0 || // handles +-0\n\t\tisnan( frac ) ||\n\t\tisInfinite( frac )\n\t) {\n\t\treturn frac;\n\t}\n\t// Normalize the input fraction:\n\tnormalize( frac, FRAC, 1, 0 );\n\tfrac = FRAC[ 0 ];\n\texp += FRAC[ 1 ];\n\n\t// Extract the exponent from `frac` and add it to `exp`:\n\texp += floatExp( frac );\n\n\t// Check for underflow/overflow...\n\tif ( exp < MIN_SUBNORMAL_EXPONENT ) {\n\t\treturn copysign( 0.0, frac );\n\t}\n\tif ( exp > MAX_EXPONENT ) {\n\t\tif ( frac < 0.0 ) {\n\t\t\treturn NINF;\n\t\t}\n\t\treturn PINF;\n\t}\n\t// Check for a subnormal and scale accordingly to retain precision...\n\tif ( exp <= MAX_SUBNORMAL_EXPONENT ) {\n\t\texp += 52;\n\t\tm = TWO52_INV;\n\t} else {\n\t\tm = 1.0;\n\t}\n\t// Split the fraction into higher and lower order words:\n\ttoWords.assign( frac, WORDS, 1, 0 );\n\thigh = WORDS[ 0 ];\n\n\t// Clear the exponent bits within the higher order word:\n\thigh &= CLEAR_EXP_MASK;\n\n\t// Set the exponent bits to the new exponent:\n\thigh |= ((exp+BIAS) << 20);\n\n\t// Create a new floating-point number:\n\treturn m * fromWords( high, WORDS[ 1 ] );\n}\n\n\n// EXPORTS //\n\nexport default ldexp;\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 getHighWord from './../../../../float64/base/get-high-word';\nimport EXP_MASK from '@stdlib/constants/float64/high-word-exponent-mask';\nimport BIAS from '@stdlib/constants/float64/exponent-bias';\n\n\n// MAIN //\n\n/**\n* Returns an integer corresponding to the unbiased exponent of a double-precision floating-point number.\n*\n* @param {number} x - input value\n* @returns {integer32} unbiased exponent\n*\n* @example\n* var exp = exponent( 3.14e-307 ); // => 2**-1019 ~ 1e-307\n* // returns -1019\n*\n* @example\n* var exp = exponent( -3.14 );\n* // returns 1\n*\n* @example\n* var exp = exponent( 0.0 );\n* // returns -1023\n*\n* @example\n* var exp = exponent( NaN );\n* // returns 1024\n*/\nfunction exponent( x ) {\n\t// Extract from the input value a higher order word (unsigned 32-bit integer) which contains the exponent:\n\tvar high = getHighWord( x );\n\n\t// Apply a mask to isolate only the exponent bits and then shift off all bits which are part of the fraction:\n\thigh = ( high & EXP_MASK ) >>> 20;\n\n\t// Remove the bias and return:\n\treturn (high - BIAS)|0; // asm type annotation\n}\n\n\n// EXPORTS //\n\nexport default exponent;\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* ## Notice\n*\n* The original C code, long comment, copyright, license, and constants are from [Cephes]{@link http://www.netlib.org/cephes}. The implementation follows the original, but has been modified for JavaScript.\n*\n* ```text\n* Copyright 1984, 1995, 2000 by Stephen L. Moshier\n*\n* Some software in this archive may be from the book _Methods and Programs for Mathematical Functions_ (Prentice-Hall or Simon & Schuster International, 1989) or from the Cephes Mathematical Library, a commercial product. In either event, it is copyrighted by the author. What you see here may be used freely but it comes with no support or guarantee.\n*\n* Stephen L. Moshier\n* moshier@na-net.ornl.gov\n* ```\n*/\n\n'use strict';\n\n// TODO: replace with TOMS (Openlibm) algo (updating license header and long comment)\n\n// MODULES //\n\nimport FLOAT64_MAX_BASE2_EXPONENT from '@stdlib/constants/float64/max-base2-exponent'; // eslint-disable-line id-length\nimport FLOAT64_MIN_BASE2_EXPONENT from '@stdlib/constants/float64/min-base2-exponent'; // eslint-disable-line id-length\nimport round from './../../../../base/special/round';\nimport ldexp from './../../../../base/special/ldexp';\nimport isnan from './../../../../base/assert/is-nan';\nimport PINF from '@stdlib/constants/float64/pinf';\nimport polyvalP from './polyval_p.js';\nimport polyvalQ from './polyval_q.js';\n\n\n// MAIN //\n\n/**\n* Evaluates the base `2` exponential function.\n*\n* ## Method\n*\n* - Range reduction is accomplished by separating the argument into an integer \\\\( k \\\\) and fraction \\\\( f \\\\) such that\n*\n* ```tex\n* 2^x = 2^k 2^f\n* ```\n*\n* - A Pade' approximate\n*\n* ```tex\n* 1 + 2x \\frac{\\mathrm{P}\\left(x^2\\right)}{\\mathrm{Q}\\left(x^2\\right) - x \\mathrm{P}\\left(x^2\\right)}\n* ```\n*\n* approximates \\\\( 2^x \\\\) in the basic range \\\\( \\[-0.5, 0.5] \\\\).\n*\n* ## Notes\n*\n* - Relative error:\n*\n* | arithmetic | domain | # trials | peak | rms |\n* |:----------:|:-----------:|:--------:|:-------:|:-------:|\n* | IEEE | -1022,+1024 | 30000 | 1.8e-16 | 5.4e-17 |\n*\n* @param {number} x - input value\n* @returns {number} function value\n*\n* @example\n* var v = exp2( 3.0 );\n* // returns 8.0\n*\n* @example\n* var v = exp2( -9.0 );\n* // returns ~0.002\n*\n* @example\n* var v = exp2( 0.0 );\n* // returns 1.0\n*\n* @example\n* var v = exp2( NaN );\n* // returns NaN\n*/\nfunction exp2( x ) {\n\tvar px;\n\tvar xx;\n\tvar n;\n\tif ( isnan( x ) ) {\n\t\treturn x;\n\t}\n\tif ( x > FLOAT64_MAX_BASE2_EXPONENT ) {\n\t\treturn PINF;\n\t}\n\tif ( x < FLOAT64_MIN_BASE2_EXPONENT ) {\n\t\treturn 0.0;\n\t}\n\t// Separate into integer and fractional parts...\n\tn = round( x );\n\tx -= n;\n\n\txx = x * x;\n\tpx = x * polyvalP( xx );\n\tx = px / ( polyvalQ( xx ) - px );\n\tx = 1.0 + ldexp( x, 1 );\n\n\t// Scale by power of 2:\n\treturn ldexp( x, n );\n}\n\n\n// EXPORTS //\n\nexport default exp2;\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/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 1513.906801156151;\n\t}\n\treturn 1513.906801156151 + (x * (20.202065669316532 + (x * 0.023093347705734523))); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default evalpoly;\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/* This is a generated file. Do not edit directly. */\n'use strict';\n\n// MAIN //\n\n/**\n* Evaluates a polynomial.\n*\n* ## Notes\n*\n* - The implementation uses [Horner's rule][horners-method] for efficient computation.\n*\n* [horners-method]: https://en.wikipedia.org/wiki/Horner%27s_method\n*\n* @private\n* @param {number} x - value at which to evaluate the polynomial\n* @returns {number} evaluated polynomial\n*/\nfunction evalpoly( x ) {\n\tif ( x === 0.0 ) {\n\t\treturn 4368.211668792106;\n\t}\n\treturn 4368.211668792106 + (x * (233.1842117223149 + (x * 1.0)));\n}\n\n\n// EXPORTS //\n\nexport default evalpoly;\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* The bias of a half-precision floating-point number's exponent.\n*\n* @module @stdlib/constants/float16/exponent-bias\n* @type {integer32}\n*\n* @example\n* import FLOAT16_EXPONENT_BIAS from '@stdlib/constants/float16/exponent-bias';\n* // returns 15\n*/\n\n\n// MAIN //\n\n/**\n* The bias of a half-precision floating-point number's exponent.\n*\n* ## Notes\n*\n* The bias can be computed via\n*\n* ```tex\n* \\mathrm{bias} = 2^{k-1} - 1\n* ```\n*\n* where \\\\(k\\\\) is the number of bits in the exponent; here, \\\\(k = 5\\\\).\n*\n* @constant\n* @type {integer32}\n* @default 15\n* @see [Half-precision floating-point format]{@link https://en.wikipedia.org/wiki/Half-precision_floating-point_format}\n*/\nvar FLOAT16_EXPONENT_BIAS = 15|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default FLOAT16_EXPONENT_BIAS;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport NINF from '@stdlib/constants/float16/ninf';\nimport PINF from '@stdlib/constants/float16/pinf';\nimport exp2 from '@stdlib/math/base/special/exp2';\nimport FLOAT16_EXPONENT_BIAS from '@stdlib/constants/float16/exponent-bias';\nimport FLOAT16_SIGN_MASK from '@stdlib/constants/float16/sign-mask';\nimport FLOAT16_EXPONENT_MASK from '@stdlib/constants/float16/exponent-mask';\nimport FLOAT16_SIGNIFICAND_MASK from '@stdlib/constants/float16/significand-mask';\nimport FLOAT16_NUM_SIGNIFICAND_BITS from '@stdlib/constants/float16/num-significand-bits'; // eslint-disable-line id-length\nimport FLOAT16_NUM_EXPONENT_BITS from '@stdlib/constants/float16/num-exponent-bits';\n\n\n// VARIABLES //\n\nvar MAX_EXPONENT = exp2( FLOAT16_NUM_EXPONENT_BITS ) - 1; // Maximum exponent value\nvar SUBNORMAL_EXPONENT = 1 - FLOAT16_EXPONENT_BIAS; // Minimum exponent for subnormal numbers\n\n\n// MAIN //\n\n/**\n* Creates a half-precision floating-point number from an unsigned integer corresponding to an IEEE 754 binary representation.\n*\n* @param {uinteger16} word - unsigned integer\n* @returns {number} half-precision floating-point number\n*\n* @example\n* var word = 15411; // => 0 01111 0000110011\n*\n* var f16 = fromWord( word ); // when printed, implicitly promoted to float64\n* // returns 1.0498046875\n*/\nfunction fromWord( word ) {\n\tvar mantissa;\n\tvar exponent;\n\tvar sign;\n\tvar f16;\n\n\t// Extract sign bit (bit 15):\n\tsign = ( word & FLOAT16_SIGN_MASK ) >>> 15;\n\n\t// Extract exponent (bits 14-10):\n\texponent = ( word & FLOAT16_EXPONENT_MASK ) >>> FLOAT16_NUM_SIGNIFICAND_BITS; // eslint-disable-line max-len\n\n\t// Extract mantissa (bits 9-0):\n\tmantissa = word & FLOAT16_SIGNIFICAND_MASK;\n\n\t// Handle special cases...\n\tif ( exponent === MAX_EXPONENT ) {\n\t\tif ( mantissa === 0 ) {\n\t\t\tif ( sign === 1 ) {\n\t\t\t\treturn NINF; // -Infinity\n\t\t\t}\n\t\t\treturn PINF; // +Infinity\n\t\t}\n\t\treturn NaN; // NaN\n\t}\n\t// Handle zero and subnormal numbers...\n\tif ( exponent === 0 ) {\n\t\tif ( mantissa === 0 ) {\n\t\t\tif ( sign === 1 ) {\n\t\t\t\treturn -0.0;\n\t\t\t}\n\t\t\treturn 0.0;\n\t\t}\n\t\t// Subnormal number: (-1)^sign × 2^(-14) × (0.mantissa)\n\t\tf16 = exp2( SUBNORMAL_EXPONENT ) * ( mantissa / 1024.0 );\n\t\tif ( sign ) {\n\t\t\treturn -f16;\n\t\t}\n\t\treturn f16;\n\t}\n\t// Normal number: (-1)^sign × 2^(exponent - 15) × (1.mantissa)\n\tf16 = exp2( exponent - FLOAT16_EXPONENT_BIAS ) * ( 1.0 + ( mantissa / 1024.0 ) ); // eslint-disable-line max-len\n\tif ( sign ) {\n\t\treturn -f16;\n\t}\n\treturn f16;\n}\n\n\n// EXPORTS //\n\nexport default fromWord;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Number of exponent bits for a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/num-exponent-bits\n* @type {integer16}\n*\n* @example\n* import FLOAT16_NUM_EXPONENT_BITS from '@stdlib/constants/float16/num-exponent-bits';\n* // returns 5\n*/\n\n\n// MAIN //\n\n/**\n* Number of exponent bits for a half-precision floating-point number.\n*\n* @constant\n* @type {integer16}\n* @default 5\n*/\nvar FLOAT16_NUM_EXPONENT_BITS = 5|0;\n\n\n// EXPORTS //\n\nexport default FLOAT16_NUM_EXPONENT_BITS;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Mask for the sign bit of a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/sign-mask\n* @type {uinteger16}\n*\n* @example\n* import FLOAT16_SIGN_MASK from '@stdlib/constants/float16/sign-mask';\n* // returns 32768\n*/\n\n\n// MAIN //\n\n/**\n* Mask for the sign bit of a half-precision floating-point number.\n*\n* ## Notes\n*\n* The mask for the sign bit of a half-precision floating-point number is an unsigned 16-bit integer with the value \\\\( 32768 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 1 00000 0000000000\n* ```\n*\n* @constant\n* @type {uinteger16}\n* @default 0x8000\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT16_SIGN_MASK = 0x8000>>>0;\n\n\n// EXPORTS //\n\nexport default FLOAT16_SIGN_MASK;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Mask for the significand of a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/significand-mask\n* @type {uinteger16}\n*\n* @example\n* import FLOAT16_SIGNIFICAND_MASK from '@stdlib/constants/float16/significand-mask';\n* // returns 1023\n*/\n\n\n// MAIN //\n\n/**\n* Mask for the significand of a half-precision floating-point number.\n*\n* ## Notes\n*\n* The mask for the significand of a half-precision floating-point number is an unsigned 16-bit integer with the value \\\\( 1023 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 00000 1111111111\n* ```\n*\n* @constant\n* @type {uinteger16}\n* @default 0x03ff\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT16_SIGNIFICAND_MASK = 0x03ff;\n\n\n// EXPORTS //\n\nexport default FLOAT16_SIGNIFICAND_MASK;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Mask for the exponent of a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/exponent-mask\n* @type {uinteger16}\n*\n* @example\n* import FLOAT16_EXPONENT_MASK from '@stdlib/constants/float16/exponent-mask';\n* // returns 31744\n*/\n\n\n// MAIN //\n\n/**\n* Mask for the exponent of a half-precision floating-point number.\n*\n* ## Notes\n*\n* The mask for the exponent of a half-precision floating-point number is an unsigned 16-bit integer with the value \\\\( 31744 \\\\), which corresponds to the bit sequence\n*\n* ```binarystring\n* 0 11111 0000000000\n* ```\n*\n* @constant\n* @type {uinteger16}\n* @default 0x7c00\n* @see [IEEE 754]{@link https://en.wikipedia.org/wiki/IEEE_754-1985}\n*/\nvar FLOAT16_EXPONENT_MASK = 0x7c00;\n\n\n// EXPORTS //\n\nexport default FLOAT16_EXPONENT_MASK;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Number of significand bits for a half-precision floating-point number.\n*\n* @module @stdlib/constants/float16/num-significand-bits\n* @type {integer16}\n*\n* @example\n* import FLOAT16_NUM_SIGNIFICAND_BITS from '@stdlib/constants/float16/num-significand-bits';\n* // returns 10\n*/\n\n\n// MAIN //\n\n/**\n* Number of significand bits for a half-precision floating-point number.\n*\n* @constant\n* @type {integer16}\n* @default 10\n*/\nvar FLOAT16_NUM_SIGNIFICAND_BITS = 10|0;\n\n\n// EXPORTS //\n\nexport default FLOAT16_NUM_SIGNIFICAND_BITS;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 f16 from '@stdlib/number/float64/base/to-float16';\nimport toWord from '@stdlib/number/float16/base/to-word';\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( toWord( f16( 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) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY 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, stdlib/jsdoc-typedef-typos, max-lines */\n\n'use strict';\n\n// MODULES //\n\nimport hasIteratorSymbolSupport from '@stdlib/assert/has-iterator-symbol-support';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport isCollection from '@stdlib/assert/is-collection';\nimport isArrayBuffer from '@stdlib/assert/is-arraybuffer';\nimport isFunction from '@stdlib/assert/is-function';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isObject from '@stdlib/assert/is-object';\nimport isnan from '@stdlib/math/base/assert/is-nan';\nimport ITERATOR_SYMBOL from '@stdlib/symbol/iterator';\nimport setReadOnlyAccessor from '@stdlib/utils/define-nonenumerable-read-only-accessor';\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport setReadWriteAccessor from '@stdlib/utils/define-read-write-accessor';\nimport floor from '@stdlib/math/base/special/floor';\nimport format from '@stdlib/string/format';\nimport Uint16Array from './../../../uint16';\nimport f16 from '@stdlib/number/float64/base/to-float16';\nimport toWord from '@stdlib/number/float16/base/to-word';\nimport fromWord from '@stdlib/number/float16/base/from-word';\nimport gcopy from '@stdlib/blas/base/gcopy';\nimport fromArray from './from_array.js';\nimport fromIterator from './from_iterator.js';\nimport fromIteratorMap from './from_iterator_map.js';\n\n\n// VARIABLES //\n\nvar BYTES_PER_ELEMENT = Uint16Array.BYTES_PER_ELEMENT;\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\n\n\n// FUNCTIONS //\n\n/**\n* Returns a boolean indicating if a value is a `Float16Array`.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `Float16Array`\n*/\nfunction isFloat16Array( value ) {\n\treturn (\n\t\ttypeof value === 'object' &&\n\t\tvalue !== null &&\n\t\tvalue.constructor.name === 'Float16Array' &&\n\t\tvalue.BYTES_PER_ELEMENT === BYTES_PER_ELEMENT\n\t);\n}\n\n/**\n* Returns a boolean indicating if a value is a floating-point typed array constructor.\n*\n* @private\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a floating-point typed array constructor\n*/\nfunction isFloatingPointArrayConstructor( value ) { // eslint-disable-line id-length\n\treturn ( value === Float16Array );\n}\n\n/**\n* Returns a getter.\n*\n* @private\n* @param {Float16Array} ctx - typed array instance\n* @param {NonNegativeInteger} idx - element index\n* @returns {Function} getter\n*/\nfunction getter( ctx, idx ) {\n\treturn get;\n\n\t/**\n\t* Returns an array element.\n\t*\n\t* @private\n\t* @returns {(number|void)} array element\n\t*/\n\tfunction get() {\n\t\treturn ctx._get( idx ); // eslint-disable-line no-underscore-dangle\n\t}\n}\n\n/**\n* Returns a setter.\n*\n* @private\n* @param {Float16Array} ctx - typed array instance\n* @param {NonNegativeInteger} idx - element index\n* @returns {Function} setter\n*/\nfunction setter( ctx, idx ) {\n\treturn set;\n\n\t/**\n\t* Sets an array element.\n\t*\n\t* @private\n\t* @param {number} value - value to set\n\t*/\n\tfunction set( value ) {\n\t\tctx.set( [ value ], idx );\n\t}\n}\n\n\n// MAIN //\n\n/**\n* 16-bit floating-point number 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 {RangeError} ArrayBuffer byte length must be a multiple of `2`\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} byte offset must be a multiple of `2`\n* @throws {TypeError} view length must be a positive multiple of `2`\n* @throws {RangeError} must provide sufficient memory to accommodate byte offset and view length requirements\n* @returns {Float16Array} half-precision floating-point number array\n*\n* @example\n* var arr = new Float16Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* var arr = new Float16Array( 5 );\n* // returns \n*\n* var len = arr.length;\n* // returns 5\n*\n* @example\n* var arr = new Float16Array( [ 1.0, 2.0, 3.0, 4.0, 5.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 5\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float16Array( buf );\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( 16 );\n* var arr = new Float16Array( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 4\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Float16Array( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nfunction Float16Array() {\n\tvar byteOffset;\n\tvar nargs;\n\tvar buf;\n\tvar len;\n\tvar arg;\n\tvar i;\n\n\tnargs = arguments.length;\n\tif ( !(this instanceof Float16Array) ) {\n\t\tif ( nargs === 0 ) {\n\t\t\treturn new Float16Array();\n\t\t}\n\t\tif ( nargs === 1 ) {\n\t\t\treturn new Float16Array( arguments[0] );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\treturn new Float16Array( arguments[0], arguments[1] );\n\t\t}\n\t\treturn new Float16Array( arguments[0], arguments[1], arguments[2] );\n\t}\n\t// Create the underlying data buffer...\n\tif ( nargs === 0 ) {\n\t\tbuf = new Uint16Array( 0 ); // backward-compatibility\n\t} else if ( nargs === 1 ) {\n\t\targ = arguments[ 0 ];\n\t\tif ( isNonNegativeInteger( arg ) ) {\n\t\t\tbuf = new Uint16Array( arg );\n\t\t} else if ( isCollection( arg ) ) {\n\t\t\tif ( isFloat16Array( arg ) ) {\n\t\t\t\tbuf = new Uint16Array( arg.length );\n\t\t\t\tgcopy.ndarray( arg.length, new Uint16Array( arg.buffer, arg.byteOffset, arg.length ), 1, 0, buf, 1, 0 ); // eslint-disable-line max-len\n\t\t\t} else {\n\t\t\t\tbuf = fromArray( new Uint16Array( arg.length ), arg );\n\t\t\t}\n\t\t} else if ( isArrayBuffer( arg ) ) {\n\t\t\tif ( !isInteger( arg.byteLength/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid argument. ArrayBuffer byte length must be a multiple of %u. Byte length: `%u`.', BYTES_PER_ELEMENT, arg.byteLength ) );\n\t\t\t}\n\t\t\tbuf = new Uint16Array( 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 Uint16Array( 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 ( !isInteger( byteOffset/BYTES_PER_ELEMENT ) ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Byte offset must be a multiple of %u. Value: `%u`.', BYTES_PER_ELEMENT, byteOffset ) );\n\t\t}\n\t\tif ( nargs === 2 ) {\n\t\t\tlen = buf.byteLength - byteOffset;\n\t\t\tif ( !isInteger( len/BYTES_PER_ELEMENT ) ) {\n\t\t\t\tthrow new RangeError( format( 'invalid arguments. ArrayBuffer view byte length must be a multiple of %u. View byte length: `%u`.', BYTES_PER_ELEMENT, len ) );\n\t\t\t}\n\t\t\tbuf = new Uint16Array( 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 Uint16Array( buf, byteOffset, len );\n\t\t}\n\t}\n\tsetReadOnly( this, '_buffer', buf );\n\tsetReadOnly( this, '_length', buf.length );\n\tfor ( i = 0; i < buf.length; i++ ) {\n\t\tsetReadWriteAccessor( this, i, getter( this, i ), setter( this, i ) );\n\t}\n\treturn this;\n}\n\n/**\n* Size (in bytes) of each array element.\n*\n* @name BYTES_PER_ELEMENT\n* @memberof Float16Array\n* @readonly\n* @type {PositiveInteger}\n* @default 2\n*\n* @example\n* var nbytes = Float16Array.BYTES_PER_ELEMENT;\n* // returns 2\n*/\nsetReadOnly( Float16Array, 'BYTES_PER_ELEMENT', BYTES_PER_ELEMENT );\n\n/**\n* Constructor name.\n*\n* @name name\n* @memberof Float16Array\n* @readonly\n* @type {string}\n* @default 'Float16Array'\n*\n* @example\n* var str = Float16Array.name;\n* // returns 'Float16Array'\n*/\nsetReadOnly( Float16Array, 'name', 'Float16Array' );\n\n/**\n* Creates a new 16-bit floating-point number array from an array-like object or an iterable.\n*\n* @name from\n* @memberof Float16Array\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 floating-point 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 {Float16Array} half-precision floating-point number array\n*\n* @example\n* var arr = Float16Array.from( [ 1.0, 2.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* function clbk( v ) {\n* return v * 2.0;\n* }\n*\n* var arr = Float16Array.from( [ 1.0, 2.0 ], clbk );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\nsetReadOnly( Float16Array, 'from', function from( src ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar clbk;\n\tvar out;\n\tvar buf;\n\tvar tmp;\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 ( !isFloatingPointArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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\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 ] = toWord( f16( clbk.call( thisArg, 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\tif ( tmp instanceof Error ) {\n\t\t\tthrow tmp;\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 16-bit floating-point number array from a variable number of arguments.\n*\n* @name of\n* @memberof Float16Array\n* @type {Function}\n* @param {...*} element - array elements\n* @throws {TypeError} `this` context must be a constructor\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Float16Array} half-precision floating-point number array\n*\n* @example\n* var arr = Float16Array.of( 1.0, 1.0, 1.0, 1.0 );\n* // returns \n*\n* var x = arr[ 0 ];\n* // returns 1.0\n*\n* var len = arr.length;\n* // returns 4\n*/\nsetReadOnly( Float16Array, '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 ( !isFloatingPointArrayConstructor( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 with support for both nonnegative and negative integer indices.\n*\n* @name at\n* @memberof Float16Array.prototype\n* @type {Function}\n* @param {integer} idx - element index\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} must provide an integer\n* @returns {(number|void)} array element\n*\n* @example\n* var arr = new Float16Array( [ 10.0, 20.0, 30.0 ] );\n*\n* var v = arr.at( 0 );\n* // returns 10.0\n*\n* v = arr.at( -1 );\n* // returns 30.0\n*\n* v = arr.at( 100 );\n* // returns undefined\n*/\nsetReadOnly( Float16Array.prototype, 'at', function at( idx ) {\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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\tif ( idx < 0 ) {\n\t\tidx += this._length;\n\t}\n\tif ( idx < 0 || idx >= this._length ) {\n\t\treturn;\n\t}\n\treturn fromWord( this._buffer[ idx ] );\n});\n\n/**\n* Pointer to the underlying data buffer.\n*\n* @name buffer\n* @memberof Float16Array.prototype\n* @readonly\n* @type {ArrayBuffer}\n*\n* @example\n* var arr = new Float16Array( 10 );\n*\n* var buf = arr.buffer;\n* // returns \n*/\nsetReadOnlyAccessor( Float16Array.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 Float16Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Float16Array( 10 );\n*\n* var byteLength = arr.byteLength;\n* // returns 20\n*/\nsetReadOnlyAccessor( Float16Array.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 Float16Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Float16Array( 10 );\n*\n* var byteOffset = arr.byteOffset;\n* // returns 0\n*/\nsetReadOnlyAccessor( Float16Array.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 Float16Array.prototype\n* @readonly\n* @type {PositiveInteger}\n* @default 2\n*\n* @example\n* var arr = new Float16Array( 10 );\n*\n* var nbytes = arr.BYTES_PER_ELEMENT;\n* // returns 2\n*/\nsetReadOnly( Float16Array.prototype, 'BYTES_PER_ELEMENT', Float16Array.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 Float16Array.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 floating-point array\n* @returns {Float16Array} modified array\n*\n* @example\n* var arr = new Float16Array( [ 1.0, 2.0, 3.0, 4.0 ] );\n*\n* // Copy the first two elements to the last two elements:\n* arr.copyWithin( 2, 0, 2 );\n*\n* var v = arr[ 2 ];\n* // returns 1.0\n*\n* v = arr[ 3 ];\n* // returns 2.0\n*/\nsetReadOnly( Float16Array.prototype, 'copyWithin', function copyWithin( target, start ) {\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Float16Array( [ 1.0, 2.0, 3.0 ] );\n*\n* var it = arr.entries();\n*\n* var v = it.next().value;\n* // returns [ 0, 1.0 ]\n*\n* v = it.next().value;\n* // returns [ 1, 2.0 ]\n*\n* v = it.next().value;\n* // returns [ 2, 3.0 ]\n*\n* var bool = it.next().done;\n* // returns true\n*/\nsetReadOnly( Float16Array.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 ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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, fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 === 0.0;\n* }\n*\n* var arr = new Float16Array( 3 );\n*\n* var bool = arr.every( predicate );\n* // returns true\n*/\nsetReadOnly( Float16Array.prototype, 'every', function every( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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, fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {number} 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 floating-point number array\n* @throws {TypeError} first argument must be a floating-point number\n* @throws {TypeError} second argument must be an integer\n* @throws {TypeError} third argument must be an integer\n* @returns {Float16Array} modified array\n*\n* @example\n* var arr = new Float16Array( 3 );\n*\n* arr.fill( 1.0, 1 );\n*\n* var v = arr[ 0 ];\n* // returns 0.0\n*\n* v = arr[ 1 ];\n* // returns 1.0\n*\n* v = arr[ 2 ];\n* // returns 1.0\n*/\nsetReadOnly( Float16Array.prototype, 'fill', function fill( value, start, end ) {\n\tvar buf;\n\tvar len;\n\tvar i;\n\tvar v;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tif ( !isNumber( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a number. 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\tv = toWord( value );\n\tfor ( i = start; i < end; i++ ) {\n\t\tbuf[ i ] = v;\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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - test function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a function\n* @returns {Float16Array} floating-point number array\n*\n* @example\n* function predicate( v ) {\n* return ( v === 0.0 );\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 0.0 ] );\n*\n* var out = arr.filter( predicate );\n* // returns \n*\n* var len = out.length;\n* // returns 2\n*\n* var v = out[ 0 ];\n* // returns 0.0\n*\n* v = out[ 1 ];\n* // returns 0.0\n*/\nsetReadOnly( Float16Array.prototype, 'filter', function filter( predicate, thisArg ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\tvar v;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 > 0.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 0.0 ] );\n*\n* var v = arr.find( predicate );\n* // returns 1.0\n*/\nsetReadOnly( Float16Array.prototype, 'find', function find( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 > 0.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var v = arr.findIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Float16Array.prototype, 'findIndex', function findIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 > 0.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 0.0 ] );\n*\n* var v = arr.findLast( predicate );\n* // returns 1.0\n*/\nsetReadOnly( Float16Array.prototype, 'findLast', function findLast( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 > 0.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 0.0 ] );\n*\n* var v = arr.findLastIndex( predicate );\n* // returns 1\n*/\nsetReadOnly( Float16Array.prototype, 'findLastIndex', function findLastIndex( predicate, thisArg ) {\n\tvar buf;\n\tvar v;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} fcn - function to invoke\n* @param {*} [thisArg] - function invocation context\n* @throws {TypeError} `this` must be a floating-point number 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 Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* arr.forEach( log );\n*/\nsetReadOnly( Float16Array.prototype, 'forEach', function forEach( fcn, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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, fromWord( buf[ i ] ), i, this );\n\t}\n});\n\n/**\n* Returns an array element.\n*\n* @private\n* @name _get\n* @memberof Float16Array.prototype\n* @type {Function}\n* @param {NonNegativeInteger} idx - element index\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} must provide a nonnegative integer\n* @returns {(number|void)} array element\n*/\nsetReadOnly( Float16Array.prototype, '_get', function get( idx ) {\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 fromWord( this._buffer[ idx ] );\n});\n\n/**\n* Returns a boolean indicating whether an array includes a provided value.\n*\n* @name includes\n* @memberof Float16Array.prototype\n* @type {Function}\n* @param {number} searchElement - search element\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a floating-point number\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 Float16Array( [ 0.0, 1.0, 2.0, 3.0, 4.0 ] );\n*\n* var bool = arr.includes( 1.0 );\n* // returns true\n*\n* bool = arr.includes( 1.0, 2 );\n* // returns false\n*\n* bool = arr.includes( 5.0 );\n* // returns false\n*/\nsetReadOnly( Float16Array.prototype, 'includes', function includes( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\tvar v;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tif ( !isNumber( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a number. 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\tv = toWord( searchElement );\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tif ( v === 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 Float16Array.prototype\n* @type {Function}\n* @param {float16} searchElement - element to find\n* @param {integer} [fromIndex=0] - starting index (inclusive)\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a floating-point number\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0, 3.0, 4.0 ] );\n*\n* var idx = arr.indexOf( 2.0 );\n* // returns 2\n*\n* idx = arr.indexOf( 2.0, 3 );\n* // returns -1\n*\n* idx = arr.indexOf( 3.0, 3 );\n* // returns 3\n*/\nsetReadOnly( Float16Array.prototype, 'indexOf', function indexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\tvar v;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tif ( !isNumber( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a number. 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\tv = toWord( searchElement );\n\tfor ( i = fromIndex; i < this._length; i++ ) {\n\t\tif ( v === 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 Float16Array.prototype\n* @type {Function}\n* @param {string} [separator=','] - element separator\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a string\n* @returns {string} string representation\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var str = arr.join();\n* // returns '0,1,2'\n*\n* str = arr.join( '|' );\n* // returns '0|1|2'\n*/\nsetReadOnly( Float16Array.prototype, 'join', function join( separator ) {\n\tvar buf;\n\tvar out;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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\tout.push( fromWord( buf[ i ] ) );\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 Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Float16Array( [ 1.0, 2.0 ] );\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( Float16Array.prototype, 'keys', function keys() {\n\tvar self;\n\tvar iter;\n\tvar len;\n\tvar FLG;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 Float16Array.prototype\n* @type {Function}\n* @param {number} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (inclusive)\n* @throws {TypeError} `this` must be a floating-point number\n* @throws {TypeError} first argument must be a numeric value\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0, 3.0, 2.0 ] );\n*\n* var idx = arr.lastIndexOf( 2.0 );\n* // returns 4\n*\n* idx = arr.lastIndexOf( 2.0, 3 );\n* // returns 2\n*\n* idx = arr.lastIndexOf( 4.0, 3 );\n* // returns -1\n*\n* idx = arr.lastIndexOf( 1.0, -3 );\n* // returns 1\n*/\nsetReadOnly( Float16Array.prototype, 'lastIndexOf', function lastIndexOf( searchElement, fromIndex ) {\n\tvar buf;\n\tvar i;\n\tvar v;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tif ( !isNumber( searchElement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a number. 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\tv = toWord( searchElement );\n\tfor ( i = fromIndex; i >= 0; i-- ) {\n\t\tif ( v === 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 Float16Array.prototype\n* @readonly\n* @type {NonNegativeInteger}\n*\n* @example\n* var arr = new Float16Array( 10 );\n*\n* var len = arr.length;\n* // returns 10\n*/\nsetReadOnlyAccessor( Float16Array.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 Float16Array.prototype\n* @type {Function}\n* @param {Function} fcn - callback function\n* @param {*} [thisArg] - callback function execution context\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a function\n* @returns {Float16Array} new floating-point number array\n*\n* @example\n* function scale( v ) {\n* return v * 2.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var out = arr.map( scale );\n* // returns \n*\n* var z = out[ 0 ];\n* // returns 0.0\n*\n* z = out[ 1 ];\n* // returns 2.0\n*\n* z = out[ 2 ];\n* // returns 4.0\n*/\nsetReadOnly( Float16Array.prototype, 'map', function map( fcn, thisArg ) {\n\tvar outbuf;\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 ] = toWord( fcn.call( thisArg, fromWord( buf[ i ] ), i, this ) ); // eslint-disable-line max-len\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 Float16Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a floating-point number 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 add( acc, v ) {\n* return acc + v;\n* }\n*\n* var arr = new Float16Array( [ 1.0, 2.0, 3.0 ] );\n*\n* var out = arr.reduce( add, 0 );\n* // returns 6.0\n*/\nsetReadOnly( Float16Array.prototype, 'reduce', function reduce( reducer, initialValue ) {\n\tvar buf;\n\tvar len;\n\tvar acc;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( buf[ 0 ] );\n\t\ti = 1;\n\t}\n\tfor ( ; i < len; i++ ) {\n\t\tacc = reducer( acc, fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} reducer - callback function\n* @param {*} [initialValue] - initial value\n* @throws {TypeError} `this` must be a floating-point number 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 add( acc, v ) {\n* return acc + v;\n* }\n*\n* var arr = new Float16Array( [ 1.0, 2.0, 3.0 ] );\n*\n* var out = arr.reduceRight( add, 0 );\n* // returns 6.0\n*/\nsetReadOnly( Float16Array.prototype, 'reduceRight', function reduceRight( reducer, initialValue ) {\n\tvar buf;\n\tvar len;\n\tvar acc;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 = fromWord( buf[ len-1 ] );\n\t\ti = len - 2;\n\t}\n\tfor ( ; i >= 0; i-- ) {\n\t\tacc = reducer( acc, fromWord( buf[ i ] ), i, this );\n\t}\n\treturn acc;\n});\n\n/**\n* Reverses an array in-place.\n*\n* @name reverse\n* @memberof Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Float16Array} reversed array\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var out = arr.reverse();\n* // returns \n*\n* var v = out[ 0 ];\n* // returns 2.0\n*\n* v = out[ 1 ];\n* // returns 1.0\n*\n* v = out[ 2 ];\n* // returns 0.0\n*/\nsetReadOnly( Float16Array.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 ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 one or more array elements.\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 Float16Array.prototype\n* @type {Function}\n* @param {(Collection|Float16Array)} value - value(s)\n* @param {NonNegativeInteger} [i=0] - element index at which to start writing values\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a collection\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 Float16Array( 10 );\n*\n* var v = arr[ 0 ];\n* // returns 0.0\n*\n* arr.set( [ 1.0, 2.0 ], 0 );\n*\n* v = arr[ 0 ];\n* // returns 1.0\n*/\nsetReadOnly( Float16Array.prototype, 'set', function set( value ) {\n\tvar sbuf;\n\tvar idx;\n\tvar buf;\n\tvar tmp;\n\tvar flg;\n\tvar N;\n\tvar i;\n\tvar j;\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tif ( !isCollection( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', value ) );\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\tN = value.length;\n\tif ( idx+N > this._length ) {\n\t\tthrow new RangeError( 'invalid arguments. Target array lacks sufficient storage to accommodate source values.' );\n\t}\n\tif ( isFloat16Array( value ) ) {\n\t\tsbuf = value._buffer; // eslint-disable-line no-underscore-dangle\n\t\tflg = true;\n\t} else {\n\t\tsbuf = value;\n\t\tflg = false;\n\t}\n\t// Check for overlapping memory...\n\tj = buf.byteOffset + (idx*BYTES_PER_ELEMENT);\n\tif (\n\t\tsbuf.buffer === buf.buffer &&\n\t\t(\n\t\t\tsbuf.byteOffset < j &&\n\t\t\tsbuf.byteOffset+sbuf.byteLength > j\n\t\t)\n\t) {\n\t\t// We need to copy source values...\n\t\ttmp = new Uint16Array( sbuf.length );\n\t\tfor ( i = 0; i < sbuf.length; i++ ) {\n\t\t\ttmp[ i ] = sbuf[ i ];\n\t\t}\n\t\tsbuf = tmp;\n\t}\n\tif ( flg ) {\n\t\tfor ( i = 0; i < N; idx++, i++ ) {\n\t\t\tbuf[ idx ] = sbuf[ i ];\n\t\t}\n\t} else {\n\t\tfor ( i = 0; i < N; idx++, i++ ) {\n\t\t\tbuf[ idx ] = toWord( sbuf[ i ] );\n\t\t}\n\t}\n});\n\n/**\n* Copies a portion of a typed array to a new typed array.\n*\n* @name slice\n* @memberof Float16Array.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 floating-point number array\n* @throws {TypeError} first argument must be integer\n* @throws {TypeError} second argument must be integer\n* @returns {Float16Array} floating-point number array\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0, 3.0, 4.0 ] );\n*\n* var out = arr.slice();\n* // returns \n*\n* var len = out.length;\n* // returns 5\n*\n* var v = out[ 0 ];\n* // returns 0.0\n*\n* v = out[ len-1 ];\n* // returns 4.0\n*\n* out = arr.slice( 1, -2 );\n* // returns \n*\n* len = out.length;\n* // returns 2\n*\n* v = out[ 0 ];\n* // returns 1.0\n*\n* v = out[ len-1 ];\n* // returns 2.0\n*/\nsetReadOnly( Float16Array.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 ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} predicate - predicate function\n* @param {*} [thisArg] - predicate function execution context\n* @throws {TypeError} `this` must be a floating-point number 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 > 0.0;\n* }\n*\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var bool = arr.some( predicate );\n* // returns true\n*/\nsetReadOnly( Float16Array.prototype, 'some', function some( predicate, thisArg ) {\n\tvar buf;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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, fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} [compareFcn] - comparison function\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a function\n* @returns {Float16Array} sorted array\n*\n* @example\n* function compare( a, b ) {\n* if ( a < b ) {\n* return -1;\n* }\n* if ( a > b ) {\n* return 1;\n* }\n* return 0;\n* }\n*\n* var arr = new Float16Array( [ 1.0, 0.0, 2.0 ] );\n*\n* arr.sort( compare );\n*\n* var v = arr[ 0 ];\n* // returns 0.0\n*\n* v = arr[ 1 ];\n* // returns 1.0\n*\n* v = arr[ 2 ];\n* // returns 2.0\n*/\nsetReadOnly( Float16Array.prototype, 'sort', function sort( compareFcn ) {\n\tvar buf;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tbuf = this._buffer;\n\tif ( arguments.length === 0 ) {\n\t\tbuf.sort( defaultCompare );\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* Default comparison function for float16 values.\n\t*\n\t* @private\n\t* @param {unsigned16} a - unsigned 16-bit integer for comparison\n\t* @param {unsigned16} b - unsigned 16-bit integer for comparison\n\t* @returns {number} comparison result\n\t*/\n\tfunction defaultCompare( a, b ) { // eslint-disable-line stdlib/no-unnecessary-nested-functions\n\t\tvar x = fromWord( a );\n\t\tvar y = fromWord( b );\n\n\t\t// Handle NaN...\n\t\tif ( isnan( x ) && isnan( y ) ) {\n\t\t\treturn 0;\n\t\t}\n\t\tif ( isnan( x ) ) {\n\t\t\treturn 1;\n\t\t}\n\t\tif ( isnan( y ) ) {\n\t\t\treturn -1;\n\t\t}\n\t\t// Normal comparison\n\t\tif ( x < y ) {\n\t\t\treturn -1;\n\t\t}\n\t\tif ( x > y ) {\n\t\t\treturn 1;\n\t\t}\n\t\treturn 0;\n\t}\n\n\t/**\n\t* Comparison function wrapper.\n\t*\n\t* @private\n\t* @param {unsigned16} a - unsigned 16-bit integer for comparison\n\t* @param {unsigned16} b - unsigned 16-bit integer for comparison\n\t* @returns {number} comparison result\n\t*/\n\tfunction compare( a, b ) {\n\t\treturn compareFcn( fromWord( a ), fromWord( 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 Float16Array.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 floating-point number array\n* @throws {TypeError} first argument must be an integer\n* @throws {TypeError} second argument must be an integer\n* @returns {Float16Array} subarray\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0, 3.0, 4.0 ] );\n*\n* var subarr = arr.subarray();\n* // returns \n*\n* var len = subarr.length;\n* // returns 5\n*\n* var bool = subarr[ 0 ];\n* // returns 0.0\n*\n* bool = subarr[ len-1 ];\n* // returns 4.0\n*\n* subarr = arr.subarray( 1, -2 );\n* // returns \n*\n* len = subarr.length;\n* // returns 2\n*\n* bool = subarr[ 0 ];\n* // returns 1.0\n*\n* bool = subarr[ len-1 ];\n* // returns 2.0\n*/\nsetReadOnly( Float16Array.prototype, 'subarray', function subarray( begin, end ) {\n\tvar offset;\n\tvar buf;\n\tvar len;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 Float16Array.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 floating-point number 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 Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var str = arr.toLocaleString();\n* // returns '0,1,2'\n*/\nsetReadOnly( Float16Array.prototype, 'toLocaleString', function toLocaleString( locales, options ) {\n\tvar opts;\n\tvar loc;\n\tvar out;\n\tvar buf;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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( fromWord( buf[ i ] ) );\n\t}\n\treturn out.toLocaleString( loc, opts );\n});\n\n/**\n* Returns a new typed array containing the elements in reversed order.\n*\n* @name toReversed\n* @memberof Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Float16Array} reversed array\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var out = arr.toReversed();\n* // returns \n*\n* var v = out[ 0 ];\n* // returns 2.0\n*\n* v = out[ 1 ];\n* // returns 1.0\n*\n* v = out[ 2 ];\n* // returns 0.0\n*/\nsetReadOnly( Float16Array.prototype, 'toReversed', function toReversed() {\n\tvar outbuf;\n\tvar out;\n\tvar len;\n\tvar buf;\n\tvar i;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 Float16Array.prototype\n* @type {Function}\n* @param {Function} [compareFcn] - comparison function\n* @throws {TypeError} `this` must be a floating-point number array\n* @throws {TypeError} first argument must be a function\n* @returns {Float16Array} sorted array\n*\n* @example\n* function compare( a, b ) {\n* if ( a > b ) {\n* return 1;\n* }\n* if ( a < b ) {\n* return -1;\n* }\n* return 0;\n* }\n*\n* var arr = new Float16Array( [ 2.0, 0.0, 1.0 ] );\n*\n* var out = arr.toSorted( compare );\n* // returns \n*\n* var v = out[ 0 ];\n* // returns 0.0\n*\n* v = out[ 1 ];\n* // returns 1.0\n*\n* v = out[ 2 ];\n* // returns 2.0\n*/\nsetReadOnly( Float16Array.prototype, 'toSorted', function toSorted( compareFcn ) {\n\tvar out;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tout = new this.constructor( this );\n\tif ( arguments.length === 0 ) {\n\t\treturn out.sort();\n\t}\n\treturn out.sort( compareFcn );\n});\n\n/**\n* Serializes an array as a string.\n*\n* @name toString\n* @memberof Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {string} string representation\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var str = arr.toString();\n* // returns '0,1,2'\n*/\nsetReadOnly( Float16Array.prototype, 'toString', function toString() {\n\tvar out;\n\tvar buf;\n\tvar i;\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number array.' );\n\t}\n\tbuf = this._buffer;\n\tout = [];\n\tfor ( i = 0; i < this._length; i++ ) {\n\t\tout.push( fromWord( buf[ i ] ) );\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 Float16Array.prototype\n* @type {Function}\n* @throws {TypeError} `this` must be a floating-point number array\n* @returns {Iterator} iterator\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0 ] );\n*\n* var iter = arr.values();\n*\n* var v = iter.next().value;\n* // returns 0.0\n*\n* v = iter.next().value;\n* // returns 1.0\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nsetReadOnly( Float16Array.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 ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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': fromWord( 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 Float16Array.prototype\n* @type {Function}\n* @param {integer} index - element index\n* @param {number} value - new value\n* @throws {TypeError} `this` must be a floating-point number 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 floating-point number\n* @returns {Float16Array} new typed array\n*\n* @example\n* var arr = new Float16Array( [ 0.0, 1.0, 2.0 ] );\n*\n* var out = arr.with( 0, 3.0 );\n* // returns \n*\n* var v = out[ 0 ];\n* // returns 3.0\n*/\nsetReadOnly( Float16Array.prototype, 'with', function copyWith( index, value ) {\n\tvar out;\n\tvar len;\n\n\tif ( !isFloat16Array( this ) ) {\n\t\tthrow new TypeError( 'invalid invocation. `this` is not a floating-point number 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 ( !isNumber( value ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a number. Value: `%s`.', value ) );\n\t}\n\tout = new this.constructor( this );\n\tout[ index ] = value;\n\treturn out;\n});\n\n\n// EXPORTS //\n\nexport default Float16Array;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 f16 from '@stdlib/number/float64/base/to-float16';\nimport toWord from '@stdlib/number/float16/base/to-word';\n\n\n// MAIN //\n\n/**\n* Fills an output array with unsigned 16-bit integers corresponding to the IEEE 754 binary representation of respective half-precision floating-point numbers.\n*\n* @private\n* @param {Uint16Array} buf - output array\n* @param {Array} arr - input array\n* @returns {Uint16Array} 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 ] = toWord( f16( 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) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 f16 from '@stdlib/number/float64/base/to-float16';\nimport toWord from '@stdlib/number/float16/base/to-word';\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( toWord( f16( clbk.call( thisArg, v.value, i ) ) ) );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default fromIteratorMap;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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 Float16Array === 'function' ) ? Float16Array : void 0; // eslint-disable-line no-undef, stdlib/require-globals\n\n\n// EXPORTS //\n\nexport default ctor;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2026 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or 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* 16-bit floating-point number array constructor.\n*\n* @module @stdlib/array/float16\n*\n* @example\n* import Float16Array from '@stdlib/array/float16';\n*\n* var arr = new Float16Array();\n* // returns \n*\n* var len = arr.length;\n* // returns 0\n*\n* @example\n* import Float16Array from '@stdlib/array/float16';\n*\n* var arr = new Float16Array( 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* import Float16Array from '@stdlib/array/float16';\n*\n* var arr = new Float16Array( [ 1.0, 2.0 ] );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n* import Float16Array from '@stdlib/array/float16';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float16Array( buf );\n* // returns \n*\n* var len = arr.length;\n* // returns 8\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n* import Float16Array from '@stdlib/array/float16';\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = new Float16Array( buf, 8 );\n* // returns \n*\n* var len = arr.length;\n* // returns 4\n*\n* @example\n* import ArrayBuffer from '@stdlib/array/buffer';\n* import Float16Array from '@stdlib/array/float16';\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = new Float16Array( buf, 8, 2 );\n* // returns \n*\n* var len = arr.length;\n* // returns 2\n*/\n\n// MODULES //\n\nimport hasFloat16ArraySupport from '@stdlib/assert/has-float16array-support';\nimport polyfill from './polyfill';\nimport builtin from './main.js';\n\n\n// MAIN //\n\nvar ctor;\nif ( hasFloat16ArraySupport() ) {\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) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport PINF from '@stdlib/constants/float16/pinf';\nimport GlobalFloat16Array from './float16array.js';\n\n\n// MAIN //\n\n/**\n* Tests for native `Float16Array` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Float16Array` support\n*\n* @example\n* var bool = hasFloat16ArraySupport();\n* // returns \n*/\nfunction hasFloat16ArraySupport() {\n\tvar bool;\n\tvar arr;\n\n\tif ( typeof GlobalFloat16Array !== 'function' ) {\n\t\treturn false;\n\t}\n\t// Test basic support...\n\ttry {\n\t\tarr = new GlobalFloat16Array( [ 1.0, 3.14, -3.14, 5.0e40 ] );\n\t\tbool = (\n\t\t\ttypeof arr === 'object' &&\n\t\t\tarr !== null &&\n\t\t\tarr.constructor.name === 'Float16Array' &&\n\t\t\tarr.BYTES_PER_ELEMENT === 2 &&\n\t\t\tarr[ 0 ] === 1.0 &&\n\t\t\tarr[ 1 ] !== 3.14 &&\n\t\t\tarr[ 2 ] !== -3.14 &&\n\t\t\tarr[ 3 ] === PINF &&\n\t\t\tarr.length === 4\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 hasFloat16ArraySupport;\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 Int8Array from '@stdlib/array/int8';\nimport Uint8Array from '@stdlib/array/uint8';\nimport Uint8ClampedArray from '@stdlib/array/uint8c';\nimport Int16Array from '@stdlib/array/int16';\nimport Uint16Array from '@stdlib/array/uint16';\nimport Int32Array from '@stdlib/array/int32';\nimport Uint32Array from '@stdlib/array/uint32';\nimport Float16Array from '@stdlib/array/float16';\nimport Float32Array from '@stdlib/array/float32';\nimport Float64Array from '@stdlib/array/float64';\n\n\n// MAIN //\n\nvar CTORS = [\n\tFloat64Array,\n\tFloat32Array,\n\tFloat16Array,\n\tInt32Array,\n\tUint32Array,\n\tInt16Array,\n\tUint16Array,\n\tInt8Array,\n\tUint8Array,\n\tUint8ClampedArray\n];\n\n\n// EXPORTS //\n\nexport default CTORS;\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';\nimport fcnName from '@stdlib/utils/function-name';\nimport getPrototypeOf from '@stdlib/utils/get-prototype-of';\nimport hasFloat64ArraySupport from './../../has-float64array-support';\nimport Float64Array from '@stdlib/array/float64';\nimport CTORS from './ctors.js';\nimport NAMES from './names.json';\n\n\n// VARIABLES //\n\n// Abstract `TypedArray` class:\nvar TypedArray = ( hasFloat64ArraySupport() ) ? getPrototypeOf( Float64Array ) : Dummy; // eslint-disable-line max-len\n\n// Ensure abstract typed array class has expected name:\nTypedArray = ( fcnName( TypedArray ) === 'TypedArray' ) ? TypedArray : Dummy;\n\n\n// FUNCTIONS //\n\n/**\n* Dummy constructor.\n*\n* @private\n*/\nfunction Dummy() {} // eslint-disable-line no-empty-function\n\n\n// MAIN //\n\n/**\n* Tests if a value is a built-in typed array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a built-in typed array\n*\n* @example\n* import Int8Array from '@stdlib/array/int8';\n*\n* var bool = isTypedArray( new Int8Array( 10 ) );\n* // returns true\n*/\nfunction isTypedArray( value ) {\n\tvar v;\n\tvar i;\n\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for the abstract class...\n\tif ( value instanceof TypedArray ) {\n\t\treturn true;\n\t}\n\t// Check for typed array objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tfor ( i = 0; i < CTORS.length; i++ ) {\n\t\tif ( value instanceof CTORS[ i ] ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\t// Walk the prototype tree until we find an object having a desired class...\n\twhile ( value ) {\n\t\tv = ctorName( value );\n\t\tfor ( i = 0; i < NAMES.length; i++ ) {\n\t\t\tif ( NAMES[ i ] === v ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isTypedArray;\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 Complex64Array from '@stdlib/array/complex64';\nimport Complex128Array from '@stdlib/array/complex128';\n\n\n// MAIN //\n\nvar CTORS = [\n\tComplex128Array,\n\tComplex64Array\n];\n\n\n// EXPORTS //\n\nexport default CTORS;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasOwnProp from './../../has-own-property';\nimport Symbol from '@stdlib/symbol/ctor';\n\n\n// MAIN //\n\n/**\n* Tests for native `Symbol.hasInstance` support.\n*\n* @returns {boolean} boolean indicating if an environment has `Symbol.hasInstance` support\n*\n* @example\n* var bool = hasHasInstanceSymbolSupport();\n* // returns \n*/\nfunction hasHasInstanceSymbolSupport() { // eslint-disable-line id-length\n\treturn (\n\t\ttypeof Symbol === 'function' &&\n\t\ttypeof Symbol( 'foo' ) === 'symbol' &&\n\t\thasOwnProp( Symbol, 'hasInstance' ) &&\n\t\ttypeof Symbol.hasInstance === 'symbol'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default hasHasInstanceSymbolSupport;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport hasHasInstanceSymbolSupport from '@stdlib/assert/has-has-instance-symbol-support'; // eslint-disable-line id-length\n\n\n// MAIN //\n\n/**\n* Has instance symbol.\n*\n* @name HasInstanceSymbol\n* @constant\n* @type {(symbol|null)}\n*\n* @example\n* import isArray from '@stdlib/assert/is-array';\n*\n* function ArrayLike() {\n* return {\n* 'length': 3,\n* '0': 1,\n* '1': 2,\n* '2': 3\n* };\n* };\n*\n* ArrayLike[ HasInstanceSymbol ] = isArray;\n*/\nvar HasInstanceSymbol = ( hasHasInstanceSymbolSupport() ) ? Symbol.hasInstance : null; // eslint-disable-line max-len\n\n\n// EXPORTS //\n\nexport default HasInstanceSymbol;\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 hasHasInstanceSymbolSupport from './../../has-has-instance-symbol-support'; // eslint-disable-line id-length\nimport HasInstanceSymbol from '@stdlib/symbol/has-instance';\nimport format from '@stdlib/string/format';\n\n\n// VARIABLES //\n\nvar hasSupport = hasHasInstanceSymbolSupport();\n\n\n// MAIN //\n\n/**\n* Tests whether a value has in its prototype chain a specified constructor as a prototype property.\n*\n* @param {*} value - value to test\n* @param {Function} constructor - constructor to test against\n* @throws {TypeError} constructor must be callable\n* @returns {boolean} boolean indicating whether a value is an instance of a provided constructor\n*\n* @example\n* var bool = instanceOf( [], Array );\n* // returns true\n*\n* @example\n* var bool = instanceOf( {}, Object ); // exception\n* // returns true\n*\n* @example\n* var bool = instanceOf( 'beep', String );\n* // returns false\n*\n* @example\n* var bool = instanceOf( null, Object );\n* // returns false\n*\n* @example\n* var bool = instanceOf( 5, Object );\n* // returns false\n*/\nfunction instanceOf( value, constructor ) {\n\t// TODO: replace with `isCallable` check\n\tif (\n\t\ttypeof constructor !== 'function' &&\n\t\t!(\n\t\t\thasSupport &&\n\t\t\ttypeof constructor === 'object' &&\n\t\t\ttypeof constructor[ HasInstanceSymbol ] === 'function'\n\t\t)\n\t) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be callable. Value: `%s`.', constructor ) );\n\t}\n\treturn ( value instanceof constructor );\n}\n\n\n// EXPORTS //\n\nexport default instanceOf;\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 Int8Array from './../../int8';\nimport Uint8Array from './../../uint8';\nimport Uint8ClampedArray from './../../uint8c';\nimport Int16Array from './../../int16';\nimport Uint16Array from './../../uint16';\nimport Int32Array from './../../int32';\nimport Uint32Array from './../../uint32';\nimport Float32Array from './../../float32';\nimport Float64Array from './../../float64';\nimport Complex64Array from './../../complex64';\nimport Complex128Array from './../../complex128';\nimport BooleanArray from './../../bool';\n\n\n// MAIN //\n\nvar CTORS = [\n\t[ Float64Array, 'Float64Array' ],\n\t[ Float32Array, 'Float32Array' ],\n\t[ Int32Array, 'Int32Array' ],\n\t[ Uint32Array, 'Uint32Array' ],\n\t[ Int16Array, 'Int16Array' ],\n\t[ Uint16Array, 'Uint16Array' ],\n\t[ Int8Array, 'Int8Array' ],\n\t[ Uint8Array, 'Uint8Array' ],\n\t[ Uint8ClampedArray, 'Uint8ClampedArray' ],\n\t[ Complex64Array, 'Complex64Array' ],\n\t[ Complex128Array, 'Complex128Array' ],\n\t[ BooleanArray, 'BooleanArray' ]\n];\n\n\n// EXPORTS //\n\nexport default CTORS;\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 instanceOf from '@stdlib/assert/instance-of';\nimport ctorName from '@stdlib/utils/constructor-name';\nimport getPrototypeOf from '@stdlib/utils/get-prototype-of';\nimport CTORS from './ctors.js';\n\n\n// MAIN //\n\n/**\n* Returns the typed array type.\n*\n* @private\n* @param {TypedArray} arr - typed array\n* @returns {(string|void)} typed array type\n*\n* @example\n* import Float64Array from '@stdlib/array/float64';\n*\n* var arr = new Float64Array( 5 );\n* var str = typeName( arr );\n* // returns 'Float64Array'\n*/\nfunction typeName( arr ) {\n\tvar v;\n\tvar i;\n\n\t// Check for typed array objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tfor ( i = 0; i < CTORS.length; i++ ) {\n\t\tif ( instanceOf( arr, CTORS[ i ][ 0 ] ) ) {\n\t\t\treturn CTORS[ i ][ 1 ];\n\t\t}\n\t}\n\t// Walk the prototype tree until we find an object having a desired native class...\n\twhile ( arr ) {\n\t\tv = ctorName( arr );\n\t\tfor ( i = 0; i < CTORS.length; i++ ) {\n\t\t\tif ( v === CTORS[ i ][ 1 ] ) {\n\t\t\t\treturn CTORS[ i ][ 1 ];\n\t\t\t}\n\t\t}\n\t\tarr = getPrototypeOf( arr );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default typeName;\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 isTypedArray from '@stdlib/assert/is-typed-array';\nimport isComplexTypedArray from '@stdlib/assert/is-complex-typed-array';\nimport isBooleanArray from '@stdlib/assert/is-booleanarray';\nimport reinterpret64 from '@stdlib/strided/base/reinterpret-complex64';\nimport reinterpret128 from '@stdlib/strided/base/reinterpret-complex128';\nimport reinterpretBoolean from '@stdlib/strided/base/reinterpret-boolean';\nimport format from '@stdlib/string/format';\nimport typeName from './type.js';\n\n\n// MAIN //\n\n/**\n* Returns a JSON representation of a typed array.\n*\n* ## Notes\n*\n* - We build a JSON object representing a typed array similar to how Node.js `Buffer` objects are represented. See [Buffer][1].\n*\n* [1]: https://nodejs.org/api/buffer.html#buffer_buf_tojson\n*\n* @param {TypedArray} arr - typed array to serialize\n* @throws {TypeError} first argument must be a typed array\n* @returns {Object} JSON representation\n*\n* @example\n* import Float64Array from '@stdlib/array/float64';\n*\n* var arr = new Float64Array( [ 5.0, 3.0 ] );\n* var json = typedarray2json( arr );\n* // returns { 'type': 'Float64Array', 'data': [ 5.0, 3.0 ] }\n*/\nfunction typedarray2json( arr ) {\n\tvar data;\n\tvar out;\n\tvar i;\n\n\tif ( isTypedArray( arr ) ) {\n\t\tdata = arr;\n\t} else if ( isComplexTypedArray( arr ) ) {\n\t\tif ( arr.BYTES_PER_ELEMENT === 8 ) {\n\t\t\tdata = reinterpret64( arr, 0 );\n\t\t} else { // arr.BYTES_PER_ELEMENT === 16\n\t\t\tdata = reinterpret128( arr, 0 );\n\t\t}\n\t} else if ( isBooleanArray( arr ) ) {\n\t\tdata = reinterpretBoolean( arr, 0 );\n\t} else {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a typed array. Value: `%s`.', arr ) );\n\t}\n\tout = {\n\t\t'type': typeName( arr ),\n\t\t'data': []\n\t};\n\tfor ( i = 0; i < data.length; i++ ) {\n\t\tout.data.push( data[ i ] );\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default typedarray2json;\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 Uint8Array from '@stdlib/array/uint8';\n\n\n// MAIN //\n\n/**\n* Reinterprets a `BooleanArray` as a `Uint8Array`.\n*\n* @param {BooleanArray} x - input array\n* @param {NonNegativeInteger} offset - starting index\n* @returns {Uint8Array} `Uint8Array` view\n*\n* @example\n* import BooleanArray from '@stdlib/array/bool';\n*\n* var x = new BooleanArray( 10 );\n*\n* var out = reinterpret( x, 0 );\n* // returns \n*\n* var bool = ( out.buffer === x.buffer );\n* // returns true\n*/\nfunction reinterpret( x, offset ) {\n\treturn new Uint8Array( x.buffer, x.byteOffset+(x.BYTES_PER_ELEMENT*offset), x.length-offset ); // eslint-disable-line max-len\n}\n\n\n// EXPORTS //\n\nexport default reinterpret;\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 BooleanArray from '@stdlib/array/bool';\nimport constructorName from '@stdlib/utils/constructor-name';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a BooleanArray.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether a value is a BooleanArray\n*\n* @example\n* import BooleanArray from '@stdlib/array/bool';\n*\n* var bool = isBooleanArray( new BooleanArray( 10 ) );\n* // returns true\n*\n* @example\n* var bool = isBooleanArray( [] );\n* // returns false\n*/\nfunction isBooleanArray( value ) {\n\treturn (\n\t\tvalue instanceof BooleanArray ||\n\t\tconstructorName( value ) === 'BooleanArray'\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isBooleanArray;\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';\nimport getPrototypeOf from '@stdlib/utils/get-prototype-of';\nimport CTORS from './ctors.js';\nimport NAMES from './names.json';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a complex typed array.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a complex typed array\n*\n* @example\n* import Complex128Array from '@stdlib/array/complex128';\n*\n* var bool = isComplexTypedArray( new Complex128Array( 10 ) );\n* // returns true\n*/\nfunction isComplexTypedArray( value ) {\n\tvar v;\n\tvar i;\n\n\tif ( typeof value !== 'object' || value === null ) {\n\t\treturn false;\n\t}\n\t// Check for complex typed array objects from the same realm (same Node.js `vm` or same `Window` object)...\n\tfor ( i = 0; i < CTORS.length; i++ ) {\n\t\tif ( value instanceof CTORS[ i ] ) {\n\t\t\treturn true;\n\t\t}\n\t}\n\t// Walk the prototype tree until we find an object having a desired class...\n\twhile ( value ) {\n\t\tv = ctorName( value );\n\t\tfor ( i = 0; i < NAMES.length; i++ ) {\n\t\t\tif ( NAMES[ i ] === v ) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\t\tvalue = getPrototypeOf( value );\n\t}\n\n\treturn false;\n}\n\n\n// EXPORTS //\n\nexport default isComplexTypedArray;\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 UINT32_MAX from '@stdlib/constants/uint32/max';\nimport floor from '@stdlib/math/base/special/floor';\n\n\n// VARIABLES //\n\nvar MAX = UINT32_MAX - 1;\n\n\n// MAIN //\n\n/**\n* Returns a pseudorandom integer on the interval \\\\( [1, 2^{32}-1) \\\\).\n*\n* @private\n* @returns {PositiveInteger} pseudorandom integer\n*\n* @example\n* var v = randuint32();\n* // returns \n*/\nfunction randuint32() {\n\tvar v = floor( 1.0 + (MAX*Math.random()) ); // eslint-disable-line stdlib/no-builtin-math\n\treturn v >>> 0; // asm type annotation\n}\n\n\n// EXPORTS //\n\nexport default randuint32;\n","/* eslint-disable max-lines, max-len */\n\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* ## Notice\n*\n* The original C code and copyright notice are from the [source implementation][mt19937]. The implementation has been modified for JavaScript.\n*\n* ```text\n* Copyright (C) 1997 - 2002, Makoto Matsumoto and Takuji Nishimura,\n* All rights reserved.\n*\n* Redistribution and use in source and binary forms, with or without\n* modification, are permitted provided that the following conditions\n* are met:\n*\n* 1. Redistributions of source code must retain the above copyright\n* notice, this list of conditions and the following disclaimer.\n*\n* 2. Redistributions in binary form must reproduce the above copyright\n* notice, this list of conditions and the following disclaimer in the\n* documentation and/or other materials provided with the distribution.\n*\n* 3. The names of its contributors may not be used to endorse or promote\n* products derived from this software without specific prior written\n* permission.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n* \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n* LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n* ```\n*\n* [mt19937]: http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/CODES/mt19937ar.c\n*/\n\n'use strict';\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils/define-nonenumerable-read-only-accessor';\nimport setReadWriteAccessor from '@stdlib/utils/define-nonenumerable-read-write-accessor';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport isCollection from '@stdlib/assert/is-collection';\nimport isUint32Array from '@stdlib/assert/is-uint32array';\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport { isPrimitive as isPositiveInteger } from '@stdlib/assert/is-positive-integer';\nimport FLOAT64_MAX_SAFE_INTEGER from '@stdlib/constants/float64/max-safe-integer';\nimport UINT32_MAX from '@stdlib/constants/uint32/max';\nimport Uint32Array from '@stdlib/array/uint32';\nimport max from '@stdlib/math/base/special/max';\nimport umul from '@stdlib/number/uint32/base/mul';\nimport gcopy from '@stdlib/blas/base/gcopy';\nimport typedarray2json from '@stdlib/array/to-json';\nimport format from '@stdlib/string/format';\nimport randuint32 from './rand_uint32.js';\n\n\n// VARIABLES //\n\n// Define the size of the state array (see refs):\nvar N = 624;\n\n// Define a (magic) constant used for indexing into the state array:\nvar M = 397;\n\n// Define the maximum seed: 11111111111111111111111111111111\nvar MAX_SEED = UINT32_MAX >>> 0; // asm type annotation\n\n// For seed arrays, define an initial state (magic) constant: 19650218 => 00000001001010111101011010101010\nvar SEED_ARRAY_INIT_STATE = 19650218 >>> 0; // asm type annotation\n\n// Define a mask for the most significant `w-r` bits, where `w` is the word size (32 bits) and `r` is the separation point of one word (see refs): 2147483648 => 0x80000000 => 10000000000000000000000000000000\nvar UPPER_MASK = 0x80000000 >>> 0; // asm type annotation\n\n// Define a mask for the least significant `r` bits (see refs): 2147483647 => 0x7fffffff => 01111111111111111111111111111111\nvar LOWER_MASK = 0x7fffffff >>> 0; // asm type annotation\n\n// Define a multiplier (see Knuth TAOCP Vol2. 3rd Ed. P.106): 1812433253 => 01101100000001111000100101100101\nvar KNUTH_MULTIPLIER = 1812433253 >>> 0; // asm type annotation\n\n// Define a (magic) multiplier: 1664525 => 00000000000110010110011000001101\nvar MAGIC_MULTIPLIER_1 = 1664525 >>> 0; // asm type annotation\n\n// Define a (magic) multiplier: 1566083941 => 01011101010110001000101101100101\nvar MAGIC_MULTIPLIER_2 = 1566083941 >>> 0; // asm type annotation\n\n// Define a tempering coefficient: 2636928640 => 0x9d2c5680 => 10011101001011000101011010000000\nvar TEMPERING_COEFFICIENT_1 = 0x9d2c5680 >>> 0; // asm type annotation\n\n// Define a tempering coefficient: 4022730752 => 0xefc60000 => 11101111110001100000000000000000\nvar TEMPERING_COEFFICIENT_2 = 0xefc60000 >>> 0; // asm type annotation\n\n// Define a constant vector `a` (see refs): 2567483615 => 0x9908b0df => 10011001000010001011000011011111\nvar MATRIX_A = 0x9908b0df >>> 0; // asm type annotation\n\n// MAG01[x] = x * MATRIX_A; for x = {0,1}\nvar MAG01 = [ 0x0 >>> 0, MATRIX_A >>> 0 ]; // asm type annotation\n\n// Define a normalization constant when generating double-precision floating-point numbers: 2^53 => 9007199254740992\nvar FLOAT64_NORMALIZATION_CONSTANT = 1.0 / ( FLOAT64_MAX_SAFE_INTEGER+1.0 ); // eslint-disable-line id-length\n\n// 2^26: 67108864\nvar TWO_26 = 67108864 >>> 0; // asm type annotation\n\n// 2^32: 2147483648 => 0x80000000 => 10000000000000000000000000000000\nvar TWO_32 = 0x80000000 >>> 0; // asm type annotation\n\n// 1 (as a 32-bit unsigned integer): 1 => 0x1 => 00000000000000000000000000000001\nvar ONE = 0x1 >>> 0; // asm type annotation\n\n// Define the maximum normalized pseudorandom double-precision floating-point number: ( (((2^32-1)>>>5)*2^26)+( (2^32-1)>>>6) ) / 2^53\nvar MAX_NORMALIZED = FLOAT64_MAX_SAFE_INTEGER * FLOAT64_NORMALIZATION_CONSTANT;\n\n// Define the state array schema version:\nvar STATE_ARRAY_VERSION = 1; // NOTE: anytime the state array schema changes, this value should be incremented!!!\n\n// Define the number of sections in the state array:\nvar NUM_STATE_SECTIONS = 3; // state, other, seed\n\n// Define the index offset of the \"state\" section in the state array:\nvar STATE_SECTION_OFFSET = 2; // | version | num_sections | state_length | ...state | other_length | state_index | seed_length | ...seed |\n\n// Define the index offset of the \"other\" section in the state array:\nvar OTHER_SECTION_OFFSET = N + 3; // | version | num_sections | state_length | ...state | other_length | state_index | seed_length | ...seed |\n\n// Define the index offset of the seed section in the state array:\nvar SEED_SECTION_OFFSET = N + 5; // | version | num_sections | state_length | ...state | other_length | state_index | seed_length | ...seed |\n\n// Define the length of the \"fixed\" length portion of the state array:\nvar STATE_FIXED_LENGTH = N + 6; // 1 (version) + 1 (num_sections) + 1 (state_length) + N (state) + 1 (other_length) + 1 (state_index) + 1 (seed_length)\n\n\n// FUNCTIONS //\n\n/**\n* Verifies state array integrity.\n*\n* @private\n* @param {Uint32Array} state - state array\n* @param {boolean} FLG - flag indicating whether the state array was provided as an option (true) or an argument (false)\n* @returns {(Error|null)} an error or `null`\n*/\nfunction verifyState( state, FLG ) {\n\tvar s1;\n\tif ( FLG ) {\n\t\ts1 = 'option';\n\t} else {\n\t\ts1 = 'argument';\n\t}\n\t// The state array must have a minimum length...\n\tif ( state.length < STATE_FIXED_LENGTH+1 ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array has insufficient length.', s1 ) );\n\t}\n\t// The first element of the state array must equal the supported state array schema version...\n\tif ( state[ 0 ] !== STATE_ARRAY_VERSION ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array has an incompatible schema version. Expected: `%s`. Actual: `%s.`', s1, STATE_ARRAY_VERSION, state[ 0 ] ) );\n\t}\n\t// The second element of the state array must contain the number of sections...\n\tif ( state[ 1 ] !== NUM_STATE_SECTIONS ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array has an incompatible number of sections. Expected: `%s`. Actual: `%s`.', s1, NUM_STATE_SECTIONS, state[ 1 ] ) );\n\t}\n\t// The length of the \"state\" section must equal `N`...\n\tif ( state[ STATE_SECTION_OFFSET ] !== N ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array has an incompatible state length. Expected: `%u`. Actual: `%u`.', s1, N, state[ STATE_SECTION_OFFSET ] ) );\n\t}\n\t// The length of the \"other\" section must equal `1`...\n\tif ( state[ OTHER_SECTION_OFFSET ] !== 1 ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array has an incompatible section length. Expected: `%u`. Actual: `%u`.', s1, 1, state[ OTHER_SECTION_OFFSET ] ) );\n\t}\n\t// The length of the \"seed\" section much match the empirical length...\n\tif ( state[ SEED_SECTION_OFFSET ] !== state.length-STATE_FIXED_LENGTH ) {\n\t\treturn new RangeError( format( 'invalid %s. `state` array length is incompatible with seed section length. Expected: `%u`. Actual: `%u`.', s1, state.length-STATE_FIXED_LENGTH, state[ SEED_SECTION_OFFSET ] ) );\n\t}\n\treturn null;\n}\n\n/**\n* Returns an initial PRNG state.\n*\n* @private\n* @param {Uint32Array} state - state array\n* @param {PositiveInteger} N - state size\n* @param {uinteger32} s - seed\n* @returns {Uint32Array} state array\n*/\nfunction createState( state, N, s ) {\n\tvar i;\n\n\t// Set the first element of the state array to the provided seed:\n\tstate[ 0 ] = s >>> 0; // equivalent to `s & 0xffffffffUL` in original C implementation\n\n\t// Initialize the remaining state array elements:\n\tfor ( i = 1; i < N; i++ ) {\n\t\t/*\n\t\t* In the original C implementation (see `init_genrand()`),\n\t\t*\n\t\t* ```c\n\t\t* mt[i] = (KNUTH_MULTIPLIER * (mt[i-1] ^ (mt[i-1] >> 30)) + i)\n\t\t* ```\n\t\t*\n\t\t* In order to replicate this in JavaScript, we must emulate C-like multiplication of unsigned 32-bit integers.\n\t\t*/\n\t\ts = state[ i-1 ]>>>0; // asm type annotation\n\t\ts = ( s^(s>>>30) )>>>0; // asm type annotation\n\t\tstate[ i ] = ( umul( s, KNUTH_MULTIPLIER ) + i )>>>0; // asm type annotation\n\t}\n\treturn state;\n}\n\n/**\n* Initializes a PRNG state array according to a seed array.\n*\n* @private\n* @param {Uint32Array} state - state array\n* @param {NonNegativeInteger} N - state array length\n* @param {Collection} seed - seed array\n* @param {NonNegativeInteger} M - seed array length\n* @returns {Uint32Array} state array\n*/\nfunction initState( state, N, seed, M ) {\n\tvar s;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\ti = 1;\n\tj = 0;\n\tfor ( k = max( N, M ); k > 0; k-- ) {\n\t\t/*\n\t\t* In the original C implementation (see `init_by_array()`),\n\t\t*\n\t\t* ```c\n\t\t* mt[i] = (mt[i]^((mt[i-1]^(mt[i-1]>>30))*1664525UL)) + seed[j] + j;\n\t\t* ```\n\t\t*\n\t\t* In order to replicate this in JavaScript, we must emulate C-like multiplication of unsigned 32-bit integers.\n\t\t*/\n\t\ts = state[ i-1 ]>>>0; // asm type annotation\n\t\ts = ( s^(s>>>30) )>>>0; // asm type annotation\n\t\ts = ( umul( s, MAGIC_MULTIPLIER_1 ) )>>>0; // asm type annotation\n\t\tstate[ i ] = ( ((state[i]>>>0)^s) + seed[j] + j )>>>0; /* non-linear */ // asm type annotation\n\n\t\ti += 1;\n\t\tj += 1;\n\t\tif ( i >= N ) {\n\t\t\tstate[ 0 ] = state[ N-1 ];\n\t\t\ti = 1;\n\t\t}\n\t\tif ( j >= M ) {\n\t\t\tj = 0;\n\t\t}\n\t}\n\tfor ( k = N-1; k > 0; k-- ) {\n\t\t/*\n\t\t* In the original C implementation (see `init_by_array()`),\n\t\t*\n\t\t* ```c\n\t\t* mt[i] = (mt[i]^((mt[i-1]^(mt[i-1]>>30))*1566083941UL)) - i;\n\t\t* ```\n\t\t*\n\t\t* In order to replicate this in JavaScript, we must emulate C-like multiplication of unsigned 32-bit integers.\n\t\t*/\n\t\ts = state[ i-1 ]>>>0; // asm type annotation\n\t\ts = ( s^(s>>>30) )>>>0; // asm type annotation\n\t\ts = ( umul( s, MAGIC_MULTIPLIER_2 ) )>>>0; // asm type annotation\n\t\tstate[ i ] = ( ((state[i]>>>0)^s) - i )>>>0; /* non-linear */ // asm type annotation\n\n\t\ti += 1;\n\t\tif ( i >= N ) {\n\t\t\tstate[ 0 ] = state[ N-1 ];\n\t\t\ti = 1;\n\t\t}\n\t}\n\t// Ensure a non-zero initial state array:\n\tstate[ 0 ] = TWO_32; // MSB (most significant bit) is 1\n\n\treturn state;\n}\n\n/**\n* Updates a PRNG's internal state by generating the next `N` words.\n*\n* @private\n* @param {Uint32Array} state - state array\n* @returns {Uint32Array} state array\n*/\nfunction twist( state ) {\n\tvar w;\n\tvar i;\n\tvar j;\n\tvar k;\n\n\tk = N - M;\n\tfor ( i = 0; i < k; i++ ) {\n\t\tw = ( state[i]&UPPER_MASK ) | ( state[i+1]&LOWER_MASK );\n\t\tstate[ i ] = state[ i+M ] ^ ( w>>>1 ) ^ MAG01[ w&ONE ];\n\t}\n\tj = N - 1;\n\tfor ( ; i < j; i++ ) {\n\t\tw = ( state[i]&UPPER_MASK ) | ( state[i+1]&LOWER_MASK );\n\t\tstate[ i ] = state[ i-k ] ^ ( w>>>1 ) ^ MAG01[ w&ONE ];\n\t}\n\tw = ( state[j]&UPPER_MASK ) | ( state[0]&LOWER_MASK );\n\tstate[ j ] = state[ M-1 ] ^ ( w>>>1 ) ^ MAG01[ w&ONE ];\n\treturn state;\n}\n\n\n// MAIN //\n\n/**\n* Returns a 32-bit Mersenne Twister pseudorandom number generator.\n*\n* ## Notes\n*\n* - In contrast to the original C implementation, array seeds of length `1` are considered integer seeds. This ensures that the seed `[ 1234 ]` generates the same output as the seed `1234`. In the original C implementation, the two seeds would yield different output, which is **not** obvious from a user perspective.\n*\n* @param {Options} [options] - options\n* @param {PRNGSeedMT19937} [options.seed] - pseudorandom number generator seed\n* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state\n* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} a seed must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integers less than or equal to the maximum unsigned 32-bit integer\n* @throws {RangeError} a numeric seed must be a positive integer less than or equal to the maximum unsigned 32-bit integer\n* @throws {TypeError} state must be a `Uint32Array`\n* @throws {Error} must provide a valid state\n* @throws {TypeError} `copy` option must be a boolean\n* @returns {PRNG} Mersenne Twister PRNG\n*\n* @example\n* var mt19937 = factory();\n*\n* var v = mt19937();\n* // returns \n*\n* @example\n* // Return a seeded Mersenne Twister PRNG:\n* var mt19937 = factory({\n* 'seed': 1234\n* });\n*\n* var v = mt19937();\n* // returns 822569775\n*/\nfunction factory( options ) {\n\tvar STATE;\n\tvar state;\n\tvar opts;\n\tvar seed;\n\tvar slen;\n\tvar err;\n\n\topts = {};\n\tif ( arguments.length ) {\n\t\tif ( !isObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t\tif ( hasOwnProp( options, 'copy' ) ) {\n\t\t\topts.copy = options.copy;\n\t\t\tif ( !isBoolean( options.copy ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'copy', options.copy ) );\n\t\t\t}\n\t\t}\n\t\tif ( hasOwnProp( options, 'state' ) ) {\n\t\t\tstate = options.state;\n\t\t\topts.state = true;\n\t\t\tif ( !isUint32Array( state ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a Uint32Array. Option: `%s`.', 'state', state ) );\n\t\t\t}\n\t\t\terr = verifyState( state, true );\n\t\t\tif ( err ) {\n\t\t\t\tthrow err;\n\t\t\t}\n\t\t\tif ( opts.copy === false ) {\n\t\t\t\tSTATE = state;\n\t\t\t} else {\n\t\t\t\tSTATE = new Uint32Array( state.length );\n\t\t\t\tgcopy( state.length, state, 1, STATE, 1 );\n\t\t\t}\n\t\t\t// Create a state \"view\":\n\t\t\tstate = new Uint32Array( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), N );\n\n\t\t\t// Create a seed \"view\":\n\t\t\tseed = new Uint32Array( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), state[ SEED_SECTION_OFFSET ] );\n\t\t}\n\t\t// If provided a PRNG state, we ignore the `seed` option...\n\t\tif ( seed === void 0 ) {\n\t\t\tif ( hasOwnProp( options, 'seed' ) ) {\n\t\t\t\tseed = options.seed;\n\t\t\t\topts.seed = true;\n\t\t\t\tif ( isPositiveInteger( seed ) ) {\n\t\t\t\t\tif ( seed > MAX_SEED ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid option. `%s` option must be a positive integer less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.', 'seed', seed ) );\n\t\t\t\t\t}\n\t\t\t\t\tseed >>>= 0; // asm type annotation\n\t\t\t\t} else if ( isCollection( seed ) === false || seed.length < 1 ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.', 'seed', seed ) );\n\t\t\t\t} else if ( seed.length === 1 ) {\n\t\t\t\t\tseed = seed[ 0 ];\n\t\t\t\t\tif ( !isPositiveInteger( seed ) ) {\n\t\t\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%s`.', 'seed', seed ) );\n\t\t\t\t\t}\n\t\t\t\t\tif ( seed > MAX_SEED ) {\n\t\t\t\t\t\tthrow new RangeError( format( 'invalid option. `%s` option must be either a positive integer less than or equal to the maximum unsigned 32-bit integer or an array-like object containing integer values less than or equal to the maximum unsigned 32-bit integer. Option: `%u`.', 'seed', seed ) );\n\t\t\t\t\t}\n\t\t\t\t\tseed >>>= 0; // asm type annotation\n\t\t\t\t} else {\n\t\t\t\t\tslen = seed.length;\n\t\t\t\t\tSTATE = new Uint32Array( STATE_FIXED_LENGTH+slen );\n\n\t\t\t\t\t// Initialize sections:\n\t\t\t\t\tSTATE[ 0 ] = STATE_ARRAY_VERSION;\n\t\t\t\t\tSTATE[ 1 ] = NUM_STATE_SECTIONS;\n\t\t\t\t\tSTATE[ STATE_SECTION_OFFSET ] = N;\n\t\t\t\t\tSTATE[ OTHER_SECTION_OFFSET ] = 1;\n\t\t\t\t\tSTATE[ OTHER_SECTION_OFFSET+1 ] = N; // state index\n\t\t\t\t\tSTATE[ SEED_SECTION_OFFSET ] = slen;\n\n\t\t\t\t\t// Copy the provided seed array to prevent external mutation, as mutation would lead to an inability to reproduce PRNG values according to the PRNG's stated seed:\n\t\t\t\t\tgcopy.ndarray( slen, seed, 1, 0, STATE, 1, SEED_SECTION_OFFSET+1 );\n\n\t\t\t\t\t// Create a state \"view\":\n\t\t\t\t\tstate = new Uint32Array( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), N );\n\n\t\t\t\t\t// Create a seed \"view\":\n\t\t\t\t\tseed = new Uint32Array( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), slen );\n\n\t\t\t\t\t// Initialize the internal PRNG state:\n\t\t\t\t\tstate = createState( state, N, SEED_ARRAY_INIT_STATE );\n\t\t\t\t\tstate = initState( state, N, seed, slen );\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tseed = randuint32() >>> 0; // asm type annotation\n\t\t\t}\n\t\t}\n\t} else {\n\t\tseed = randuint32() >>> 0; // asm type annotation\n\t}\n\tif ( state === void 0 ) {\n\t\tSTATE = new Uint32Array( STATE_FIXED_LENGTH+1 );\n\n\t\t// Initialize sections:\n\t\tSTATE[ 0 ] = STATE_ARRAY_VERSION;\n\t\tSTATE[ 1 ] = NUM_STATE_SECTIONS;\n\t\tSTATE[ STATE_SECTION_OFFSET ] = N;\n\t\tSTATE[ OTHER_SECTION_OFFSET ] = 1;\n\t\tSTATE[ OTHER_SECTION_OFFSET+1 ] = N; // state index\n\t\tSTATE[ SEED_SECTION_OFFSET ] = 1;\n\t\tSTATE[ SEED_SECTION_OFFSET+1 ] = seed;\n\n\t\t// Create a state \"view\":\n\t\tstate = new Uint32Array( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), N );\n\n\t\t// Create a seed \"view\":\n\t\tseed = new Uint32Array( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), 1 );\n\n\t\t// Initialize the internal PRNG state:\n\t\tstate = createState( state, N, seed );\n\t}\n\t// Note: property order matters in order to maintain consistency of PRNG \"shape\" (hidden classes).\n\tsetReadOnly( mt19937, 'NAME', 'mt19937' );\n\tsetReadOnlyAccessor( mt19937, 'seed', getSeed );\n\tsetReadOnlyAccessor( mt19937, 'seedLength', getSeedLength );\n\tsetReadWriteAccessor( mt19937, 'state', getState, setState );\n\tsetReadOnlyAccessor( mt19937, 'stateLength', getStateLength );\n\tsetReadOnlyAccessor( mt19937, 'byteLength', getStateSize );\n\tsetReadOnly( mt19937, 'toJSON', toJSON );\n\tsetReadOnly( mt19937, 'MIN', 0 );\n\tsetReadOnly( mt19937, 'MAX', UINT32_MAX );\n\tsetReadOnly( mt19937, 'normalized', normalized );\n\n\tsetReadOnly( normalized, 'NAME', mt19937.NAME );\n\tsetReadOnlyAccessor( normalized, 'seed', getSeed );\n\tsetReadOnlyAccessor( normalized, 'seedLength', getSeedLength );\n\tsetReadWriteAccessor( normalized, 'state', getState, setState );\n\tsetReadOnlyAccessor( normalized, 'stateLength', getStateLength );\n\tsetReadOnlyAccessor( normalized, 'byteLength', getStateSize );\n\tsetReadOnly( normalized, 'toJSON', toJSON );\n\tsetReadOnly( normalized, 'MIN', 0.0 );\n\tsetReadOnly( normalized, 'MAX', MAX_NORMALIZED );\n\n\treturn mt19937;\n\n\t/**\n\t* Returns the PRNG seed.\n\t*\n\t* @private\n\t* @returns {PRNGSeedMT19937} seed\n\t*/\n\tfunction getSeed() {\n\t\tvar len = STATE[ SEED_SECTION_OFFSET ];\n\t\treturn gcopy( len, seed, 1, new Uint32Array( len ), 1 );\n\t}\n\n\t/**\n\t* Returns the PRNG seed length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} seed length\n\t*/\n\tfunction getSeedLength() {\n\t\treturn STATE[ SEED_SECTION_OFFSET ];\n\t}\n\n\t/**\n\t* Returns the PRNG state length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state length\n\t*/\n\tfunction getStateLength() {\n\t\treturn STATE.length;\n\t}\n\n\t/**\n\t* Returns the PRNG state size (in bytes).\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state size (in bytes)\n\t*/\n\tfunction getStateSize() {\n\t\treturn STATE.byteLength;\n\t}\n\n\t/**\n\t* Returns the current PRNG state.\n\t*\n\t* ## Notes\n\t*\n\t* - The PRNG state array is comprised of a preamble followed by `3` sections:\n\t*\n\t* 0. preamble (version + number of sections)\n\t* 1. internal PRNG state\n\t* 2. auxiliary state information\n\t* 3. PRNG seed\n\t*\n\t* - The first element of the PRNG state array preamble is the state array schema version.\n\t*\n\t* - The second element of the PRNG state array preamble is the number of state array sections (i.e., `3`).\n\t*\n\t* - The first element of each section following the preamble specifies the section length. The remaining section elements comprise the section contents.\n\t*\n\t* @private\n\t* @returns {PRNGStateMT19937} current state\n\t*/\n\tfunction getState() {\n\t\tvar len = STATE.length;\n\t\treturn gcopy( len, STATE, 1, new Uint32Array( len ), 1 );\n\t}\n\n\t/**\n\t* Sets the PRNG state.\n\t*\n\t* ## Notes\n\t*\n\t* - If PRNG state is \"shared\" (meaning a state array was provided during PRNG creation and **not** copied) and one sets the generator state to a state array having a different length, the PRNG does **not** update the existing shared state and, instead, points to the newly provided state array. In order to synchronize PRNG output according to the new shared state array, the state array for **each** relevant PRNG must be **explicitly** set.\n\t* - If PRNG state is \"shared\" and one sets the generator state to a state array of the same length, the PRNG state is updated (along with the state of all other PRNGs sharing the PRNG's state array).\n\t*\n\t* @private\n\t* @param {PRNGStateMT19937} s - generator state\n\t* @throws {TypeError} must provide a `Uint32Array`\n\t* @throws {Error} must provide a valid state\n\t*/\n\tfunction setState( s ) {\n\t\tvar err;\n\t\tif ( !isUint32Array( s ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a Uint32Array. Value: `%s`.', s ) );\n\t\t}\n\t\terr = verifyState( s, false );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t\tif ( opts.copy === false ) {\n\t\t\tif ( opts.state && s.length === STATE.length ) {\n\t\t\t\tgcopy( s.length, s, 1, STATE, 1 ); // update current shared state\n\t\t\t} else {\n\t\t\t\tSTATE = s; // point to new shared state\n\t\t\t\topts.state = true; // setting this flag allows updating a shared state even if a state array was not provided at PRNG creation\n\t\t\t}\n\t\t} else {\n\t\t\t// Check if we can reuse allocated memory...\n\t\t\tif ( s.length !== STATE.length ) {\n\t\t\t\tSTATE = new Uint32Array( s.length ); // reallocate\n\t\t\t}\n\t\t\tgcopy( s.length, s, 1, STATE, 1 );\n\t\t}\n\t\t// Create a new state \"view\":\n\t\tstate = new Uint32Array( STATE.buffer, STATE.byteOffset+((STATE_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), N );\n\n\t\t// Create a new seed \"view\":\n\t\tseed = new Uint32Array( STATE.buffer, STATE.byteOffset+((SEED_SECTION_OFFSET+1)*STATE.BYTES_PER_ELEMENT), STATE[ SEED_SECTION_OFFSET ] );\n\t}\n\n\t/**\n\t* Serializes the pseudorandom number generator as a JSON object.\n\t*\n\t* ## Notes\n\t*\n\t* - `JSON.stringify()` implicitly calls this method when stringifying a PRNG.\n\t*\n\t* @private\n\t* @returns {Object} JSON representation\n\t*/\n\tfunction toJSON() {\n\t\tvar out = {};\n\t\tout.type = 'PRNG';\n\t\tout.name = mt19937.NAME;\n\t\tout.state = typedarray2json( STATE );\n\t\tout.params = [];\n\t\treturn out;\n\t}\n\n\t/**\n\t* Generates a pseudorandom integer on the interval \\\\( [0, 2^{32}) \\\\).\n\t*\n\t* @private\n\t* @returns {uinteger32} pseudorandom integer\n\t*\n\t* @example\n\t* var r = mt19937();\n\t* // returns \n\t*/\n\tfunction mt19937() {\n\t\tvar r;\n\t\tvar i;\n\n\t\t// Retrieve the current state index:\n\t\ti = STATE[ OTHER_SECTION_OFFSET+1 ];\n\n\t\t// Determine whether we need to update the PRNG state:\n\t\tif ( i >= N ) {\n\t\t\tstate = twist( state );\n\t\t\ti = 0;\n\t\t}\n\t\t// Get the next word of \"raw\"/untempered state:\n\t\tr = state[ i ];\n\n\t\t// Update the state index:\n\t\tSTATE[ OTHER_SECTION_OFFSET+1 ] = i + 1;\n\n\t\t// Tempering transform to compensate for the reduced dimensionality of equidistribution:\n\t\tr ^= r >>> 11;\n\t\tr ^= ( r << 7 ) & TEMPERING_COEFFICIENT_1;\n\t\tr ^= ( r << 15 ) & TEMPERING_COEFFICIENT_2;\n\t\tr ^= r >>> 18;\n\n\t\treturn r >>> 0;\n\t}\n\n\t/**\n\t* Generates a pseudorandom number on the interval \\\\( [0, 1) \\\\).\n\t*\n\t* ## Notes\n\t*\n\t* - The original C implementation credits Isaku Wada for this algorithm (2002/01/09).\n\t*\n\t* @private\n\t* @returns {number} pseudorandom number\n\t*\n\t* @example\n\t* var r = normalized();\n\t* // returns \n\t*/\n\tfunction normalized() {\n\t\tvar x = mt19937() >>> 5;\n\t\tvar y = mt19937() >>> 6;\n\t\treturn ( (x*TWO_26)+y ) * FLOAT64_NORMALIZATION_CONSTANT;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default factory;\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 setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport setReadOnlyAccessor from '@stdlib/utils/define-nonenumerable-read-only-accessor';\nimport setReadWriteAccessor from '@stdlib/utils/define-nonenumerable-read-write-accessor';\nimport isObject from '@stdlib/assert/is-plain-object';\nimport { isPrimitive as isProbability } from '@stdlib/assert/is-probability';\nimport isFunction from '@stdlib/assert/is-function';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport constantFunction from '@stdlib/utils/constant-function';\nimport noop from '@stdlib/utils/noop';\nimport { factory as randu } from './../../../base/mt19937';\nimport isnan from '@stdlib/math/base/assert/is-nan';\nimport typedarray2json from '@stdlib/array/to-json';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Returns a pseudorandom number generator for generating Bernoulli distributed random numbers.\n*\n* @param {Probability} [p] - success probability\n* @param {Options} [options] - function options\n* @param {PRNG} [options.prng] - pseudorandom number generator which generates uniformly distributed pseudorandom numbers\n* @param {PRNGSeedMT19937} [options.seed] - pseudorandom number generator seed\n* @param {PRNGStateMT19937} [options.state] - pseudorandom number generator state\n* @param {boolean} [options.copy=true] - boolean indicating whether to copy a provided pseudorandom number generator state\n* @throws {TypeError} `p` must be a probability\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {Error} must provide a valid state\n* @returns {PRNG} pseudorandom number generator\n*\n* @example\n* var bernoulli = factory( 0.5 );\n* var v = bernoulli();\n* // returns \n*\n* @example\n* var bernoulli = factory( 0.8, {\n* 'seed': 297\n* });\n* var v = bernoulli();\n* // returns \n*\n* @example\n* var bernoulli = factory();\n* var v = bernoulli( 0.5 );\n* // returns \n*/\nfunction factory() {\n\tvar opts;\n\tvar rand;\n\tvar prng;\n\tvar p;\n\n\tif ( arguments.length === 0 ) {\n\t\trand = randu();\n\t} else if (\n\t\targuments.length === 1 &&\n\t\tisObject( arguments[ 0 ] )\n\t) {\n\t\topts = arguments[ 0 ];\n\t\tif ( hasOwnProp( opts, 'prng' ) ) {\n\t\t\tif ( !isFunction( opts.prng ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );\n\t\t\t}\n\t\t\trand = opts.prng;\n\t\t} else {\n\t\t\trand = randu( opts );\n\t\t}\n\t} else {\n\t\tp = arguments[ 0 ];\n\t\tif ( !isProbability( p ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. First argument must be a probability. Value: `%s`.', p ) );\n\t\t}\n\t\tif ( arguments.length > 1 ) {\n\t\t\topts = arguments[ 1 ];\n\t\t\tif ( !isObject( opts ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', opts ) );\n\t\t\t}\n\t\t\tif ( hasOwnProp( opts, 'prng' ) ) {\n\t\t\t\tif ( !isFunction( opts.prng ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be a pseudorandom number generator function. Option: `%s`.', 'prng', opts.prng ) );\n\t\t\t\t}\n\t\t\t\trand = opts.prng;\n\t\t\t} else {\n\t\t\t\trand = randu( opts );\n\t\t\t}\n\t\t} else {\n\t\t\trand = randu();\n\t\t}\n\t}\n\tif ( p === void 0 ) {\n\t\tprng = bernoulli2;\n\t} else {\n\t\tprng = bernoulli1;\n\t}\n\tsetReadOnly( prng, 'NAME', 'bernoulli' );\n\n\t// If we are provided an \"external\" PRNG, we don't support getting or setting PRNG state, as we'd need to check for compatible state value types, etc, entailing considerable complexity.\n\tif ( opts && opts.prng ) {\n\t\tsetReadOnly( prng, 'seed', null );\n\t\tsetReadOnly( prng, 'seedLength', null );\n\t\tsetReadWriteAccessor( prng, 'state', constantFunction( null ), noop );\n\t\tsetReadOnly( prng, 'stateLength', null );\n\t\tsetReadOnly( prng, 'byteLength', null );\n\t\tsetReadOnly( prng, 'toJSON', constantFunction( null ) );\n\t\tsetReadOnly( prng, 'PRNG', rand );\n\t} else {\n\t\tsetReadOnlyAccessor( prng, 'seed', getSeed );\n\t\tsetReadOnlyAccessor( prng, 'seedLength', getSeedLength );\n\t\tsetReadWriteAccessor( prng, 'state', getState, setState );\n\t\tsetReadOnlyAccessor( prng, 'stateLength', getStateLength );\n\t\tsetReadOnlyAccessor( prng, 'byteLength', getStateSize );\n\t\tsetReadOnly( prng, 'toJSON', toJSON );\n\t\tsetReadOnly( prng, 'PRNG', rand );\n\t\trand = rand.normalized;\n\t}\n\treturn prng;\n\n\t/**\n\t* Returns the PRNG seed.\n\t*\n\t* @private\n\t* @returns {PRNGSeedMT19937} seed\n\t*/\n\tfunction getSeed() {\n\t\treturn rand.seed;\n\t}\n\n\t/**\n\t* Returns the PRNG seed length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} seed length\n\t*/\n\tfunction getSeedLength() {\n\t\treturn rand.seedLength;\n\t}\n\n\t/**\n\t* Returns the PRNG state length.\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state length\n\t*/\n\tfunction getStateLength() {\n\t\treturn rand.stateLength;\n\t}\n\n\t/**\n\t* Returns the PRNG state size (in bytes).\n\t*\n\t* @private\n\t* @returns {PositiveInteger} state size (in bytes)\n\t*/\n\tfunction getStateSize() {\n\t\treturn rand.byteLength;\n\t}\n\n\t/**\n\t* Returns the current pseudorandom number generator state.\n\t*\n\t* @private\n\t* @returns {PRNGStateMT19937} current state\n\t*/\n\tfunction getState() {\n\t\treturn rand.state;\n\t}\n\n\t/**\n\t* Sets the pseudorandom number generator state.\n\t*\n\t* @private\n\t* @param {PRNGStateMT19937} s - generator state\n\t* @throws {Error} must provide a valid state\n\t*/\n\tfunction setState( s ) {\n\t\trand.state = s;\n\t}\n\n\t/**\n\t* Serializes the pseudorandom number generator as a JSON object.\n\t*\n\t* ## Notes\n\t*\n\t* - `JSON.stringify()` implicitly calls this method when stringifying a PRNG.\n\t*\n\t* @private\n\t* @returns {Object} JSON representation\n\t*/\n\tfunction toJSON() {\n\t\tvar out = {};\n\t\tout.type = 'PRNG';\n\t\tout.name = prng.NAME;\n\t\tout.state = typedarray2json( rand.state );\n\t\tif ( p === void 0 ) {\n\t\t\tout.params = [];\n\t\t} else {\n\t\t\tout.params = [ p ];\n\t\t}\n\t\treturn out;\n\t}\n\n\t/**\n\t* Returns a pseudorandom number drawn from a Bernoulli distribution with bound parameter `p`.\n\t*\n\t* @private\n\t* @returns {NonNegativeInteger} pseudorandom number\n\t*\n\t* @example\n\t* var v = bernoulli1();\n\t* // returns \n\t*/\n\tfunction bernoulli1() {\n\t\treturn ( rand() <= p ) ? 1 : 0;\n\t}\n\n\t/**\n\t* Returns a pseudorandom number drawn from a Bernoulli distribution with parameter `p`.\n\t*\n\t* @private\n\t* @param {Probability} p - success probability\n\t* @returns {NonNegativeInteger} pseudorandom number\n\t*\n\t* @example\n\t* var v = bernoulli2( 0.5 );\n\t* // returns \n\t*/\n\tfunction bernoulli2( p ) {\n\t\tif (\n\t\t\tisnan( p ) ||\n\t\t\tp < 0.0 ||\n\t\t\tp > 1.0\n\t\t) {\n\t\t\treturn NaN;\n\t\t}\n\t\treturn ( rand() <= p ) ? 1 : 0;\n\t}\n}\n\n\n// EXPORTS //\n\nexport default factory;\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* A 32-bit Mersenne Twister pseudorandom number generator.\n*\n* @module @stdlib/random/base/mt19937\n*\n* @example\n* import mt19937 from '@stdlib/random/base/mt19937';\n*\n* var v = mt19937();\n* // returns \n*\n* @example\n* import { factory as factory } from '@stdlib/random/base/mt19937';\n*\n* var mt19937 = factory({\n* 'seed': 1234\n* });\n*\n* var v = mt19937();\n* // returns 822569775\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\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 factory from './factory.js';\nimport randuint32 from './rand_uint32.js';\n\n\n// MAIN //\n\n/**\n* Generates a pseudorandom integer on the interval \\\\( [0, 2^{32}) \\\\).\n*\n* ## Method\n*\n* - When generating normalized double-precision floating-point numbers, we first generate two pseudorandom integers \\\\( x \\\\) and \\\\( y \\\\) on the interval \\\\( [0, 2^{32}) \\\\) for a combined \\\\( 64 \\\\) random bits.\n*\n* - We would like \\\\( 53 \\\\) random bits to generate a 53-bit precision integer and, thus, want to discard \\\\( 11 \\\\) of the generated bits.\n*\n* - We do so by discarding \\\\( 5 \\\\) bits from \\\\( x \\\\) and \\\\( 6 \\\\) bits from \\\\( y \\\\).\n*\n* - Accordingly, \\\\( x \\\\) contains \\\\( 27 \\\\) random bits, which are subsequently shifted left \\\\( 26 \\\\) bits (multiplied by \\\\( 2^{26} \\\\), and \\\\( y \\\\) contains \\\\( 26 \\\\) random bits to fill in the lower \\\\( 26 \\\\) bits. When summed, they combine to comprise \\\\( 53 \\\\) random bits of a double-precision floating-point integer.\n*\n* - As an example, suppose, for the sake of argument, the 32-bit PRNG generates the maximum unsigned 32-bit integer \\\\( 2^{32}-1 \\\\) twice in a row. Then,\n*\n* ```javascript\n* x = 4294967295 >>> 5; // 00000111111111111111111111111111\n* y = 4294967295 >>> 6; // 00000011111111111111111111111111\n* ```\n*\n* Multiplying \\\\( x \\\\) by \\\\( 2^{26} \\\\) returns \\\\( 9007199187632128 \\\\), which, in binary, is\n*\n* ```binarystring\n* 0 10000110011 11111111111111111111 11111100000000000000000000000000\n* ```\n*\n* Adding \\\\( y \\\\) yields \\\\( 9007199254740991 \\\\) (the maximum \"safe\" double-precision floating-point integer value), which, in binary, is\n*\n* ```binarystring\n* 0 10000110011 11111111111111111111 11111111111111111111111111111111\n* ```\n*\n* - Similarly, suppose the 32-bit PRNG generates the following values\n*\n* ```javascript\n* x = 1 >>> 5; // 0 => 00000000000000000000000000000000\n* y = 64 >>> 6; // 1 => 00000000000000000000000000000001\n* ```\n*\n* Multiplying \\\\( x \\\\) by \\\\( 2^{26} \\\\) returns \\\\( 0 \\\\), which, in binary, is\n*\n* ```binarystring\n* 0 00000000000 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* Adding \\\\( y \\\\) yields \\\\( 1 \\\\), which, in binary, is\n*\n* ```binarystring\n* 0 01111111111 00000000000000000000 00000000000000000000000000000000\n* ```\n*\n* - As different combinations of \\\\( x \\\\) and \\\\( y \\\\) are generated, different combinations of double-precision floating-point exponent and significand bits will be toggled, thus generating pseudorandom double-precision floating-point numbers.\n*\n* ## References\n*\n* - Matsumoto, Makoto, and Takuji Nishimura. 1998. \"Mersenne Twister: A 623-dimensionally Equidistributed Uniform Pseudo-random Number Generator.\" _ACM Transactions on Modeling and Computer Simulation_ 8 (1). New York, NY, USA: ACM: 3–30. doi:[10.1145/272991.272995][@matsumoto:1998a].\n* - Harase, Shin. 2017. \"Conversion of Mersenne Twister to double-precision floating-point numbers.\" _ArXiv_ abs/1708.06018 (September). .\n*\n* [@matsumoto:1998a]: https://doi.org/10.1145/272991.272995\n*\n* @function mt19937\n* @type {PRNG}\n* @returns {PositiveInteger} pseudorandom integer\n*\n* @example\n* var v = mt19937();\n* // returns \n*/\nvar mt19937 = factory({\n\t'seed': randuint32()\n});\n\n\n// EXPORTS //\n\nexport default mt19937;\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 factory from './factory.js';\n\n\n// MAIN //\n\n/**\n* Returns a pseudorandom random number drawn from a Bernoulli distribution with parameter `p`.\n*\n* @name bernoulli\n* @type {PRNG}\n* @param {Probability} p - success probability\n* @returns {NonNegativeInteger} pseudorandom number\n*\n* @example\n* var v = bernoulli( 0.5 );\n* // returns \n*\n* @example\n* var v = bernoulli( 3.14 );\n* // returns NaN\n*\n* @example\n* var v = bernoulli( -1.0 );\n* // returns NaN\n*\n* @example\n* var v = bernoulli( NaN );\n* // returns NaN\n*/\nvar bernoulli = factory();\n\n\n// EXPORTS //\n\nexport default bernoulli;\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* Uncapitalizes the first character of a string.\n*\n* @param {string} str - input string\n* @returns {string} input string with first character converted to lowercase\n*\n* @example\n* var out = uncapitalize( 'Last man standing' );\n* // returns 'last man standing'\n*\n* @example\n* var out = uncapitalize( 'Presidential election' );\n* // returns 'presidential election'\n*\n* @example\n* var out = uncapitalize( 'JavaScript' );\n* // returns 'javaScript'\n*\n* @example\n* var out = uncapitalize( 'Hidden Treasures' );\n* // returns 'hidden Treasures'\n*/\nfunction uncapitalize( str ) {\n\tif ( str === '' ) {\n\t\treturn '';\n\t}\n\treturn str.charAt( 0 ).toLowerCase() + str.slice( 1 );\n}\n\n\n// EXPORTS //\n\nexport default uncapitalize;\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* Bernoulli distributed pseudorandom numbers.\n*\n* @module @stdlib/random/base/bernoulli\n*\n* @example\n* import bernoulli from '@stdlib/random/base/bernoulli';\n*\n* var v = bernoulli( 0.5 );\n* // returns \n*\n* @example\n* import { factory as factory } from '@stdlib/random/base/bernoulli';\n*\n* var bernoulli = factory( 0.3, {\n* 'seed': 297\n* });\n*\n* var v = bernoulli();\n* // returns \n*\n* @example\n* import { factory as factory } from '@stdlib/random/base/bernoulli';\n*\n* var bernoulli = factory({\n* 'seed': 297\n* });\n*\n* var v = bernoulli( 0.5 );\n* // returns \n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport main from './main.js';\nimport factory from './factory.js';\n\n\n// MAIN //\n\nsetReadOnly( main, 'factory', factory );\n\n\n// EXPORTS //\n\nexport default main;\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* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace ns\n*/\nvar ns = {};\n\n/**\n* @name altcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/altcase}\n*/\nimport altcase from './../../base/altcase';\nsetReadOnly( ns, 'altcase', altcase );\n\n/**\n* @name atob\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/atob}\n*/\nimport atob from './../../base/atob';\nsetReadOnly( ns, 'atob', atob );\n\n/**\n* @name base64ToUint8Array\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/base64-to-uint8array}\n*/\nimport base64ToUint8Array from './../../base/base64-to-uint8array';\nsetReadOnly( ns, 'base64ToUint8Array', base64ToUint8Array );\n\n/**\n* @name camelcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/camelcase}\n*/\nimport camelcase from './../../base/camelcase';\nsetReadOnly( ns, 'camelcase', camelcase );\n\n/**\n* @name capitalize\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/capitalize}\n*/\nimport capitalize from './../../base/capitalize';\nsetReadOnly( ns, 'capitalize', capitalize );\n\n/**\n* @name codePointAt\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/code-point-at}\n*/\nimport codePointAt from './../../base/code-point-at';\nsetReadOnly( ns, 'codePointAt', codePointAt );\n\n/**\n* @name constantcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/constantcase}\n*/\nimport constantcase from './../../base/constantcase';\nsetReadOnly( ns, 'constantcase', constantcase );\n\n/**\n* @name distances\n* @memberof ns\n* @readonly\n* @type {Namespace}\n* @see {@link module:@stdlib/string/base/distances}\n*/\nimport distances from './../../base/distances';\nsetReadOnly( ns, 'distances', distances );\n\n/**\n* @name dotcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/dotcase}\n*/\nimport dotcase from './../../base/dotcase';\nsetReadOnly( ns, 'dotcase', dotcase );\n\n/**\n* @name endsWith\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/ends-with}\n*/\nimport endsWith from './../../base/ends-with';\nsetReadOnly( ns, 'endsWith', endsWith );\n\n/**\n* @name first\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/first}\n*/\nimport first from './../../base/first';\nsetReadOnly( ns, 'first', first );\n\n/**\n* @name firstCodePoint\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/first-code-point}\n*/\nimport firstCodePoint from './../../base/first-code-point';\nsetReadOnly( ns, 'firstCodePoint', firstCodePoint );\n\n/**\n* @name firstGraphemeCluster\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/first-grapheme-cluster}\n*/\nimport firstGraphemeCluster from './../../base/first-grapheme-cluster';\nsetReadOnly( ns, 'firstGraphemeCluster', firstGraphemeCluster );\n\n/**\n* @name forEach\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/for-each}\n*/\nimport forEach from './../../base/for-each';\nsetReadOnly( ns, 'forEach', forEach );\n\n/**\n* @name forEachCodePoint\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/for-each-code-point}\n*/\nimport forEachCodePoint from './../../base/for-each-code-point';\nsetReadOnly( ns, 'forEachCodePoint', forEachCodePoint );\n\n/**\n* @name forEachCodePointRight\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/for-each-code-point-right}\n*/\nimport forEachCodePointRight from './../../base/for-each-code-point-right';\nsetReadOnly( ns, 'forEachCodePointRight', forEachCodePointRight );\n\n/**\n* @name forEachGraphemeCluster\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/for-each-grapheme-cluster}\n*/\nimport forEachGraphemeCluster from './../../base/for-each-grapheme-cluster';\nsetReadOnly( ns, 'forEachGraphemeCluster', forEachGraphemeCluster );\n\n/**\n* @name forEachRight\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/for-each-right}\n*/\nimport forEachRight from './../../base/for-each-right';\nsetReadOnly( ns, 'forEachRight', forEachRight );\n\n/**\n* @name formatInterpolate\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/format-interpolate}\n*/\nimport formatInterpolate from './../../base/format-interpolate';\nsetReadOnly( ns, 'formatInterpolate', formatInterpolate );\n\n/**\n* @name formatTokenize\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/format-tokenize}\n*/\nimport formatTokenize from './../../base/format-tokenize';\nsetReadOnly( ns, 'formatTokenize', formatTokenize );\n\n/**\n* @name headercase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/headercase}\n*/\nimport headercase from './../../base/headercase';\nsetReadOnly( ns, 'headercase', headercase );\n\n/**\n* @name invcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/invcase}\n*/\nimport invcase from './../../base/invcase';\nsetReadOnly( ns, 'invcase', invcase );\n\n/**\n* @name kebabcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/kebabcase}\n*/\nimport kebabcase from './../../base/kebabcase';\nsetReadOnly( ns, 'kebabcase', kebabcase );\n\n/**\n* @name last\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/last}\n*/\nimport last from './../../base/last';\nsetReadOnly( ns, 'last', last );\n\n/**\n* @name lastCodePoint\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/last-code-point}\n*/\nimport lastCodePoint from './../../base/last-code-point';\nsetReadOnly( ns, 'lastCodePoint', lastCodePoint );\n\n/**\n* @name lastGraphemeCluster\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/last-grapheme-cluster}\n*/\nimport lastGraphemeCluster from './../../base/last-grapheme-cluster';\nsetReadOnly( ns, 'lastGraphemeCluster', lastGraphemeCluster );\n\n/**\n* @name lpad\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/left-pad}\n*/\nimport lpad from './../../base/left-pad';\nsetReadOnly( ns, 'lpad', lpad );\n\n/**\n* @name ltrim\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/left-trim}\n*/\nimport ltrim from './../../base/left-trim';\nsetReadOnly( ns, 'ltrim', ltrim );\n\n/**\n* @name lowercase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/lowercase}\n*/\nimport lowercase from './../../base/lowercase';\nsetReadOnly( ns, 'lowercase', lowercase );\n\n/**\n* @name pascalcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/pascalcase}\n*/\nimport pascalcase from './../../base/pascalcase';\nsetReadOnly( ns, 'pascalcase', pascalcase );\n\n/**\n* @name percentEncode\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/percent-encode}\n*/\nimport percentEncode from './../../base/percent-encode';\nsetReadOnly( ns, 'percentEncode', percentEncode );\n\n/**\n* @name removeFirst\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-first}\n*/\nimport removeFirst from './../../base/remove-first';\nsetReadOnly( ns, 'removeFirst', removeFirst );\n\n/**\n* @name removeFirstCodePoint\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-first-code-point}\n*/\nimport removeFirstCodePoint from './../../base/remove-first-code-point';\nsetReadOnly( ns, 'removeFirstCodePoint', removeFirstCodePoint );\n\n/**\n* @name removeFirstGraphemeCluster\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-first-grapheme-cluster}\n*/\nimport removeFirstGraphemeCluster from './../../base/remove-first-grapheme-cluster';\nsetReadOnly( ns, 'removeFirstGraphemeCluster', removeFirstGraphemeCluster );\n\n/**\n* @name removeLast\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-last}\n*/\nimport removeLast from './../../base/remove-last';\nsetReadOnly( ns, 'removeLast', removeLast );\n\n/**\n* @name removeLastCodePoint\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-last-code-point}\n*/\nimport removeLastCodePoint from './../../base/remove-last-code-point';\nsetReadOnly( ns, 'removeLastCodePoint', removeLastCodePoint );\n\n/**\n* @name removeLastGraphemeCluster\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/remove-last-grapheme-cluster}\n*/\nimport removeLastGraphemeCluster from './../../base/remove-last-grapheme-cluster';\nsetReadOnly( ns, 'removeLastGraphemeCluster', removeLastGraphemeCluster );\n\n/**\n* @name repeat\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/repeat}\n*/\nimport repeat from './../../base/repeat';\nsetReadOnly( ns, 'repeat', repeat );\n\n/**\n* @name replace\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/replace}\n*/\nimport replace from './../../base/replace';\nsetReadOnly( ns, 'replace', replace );\n\n/**\n* @name replaceAfter\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/replace-after}\n*/\nimport replaceAfter from './../../base/replace-after';\nsetReadOnly( ns, 'replaceAfter', replaceAfter );\n\n/**\n* @name replaceAfterLast\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/replace-after-last}\n*/\nimport replaceAfterLast from './../../base/replace-after-last';\nsetReadOnly( ns, 'replaceAfterLast', replaceAfterLast );\n\n/**\n* @name replaceBefore\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/replace-before}\n*/\nimport replaceBefore from './../../base/replace-before';\nsetReadOnly( ns, 'replaceBefore', replaceBefore );\n\n/**\n* @name replaceBeforeLast\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/replace-before-last}\n*/\nimport replaceBeforeLast from './../../base/replace-before-last';\nsetReadOnly( ns, 'replaceBeforeLast', replaceBeforeLast );\n\n/**\n* @name reverse\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/reverse}\n*/\nimport reverse from './../../base/reverse';\nsetReadOnly( ns, 'reverse', reverse );\n\n/**\n* @name reverseCodePoints\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/reverse-code-points}\n*/\nimport reverseCodePoints from './../../base/reverse-code-points';\nsetReadOnly( ns, 'reverseCodePoints', reverseCodePoints );\n\n/**\n* @name reverseGraphemeClusters\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/reverse-grapheme-clusters}\n*/\nimport reverseGraphemeClusters from './../../base/reverse-grapheme-clusters';\nsetReadOnly( ns, 'reverseGraphemeClusters', reverseGraphemeClusters );\n\n/**\n* @name rpad\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/right-pad}\n*/\nimport rpad from './../../base/right-pad';\nsetReadOnly( ns, 'rpad', rpad );\n\n/**\n* @name rtrim\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/right-trim}\n*/\nimport rtrim from './../../base/right-trim';\nsetReadOnly( ns, 'rtrim', rtrim );\n\n/**\n* @name slice\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/slice}\n*/\nimport slice from './../../base/slice';\nsetReadOnly( ns, 'slice', slice );\n\n/**\n* @name sliceCodePoints\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/slice-code-points}\n*/\nimport sliceCodePoints from './../../base/slice-code-points';\nsetReadOnly( ns, 'sliceCodePoints', sliceCodePoints );\n\n/**\n* @name sliceGraphemeClusters\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/slice-grapheme-clusters}\n*/\nimport sliceGraphemeClusters from './../../base/slice-grapheme-clusters';\nsetReadOnly( ns, 'sliceGraphemeClusters', sliceGraphemeClusters );\n\n/**\n* @name snakecase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/snakecase}\n*/\nimport snakecase from './../../base/snakecase';\nsetReadOnly( ns, 'snakecase', snakecase );\n\n/**\n* @name startcase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/startcase}\n*/\nimport startcase from './../../base/startcase';\nsetReadOnly( ns, 'startcase', startcase );\n\n/**\n* @name startsWith\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/starts-with}\n*/\nimport startsWith from './../../base/starts-with';\nsetReadOnly( ns, 'startsWith', startsWith );\n\n/**\n* @name stickycase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/stickycase}\n*/\nimport stickycase from './../../base/stickycase';\nsetReadOnly( ns, 'stickycase', stickycase );\n\n/**\n* @name trim\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/trim}\n*/\nimport trim from './../../base/trim';\nsetReadOnly( ns, 'trim', trim );\n\n/**\n* @name truncateMiddle\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/truncate-middle}\n*/\nimport truncateMiddle from './../../base/truncate-middle';\nsetReadOnly( ns, 'truncateMiddle', truncateMiddle );\n\n/**\n* @name uncapitalize\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/uncapitalize}\n*/\nimport uncapitalize from './../../base/uncapitalize';\nsetReadOnly( ns, 'uncapitalize', uncapitalize );\n\n/**\n* @name uppercase\n* @memberof ns\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base/uppercase}\n*/\nimport uppercase from './../../base/uppercase';\nsetReadOnly( ns, 'uppercase', uppercase );\n\n\n// EXPORTS //\n\nexport default ns;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport lowercase from './../../../base/lowercase';\nimport uppercase from './../../../base/uppercase';\nimport isEven from '@stdlib/math/base/assert/is-even';\n\n\n// MAIN //\n\n/**\n* Converts a string to alternate case.\n*\n* @param {string} str - string to convert\n* @returns {string} alternate-cased string\n*\n* @example\n* var str = altcase( 'beep' );\n* // returns 'bEeP'\n*\n* @example\n* var str = altcase( 'beep boop' );\n* // returns 'bEeP BoOp'\n*\n* @example\n* var str = altcase( 'isMobile' );\n* // returns 'iSmObIlE'\n*\n* @example\n* var str = altcase( 'Hello World!' );\n* // returns 'hElLo wOrLd!'\n*/\nfunction altcase( str ) {\n\tvar out = '';\n\tvar i;\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tif ( isEven( i ) ) {\n\t\t\tout += lowercase( str[i] );\n\t\t} else {\n\t\t\tout += uppercase( str[i] );\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default altcase;\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 atob from './../../../base/atob'; // eslint-disable-line stdlib/no-redeclare\nimport Uint8Array from '@stdlib/array/uint8';\n\n\n// MAIN //\n\n/**\n* Converts a base64-encoded string to a Uint8Array.\n*\n* @param {string} str - base64-encoded string\n* @returns {(Uint8Array|null)} output array\n*\n* @example\n* import string2buffer from '@stdlib/buffer/from-string';\n*\n* var str = string2buffer( 'Hello World!' ).toString( 'base64' );\n* // returns 'SGVsbG8gV29ybGQh'\n*\n* var out = base64ToUint8Array( str );\n* // returns [ 72, 101, 108, 108, 111, 32, 87, 111, 114, 108, 100, 33 ]\n*/\nfunction base64ToUint8Array( str ) {\n\tvar bytes;\n\tvar v;\n\tvar i;\n\n\tv = atob( str );\n\tif ( v === null ) {\n\t\treturn null;\n\t}\n\tbytes = new Uint8Array( v.length );\n\tfor ( i = 0; i < v.length; i++ ) {\n\t\tbytes[ i ] = v.charCodeAt( i );\n\t}\n\treturn bytes;\n}\n\n\n// EXPORTS //\n\nexport default base64ToUint8Array;\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// MAIN //\n\n/**\n* Invokes a function for each UTF-16 code unit in a string, iterating from right to left.\n*\n* @param {string} str - input string\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEachRight( 'Hello', log );\n*/\nfunction forEachRight( str, clbk, thisArg ) {\n\tvar i;\n\tfor ( i = str.length-1; i >= 0; i-- ) {\n\t\tclbk.call( thisArg, str[ i ], i, str );\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEachRight;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport uppercase from './../../../base/uppercase';\nimport lowercase from './../../../base/lowercase';\n\n\n// MAIN //\n\n/**\n* Converts a string to inverse case.\n*\n* @param {string} str - string to convert\n* @returns {string} inverse-cased string\n*\n* @example\n* var str = invcase( 'beep' );\n* // returns 'BEEP'\n*\n* @example\n* var str = invcase( 'beep BOOP' );\n* // returns 'BEEP boop'\n*\n* @example\n* var str = invcase( 'isMobile' );\n* // returns 'ISmOBILE'\n*\n* @example\n* var str = invcase( 'HeLlO wOrLd!' );\n* // returns 'hElLo WoRlD!'\n*/\nfunction invcase( str ) {\n\tvar out;\n\tvar ch;\n\tvar s;\n\tvar i;\n\n\tout = [];\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tch = str[ i ];\n\t\ts = uppercase( ch );\n\t\tif ( s === ch ) {\n\t\t\ts = lowercase( ch );\n\t\t}\n\t\tout.push( s );\n\t}\n\treturn out.join( '' );\n}\n\n\n// EXPORTS //\n\nexport default invcase;\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// MAIN //\n\n/**\n* Replaces the substring after the first occurrence of a specified search string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {string} replacement - replacement string\n* @param {integer} fromIndex - index at which to start the search\n* @returns {string} output string\n*\n* @example\n* var out = replaceAfter( 'beep boop', ' ', 'foo', 0 );\n* // returns 'beep foo'\n*\n* @example\n* var out = replaceAfter( 'beep boop', 'p', 'foo', 5 );\n* // returns 'beep boopfoo'\n*\n* @example\n* var out = replaceAfter( 'Hello World!', '', 'foo', 0 );\n* // returns 'Hello World!'\n*\n* @example\n* var out = replaceAfter( 'Hello World!', 'xyz', 'foo', 0 );\n* // returns 'Hello World!'\n*\n* @example\n* var out = replaceAfter( 'beep boop', ' ', 'foo', 5 );\n* // returns 'beep boop'\n*\n* @example\n* var out = replaceAfter( 'beep boop beep baz', 'beep', 'foo', 5 );\n* // returns 'beep boop beepfoo'\n*/\nfunction replaceAfter( str, search, replacement, fromIndex ) {\n\tvar idx;\n\tif ( fromIndex < 0 ) {\n\t\tfromIndex += str.length;\n\t} else if ( fromIndex >= str.length ) {\n\t\treturn str;\n\t}\n\tidx = str.indexOf( search, fromIndex );\n\tif ( str === '' || search === '' || replacement === '' || idx < 0 ) {\n\t\treturn str;\n\t}\n\treturn str.substring( 0, idx + search.length ) + replacement;\n}\n\n\n// EXPORTS //\n\nexport default replaceAfter;\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// MAIN //\n\n/**\n* Replaces the substring after the last occurrence of a specified search string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {string} replacement - replacement string\n* @param {integer} fromIndex - index from which to start searching\n* @returns {string} string\n*\n* @example\n* var str = 'beep boop';\n* var out = replaceAfterLast( str, ' ', 'foo', str.length );\n* // returns 'beep foo'\n*\n* @example\n* var str = 'beep boop';\n* var out = replaceAfterLast( str, 'p', 'foo', str.length );\n* // returns 'beep boopfoo'\n*\n* @example\n* var str = 'Hello World!';\n* var out = replaceAfterLast( str, '', 'foo', str.length );\n* // returns 'Hello World!'\n*\n* @example\n* var str = 'Hello World!';\n* var out = replaceAfterLast( str, 'xyz', 'foo', str.length );\n* // returns 'Hello World!'\n*\n* @example\n* var str = 'beep boop baz';\n* var out = replaceAfterLast( str, 'p b', 'foo', str.length );\n* // returns 'beep boop bfoo'\n*\n* @example\n* var str = 'beep boop baz';\n* var out = replaceAfterLast( str, 'p b', 'foo', 6 );\n* // returns 'beep bfoo'\n*/\nfunction replaceAfterLast( str, search, replacement, fromIndex ) {\n\tvar idx;\n\tif ( fromIndex < 0 ) {\n\t\tfromIndex += str.length;\n\t\tif ( fromIndex < 0 ) {\n\t\t\treturn str;\n\t\t}\n\t}\n\tidx = str.lastIndexOf( search, fromIndex );\n\tif ( str === '' || search === '' || replacement === '' || idx < 0 ) {\n\t\treturn str;\n\t}\n\treturn str.substring( 0, idx + search.length ) + replacement;\n}\n\n\n// EXPORTS //\n\nexport default replaceAfterLast;\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// MAIN //\n\n/**\n* Replaces the substring before the last occurrence of a specified search string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {string} replacement - replacement string\n* @param {integer} fromIndex - index from which to start searching\n* @returns {string} string\n*\n* @example\n* var str = 'beep boop';\n* var out = replaceBeforeLast( str, ' ', 'foo', str.length );\n* // returns 'foo boop'\n*\n* @example\n* var str = 'beep boop';\n* var out = replaceBeforeLast( str, 'p', 'foo', str.length );\n* // returns 'foop'\n*\n* @example\n* var str = 'Hello World!';\n* var out = replaceBeforeLast( str, '', 'foo', str.length );\n* // returns 'Hello World!'\n*\n* @example\n* var str = 'Hello World!';\n* var out = replaceBeforeLast( str, 'xyz', 'foo', str.length );\n* // returns 'Hello World!'\n*\n* @example\n* var str = 'beep boop baz';\n* var out = replaceBeforeLast( str, 'p b', 'foo', str.length );\n* // returns 'foop baz'\n*\n* @example\n* var str = 'beep boop baz';\n* var out = replaceBeforeLast( str, 'p b', 'foo', 6 );\n* // returns 'foop boop baz'\n*/\nfunction replaceBeforeLast( str, search, replacement, fromIndex ) {\n\tvar idx;\n\tif ( fromIndex < 0 ) {\n\t\tfromIndex += str.length;\n\t\tif ( fromIndex < 0 ) {\n\t\t\treturn str;\n\t\t}\n\t}\n\tidx = str.lastIndexOf( search, fromIndex );\n\tif ( str === '' || search === '' || replacement === '' || idx < 0 ) {\n\t\treturn str;\n\t}\n\treturn replacement + str.substring( idx );\n}\n\n\n// EXPORTS //\n\nexport default replaceBeforeLast;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2025 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport nextGraphemeClusterBreak from './../../../next-grapheme-cluster-break';\nimport numGraphemeClusters from './../../../num-grapheme-clusters';\nimport max from '@stdlib/math/base/special/fast/max';\n\n\n// MAIN //\n\n/**\n* Slices a string based on grapheme cluster (i.e., user-perceived character) indices.\n*\n* @param {string} str - input string\n* @param {integer} start - the `ith` grapheme cluster to start a slice (inclusive)\n* @param {integer} end - the `jth` grapheme cluster to end a slice (exclusive)\n* @returns {string} output string\n*\n* @example\n* var out = sliceGraphemeClusters( 'Hello World', 0, 5 );\n* // returns 'Hello'\n*\n* out = sliceGraphemeClusters( '👋👋👋', 0, 2 );\n* // returns '👋👋'\n*\n* out = sliceGraphemeClusters( 'अनुच्छेद', 1, 3 );\n* // returns 'नुच्'\n*\n* out = sliceGraphemeClusters( 'Hello World', -5, -1 );\n* // returns 'Worl'\n*/\nfunction sliceGraphemeClusters( str, start, end ) {\n\tvar numClusters;\n\tvar result;\n\tvar idx;\n\tvar brk;\n\tvar i;\n\n\tif ( str === '' ) {\n\t\treturn '';\n\t}\n\tnumClusters = numGraphemeClusters( str );\n\tif ( start < 0 ) {\n\t\tstart = max( start + numClusters, 0 );\n\t}\n\tif ( end < 0 ) {\n\t\tend = max( end + numClusters, 0 );\n\t}\n\tif ( start >= numClusters || start >= end ) {\n\t\treturn '';\n\t}\n\tif ( end > numClusters ) {\n\t\tend = numClusters;\n\t}\n\tresult = '';\n\tidx = 0;\n\ti = 0;\n\twhile ( idx < str.length ) {\n\t\tbrk = nextGraphemeClusterBreak( str, idx );\n\t\tif ( brk === -1 ) {\n\t\t\tbrk = str.length;\n\t\t}\n\t\tif ( i >= start && i < end ) {\n\t\t\tresult += str.substring( idx, brk );\n\t\t}\n\t\tidx = brk;\n\t\ti += 1;\n\t\tif ( i >= end ) {\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn result;\n}\n\n\n// EXPORTS //\n\nexport default sliceGraphemeClusters;\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 bernoulli from '@stdlib/random/base/bernoulli';\n\n\n// MAIN //\n\n/**\n* Converts a string to \"sticky caps\" case.\n*\n* @param {string} str - input string\n* @param {number} [p=0.5] - probability of capitalization (between 0 and 1)\n* @returns {string} converted string\n*\n* @example\n* var str = stickycase( 'hello world' );\n* // returns \n*\n* @example\n* var str = stickycase( 'hello world', 0.2 );\n* // returns \n*\n* @example\n* var str = stickycase( 'hello world', 0.8 );\n* // returns \n*\n* @example\n* var str = stickycase( 'hello world', '0.5' );\n* // returns \n*/\nfunction stickycase( str, p ) {\n\tvar result = '';\n\tvar char;\n\tvar i;\n\tp = ( typeof p === 'number' && p >= 0 && p <= 1 ) ? p : 0.5;\n\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tchar = str.charAt( i );\n\t\tif ( bernoulli( p ) ) {\n\t\t\tchar = char.toUpperCase();\n\t\t} else {\n\t\t\tchar = char.toLowerCase();\n\t\t}\n\t\tresult += char;\n\t}\n\treturn result;\n}\n\n\n// EXPORTS //\n\nexport default stickycase;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isOdd from '@stdlib/math/base/assert/is-odd';\nimport round from '@stdlib/math/base/special/round';\n\n\n// MAIN //\n\n/**\n* Truncates the middle UTF-16 code units of a string to return a string having a specified length.\n*\n* @param {string} str - input string\n* @param {integer} len - output string length (including sequence)\n* @param {string} seq - custom replacement sequence\n* @returns {string} truncated string\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 5, '...' );\n* // returns 'b...p'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 5, '>>>' );\n* // returns 'b>>>p'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 10, '...' );\n* // returns 'beep boop'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 0, '...' );\n* // returns ''\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 2, '...' );\n* // returns '..'\n*/\nfunction truncateMiddle( str, len, seq ) {\n\tvar finalLength;\n\tvar seqLength;\n\tvar strLength;\n\tvar seqStart;\n\tvar seqEnd;\n\n\tseqLength = seq.length;\n\tstrLength = str.length;\n\tif ( len > strLength ) {\n\t\treturn str;\n\t}\n\tfinalLength = len - seqLength;\n\tif ( finalLength < 0 ) {\n\t\treturn seq.slice( 0, len );\n\t}\n\n\tseqStart = round( finalLength / 2 );\n\tseqEnd = ( isOdd( finalLength ) ) ? seqStart-1 : seqStart;\n\tseqEnd = strLength - seqEnd;\n\n\treturn str.substring( 0, seqStart ) + seq + str.substring( seqEnd );\n}\n\n\n// EXPORTS //\n\nexport default truncateMiddle;\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 isEven from './../../../../base/assert/is-even';\n\n\n// MAIN //\n\n/**\n* Tests if a finite double-precision floating-point number is an odd number.\n*\n* @param {number} x - value to test\n* @returns {boolean} boolean indicating whether the value is an odd number\n*\n* @example\n* var bool = isOdd( 5.0 );\n* // returns true\n*\n* @example\n* var bool = isOdd( -2.0 );\n* // returns false\n*\n* @example\n* var bool = isOdd( 0.0 );\n* // returns false\n*\n* @example\n* var bool = isOdd( NaN );\n* // returns false\n*/\nfunction isOdd( x ) {\n\t// Check sign to prevent overflow...\n\tif ( x > 0.0 ) {\n\t\treturn isEven( x-1.0 );\n\t}\n\treturn isEven( x+1.0 );\n}\n\n\n// EXPORTS //\n\nexport default isOdd;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport firstCodeUnit from './../../base/first';\nimport firstCodePoint from './../../base/first-code-point';\nimport firstGraphemeCluster from './../../base/first-grapheme-cluster';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': firstGraphemeCluster,\n\t'code_point': firstCodePoint,\n\t'code_unit': firstCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Returns the first character(s) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} [n=1] - number of characters to return\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" to return (must be either `grapheme`, `code_point`, or `code_unit`)\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} output string\n*\n* @example\n* var out = first( 'last man standing' );\n* // returns 'l'\n*\n* @example\n* var out = first( 'presidential election' );\n* // returns 'p'\n*\n* @example\n* var out = first( 'javaScript' );\n* // returns 'j'\n*\n* @example\n* var out = first( 'Hidden Treasures' );\n* // returns 'H'\n*\n* @example\n* var out = first( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐶🐮'\n*\n* @example\n* var out = first( 'foo bar', 5 );\n* // returns 'foo b'\n*/\nfunction first( str ) {\n\tvar options;\n\tvar nargs;\n\tvar opts;\n\tvar n;\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\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs === 1 ) {\n\t\tn = 1;\n\t} else if ( nargs === 2 ) {\n\t\tn = arguments[ 1 ];\n\t\tif ( isPlainObject( n ) ) {\n\t\t\toptions = n;\n\t\t\tn = 1;\n\t\t} else if ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t} else { // nargs > 2\n\t\tn = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t\toptions = arguments[ 2 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn FCNS[ opts.mode ]( str, n );\n}\n\n\n// EXPORTS //\n\nexport default first;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isFunction from '@stdlib/assert/is-function';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport forEachCodeUnit from './../../base/for-each';\nimport forEachCodePoint from './../../base/for-each-code-point';\nimport forEachGraphemeCluster from './../../base/for-each-grapheme-cluster';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': forEachGraphemeCluster,\n\t'code_point': forEachCodePoint,\n\t'code_unit': forEachCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Invokes a function for each character in a string.\n*\n* @param {string} str - input string\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" over which to iterate (must be either `grapheme`, `code_point`, or `code_unit`)\n* @param {Function} clbk - function to invoke\n* @param {*} [thisArg] - execution context\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} callback argument must be a function\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} input string\n*\n* @example\n* function log( value, index ) {\n* console.log( '%d: %s', index, value );\n* }\n*\n* forEach( 'Hello', log );\n*/\nfunction forEach( str, options, clbk ) {\n\tvar thisArg;\n\tvar nargs;\n\tvar opts;\n\tvar cb;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs === 2 ) {\n\t\tcb = options;\n\t\toptions = null;\n\t} else if ( nargs === 3 ) {\n\t\tif ( isPlainObject( options ) ) {\n\t\t\tcb = clbk;\n\t\t} else {\n\t\t\tcb = options;\n\t\t\toptions = null;\n\t\t\tthisArg = clbk;\n\t\t}\n\t} else { // nargs === 4\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t\tcb = clbk;\n\t\tthisArg = arguments[ 3 ];\n\t}\n\tif ( !isFunction( cb ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Callback argument must be a function. Value: `%s`.', cb ) );\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\tFCNS[ opts.mode ]( str, cb, thisArg );\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default forEach;\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 Unicode code point.\n*\n* @module @stdlib/constants/unicode/max\n* @type {integer32}\n*\n* @example\n* import UNICODE_MAX from '@stdlib/constants/unicode/max';\n* // returns 1114111\n*/\n\n\n// MAIN //\n\n/**\n* Maximum Unicode code point.\n*\n* @constant\n* @type {integer32}\n* @default 1114111\n* @see [Unicode]{@link https://en.wikipedia.org/wiki/Unicode}\n*/\nvar UNICODE_MAX = 0x10FFFF|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default UNICODE_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// MODULES //\n\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport isCollection from '@stdlib/assert/is-collection';\nimport format from './../../format';\nimport UNICODE_MAX from '@stdlib/constants/unicode/max';\nimport UNICODE_MAX_BMP from '@stdlib/constants/unicode/max-bmp';\n\n\n// VARIABLES //\n\nvar fromCharCode = String.fromCharCode;\n\n// Factor to rescale a code point from a supplementary plane:\nvar Ox10000 = 0x10000|0; // 65536\n\n// Factor added to obtain a high surrogate:\nvar OxD800 = 0xD800|0; // 55296\n\n// Factor added to obtain a low surrogate:\nvar OxDC00 = 0xDC00|0; // 56320\n\n// 10-bit mask: 2^10-1 = 1023 => 0x3ff => 00000000 00000000 00000011 11111111\nvar Ox3FF = 1023|0;\n\n\n// MAIN //\n\n/**\n* Creates a string from a sequence of Unicode code points.\n*\n* ## Notes\n*\n* - UTF-16 encoding uses one 16-bit unit for non-surrogates (U+0000 to U+D7FF and U+E000 to U+FFFF).\n* - UTF-16 encoding uses two 16-bit units (surrogate pairs) for U+10000 to U+10FFFF and encodes U+10000-U+10FFFF by subtracting 0x10000 from the code point, expressing the result as a 20-bit binary, and splitting the 20 bits of 0x0-0xFFFFF as upper and lower 10-bits. The respective 10-bits are stored in two 16-bit words: a high and a low surrogate.\n*\n* @param {...NonNegativeInteger} args - sequence of code points\n* @throws {Error} must provide either an array-like object of code points or one or more code points as separate arguments\n* @throws {TypeError} a code point must be a nonnegative integer\n* @throws {RangeError} must provide a valid Unicode code point\n* @returns {string} created string\n*\n* @example\n* var str = fromCodePoint( 9731 );\n* // returns '☃'\n*/\nfunction fromCodePoint( args ) {\n\tvar len;\n\tvar str;\n\tvar arr;\n\tvar low;\n\tvar hi;\n\tvar pt;\n\tvar i;\n\n\tlen = arguments.length;\n\tif ( len === 1 && isCollection( args ) ) {\n\t\tarr = arguments[ 0 ];\n\t\tlen = arr.length;\n\t} else {\n\t\tarr = [];\n\t\tfor ( i = 0; i < len; i++ ) {\n\t\t\tarr.push( arguments[ i ] );\n\t\t}\n\t}\n\tif ( len === 0 ) {\n\t\tthrow new Error( 'insufficient arguments. Must provide either an array of code points or one or more code points as separate arguments.' );\n\t}\n\tstr = '';\n\tfor ( i = 0; i < len; i++ ) {\n\t\tpt = arr[ i ];\n\t\tif ( !isNonNegativeInteger( pt ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide valid code points (i.e., nonnegative integers). Value: `%s`.', pt ) );\n\t\t}\n\t\tif ( pt > UNICODE_MAX ) {\n\t\t\tthrow new RangeError( format( 'invalid argument. Must provide a valid code point (i.e., cannot exceed %u). Value: `%s`.', UNICODE_MAX, pt ) );\n\t\t}\n\t\tif ( pt <= UNICODE_MAX_BMP ) {\n\t\t\tstr += fromCharCode( pt );\n\t\t} else {\n\t\t\t// Code point from a supplementary plane. Split into two 16-bit code units (surrogate pair).\n\t\t\tpt -= Ox10000;\n\t\t\thi = (pt >> 10) + OxD800;\n\t\t\tlow = (pt & Ox3FF) + OxDC00;\n\t\t\tstr += fromCharCode( hi, low );\n\t\t}\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default fromCodePoint;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport lastCodeUnit from './../../base/last';\nimport lastCodePoint from './../../base/last-code-point';\nimport lastGraphemeCluster from './../../base/last-grapheme-cluster';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': lastGraphemeCluster,\n\t'code_point': lastCodePoint,\n\t'code_unit': lastCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Returns the last character(s) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} [n=1] - number of characters to return\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" to return (must be either `grapheme`, `code_point`, or `code_unit`)\n* @throws {TypeError} last argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} output string\n*\n* @example\n* var out = last( 'last man standing' );\n* // returns 'g'\n*\n* @example\n* var out = last( 'presidential election' );\n* // returns 'n'\n*\n* @example\n* var out = last( 'javaScript' );\n* // returns 't'\n*\n* @example\n* var out = last( 'Hidden Treasures' );\n* // returns 's'\n*\n* @example\n* var out = last( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐰🐸'\n*\n* @example\n* var out = last( 'foo bar', 3 );\n* // returns 'bar'\n*/\nfunction last( str ) {\n\tvar options;\n\tvar nargs;\n\tvar opts;\n\tvar n;\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\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs === 1 ) {\n\t\tn = 1;\n\t} else if ( nargs === 2 ) {\n\t\tn = arguments[ 1 ];\n\t\tif ( isPlainObject( n ) ) {\n\t\t\toptions = n;\n\t\t\tn = 1;\n\t\t} else if ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t} else { // nargs > 2\n\t\tn = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t\toptions = arguments[ 2 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn FCNS[ opts.mode ]( str, n );\n}\n\n\n// EXPORTS //\n\nexport default last;\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 isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport FLOAT64_MAX_SAFE_INTEGER from '@stdlib/constants/float64/max-safe-integer';\nimport base from './../../base/left-pad';\n\n\n// MAIN //\n\n/**\n* Left pads a string such that the padded string has a length of at least `len`.\n*\n* @param {string} str - string to pad\n* @param {NonNegativeInteger} len - minimum string length\n* @param {string} [pad=' '] - string used to pad\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string\n* @throws {RangeError} padding must have a length greater than `0`\n* @returns {string} padded string\n*\n* @example\n* var str = lpad( 'a', 5 );\n* // returns ' a'\n*\n* @example\n* var str = lpad( 'beep', 10, 'b' );\n* // returns 'bbbbbbbeep'\n*\n* @example\n* var str = lpad( 'boop', 12, 'beep' );\n* // returns 'beepbeepboop'\n*/\nfunction lpad( str, len, pad ) {\n\tvar p;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( len ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tp = pad;\n\t\tif ( !isString( p ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', p ) );\n\t\t}\n\t\tif ( p.length === 0 ) {\n\t\t\tthrow new RangeError( 'invalid argument. Third argument must not be an empty string.' );\n\t\t}\n\t} else {\n\t\tp = ' ';\n\t}\n\tif ( len > FLOAT64_MAX_SAFE_INTEGER ) {\n\t\tthrow new RangeError( format( 'invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.', len ) );\n\t}\n\treturn base( str, len, p );\n}\n\n\n// EXPORTS //\n\nexport default lpad;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport nextGraphemeClusterBreak from './../../next-grapheme-cluster-break';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Splits a string by its grapheme cluster breaks.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string primitive\n* @returns {StringArray} array of grapheme clusters\n*\n* @example\n* var out = splitGraphemeClusters( 'café' );\n* // returns [ 'c', 'a', 'f', 'é' ]\n*\n* @example\n* var out = splitGraphemeClusters( '🍕🍕🍕' );\n* // returns [ '🍕', '🍕', '🍕' ]\n*/\nfunction splitGraphemeClusters( str ) {\n\tvar idx;\n\tvar brk;\n\tvar out;\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tidx = 0;\n\tout = [];\n\tif ( str.length === 0 ) {\n\t\treturn out;\n\t}\n\tbrk = nextGraphemeClusterBreak( str, idx );\n\twhile ( brk !== -1 ) {\n\t\tout.push( str.substring( idx, brk ) );\n\t\tidx = brk;\n\t\tbrk = nextGraphemeClusterBreak( str, idx );\n\t}\n\tout.push( str.substring( idx ) );\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default splitGraphemeClusters;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/; // TODO: replace with stdlib pkg\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/; // TODO: replace with stdlib pkg\n\n\n// MAIN //\n\n/**\n* Returns the position of the next Unicode code point in a string after a specified position.\n*\n* @param {string} str - input string\n* @param {integer} [fromIndex=0] - position\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be an integer\n* @returns {integer} position of the next Unicode code point\n*\n* @example\n* var out = nextCodePointIndex( 'last man standing', 4 );\n* // returns 5\n*\n* @example\n* var out = nextCodePointIndex( 'presidential election', 8 );\n* // returns 9\n*\n* @example\n* var out = nextCodePointIndex( '𐒻𐓟𐒻𐓟', 0 );\n* // returns 2\n*\n* @example\n* var out = nextCodePointIndex( '🌷' );\n* // returns -1\n*/\nfunction nextCodePointIndex( str, fromIndex ) {\n\tvar lastIndex;\n\tvar len;\n\tvar idx;\n\tvar i;\n\tvar j;\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\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\tidx = fromIndex;\n\t} else {\n\t\tidx = 0;\n\t}\n\tlen = str.length;\n\tif ( idx < 0 ) {\n\t\tidx += len;\n\t\tif ( idx < 0 ) {\n\t\t\tidx = 0;\n\t\t}\n\t}\n\tlastIndex = len - 1;\n\tif ( idx >= lastIndex ) {\n\t\treturn -1;\n\t}\n\n\t// Check for a high UTF-16 surrogate...\n\ti = idx + 1;\n\tj = i + 1;\n\tif ( RE_UTF16_HIGH_SURROGATE.test( str[ idx ] ) ) {\n\t\t// Check whether the high surrogate is paired with a low surrogate...\n\t\tif ( RE_UTF16_LOW_SURROGATE.test( str[ i ] ) ) {\n\t\t\t// We found a surrogate pair:\n\t\t\treturn ( j >= lastIndex ) ? -1 : j;\n\t\t}\n\t\treturn i;\n\t}\n\treturn i;\n}\n\n\n// EXPORTS //\n\nexport default nextCodePointIndex;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n/* eslint-disable @cspell/spellchecker */\n\n'use strict';\n\n// MODULES //\n\nimport floor from '@stdlib/math/base/special/floor';\nimport endsWith from './../../base/ends-with';\nimport UNITS from './units.json';\n\n\n// VARIABLES //\n\nvar ONES = [ 'null', 'eins', 'zwei', 'drei', 'vier', 'fünf', 'sechs', 'sieben', 'acht', 'neun', 'zehn', 'elf', 'zwölf', 'dreizehn', 'vierzehn', 'fünfzehn', 'sechzehn', 'siebzehn', 'achtzehn', 'neunzehn' ];\nvar TENS = [ 'null', 'zehn', 'zwanzig', 'dreißig', 'vierzig', 'fünfzig', 'sechzig', 'siebzig', 'achtzig', 'neunzig' ];\n\n\n// FUNCTIONS //\n\n/**\n* Pluralizes a word by adding a 'n' or 'en' suffix.\n*\n* @private\n* @param {string} word - word to pluralize\n* @returns {string} pluralized word\n*/\nfunction pluralize( word ) {\n\tif ( endsWith( word, 'e' ) ) {\n\t\treturn word + 'n';\n\t}\n\treturn word + 'en';\n}\n\n\n// MAIN //\n\n/**\n* Converts a number to a word representation in German.\n*\n* @private\n* @param {number} num - number to convert\n* @param {string} out - output string\n* @returns {string} word representation\n*\n* @example\n* var words = int2wordsDE( 1243, '' );\n* // returns 'eintausendzweihundertdreiundvierzig'\n*\n* @example\n* var words = int2wordsDE( 387, '' );\n* // returns 'dreihundertsiebenundachtzig'\n*\n* @example\n* var words = int2wordsDE( 100, '' );\n* // returns 'einhundert'\n*\n* @example\n* var words = int2wordsDE( 1421, '' );\n* // returns 'eintausendvierhunderteinundzwanzig'\n*\n* @example\n* var words = int2wordsDE( 100381, '' );\n* // returns 'einhunderttausenddreihunderteinundachtzig'\n*\n* @example\n* var words = int2wordsDE( -13, '' );\n* // returns 'minus dreizehn'\n*/\nfunction int2wordsDE( num, out ) {\n\tvar word;\n\tvar rem;\n\tvar i;\n\tif ( num === 0 ) {\n\t\t// Case: We have reached the end of the number and the number is zero.\n\t\treturn out || 'null';\n\t}\n\tif ( num < 0 ) {\n\t\tout += 'minus ';\n\t\tnum *= -1;\n\t}\n\tif ( num < 20 ) {\n\t\trem = 0;\n\t\tif ( num === 1 && out.length === 0 ) {\n\t\t\tword = 'ein';\n\t\t} else {\n\t\t\tword = ONES[ num ];\n\t\t}\n\t}\n\telse if ( num < 100 ) {\n\t\trem = num % 10;\n\t\tword = TENS[ floor( num / 10 ) ];\n\t\tif ( rem ) {\n\t\t\tword = ( ( rem === 1 ) ? 'ein' : ONES[ rem ] ) + 'und' + word;\n\t\t\trem = 0;\n\t\t}\n\t}\n\telse if ( num < 1e3 ) {\n\t\trem = num % 100;\n\t\tword = int2wordsDE( floor( num / 100 ), '' ) + 'hundert';\n\t}\n\telse if ( num < 1e6 ) {\n\t\trem = num % 1e3;\n\t\tword = int2wordsDE( floor( num / 1e3 ), '' ) + 'tausend';\n\t}\n\telse {\n\t\tfor ( i = 5; i < UNITS.length; i++ ) {\n\t\t\tif ( num < UNITS[ i ].VAL ) {\n\t\t\t\trem = num % UNITS[ i-1 ].VAL;\n\t\t\t\tif ( floor( num / UNITS[ i-1 ].VAL ) === 1 ) {\n\t\t\t\t\tword = 'eine ' + UNITS[ i-1 ].DE;\n\t\t\t\t} else {\n\t\t\t\t\tword = int2wordsDE( floor( num / UNITS[ i-1 ].VAL ), '' ) + ' ' + pluralize( UNITS[ i-1 ].DE );\n\t\t\t\t}\n\t\t\t\tif ( rem ) {\n\t\t\t\t\tword += ' ';\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\tout += word;\n\treturn int2wordsDE( rem, out );\n}\n\n\n// EXPORTS //\n\nexport default int2wordsDE;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport floor from '@stdlib/math/base/special/floor';\nimport UNITS from './units.json';\n\n\n// VARIABLES //\n\nvar ONES = [ 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen' ];\nvar TENS = [ 'zero', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety' ];\n\n\n// MAIN //\n\n/**\n* Converts a number to a word representation in English.\n*\n* @private\n* @param {number} num - number to convert\n* @param {string} out - output string\n* @returns {string} word representation\n*\n* @example\n* var words = int2wordsEN( 1234, '' );\n* // returns 'one thousand two hundred thirty-four'\n*\n* @example\n* var words = int2wordsEN( -129, '' );\n* // returns 'minus one hundred twenty-nine'\n*\n* @example\n* var words = int2wordsEN( 0, '' );\n* // returns 'zero'\n*/\nfunction int2wordsEN( num, out ) {\n\tvar word;\n\tvar rem;\n\tvar i;\n\tif ( num === 0 ) {\n\t\t// Case: We have reached the end of the number and the number is zero.\n\t\treturn out || 'zero';\n\t}\n\tif ( num < 0 ) {\n\t\tout += 'minus';\n\t\tnum *= -1;\n\t}\n\tif ( num < 20 ) {\n\t\trem = 0;\n\t\tword = ONES[ num ];\n\t}\n\telse if ( num < 100 ) {\n\t\trem = num % 10;\n\t\tword = TENS[ floor( num / 10 ) ];\n\t\tif ( rem > 0 ) {\n\t\t\tword += '-' + ONES[ rem ];\n\t\t\trem = 0;\n\t\t}\n\t}\n\telse {\n\t\tfor ( i = 3; i < UNITS.length - 1; i++ ) {\n\t\t\tif ( num < UNITS[ i ].VAL ) {\n\t\t\t\trem = num % UNITS[ i-1 ].VAL;\n\t\t\t\tword = int2wordsEN( floor( num / UNITS[ i-1 ].VAL ), '' ) + ' ' + UNITS[ i-1 ].EN;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ( i === UNITS.length - 1 ) {\n\t\t\trem = num % UNITS[ i-1 ].VAL;\n\t\t\tword = int2wordsEN( floor( num / UNITS[ i-1 ].VAL ), '' ) + ' ' + UNITS[ i-1 ].EN;\n\t\t}\n\t}\n\tif ( out.length > 0 ) {\n\t\tout += ' ';\n\t}\n\tout += word;\n\treturn int2wordsEN( rem, out );\n}\n\n\n// EXPORTS //\n\nexport default int2wordsEN;\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 './../../is-number';\nimport isNan from '@stdlib/math/base/assert/is-nan';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a `NaN` number primitive.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a `NaN` number primitive\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 './../../is-number';\nimport isNan from '@stdlib/math/base/assert/is-nan';\n\n\n// MAIN //\n\n/**\n* Tests if a value is a number object having a value of `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating if a value is a number object having a value of `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns false\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*/\nfunction isnan( value ) {\n\treturn (\n\t\tisNumber( value ) &&\n\t\tisNan( value.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 `NaN`.\n*\n* @param {*} value - value to test\n* @returns {boolean} boolean indicating whether value is `NaN`\n*\n* @example\n* var bool = isnan( NaN );\n* // returns true\n*\n* @example\n* var bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* @example\n* var bool = isnan( 3.14 );\n* // returns false\n*\n* @example\n* var bool = isnan( null );\n* // returns false\n*/\nfunction isnan( value ) {\n\treturn ( isPrimitive( value ) || isObject( value ) );\n}\n\n\n// EXPORTS //\n\nexport default isnan;\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 `NaN`.\n*\n* @module @stdlib/assert/is-nan\n*\n* @example\n* import isnan from '@stdlib/assert/is-nan';\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( new Number( NaN ) );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( null );\n* // returns false\n*\n* @example\n* import { isPrimitive as isnan } from '@stdlib/assert/is-nan';\n*\n* var bool = isnan( NaN );\n* // returns true\n*\n* bool = isnan( 3.14 );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\n* // returns false\n*\n* @example\n* import { isObject as isnan } from '@stdlib/assert/is-nan';\n*\n* var bool = isnan( NaN );\n* // returns false\n*\n* bool = isnan( new Number( NaN ) );\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) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport indexOf from '@stdlib/utils/index-of';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar LANGUAGE_CODES = [ 'en', 'de' ];\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.lang] - language code\n* @returns {(null|Error)} error object or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'lang': 'es'\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isPlainObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'lang' ) ) {\n\t\topts.lang = options.lang;\n\t\tif ( indexOf( LANGUAGE_CODES, opts.lang ) === -1 ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'lang', LANGUAGE_CODES.join( '\", \"' ), opts.lang ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\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 isnan from '@stdlib/assert/is-nan';\nimport isCollection from '@stdlib/assert/is-collection';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport format from '@stdlib/string/format';\n\n\n// MAIN //\n\n/**\n* Returns the first index at which a given element can be found.\n*\n* @param {ArrayLike} arr - array-like object\n* @param {*} searchElement - element to find\n* @param {integer} [fromIndex] - starting index (if negative, the start index is determined relative to last element)\n* @throws {TypeError} must provide an array-like object\n* @throws {TypeError} third argument must be an integer\n* @returns {integer} index or -1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 3 );\n* // returns 1\n*\n* @example\n* var arr = [ 4, 3, 2, 1 ];\n* var idx = indexOf( arr, 5 );\n* // returns -1\n*\n* @example\n* // Using a `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, 3 );\n* // returns 5\n*\n* @example\n* // `fromIndex` which exceeds `array` length:\n* var arr = [ 1, 2, 3, 4, 2, 5 ];\n* var idx = indexOf( arr, 2, 10 );\n* // returns -1\n*\n* @example\n* // Negative `fromIndex`:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6, 2 ];\n* var idx = indexOf( arr, 2, -4 );\n* // returns 5\n*\n* idx = indexOf( arr, 2, -1 );\n* // returns 7\n*\n* @example\n* // Negative `fromIndex` exceeding input `array` length:\n* var arr = [ 1, 2, 3, 4, 5, 2, 6 ];\n* var idx = indexOf( arr, 2, -10 );\n* // returns 1\n*\n* @example\n* // Array-like objects:\n* var str = 'bebop';\n* var idx = indexOf( str, 'o' );\n* // returns 3\n*/\nfunction indexOf( arr, searchElement, fromIndex ) {\n\tvar len;\n\tvar i;\n\tif ( !isCollection( arr ) && !isString( arr ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be an array-like object. Value: `%s`.', arr ) );\n\t}\n\tlen = arr.length;\n\tif ( len === 0 ) {\n\t\treturn -1;\n\t}\n\tif ( arguments.length === 3 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tif ( fromIndex >= 0 ) {\n\t\t\tif ( fromIndex >= len ) {\n\t\t\t\treturn -1;\n\t\t\t}\n\t\t\ti = fromIndex;\n\t\t} else {\n\t\t\ti = len + fromIndex;\n\t\t\tif ( i < 0 ) {\n\t\t\t\ti = 0;\n\t\t\t}\n\t\t}\n\t} else {\n\t\ti = 0;\n\t}\n\t// Check for `NaN`...\n\tif ( isnan( searchElement ) ) {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( isnan( arr[i] ) ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tfor ( ; i < len; i++ ) {\n\t\t\tif ( arr[ i ] === searchElement ) {\n\t\t\t\treturn i;\n\t\t\t}\n\t\t}\n\t}\n\treturn -1;\n}\n\n\n// EXPORTS //\n\nexport default indexOf;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MAIN //\n\n/**\n* Processes a string of decimal numbers and applies a function mapping decimal numbers to words to each character.\n*\n* @private\n* @param {string} x - string of decimal numbers\n* @param {Function} fcn - function mapping decimal numbers to words\n* @returns {string} string of words\n*/\nfunction decimals( x, fcn ) {\n\tvar out;\n\tvar len;\n\tvar i;\n\n\tlen = x.length;\n\tout = '';\n\tfor ( i = 0; i < len; i++ ) {\n\t\tout += fcn( x[ i ], '' );\n\t\tif ( i < len-1 ) {\n\t\t\tout += ' ';\n\t\t}\n\t}\n\treturn out;\n}\n\n\n// EXPORTS //\n\nexport default decimals;\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 isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/repeat';\n\n\n// MAIN //\n\n/**\n* Repeats a string a specified number of times and returns the concatenated result.\n*\n* @param {string} str - string to repeat\n* @param {NonNegativeInteger} n - number of times to repeat the string\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {RangeError} output string length must not exceed maximum allowed string length\n* @returns {string} repeated string\n*\n* @example\n* var str = repeat( 'a', 5 );\n* // returns 'aaaaa'\n*\n* @example\n* var str = repeat( '', 100 );\n* // returns ''\n*\n* @example\n* var str = repeat( 'beep', 0 );\n* // returns ''\n*/\nfunction repeat( str, 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\tif ( !isNonNegativeInteger( n ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t}\n\treturn base( str, n );\n}\n\n\n// EXPORTS //\n\nexport default repeat;\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 isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport FLOAT64_MAX_SAFE_INTEGER from '@stdlib/constants/float64/max-safe-integer';\nimport base from './../../base/right-pad';\n\n\n// MAIN //\n\n/**\n* Right pads a string such that the padded string has a length of at least `len`.\n*\n* @param {string} str - string to pad\n* @param {NonNegativeInteger} len - minimum string length\n* @param {string} [pad=' '] - string used to pad\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string\n* @throws {RangeError} padding must have a length greater than `0`\n* @returns {string} padded string\n*\n* @example\n* var str = rpad( 'a', 5 );\n* // returns 'a '\n*\n* @example\n* var str = rpad( 'beep', 10, 'p' );\n* // returns 'beeppppppp'\n*\n* @example\n* var str = rpad( 'beep', 12, 'boop' );\n* // returns 'beepboopboop'\n*/\nfunction rpad( str, len, pad ) {\n\tvar p;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( len ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tp = pad;\n\t\tif ( !isString( p ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', p ) );\n\t\t}\n\t\tif ( p.length === 0 ) {\n\t\t\tthrow new RangeError( 'invalid argument. Pad string must not be an empty string.' );\n\t\t}\n\t} else {\n\t\tp = ' ';\n\t}\n\tif ( len > FLOAT64_MAX_SAFE_INTEGER ) {\n\t\tthrow new RangeError( format( 'invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.', len ) );\n\t}\n\treturn base( str, len, p );\n}\n\n\n// EXPORTS //\n\nexport default rpad;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport isInteger from '@stdlib/assert/is-integer';\nimport codePointAt from './../../code-point-at';\nimport hasUTF16SurrogatePairAt from '@stdlib/assert/has-utf16-surrogate-pair-at';\nimport grapheme from './../../tools/grapheme-cluster-break';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar breakType = grapheme.breakType;\nvar breakProperty = grapheme.breakProperty;\nvar emojiProperty = grapheme.emojiProperty;\n\n\n// MAIN //\n\n/**\n* Returns the previous extended grapheme cluster break in a string before a specified position.\n*\n* @param {string} str - input string\n* @param {integer} [fromIndex=str.length-1] - position\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be an integer\n* @returns {NonNegativeInteger} previous grapheme break position\n*\n* @example\n* var out = prevGraphemeClusterBreak( 'last man standing', 4 );\n* // returns 3\n*\n* @example\n* var out = prevGraphemeClusterBreak( 'presidential election', 8 );\n* // returns 7\n*\n* @example\n* var out = prevGraphemeClusterBreak( 'अनुच्छेद', 2 );\n* // returns 0\n*\n* @example\n* var out = prevGraphemeClusterBreak( '🌷', 1 );\n* // returns -1\n*/\nfunction prevGraphemeClusterBreak( str, fromIndex ) {\n\tvar breaks;\n\tvar emoji;\n\tvar ans;\n\tvar len;\n\tvar idx;\n\tvar cp;\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\tlen = str.length;\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\tidx = fromIndex;\n\t} else {\n\t\tidx = len - 1;\n\t}\n\tif ( len === 0 || idx <= 0 ) {\n\t\treturn -1;\n\t}\n\tif ( idx >= len ) {\n\t\tidx = len - 1;\n\t}\n\n\t// Initialize caches for storing grapheme break and emoji properties:\n\tbreaks = [];\n\temoji = [];\n\n\t// Get the code point for the starting index:\n\tcp = codePointAt( str, 0 );\n\n\t// Get the corresponding grapheme break and emoji properties:\n\tbreaks.push( breakProperty( cp ) );\n\temoji.push( emojiProperty( cp ) );\n\n\tans = -1;\n\tfor ( i = 1; i <= idx; i++ ) {\n\t\t// If the current character is part of a surrogate pair, move along...\n\t\tif ( hasUTF16SurrogatePairAt( str, i-1 ) ) {\n\t\t\tans = i-2;\n\t\t\tbreaks.length = 0;\n\t\t\temoji.length = 0;\n\t\t\tcontinue;\n\t\t}\n\t\tcp = codePointAt( str, i );\n\n\t\t// Get the corresponding grapheme break and emoji properties:\n\t\tbreaks.push( breakProperty( cp ) );\n\t\temoji.push( emojiProperty( cp ) );\n\n\t\t// Determine if we've encountered a grapheme cluster break...\n\t\tif ( breakType( breaks, emoji ) > 0 ) {\n\t\t\tans = i-1;\n\t\t\tbreaks.length = 0;\n\t\t\temoji.length = 0;\n\t\t\tcontinue;\n\t\t}\n\t}\n\treturn ans;\n}\n\n\n// EXPORTS //\n\nexport default prevGraphemeClusterBreak;\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 isString } from '@stdlib/assert/is-string';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport removeFirstCodeUnit from './../../base/remove-first';\nimport removeFirstCodePoint from './../../base/remove-first-code-point';\nimport removeFirstGraphemeCluster from './../../base/remove-first-grapheme-cluster'; // eslint-disable-line id-length\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': removeFirstGraphemeCluster,\n\t'code_point': removeFirstCodePoint,\n\t'code_unit': removeFirstCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Removes the first character(s) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} [n=1] - number of characters to remove\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" to return (must be either `grapheme`, `code_point`, or `code_unit`)\n* @throws {TypeError} must provide a string primitive\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} updated string\n*\n* @example\n* var out = removeFirst( 'last man standing' );\n* // returns 'ast man standing'\n*\n* @example\n* var out = removeFirst( 'presidential election' );\n* // returns 'residential election'\n*\n* @example\n* var out = removeFirst( 'JavaScript' );\n* // returns 'avaScript'\n*\n* @example\n* var out = removeFirst( 'Hidden Treasures' );\n* // returns 'idden Treasures'\n*\n* @example\n* var out = removeFirst( '🐶🐮🐷🐰🐸', 2 );\n* // returns '🐷🐰🐸'\n*\n* @example\n* var out = removeFirst( 'foo bar', 4 );\n* // returns 'bar'\n*/\nfunction removeFirst( str ) {\n\tvar options;\n\tvar nargs;\n\tvar opts;\n\tvar n;\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\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs === 1 ) {\n\t\tn = 1;\n\t} else if ( nargs === 2 ) {\n\t\tn = arguments[ 1 ];\n\t\tif ( isPlainObject( n ) ) {\n\t\t\toptions = n;\n\t\t\tn = 1;\n\t\t} else if ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t} else { // nargs > 2\n\t\tn = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t\toptions = arguments[ 2 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn FCNS[ opts.mode ]( str, n );\n}\n\n\n// EXPORTS //\n\nexport default removeFirst;\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 isString } from '@stdlib/assert/is-string';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport removeLastCodeUnit from './../../base/remove-last';\nimport removeLastCodePoint from './../../base/remove-last-code-point';\nimport removeLastGraphemeCluster from './../../base/remove-last-grapheme-cluster';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': removeLastGraphemeCluster,\n\t'code_point': removeLastCodePoint,\n\t'code_unit': removeLastCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Removes the last character(s) of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} [n=1] - number of character to remove\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" to return (must be either `grapheme`, `code_point`, or `code_unit`)\n* @throws {TypeError} must provide a string primitive\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} updated string\n*\n* @example\n* var out = removeLast( 'last man standing' );\n* // returns 'last man standin'\n*\n* @example\n* var out = removeLast( 'presidential election' );\n* // returns 'presidential electio'\n*\n* @example\n* var out = removeLast( 'javaScript' );\n* // returns 'javaScrip'\n*\n* @example\n* var out = removeLast( 'Hidden Treasures' );\n* // returns 'Hidden Treasure'\n*\n* @example\n* var out = removeLast( 'leader', 2 );\n* // returns 'lead'\n*/\nfunction removeLast( str ) {\n\tvar options;\n\tvar nargs;\n\tvar opts;\n\tvar n;\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\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs === 1 ) {\n\t\tn = 1;\n\t} else if ( nargs === 2 ) {\n\t\tn = arguments[ 1 ];\n\t\tif ( isPlainObject( n ) ) {\n\t\t\toptions = n;\n\t\t\tn = 1;\n\t\t} else if ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t} else { // nargs > 2\n\t\tn = arguments[ 1 ];\n\t\tif ( !isNonNegativeInteger( n ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t\t}\n\t\toptions = arguments[ 2 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn FCNS[ opts.mode ]( str, n );\n}\n\n\n// EXPORTS //\n\nexport default removeLast;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Converts a string to uppercase.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} uppercase string\n*\n* @example\n* var str = uppercase( 'bEEp' );\n* // returns 'BEEP'\n*/\nfunction uppercase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn str.toUpperCase();\n}\n\n\n// EXPORTS //\n\nexport default uppercase;\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 isString } from '@stdlib/assert/is-string';\nimport isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { factory as contains } from '@stdlib/array/base/assert/contains';\nimport reverseCodeUnit from './../../base/reverse';\nimport reverseCodePoints from './../../base/reverse-code-points';\nimport reverseGraphemeClusters from './../../base/reverse-grapheme-clusters';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar MODES = [ 'grapheme', 'code_point', 'code_unit' ];\nvar FCNS = {\n\t'grapheme': reverseGraphemeClusters,\n\t'code_point': reverseCodePoints,\n\t'code_unit': reverseCodeUnit\n};\nvar isMode = contains( MODES );\n\n\n// MAIN //\n\n/**\n* Reverses a string.\n*\n* @param {string} str - input string\n* @param {Options} [options] - options\n* @param {string} [options.mode=\"grapheme\"] - type of \"character\" to return (must be either `grapheme`, `code_point`, or `code_unit`)\n* @throws {TypeError} must provide a string primitive\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @returns {string} reversed string\n*\n* @example\n* var out = reverse( 'last man standing' );\n* // returns 'gnidnats nam tsal'\n*\n* @example\n* var out = reverse( 'presidential election' );\n* // returns 'noitcele laitnediserp'\n*\n* @example\n* var out = reverse( 'javaScript' );\n* // returns 'tpircSavaj'\n*\n* @example\n* var out = reverse( 'Hidden Treasures' );\n* // returns 'serusaerT neddiH'\n*/\nfunction reverse( str ) {\n\tvar options;\n\tvar nargs;\n\tvar opts;\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\topts = {\n\t\t'mode': 'grapheme'\n\t};\n\tnargs = arguments.length;\n\tif ( nargs > 1 ) {\n\t\toptions = arguments[ 1 ];\n\t\tif ( !isPlainObject( options ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t\t}\n\t}\n\tif ( options ) {\n\t\tif ( hasOwnProp( options, 'mode' ) ) {\n\t\t\topts.mode = options.mode;\n\t\t\tif ( !isMode( opts.mode ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid option. `%s` option must be one of the following: \"%s\". Value: `%s`.', 'mode', MODES.join( '\", \"' ), opts.mode ) );\n\t\t\t}\n\t\t}\n\t}\n\treturn FCNS[ opts.mode ]( str );\n}\n\n\n// EXPORTS //\n\nexport default reverse;\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// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/;\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/;\n\n\n// MAIN //\n\n/**\n* Tests if a string is a well-formed string.\n*\n* @param {string} str - input string\n* @returns {boolean} boolean indicating if a value is a well-formed string primitive\n*\n* @example\n* var bool = isWellFormed( '' );\n* // returns true\n*\n* @example\n* var bool = isWellFormed( new String( '\\uDC00' ) );\n* // returns false\n*/\nfunction isWellFormed( str ) {\n\tvar i;\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\t// Checking if a low surrogate is present at the beginning\n\t\tif ( i === 0 && RE_UTF16_LOW_SURROGATE.test(str[i]) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Checking if a high surrogate is present at the last position\n\t\tif ( i === str.length - 1 && RE_UTF16_HIGH_SURROGATE.test(str[i]) ) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// Checking if there is no low surrogate after a high surrogate\n\t\tif ( i < str.length - 1 && RE_UTF16_HIGH_SURROGATE.test(str[i]) ) {\n\t\t\tif ( RE_UTF16_LOW_SURROGATE.test(str[i + 1]) ) {\n\t\t\t\ti += 1;\n\t\t\t}\n\t\t\telse {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\t// Checking if there is no high surrogate before a low surrogate\n\t\tif ( i > 0 && RE_UTF16_LOW_SURROGATE.test(str[i]) ) {\n\t\t\tif ( !RE_UTF16_HIGH_SURROGATE.test(str[i - 1]) ) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\t}\n\treturn true;\n}\n\n\n// EXPORTS //\n\nexport default isWellFormed;\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 isWellFormed from './iswellformed.js';\n\n\n// MAIN //\n\n/**\n* Tests if a string is a well-formed string primitive.\n*\n* @param {string} str - input string\n* @returns {boolean} boolean indicating if a string is a well-formed string primitive\n*\n* @example\n* var bool = isWellFormedString( '\\uDC00' );\n* // returns false\n*\n* @example\n* var bool = isWellFormedString( new String( '' ) );\n* // returns false\n*/\nfunction isWellFormedString( str ) {\n\treturn (\n\t\ttypeof str === 'string' && isWellFormed( str )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isWellFormedString;\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 isString from './../../is-string';\nimport isWellFormed from './iswellformed.js';\n\n\n// MAIN //\n\n/**\n* Tests if a string is a well-formed string object.\n*\n* @param {string} str - input string\n* @returns {boolean} boolean indicating if a string is a well-formed string object\n*\n* @example\n* var bool = isWellFormedString( '\\uDC00' );\n* // returns false\n*\n* @example\n* var bool = isWellFormedString( new String( '' ) );\n* // returns true\n*/\nfunction isWellFormedString( str ) {\n\treturn (\n\t\tisString.isObject( str ) &&\n\t\tisWellFormed( str.valueOf() )\n\t);\n}\n\n\n// EXPORTS //\n\nexport default isWellFormedString;\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 isPrimitive from './primitive.js';\nimport isObject from './object.js';\n\n\n// MAIN //\n\n/**\n* Tests if a string is well-formed.\n*\n* @param {string} str - input string\n* @returns {boolean} boolean indicating whether a string is well-formed\n*\n* @example\n* var bool = isWellFormedString( '' );\n* // returns true\n*\n* @example\n* var bool = isWellFormedString( new String( '' ) );\n* // returns true\n*\n* @example\n* var bool = isWellFormedString( '\\uDBFF' );\n* // returns false\n*\n* @example\n* var bool = isWellFormedString( '\\uDBFFFF\\uDBFF' );\n* // returns false\n*\n* @example\n* var bool = isWellFormedString( [] );\n* // returns false\n*\n* @example\n* var bool = isWellFormedString( '-5' );\n* // returns true\n*\n* @example\n* var bool = isWellFormedString( null );\n* // returns false\n*/\nfunction isWellFormedString( str ) {\n\treturn ( isPrimitive( str ) || isObject( str ) );\n}\n\n\n// EXPORTS //\n\nexport default isWellFormedString;\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* Test if a string is well-formed.\n*\n* @module @stdlib/assert/is-well-formed-string\n*\n* @example\n* import isWellFormedString from '@stdlib/assert/is-well-formed-string';\n*\n* var bool = isWellFormedString( '' );\n* // returns true\n*\n* bool = isWellFormedString( new String( '' ) );\n* // returns true\n*\n* bool = isWellFormedString( '\\uDBFF' );\n* // returns false\n*\n* bool = isWellFormedString( '\\uDBFFFF\\uDBFF' );\n* // returns false\n*\n* bool = isWellFormedString( [] );\n* // returns false\n*\n* bool = isWellFormedString( '-5' );\n* // returns true\n*\n* bool = isWellFormedString( null );\n* // returns false\n*\n* @example\n* // Use interface to check for well-formed string primitives...\n* import { isPrimitive as isWellFormedString } from '@stdlib/assert/is-well-formed-string';\n*\n* var bool = isWellFormedString( '\\uDC00' );\n* // returns false\n*\n* bool = isWellFormedString( new String( '' ) );\n* // returns false\n*\n* @example\n* // Use interface to check for well-formed string objects...\n* import { isObject as isWellFormedString } from '@stdlib/assert/is-well-formed-string';\n*\n* var bool = isWellFormedString( '\\uDC00' );\n* // returns false\n*\n* bool = isWellFormedString( new String( '' ) );\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) 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 isString from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport isWellFormed from '@stdlib/assert/is-well-formed-string';\n\n\n// VARIABLES //\n\nvar RE_UTF16_LOW_SURROGATE = /[\\uDC00-\\uDFFF]/;\nvar RE_UTF16_HIGH_SURROGATE = /[\\uD800-\\uDBFF]/;\n\n\n// MAIN //\n\n/**\n* Replaces all lone surrogates in order to create a new string which is well formed.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} new string which does not contain any lone surrogates\n*\n* @example\n* var str = str2wellformed( 'ab\\uD800' );\n* // returns 'ab�'\n*/\nfunction str2wellformed( str ) {\n\tvar modifiedString;\n\tvar i;\n\tmodifiedString = '';\n\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tif ( isWellFormed( str ) ) {\n\t\tfor ( i = 0; i < str.length; i++ ) {\n\t\t\tmodifiedString += str[i];\n\t\t}\n\t\treturn modifiedString;\n\t}\n\tfor ( i = 0; i < str.length; i++ ) {\n\t\tif ( RE_UTF16_LOW_SURROGATE.test( str[ i ] ) || RE_UTF16_HIGH_SURROGATE.test( str[ i ] ) ) {\n\t\t\tmodifiedString += '\\uFFFD';\n\t\t}\n\t\telse {\n\t\t\tmodifiedString += str[ i ];\n\t\t}\n\t}\n\treturn modifiedString;\n}\n\n\n// EXPORTS //\n\nexport default str2wellformed;\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* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name.\n*/\n\n/*\n* The following modules are intentionally not exported: tools\n*/\n\n// MODULES //\n\nimport setReadOnly from '@stdlib/utils/define-read-only-property';\n\n\n// MAIN //\n\n/**\n* Top-level namespace.\n*\n* @namespace string\n*/\nvar string = {};\n\n/**\n* @name acronym\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/acronym}\n*/\nimport acronym from './../acronym';\nsetReadOnly( string, 'acronym', acronym );\n\n/**\n* @name base\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/base}\n*/\nimport base from './../base';\nsetReadOnly( string, 'base', base );\n\n/**\n* @name camelcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/camelcase}\n*/\nimport camelcase from './../camelcase';\nsetReadOnly( string, 'camelcase', camelcase );\n\n/**\n* @name capitalize\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/capitalize}\n*/\nimport capitalize from './../capitalize';\nsetReadOnly( string, 'capitalize', capitalize );\n\n/**\n* @name codePointAt\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/code-point-at}\n*/\nimport codePointAt from './../code-point-at';\nsetReadOnly( string, 'codePointAt', codePointAt );\n\n/**\n* @name constantcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/constantcase}\n*/\nimport constantcase from './../constantcase';\nsetReadOnly( string, 'constantcase', constantcase );\n\n/**\n* @name dotcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/dotcase}\n*/\nimport dotcase from './../dotcase';\nsetReadOnly( string, 'dotcase', dotcase );\n\n/**\n* @name endsWith\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/ends-with}\n*/\nimport endsWith from './../ends-with';\nsetReadOnly( string, 'endsWith', endsWith );\n\n/**\n* @name first\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/first}\n*/\nimport first from './../first';\nsetReadOnly( string, 'first', first );\n\n/**\n* @name forEach\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/for-each}\n*/\nimport forEach from './../for-each';\nsetReadOnly( string, 'forEach', forEach );\n\n/**\n* @name format\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/format}\n*/\nimport format from './../format';\nsetReadOnly( string, 'format', format );\n\n/**\n* @name fromCodePoint\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/from-code-point}\n*/\nimport fromCodePoint from './../from-code-point';\nsetReadOnly( string, 'fromCodePoint', fromCodePoint );\n\n/**\n* @name headercase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/headercase}\n*/\nimport headercase from './../headercase';\nsetReadOnly( string, 'headercase', headercase );\n\n/**\n* @name kebabcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/kebabcase}\n*/\nimport kebabcase from './../kebabcase';\nsetReadOnly( string, 'kebabcase', kebabcase );\n\n/**\n* @name last\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/last}\n*/\nimport last from './../last';\nsetReadOnly( string, 'last', last );\n\n/**\n* @name lpad\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/left-pad}\n*/\nimport lpad from './../left-pad';\nsetReadOnly( string, 'lpad', lpad );\n\n/**\n* @name ltrim\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/left-trim}\n*/\nimport ltrim from './../left-trim';\nsetReadOnly( string, 'ltrim', ltrim );\n\n/**\n* @name ltrimN\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/left-trim-n}\n*/\nimport ltrimN from './../left-trim-n';\nsetReadOnly( string, 'ltrimN', ltrimN );\n\n/**\n* @name lowercase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/lowercase}\n*/\nimport lowercase from './../lowercase';\nsetReadOnly( string, 'lowercase', lowercase );\n\n/**\n* @name nextCodePointIndex\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/next-code-point-index}\n*/\nimport nextCodePointIndex from './../next-code-point-index';\nsetReadOnly( string, 'nextCodePointIndex', nextCodePointIndex );\n\n/**\n* @name nextGraphemeClusterBreak\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/next-grapheme-cluster-break}\n*/\nimport nextGraphemeClusterBreak from './../next-grapheme-cluster-break';\nsetReadOnly( string, 'nextGraphemeClusterBreak', nextGraphemeClusterBreak );\n\n/**\n* @name numCodePoints\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/num-code-points}\n*/\nimport numCodePoints from './../num-code-points';\nsetReadOnly( string, 'numCodePoints', numCodePoints );\n\n/**\n* @name numGraphemeClusters\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/num-grapheme-clusters}\n*/\nimport numGraphemeClusters from './../num-grapheme-clusters';\nsetReadOnly( string, 'numGraphemeClusters', numGraphemeClusters );\n\n/**\n* @name num2words\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/num2words}\n*/\nimport num2words from './../num2words';\nsetReadOnly( string, 'num2words', num2words );\n\n/**\n* @name pad\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/pad}\n*/\nimport pad from './../pad';\nsetReadOnly( string, 'pad', pad );\n\n/**\n* @name pascalcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/pascalcase}\n*/\nimport pascalcase from './../pascalcase';\nsetReadOnly( string, 'pascalcase', pascalcase );\n\n/**\n* @name percentEncode\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/percent-encode}\n*/\nimport percentEncode from './../percent-encode';\nsetReadOnly( string, 'percentEncode', percentEncode );\n\n/**\n* @name prevGraphemeClusterBreak\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/prev-grapheme-cluster-break}\n*/\nimport prevGraphemeClusterBreak from './../prev-grapheme-cluster-break';\nsetReadOnly( string, 'prevGraphemeClusterBreak', prevGraphemeClusterBreak );\n\n/**\n* @name removeFirst\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/remove-first}\n*/\nimport removeFirst from './../remove-first';\nsetReadOnly( string, 'removeFirst', removeFirst );\n\n/**\n* @name removeLast\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/remove-last}\n*/\nimport removeLast from './../remove-last';\nsetReadOnly( string, 'removeLast', removeLast );\n\n/**\n* @name removePunctuation\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/remove-punctuation}\n*/\nimport removePunctuation from './../remove-punctuation';\nsetReadOnly( string, 'removePunctuation', removePunctuation );\n\n/**\n* @name removeUTF8BOM\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/remove-utf8-bom}\n*/\nimport removeUTF8BOM from './../remove-utf8-bom';\nsetReadOnly( string, 'removeUTF8BOM', removeUTF8BOM );\n\n/**\n* @name removeWords\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/remove-words}\n*/\nimport removeWords from './../remove-words';\nsetReadOnly( string, 'removeWords', removeWords );\n\n/**\n* @name repeat\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/repeat}\n*/\nimport repeat from './../repeat';\nsetReadOnly( string, 'repeat', repeat );\n\n/**\n* @name replace\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/replace}\n*/\nimport replace from './../replace';\nsetReadOnly( string, 'replace', replace );\n\n/**\n* @name replaceBefore\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/replace-before}\n*/\nimport replaceBefore from './../replace-before';\nsetReadOnly( string, 'replaceBefore', replaceBefore );\n\n/**\n* @name reverse\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/reverse}\n*/\nimport reverse from './../reverse';\nsetReadOnly( string, 'reverse', reverse );\n\n/**\n* @name rpad\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/right-pad}\n*/\nimport rpad from './../right-pad';\nsetReadOnly( string, 'rpad', rpad );\n\n/**\n* @name rtrim\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/right-trim}\n*/\nimport rtrim from './../right-trim';\nsetReadOnly( string, 'rtrim', rtrim );\n\n/**\n* @name rtrimN\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/right-trim-n}\n*/\nimport rtrimN from './../right-trim-n';\nsetReadOnly( string, 'rtrimN', rtrimN );\n\n/**\n* @name snakecase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/snakecase}\n*/\nimport snakecase from './../snakecase';\nsetReadOnly( string, 'snakecase', snakecase );\n\n/**\n* @name splitGraphemeClusters\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/split-grapheme-clusters}\n*/\nimport splitGraphemeClusters from './../split-grapheme-clusters';\nsetReadOnly( string, 'splitGraphemeClusters', splitGraphemeClusters );\n\n/**\n* @name startcase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/startcase}\n*/\nimport startcase from './../startcase';\nsetReadOnly( string, 'startcase', startcase );\n\n/**\n* @name startsWith\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/starts-with}\n*/\nimport startsWith from './../starts-with';\nsetReadOnly( string, 'startsWith', startsWith );\n\n/**\n* @name substringAfter\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/substring-after}\n*/\nimport substringAfter from './../substring-after';\nsetReadOnly( string, 'substringAfter', substringAfter );\n\n/**\n* @name substringAfterLast\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/substring-after-last}\n*/\nimport substringAfterLast from './../substring-after-last';\nsetReadOnly( string, 'substringAfterLast', substringAfterLast );\n\n/**\n* @name substringBefore\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/substring-before}\n*/\nimport substringBefore from './../substring-before';\nsetReadOnly( string, 'substringBefore', substringBefore );\n\n/**\n* @name substringBeforeLast\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/substring-before-last}\n*/\nimport substringBeforeLast from './../substring-before-last';\nsetReadOnly( string, 'substringBeforeLast', substringBeforeLast );\n\n/**\n* @name graphemeClusters2iterator\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/to-grapheme-cluster-iterator}\n*/\nimport graphemeClusters2iterator from './../to-grapheme-cluster-iterator';\nsetReadOnly( string, 'graphemeClusters2iterator', graphemeClusters2iterator );\n\n/**\n* @name graphemeClusters2iteratorRight\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/to-grapheme-cluster-iterator-right}\n*/\nimport graphemeClusters2iteratorRight from './../to-grapheme-cluster-iterator-right';\nsetReadOnly( string, 'graphemeClusters2iteratorRight', graphemeClusters2iteratorRight );\n\n/**\n* @name toWellFormed\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/to-well-formed}\n*/\nimport toWellFormed from './../to-well-formed';\nsetReadOnly( string, 'toWellFormed', toWellFormed );\n\n/**\n* @name trim\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/trim}\n*/\nimport trim from './../trim';\nsetReadOnly( string, 'trim', trim );\n\n/**\n* @name truncate\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/truncate}\n*/\nimport truncate from './../truncate';\nsetReadOnly( string, 'truncate', truncate );\n\n/**\n* @name truncateMiddle\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/truncate-middle}\n*/\nimport truncateMiddle from './../truncate-middle';\nsetReadOnly( string, 'truncateMiddle', truncateMiddle );\n\n/**\n* @name uncapitalize\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/uncapitalize}\n*/\nimport uncapitalize from './../uncapitalize';\nsetReadOnly( string, 'uncapitalize', uncapitalize );\n\n/**\n* @name uppercase\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/uppercase}\n*/\nimport uppercase from './../uppercase';\nsetReadOnly( string, 'uppercase', uppercase );\n\n/**\n* @name utf16ToUTF8Array\n* @memberof string\n* @readonly\n* @type {Function}\n* @see {@link module:@stdlib/string/utf16-to-utf8-array}\n*/\nimport utf16ToUTF8Array from './../utf16-to-utf8-array';\nsetReadOnly( string, 'utf16ToUTF8Array', utf16ToUTF8Array );\n\n\n// EXPORTS //\n\nexport default string;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/camelcase';\n\n\n// MAIN //\n\n/**\n* Converts a string to camel case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} camel-cased string\n*\n* @example\n* var out = camelcase( 'foo bar' );\n* // returns 'fooBar'\n*\n* @example\n* var out = camelcase( 'IS_MOBILE' );\n* // returns 'isMobile'\n*\n* @example\n* var out = camelcase( 'Hello World!' );\n* // returns 'helloWorld'\n*\n* @example\n* var out = camelcase( '--foo-bar--' );\n* // returns 'fooBar'\n*/\nfunction camelcase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default camelcase;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/capitalize';\n\n\n// MAIN //\n\n/**\n* Capitalizes the first character in a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {string} capitalized string\n*\n* @example\n* var out = capitalize( 'last man standing' );\n* // returns 'Last man standing'\n*\n* @example\n* var out = capitalize( 'presidential election' );\n* // returns 'Presidential election'\n*\n* @example\n* var out = capitalize( 'javaScript' );\n* // returns 'JavaScript'\n*\n* @example\n* var out = capitalize( 'Hidden Treasures' );\n* // returns 'Hidden Treasures'\n*/\nfunction capitalize( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default capitalize;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/constantcase';\n\n\n// MAIN //\n\n/**\n* Converts a string to constant case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} constant-cased string\n*\n* @example\n* var str = constantcase( 'beep' );\n* // returns 'BEEP'\n*\n* @example\n* var str = constantcase( 'beep boop' );\n* // returns 'BEEP_BOOP'\n*\n* @example\n* var str = constantcase( 'isMobile' );\n* // returns 'IS_MOBILE'\n*\n* @example\n* var str = constantcase( 'Hello World!' );\n* // returns 'HELLO_WORLD'\n*/\nfunction constantcase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default constantcase;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/dotcase';\n\n\n// MAIN //\n\n/**\n* Converts a string to dot case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} dot-cased string\n*\n* @example\n* var out = dotcase( 'foo bar' );\n* // returns 'foo.bar'\n*\n* @example\n* var out = dotcase( 'IS_MOBILE' );\n* // returns 'is.mobile'\n*\n* @example\n* var out = dotcase( 'Hello World!' );\n* // returns 'hello.world'\n*\n* @example\n* var out = dotcase( '--foo-bar--' );\n* // returns 'foo.bar'\n*/\nfunction dotcase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default dotcase;\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';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/ends-with';\n\n\n// MAIN //\n\n/**\n* Test if a string ends with the characters of another string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} [len=str.length] - substring length\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} third argument must be an integer\n* @returns {boolean} boolean indicating if the input string ends with the search string\n*\n* @example\n* var bool = endsWith( 'Remember the story I used to tell you when you were a boy?', 'boy?' );\n* // returns true\n*\n* @example\n* var bool = endsWith( 'Remember the story I used to tell you when you were a boy?', 'Boy?' );\n* // returns false\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be' );\n* // returns false\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', 19 );\n* // returns true\n*\n* @example\n* var bool = endsWith( 'To be, or not to be, that is the question.', 'to be', -23 );\n* // returns true\n*/\nfunction endsWith( str, search, len ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isInteger( len ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', len ) );\n\t\t}\n\t} else {\n\t\tlen = str.length;\n\t}\n\treturn base( str, search, len );\n}\n\n\n// EXPORTS //\n\nexport default endsWith;\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 Unicode code point in the Basic Multilingual Plane (BMP).\n*\n* @module @stdlib/constants/unicode/max-bmp\n* @type {integer32}\n*\n* @example\n* import UNICODE_MAX_BMP from '@stdlib/constants/unicode/max-bmp';\n* // returns 65535\n*/\n\n\n// MAIN //\n\n/**\n* Maximum Unicode code point in the Basic Multilingual Plane (BMP).\n*\n* @constant\n* @type {integer32}\n* @default 65535\n* @see [Unicode]{@link https://en.wikipedia.org/wiki/Unicode}\n*/\nvar UNICODE_MAX_BMP = 0xFFFF|0; // asm type annotation\n\n\n// EXPORTS //\n\nexport default UNICODE_MAX_BMP;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/headercase';\n\n\n// MAIN //\n\n/**\n* Converts a string to HTTP header case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} HTTP header-cased string\n*\n* @example\n* var out = headercase( 'foo bar' );\n* // returns 'Foo-Bar'\n*\n* @example\n* var out = headercase( 'IS_MOBILE' );\n* // returns 'Is-Mobile'\n*\n* @example\n* var out = headercase( 'Hello World!' );\n* // returns 'Hello-World'\n*\n* @example\n* var out = headercase( '--foo-bar--' );\n* // returns 'Foo-Bar'\n*/\nfunction headercase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default headercase;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/kebabcase';\n\n\n// MAIN //\n\n/**\n* Converts a string to kebab case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} kebab-cased string\n*\n* @example\n* var str = kebabCase( 'Hello World!' );\n* // returns 'hello-world'\n*\n* @example\n* var str = kebabCase( 'foo bar' );\n* // returns 'foo-bar'\n*\n* @example\n* var str = kebabCase( 'I am a tiny little teapot' );\n* // returns 'i-am-a-tiny-little-teapot'\n*\n* @example\n* var str = kebabCase( 'BEEP boop' );\n* // returns 'beep-boop'\n*\n* @example\n* var str = kebabCase( 'isMobile' );\n* // returns 'is-mobile'\n*/\nfunction kebabCase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default kebabCase;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/left-trim';\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning of a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {string} trimmed string\n*\n* @example\n* var out = ltrim( ' Whitespace ' );\n* // returns 'Whitespace '\n*\n* @example\n* var out = ltrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs\\t\\t\\t'\n*\n* @example\n* var out = ltrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines\\n\\n\\n'\n*/\nfunction ltrim( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default ltrim;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport splitGraphemeClusters from './../../split-grapheme-clusters';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport replace from './../../replace';\nimport rescape from '@stdlib/utils/escape-regexp-string';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar WHITESPACE_CHARS = '\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff';\n\n\n// MAIN //\n\n/**\n* Trims `n` characters from the beginning of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of characters to trim\n* @param {(string|StringArray)} [chars] - characters to trim (defaults to whitespace characters)\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string or an array of strings\n* @returns {string} trimmed string\n*\n* @example\n* var str = ' abc ';\n* var out = ltrimN( str, 2 );\n* // returns ' abc '\n*\n* @example\n* var str = ' abc ';\n* var out = ltrimN( str, str.length );\n* // returns 'abc '\n*\n* @example\n* var str = '~~abc!~~';\n* var out = ltrimN( str, str.length, [ '~', '!' ] );\n* // returns 'abc!~~'\n*\n* @example\n* var str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨';\n* var out = ltrimN( str, str.length, '👨🏼‍🎨🤖' );\n* // returns ''\n*/\nfunction ltrimN( str, n, chars ) {\n\tvar nElems;\n\tvar reStr;\n\tvar isStr;\n\tvar RE;\n\tvar i;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( n ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tisStr = isString( chars );\n\t\tif ( !isStr && !isStringArray( chars ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string or an array of strings. Value: `%s`.', chars ) );\n\t\t}\n\t\tif ( isStr ) {\n\t\t\tchars = splitGraphemeClusters( chars );\n\t\t}\n\t\tnElems = chars.length - 1;\n\t\treStr = '';\n\t\tfor ( i = 0; i < nElems; i++ ) {\n\t\t\treStr += rescape( chars[ i ] );\n\t\t\treStr += '|';\n\t\t}\n\t\treStr += rescape( chars[ nElems ] );\n\n\t\t// Case: Trim a specific set of characters from the beginning of a string..\n\t\tRE = new RegExp( '^(?:' + reStr + '){0,'+n+'}' );\n\t} else {\n\t\t// Case: Trim `n` whitespace characters from the beginning of a string...\n\t\tRE = new RegExp( '^[' + WHITESPACE_CHARS + ']{0,'+n+'}' );\n\t}\n\treturn replace( str, RE, '' );\n}\n\n\n// EXPORTS //\n\nexport default ltrimN;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/lowercase';\n\n\n// MAIN //\n\n/**\n* Converts a string to lowercase.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} lowercase string\n*\n* @example\n* var str = lowercase( 'bEEp' );\n* // returns 'beep'\n*/\nfunction lowercase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default lowercase;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isNumber } from '@stdlib/assert/is-number';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport isfinite from '@stdlib/math/base/assert/is-finite';\nimport format from './../../format';\nimport int2wordsDE from './int2words_de.js';\nimport int2wordsEN from './int2words_en.js';\nimport validate from './validate.js';\nimport decimals from './decimals.js';\n\n\n// MAIN //\n\n/**\n* Converts a number to a word representation.\n*\n* @param {number} num - number to convert\n* @param {Object} [options] - options\n* @param {string} [options.lang='en'] - language code\n* @throws {TypeError} must provide valid options\n* @returns {string} word representation of number\n*\n* @example\n* var out = num2words( 12 );\n* // returns 'twelve'\n*\n* @example\n* var out = num2words( 21.8 );\n* // returns 'twenty-one point eight'\n*\n* @example\n* var out = num2words( 1234 );\n* // returns 'one thousand two hundred thirty-four'\n*\n* @example\n* var out = num2words( 100381 );\n* // returns 'one hundred thousand three hundred eighty-one'\n*/\nfunction num2words( num, options ) {\n\tvar parts;\n\tvar opts;\n\tvar err;\n\n\tif ( !isNumber( num ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a number. Value: `%s`.', num ) );\n\t}\n\topts = {};\n\tif ( arguments.length > 1 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tif ( isInteger( num ) ) {\n\t\tswitch ( opts.lang ) {\n\t\tcase 'de':\n\t\t\treturn int2wordsDE( num, '' );\n\t\tcase 'en':\n\t\tdefault:\n\t\t\treturn int2wordsEN( num, '' );\n\t\t}\n\t}\n\tif ( !isfinite( num ) ) {\n\t\tswitch ( opts.lang ) {\n\t\tcase 'de':\n\t\t\treturn ( num < 0 ) ? 'minus unendlich' : 'unendlich';\n\t\tcase 'en':\n\t\tdefault:\n\t\t\treturn ( num < 0 ) ? 'negative infinity' : 'infinity';\n\t\t}\n\t}\n\tparts = num.toString().split( '.' );\n\tswitch ( opts.lang ) {\n\tcase 'de':\n\t\treturn int2wordsDE( parts[ 0 ], '' ) + ' Komma ' + decimals( parts[ 1 ], int2wordsDE );\n\tcase 'en':\n\tdefault:\n\t\treturn int2wordsEN( parts[ 0 ], '' ) + ' point ' + decimals( parts[ 1 ], int2wordsEN );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default num2words;\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 isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport repeat from './../../repeat';\nimport format from './../../format';\nimport floor from '@stdlib/math/base/special/floor';\nimport ceil from '@stdlib/math/base/special/ceil';\nimport lpad from './../../left-pad';\nimport rpad from './../../right-pad';\nimport abs from '@stdlib/math/base/special/abs';\nimport FLOAT64_MAX_SAFE_INTEGER from '@stdlib/constants/float64/max-safe-integer';\nimport validate from './validate.js';\n\n\n// MAIN //\n\n/**\n* Pads a string such that the padded string has a length of `len`.\n*\n* @param {string} str - string to pad\n* @param {NonNegativeInteger} len - string length\n* @param {Options} [options] - function options\n* @param {string} [options.lpad=''] - string used to left pad\n* @param {string} [options.rpad=' '] - string used to right pad\n* @param {boolean} [options.centerRight=false] - boolean indicating whether to center right in the event of a tie\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} options argument must be an object\n* @throws {TypeError} must provide valid options\n* @throws {RangeError} at least one padding must have a length greater than `0`\n* @returns {string} padded string\n*\n* @example\n* var str = pad( 'a', 5 );\n* // returns 'a '\n*\n* @example\n* var str = pad( 'a', 10, {\n* 'lpad': 'b'\n* });\n* // returns 'bbbbbbbbba'\n*\n* @example\n* var str = pad( 'a', 12, {\n* 'rpad': 'b'\n* });\n* // returns 'abbbbbbbbbbb'\n*\n* @example\n* var opts = {\n* 'lpad': 'a',\n* 'rpad': 'c'\n* };\n* var str = pad( 'b', 10, opts );\n* // returns 'aaaabccccc'\n*\n* @example\n* var opts = {\n* 'lpad': 'a',\n* 'rpad': 'c',\n* 'centerRight': true\n* };\n* var str = pad( 'b', 10, opts );\n* // returns 'aaaaabcccc'\n*/\nfunction pad( str, len, options ) {\n\tvar nright;\n\tvar nleft;\n\tvar isodd;\n\tvar right;\n\tvar left;\n\tvar opts;\n\tvar err;\n\tvar tmp;\n\tvar 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\tif ( !isNonNegativeInteger( len ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );\n\t}\n\tif ( len > FLOAT64_MAX_SAFE_INTEGER ) {\n\t\tthrow new RangeError( format( 'invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.', len ) );\n\t}\n\topts = {};\n\tif ( arguments.length > 2 ) {\n\t\terr = validate( opts, options );\n\t\tif ( err ) {\n\t\t\tthrow err;\n\t\t}\n\t}\n\tif ( opts.lpad && opts.rpad ) {\n\t\tn = ( len-str.length ) / 2;\n\t\tif ( n === 0 ) {\n\t\t\treturn str;\n\t\t}\n\t\ttmp = floor( n );\n\t\tif ( tmp !== n ) {\n\t\t\tisodd = true;\n\t\t}\n\t\tif ( n < 0 ) {\n\t\t\tn = floor( abs( n ) );\n\t\t\tnleft = n;\n\t\t\tnright = str.length - n;\n\n\t\t\t// If |len-str.length| is an odd number, take away an additional character from one side...\n\t\t\tif ( isodd ) {\n\t\t\t\tif ( opts.centerRight ) {\n\t\t\t\t\tnright -= 1;\n\t\t\t\t} else {\n\t\t\t\t\tnleft += 1;\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn str.substring( nleft, nright );\n\t\t}\n\t\tnleft = ceil( n / opts.lpad.length );\n\t\tleft = repeat( opts.lpad, nleft );\n\n\t\tnright = ceil( n / opts.rpad.length );\n\t\tright = repeat( opts.rpad, nright );\n\n\t\t// If (len-str.length) is an odd number, give one side one extra character...\n\t\tn = tmp;\n\t\tnleft = n;\n\t\tnright = n;\n\t\tif ( isodd ) {\n\t\t\tif ( opts.centerRight ) {\n\t\t\t\tnleft += 1;\n\t\t\t} else {\n\t\t\t\tnright += 1;\n\t\t\t}\n\t\t}\n\t\tleft = left.substring( 0, nleft );\n\t\tright = right.substring( 0, nright );\n\t\treturn left + str + right;\n\t}\n\tif ( opts.lpad ) {\n\t\ttmp = lpad( str, len, opts.lpad );\n\t\treturn tmp.substring( tmp.length-len );\n\t}\n\tif ( opts.rpad ) {\n\t\treturn ( rpad( str, len, opts.rpad ) ).substring( 0, len );\n\t}\n\tif ( opts.rpad === void 0 ) {\n\t\treturn ( rpad( str, len, ' ' ) ).substring( 0, len );\n\t}\n\tthrow new RangeError( format( 'invalid argument. At least one padding option must have a length greater than 0. Left padding: `%s`. Right padding: `%s`.', opts.lpad, opts.rpad ) );\n}\n\n\n// EXPORTS //\n\nexport default pad;\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 isPlainObject from '@stdlib/assert/is-plain-object';\nimport hasOwnProp from '@stdlib/assert/has-own-property';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Validates function options.\n*\n* @private\n* @param {Object} opts - destination object\n* @param {Options} options - options to validate\n* @param {string} [options.lpad] - string used to left pad\n* @param {string} [options.rpad] - string used to right pad\n* @param {boolean} [options.centerRight] - boolean indicating whether to center right in the event of a tie\n* @returns {(null|Error)} error object or null\n*\n* @example\n* var opts = {};\n* var options = {\n* 'lpad': 'a',\n* 'rpad': 'b'\n* };\n* var err = validate( opts, options );\n* if ( err ) {\n* throw err;\n* }\n*/\nfunction validate( opts, options ) {\n\tif ( !isPlainObject( options ) ) {\n\t\treturn new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );\n\t}\n\tif ( hasOwnProp( options, 'lpad' ) ) {\n\t\topts.lpad = options.lpad;\n\t\tif ( !isString( opts.lpad ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'lpad', opts.lpad ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'rpad' ) ) {\n\t\topts.rpad = options.rpad;\n\t\tif ( !isString( opts.rpad ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'rpad', opts.rpad ) );\n\t\t}\n\t}\n\tif ( hasOwnProp( options, 'centerRight' ) ) {\n\t\topts.centerRight = options.centerRight;\n\t\tif ( !isBoolean( opts.centerRight ) ) {\n\t\t\treturn new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'centerRight', opts.centerRight ) );\n\t\t}\n\t}\n\treturn null;\n}\n\n\n// EXPORTS //\n\nexport default validate;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/pascalcase';\n\n\n// MAIN //\n\n/**\n* Converts a string to Pascal case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} Pascal-cased string\n*\n* @example\n* var out = pascalcase( 'foo bar' );\n* // returns 'FooBar'\n*\n* @example\n* var out = pascalcase( 'IS_MOBILE' );\n* // returns 'IsMobile'\n*\n* @example\n* var out = pascalcase( 'Hello World!' );\n* // returns 'HelloWorld'\n*\n* @example\n* var out = pascalcase( '--foo-bar--' );\n* // returns 'FooBar'\n*/\nfunction pascalcase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default pascalcase;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/percent-encode';\n\n\n// MAIN //\n\n/**\n* Percent-encodes a UTF-16 encoded string according to [RFC 3986][1].\n*\n* [1]: https://tools.ietf.org/html/rfc3986#section-2.1\n*\n* @param {string} str - string to percent-encode\n* @throws {TypeError} must provide a string\n* @returns {string} percent-encoded string\n*\n* @example\n* var str1 = 'Ladies + Gentlemen';\n*\n* var str2 = percentEncode( str1 );\n* // returns 'Ladies%20%2B%20Gentlemen'\n*/\nfunction percentEncode( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default percentEncode;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// VARIABLES //\n\n// '\\ufeff' => 1111111011111111 => 0xFEFF => 65279\nvar BOM = 65279;\n\n\n// MAIN //\n\n/**\n* Removes a UTF-8 byte order mark (BOM) from the beginning of a string.\n*\n* ## Notes\n*\n* - A UTF-8 byte order mark ([BOM][1]) is the byte sequence `0xEF,0xBB,0xBF`.\n* - To convert a UTF-8 encoded `Buffer` to a `string`, the `Buffer` must be converted to [UTF-16][2]. The BOM thus gets converted to the single 16-bit code point `'\\ufeff'` (UTF-16 BOM).\n*\n* [1]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8\n* [2]: http://es5.github.io/#x4.3.16\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string primitive\n* @returns {string} string with BOM removed\n*\n* @example\n* var str = removeUTF8BOM( '\\ufeffbeep' );\n* // returns 'beep'\n*/\nfunction removeUTF8BOM( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tif ( str.charCodeAt( 0 ) === BOM ) {\n\t\treturn str.slice( 1 );\n\t}\n\treturn str;\n}\n\n\n// EXPORTS //\n\nexport default removeUTF8BOM;\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 isStringArray from '@stdlib/assert/is-string-array';\nimport uppercase from './../../uppercase';\nimport { isPrimitive as isBoolean } from '@stdlib/assert/is-boolean';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport tokenize from '@stdlib/nlp/tokenize';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Removes a list of words from a string.\n*\n* @param {string} str - input string\n* @param {StringArray} words - array of words to be removed\n* @param {boolean} [ignoreCase=false] - boolean indicating whether to perform a case-insensitive operation\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be an array of strings\n* @throws {TypeError} third argument must be a boolean\n* @returns {string} output string\n*\n* @example\n* var str = 'beep boop Foo bar';\n* var out = removeWords( str, [ 'boop', 'foo' ] );\n* // returns 'beep Foo bar'\n*\n* @example\n* var str = 'beep boop Foo bar';\n* var out = removeWords( str, [ 'boop', 'foo' ], true );\n* // returns 'beep bar'\n*/\nfunction removeWords( str, words, ignoreCase ) {\n\tvar tokens;\n\tvar token;\n\tvar list;\n\tvar flg;\n\tvar out;\n\tvar N;\n\tvar i;\n\tvar j;\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\tif ( !isStringArray( words ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be an array of strings. Value: `%s`.', words ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isBoolean( ignoreCase ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a boolean. Value: `%s`.', ignoreCase ) );\n\t\t}\n\t}\n\ttokens = tokenize( str, true );\n\tN = words.length;\n\tout = [];\n\tif ( ignoreCase ) {\n\t\tlist = words.slice();\n\t\tfor ( i = 0; i < N; i++ ) {\n\t\t\tlist[ i ] = uppercase( list[ i ] );\n\t\t}\n\t\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\t\tflg = true;\n\t\t\ttoken = uppercase( tokens[ i ] );\n\t\t\tfor ( j = 0; j < N; j++ ) {\n\t\t\t\tif ( list[ j ] === token ) {\n\t\t\t\t\tflg = false;\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif ( flg ) {\n\t\t\t\tout.push( tokens[ i ] );\n\t\t\t}\n\t\t}\n\t\treturn out.join( '' );\n\t}\n\t// Case: case-sensitive\n\tfor ( i = 0; i < tokens.length; i++ ) {\n\t\ttoken = tokens[ i ];\n\t\tflg = true;\n\t\tfor ( j = 0; j < N; j++ ) {\n\t\t\tif ( words[ j ] === token ) {\n\t\t\t\tflg = false;\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t\tif ( flg ) {\n\t\t\tout.push( token );\n\t\t}\n\t}\n\treturn out.join( '' );\n}\n\n\n// EXPORTS //\n\nexport default removeWords;\n","/**\n* @license Apache-2.0\n*\n* Copyright (c) 2023 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/replace-before';\n\n\n// MAIN //\n\n/**\n* Replaces the substring before the first occurrence of a specified search string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {string} replacement - replacement string\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} third argument must be a string\n* @returns {string} output string\n*\n* @example\n* var out = replaceBefore( 'beep boop', ' ', 'foo' );\n* // returns 'foo boop'\n*\n* @example\n* var out = replaceBefore( 'beep boop', 'p', 'foo' );\n* // returns 'foop boop'\n*\n* @example\n* var out = replaceBefore( 'Hello World!', '', 'foo' );\n* // returns 'Hello World!'\n*\n* @example\n* var out = replaceBefore( 'Hello World!', 'xyz', 'foo' );\n* // returns 'Hello World!'\n*/\nfunction replaceBefore( str, search, replacement ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tif ( !isString( replacement ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', replacement ) );\n\t}\n\treturn base( str, search, replacement, 0 );\n}\n\n\n// EXPORTS //\n\nexport default replaceBefore;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/right-trim';\n\n\n// MAIN //\n\n/**\n* Trims whitespace from the end of a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {string} trimmed string\n*\n* @example\n* var out = rtrim( ' Whitespace ' );\n* // returns ' Whitespace'\n*\n* @example\n* var out = rtrim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns '\\t\\t\\tTabs'\n*\n* @example\n* var out = rtrim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns '\\n\\n\\nNew Lines'\n*/\nfunction rtrim( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default rtrim;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport splitGraphemeClusters from './../../split-grapheme-clusters';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport { primitives as isStringArray } from '@stdlib/assert/is-string-array';\nimport replace from './../../replace';\nimport rescape from '@stdlib/utils/escape-regexp-string';\nimport format from './../../format';\n\n\n// VARIABLES //\n\nvar WHITESPACE_CHARS = '\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff';\n\n\n// MAIN //\n\n/**\n* Trims `n` characters from the end of a string.\n*\n* @param {string} str - input string\n* @param {NonNegativeInteger} n - number of characters to trim\n* @param {(string|StringArray)} [chars] - characters to trim (defaults to whitespace characters)\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string or an array of strings\n* @returns {string} trimmed string\n*\n* @example\n* var str = ' abc ';\n* var out = rtrimN( str, 2 );\n* // returns ' abc '\n*\n* @example\n* var str = ' abc ';\n* var out = rtrimN( str, str.length );\n* // returns ' abc'\n*\n* @example\n* var str = '~~abc!~~';\n* var out = rtrimN( str, str.length, [ '~', '!' ] );\n* // returns '~~abc'\n*\n* @example\n* var str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨';\n* var out = rtrimN( str, str.length, '👨🏼‍🎨🤖' );\n* // returns ''\n*/\nfunction rtrimN( str, n, chars ) {\n\tvar nElems;\n\tvar reStr;\n\tvar isStr;\n\tvar RE;\n\tvar i;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( n ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', n ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tisStr = isString( chars );\n\t\tif ( !isStr && !isStringArray( chars ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a string or an array of strings. Value: `%s`.', chars ) );\n\t\t}\n\t\tif ( isStr ) {\n\t\t\tchars = splitGraphemeClusters( chars );\n\t\t}\n\t\tnElems = chars.length - 1;\n\t\treStr = '';\n\t\tfor ( i = 0; i < nElems; i++ ) {\n\t\t\treStr += rescape( chars[ i ] );\n\t\t\treStr += '|';\n\t\t}\n\t\treStr += rescape( chars[ nElems ] );\n\n\t\t// Case: Trim a specific set of characters from the end of a string..\n\t\tRE = new RegExp( '(?:' + reStr + '){0,'+n+'}$' );\n\t} else {\n\t\t// Case: Trim `n` whitespace characters from the end of a string...\n\t\tRE = new RegExp( '[' + WHITESPACE_CHARS + ']{0,'+n+'}$' );\n\t}\n\treturn replace( str, RE, '' );\n}\n\n\n// EXPORTS //\n\nexport default rtrimN;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/snakecase';\n\n\n// MAIN //\n\n/**\n* Converts a string to snake case.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} snake-cased string\n*\n* @example\n* var str = snakecase( 'Hello World!' );\n* // returns 'hello_world'\n*\n* @example\n* var str = snakecase( 'foo bar' );\n* // returns 'foo_bar'\n*\n* @example\n* var str = snakecase( 'I am a tiny little teapot' );\n* // returns 'i_am_a_tiny_little_teapot'\n*\n* @example\n* var str = snakecase( 'BEEP boop' );\n* // returns 'beep_boop'\n*\n* @example\n* var str = snakecase( 'isMobile' );\n* // returns 'is_mobile'\n*/\nfunction snakecase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default snakecase;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/startcase';\n\n\n// MAIN //\n\n/**\n* Capitalizes the first letter of each word in an input string.\n*\n* @param {string} str - string to convert\n* @throws {TypeError} must provide a string\n* @returns {string} start case string\n*\n* @example\n* var str = startcase( 'beep boop foo bar' );\n* // returns 'Beep Boop Foo Bar'\n*/\nfunction startcase( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default startcase;\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';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/starts-with';\n\n\n// MAIN //\n\n/**\n* Tests if a string starts with the characters of another string.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} [position=0] - position at which to start searching\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} third argument must be an integer\n* @returns {boolean} boolean indicating if the input string starts with the search string\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember' );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember' );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be' );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be' );\n* // returns false\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 );\n* // returns true\n*\n* @example\n* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 );\n* // returns true\n*/\nfunction startsWith( str, search, position ) {\n\tvar pos;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isInteger( position ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', position ) );\n\t\t}\n\t\tpos = position;\n\t} else {\n\t\tpos = 0;\n\t}\n\treturn base( str, search, pos );\n}\n\n\n// EXPORTS //\n\nexport default startsWith;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns the part of a string after a specified substring.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @param {integer} [fromIndex=0] - index at which to start the search\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} third argument must be an integer\n* @returns {string} substring\n*\n* @example\n* var out = substringAfter( 'Hello, world!', ', ' );\n* // returns 'world!'\n*\n* @example\n* var out = substringAfter( 'beep boop', 'beep' );\n* // returns ' boop'\n*\n* @example\n* var out = substringAfter( 'beep boop', 'boop' );\n* // returns ''\n*\n* @example\n* var out = substringAfter( 'beep boop', 'xyz' );\n* // returns ''\n*\n* @example\n* var out = substringAfter( 'beep boop', 'beep', 5 );\n* // returns ''\n*\n* @example\n* var out = substringAfter( 'beep boop beep baz', 'beep', 5 );\n* // returns ' baz'\n*/\nfunction substringAfter( str, search, fromIndex ) {\n\tvar idx;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tidx = str.indexOf( search, fromIndex );\n\t} else {\n\t\tidx = str.indexOf( search );\n\t}\n\tif ( idx === -1 ) {\n\t\treturn '';\n\t}\n\treturn str.substring( idx+search.length );\n}\n\n\n// EXPORTS //\n\nexport default substringAfter;\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 { isPrimitive as isInteger } from '@stdlib/assert/is-integer';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns the part of a string after the last occurrence of a specified substring.\n*\n* @param {string} str - input string\n* @param {string} search - search value\n* @param {integer} [fromIndex=str.length] - index of last character to be considered beginning of a match\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @throws {TypeError} third argument must be an integer\n* @returns {string} substring\n*\n* @example\n* var out = substringAfterLast( 'beep boop', 'b' );\n* // returns 'oop'\n*\n* @example\n* var out = substringAfterLast( 'beep boop', 'o' );\n* // returns 'p'\n*\n* @example\n* var out = substringAfterLast( 'Hello World', 'o' );\n* // returns 'rld'\n*\n* @example\n* var out = substringAfterLast( 'Hello World', '!' );\n* // returns ''\n*\n* @example\n* var out = substringAfterLast( 'Hello World', '' );\n* // returns ''\n*\n* @example\n* var out = substringAfterLast( 'beep boop baz', 'p b', 6 );\n* // returns 'oop baz'\n*/\nfunction substringAfterLast( str, search, fromIndex ) {\n\tvar idx;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isInteger( fromIndex ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%s`.', fromIndex ) );\n\t\t}\n\t\tidx = str.lastIndexOf( search, fromIndex );\n\t} else {\n\t\tidx = str.lastIndexOf( search );\n\t}\n\tif ( idx === -1 ) {\n\t\treturn '';\n\t}\n\treturn str.substring( idx+search.length );\n}\n\n\n// EXPORTS //\n\nexport default substringAfterLast;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns the part of a string before a specified substring.\n*\n* @param {string} str - input string\n* @param {string} search - search string\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @returns {string} substring\n*\n* @example\n* var out = substringBefore( 'beep boop', ' ' );\n* // returns 'beep'\n*\n* @example\n* var out = substringBefore( 'beep boop', 'p' );\n* // returns 'bee'\n*\n* @example\n* var out = substringBefore( 'Hello World!', '' );\n* // returns ''\n*\n* @example\n* var out = substringBefore( 'Hello World!', 'XYZ' );\n* // returns 'Hello World!'\n*/\nfunction substringBefore( str, search ) {\n\tvar idx;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tidx = str.indexOf( search );\n\tif ( idx === -1 ) {\n\t\treturn str;\n\t}\n\treturn str.substring( 0, idx );\n}\n\n\n// EXPORTS //\n\nexport default substringBefore;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns the part of a string before the last occurrence of a specified substring.\n*\n* @param {string} str - input string\n* @param {string} search - search value\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a string\n* @returns {string} substring\n*\n* @example\n* var out = substringBeforeLast( 'abcba', 'b' );\n* // returns 'abc'\n*\n* @example\n* var out = substringBeforeLast( 'Hello World, my friend!', ' ' );\n* // returns 'Hello World, my'\n*\n* @example\n* var out = substringBeforeLast( 'abcba', ' ' );\n* // returns 'abcba'\n*\n* @example\n* var out = substringBeforeLast( 'abcba', '' );\n* // returns 'abcba'\n*/\nfunction substringBeforeLast( str, search ) {\n\tvar idx;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isString( search ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) );\n\t}\n\tidx = str.lastIndexOf( search );\n\tif ( idx === -1 ) {\n\t\treturn str;\n\t}\n\treturn str.substring( 0, idx );\n}\n\n\n// EXPORTS //\n\nexport default substringBeforeLast;\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 setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport isFunction from '@stdlib/assert/is-function';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport iteratorSymbol from '@stdlib/symbol/iterator';\nimport nextGraphemeClusterBreak from './../../next-grapheme-cluster-break';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns an iterator which iterates over each grapheme cluster in a string.\n*\n* @param {string} src - input value\n* @param {Function} [mapFcn] - function to invoke for each iterated value\n* @param {*} [thisArg] - execution context\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a function\n* @returns {Iterator} iterator\n*\n* @example\n* var iter = graphemeClusters2iterator( '🌷🍕' );\n*\n* var v = iter.next().value;\n* // returns '🌷'\n*\n* v = iter.next().value;\n* // returns '🍕'\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nfunction graphemeClusters2iterator( src ) {\n\tvar thisArg;\n\tvar iter;\n\tvar FLG;\n\tvar fcn;\n\tvar i;\n\tif ( !isString( src ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', src ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tfcn = arguments[ 1 ];\n\t\tif ( !isFunction( fcn ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) );\n\t\t}\n\t\tthisArg = arguments[ 2 ];\n\t}\n\ti = 0;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tif ( fcn ) {\n\t\tsetReadOnly( iter, 'next', next1 );\n\t} else {\n\t\tsetReadOnly( iter, 'next', next2 );\n\t}\n\tsetReadOnly( iter, 'return', end );\n\n\t// If an environment supports `Symbol.iterator`, make the iterator iterable:\n\tif ( iteratorSymbol ) {\n\t\tsetReadOnly( iter, iteratorSymbol, 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 next1() {\n\t\tvar v;\n\t\tvar j;\n\t\tif ( FLG ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj = nextGraphemeClusterBreak( src, i );\n\t\tif ( j === -1 ) {\n\t\t\tFLG = true;\n\t\t\tif ( src.length ) {\n\t\t\t\treturn {\n\t\t\t\t\t'value': fcn.call( thisArg, src.substring( i ), i, src ),\n\t\t\t\t\t'done': false\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tv = fcn.call( thisArg, src.substring( i, j ), i, src );\n\t\ti = j;\n\t\treturn {\n\t\t\t'value': v,\n\t\t\t'done': false\n\t\t};\n\t}\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 next2() {\n\t\tvar v;\n\t\tvar j;\n\t\tif ( FLG ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj = nextGraphemeClusterBreak( src, i );\n\t\tif ( j === -1 ) {\n\t\t\tFLG = true;\n\t\t\tif ( src.length ) {\n\t\t\t\treturn {\n\t\t\t\t\t'value': src.substring( i ),\n\t\t\t\t\t'done': false\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tv = src.substring( i, j );\n\t\ti = j;\n\t\treturn {\n\t\t\t'value': v,\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\tif ( fcn ) {\n\t\t\treturn graphemeClusters2iterator( src, fcn, thisArg );\n\t\t}\n\t\treturn graphemeClusters2iterator( src );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default graphemeClusters2iterator;\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 setReadOnly from '@stdlib/utils/define-nonenumerable-read-only-property';\nimport isFunction from '@stdlib/assert/is-function';\nimport { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport iteratorSymbol from '@stdlib/symbol/iterator';\nimport prevGraphemeClusterBreak from './../../prev-grapheme-cluster-break';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Returns an iterator which iterates from right to left over each grapheme cluster in a string.\n*\n* @param {string} src - input value\n* @param {Function} [mapFcn] - function to invoke for each iterated value\n* @param {*} [thisArg] - execution context\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a function\n* @returns {Iterator} iterator\n*\n* @example\n* var iter = graphemeClusters2iteratorRight( '🌷🍕' );\n*\n* var v = iter.next().value;\n* // returns '🍕'\n*\n* v = iter.next().value;\n* // returns '🌷'\n*\n* var bool = iter.next().done;\n* // returns true\n*/\nfunction graphemeClusters2iteratorRight( src ) { // eslint-disable-line id-length\n\tvar thisArg;\n\tvar iter;\n\tvar FLG;\n\tvar fcn;\n\tvar i;\n\tif ( !isString( src ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', src ) );\n\t}\n\tif ( arguments.length > 1 ) {\n\t\tfcn = arguments[ 1 ];\n\t\tif ( !isFunction( fcn ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) );\n\t\t}\n\t\tthisArg = arguments[ 2 ];\n\t}\n\ti = src.length - 1;\n\n\t// Create an iterator protocol-compliant object:\n\titer = {};\n\tif ( fcn ) {\n\t\tsetReadOnly( iter, 'next', next1 );\n\t} else {\n\t\tsetReadOnly( iter, 'next', next2 );\n\t}\n\tsetReadOnly( iter, 'return', end );\n\n\t// If an environment supports `Symbol.iterator`, make the iterator iterable:\n\tif ( iteratorSymbol ) {\n\t\tsetReadOnly( iter, iteratorSymbol, 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 next1() {\n\t\tvar v;\n\t\tvar j;\n\t\tif ( FLG ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj = prevGraphemeClusterBreak( src, i );\n\t\tif ( j === -1 ) {\n\t\t\tFLG = true;\n\t\t\tif ( src.length ) {\n\t\t\t\treturn {\n\t\t\t\t\t'value': fcn.call( thisArg, src.substring( j+1, i+1 ), j+1, src ),\n\t\t\t\t\t'done': false\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tv = fcn.call( thisArg, src.substring( j+1, i+1 ), j+1, src );\n\t\ti = j;\n\t\treturn {\n\t\t\t'value': v,\n\t\t\t'done': false\n\t\t};\n\t}\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 next2() {\n\t\tvar v;\n\t\tvar j;\n\t\tif ( FLG ) {\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tj = prevGraphemeClusterBreak( src, i );\n\t\tif ( j === -1 ) {\n\t\t\tFLG = true;\n\t\t\tif ( src.length ) {\n\t\t\t\treturn {\n\t\t\t\t\t'value': src.substring( j+1, i+1 ),\n\t\t\t\t\t'done': false\n\t\t\t\t};\n\t\t\t}\n\t\t\treturn {\n\t\t\t\t'done': true\n\t\t\t};\n\t\t}\n\t\tv = src.substring( j+1, i+1 );\n\t\ti = j;\n\t\treturn {\n\t\t\t'value': v,\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\tif ( fcn ) {\n\t\t\treturn graphemeClusters2iteratorRight( src, fcn, thisArg );\n\t\t}\n\t\treturn graphemeClusters2iteratorRight( src );\n\t}\n}\n\n\n// EXPORTS //\n\nexport default graphemeClusters2iteratorRight;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/trim';\n\n\n// MAIN //\n\n/**\n* Trims whitespace characters from the beginning and end of a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {string} trimmed string\n*\n* @example\n* var out = trim( ' Whitespace ' );\n* // returns 'Whitespace'\n*\n* @example\n* var out = trim( '\\t\\t\\tTabs\\t\\t\\t' );\n* // returns 'Tabs'\n*\n* @example\n* var out = trim( '\\n\\n\\nNew Lines\\n\\n\\n' );\n* // returns 'New Lines'\n*/\nfunction trim( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default trim;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport numGraphemeClusters from './../../num-grapheme-clusters';\nimport nextGraphemeClusterBreak from './../../next-grapheme-cluster-break';\nimport format from './../../format';\n\n\n// MAIN //\n\n/**\n* Truncates a string to a specified length.\n*\n* @param {string} str - input string\n* @param {integer} len - output string length (including ending)\n* @param {string} [ending='...'] - custom ending\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string\n* @returns {string} truncated string\n*\n* @example\n* var str = 'beep boop';\n* var out = truncate( str, 7 );\n* // returns 'beep...'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncate( str, 5, '>>>' );\n* // returns 'be>>>'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncate( str, 10 );\n* // returns 'beep boop'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncate( str, 0 );\n* // returns ''\n*\n* @example\n* var str = 'beep boop';\n* var out = truncate( str, 2 );\n* // returns '..'\n*\n* @example\n* var str = '🐺 Wolf Brothers 🐺';\n* var out = truncate( str, 6 );\n* // returns '🐺 W...'\n*/\nfunction truncate( str, len, ending ) {\n\tvar endingLength;\n\tvar fromIndex;\n\tvar nVisual;\n\tvar idx;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( len ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isString( ending ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', ending ) );\n\t\t}\n\t}\n\tending = ending || '...';\n\tendingLength = numGraphemeClusters( ending );\n\tfromIndex = 0;\n\tif ( len >= numGraphemeClusters( str ) ) {\n\t\treturn str;\n\t}\n\tif ( len - endingLength <= 0 ) {\n\t\treturn ending.slice( 0, len );\n\t}\n\tnVisual = 0;\n\twhile ( nVisual < len - endingLength ) {\n\t\tidx = nextGraphemeClusterBreak( str, fromIndex );\n\t\tfromIndex = idx;\n\t\tnVisual += 1;\n\t}\n\treturn str.substring( 0, idx ) + ending;\n}\n\n\n// EXPORTS //\n\nexport default truncate;\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 { isPrimitive as isString } from '@stdlib/assert/is-string';\nimport { isPrimitive as isNonNegativeInteger } from '@stdlib/assert/is-nonnegative-integer';\nimport numGraphemeClusters from './../../num-grapheme-clusters';\nimport nextGraphemeClusterBreak from './../../next-grapheme-cluster-break';\nimport format from './../../format';\nimport round from '@stdlib/math/base/special/round';\nimport floor from '@stdlib/math/base/special/floor';\n\n\n// MAIN //\n\n/**\n* Truncates a string in the middle to a specified length.\n*\n* @param {string} str - input string\n* @param {integer} len - output string length (including sequence)\n* @param {string} [seq='...'] - custom replacement sequence\n* @throws {TypeError} first argument must be a string\n* @throws {TypeError} second argument must be a nonnegative integer\n* @throws {TypeError} third argument must be a string\n* @returns {string} truncated string\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 5 );\n* // returns 'b...p'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 5, '>>>' );\n* // returns 'b>>>p'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 10 );\n* // returns 'beep boop'\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 0 );\n* // returns ''\n*\n* @example\n* var str = 'beep boop';\n* var out = truncateMiddle( str, 2 );\n* // returns '..'\n*\n* @example\n* var str = '🐺 Wolf Brothers 🐺';\n* var out = truncateMiddle( str, 7 );\n* // returns '🐺 ... 🐺'\n*/\nfunction truncateMiddle( str, len, seq ) {\n\tvar seqLength;\n\tvar fromIndex;\n\tvar strLength;\n\tvar seqStart;\n\tvar nVisual;\n\tvar seqEnd;\n\tvar idx2;\n\tvar idx1;\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\tif ( !isNonNegativeInteger( len ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) );\n\t}\n\tif ( arguments.length > 2 ) {\n\t\tif ( !isString( seq ) ) {\n\t\t\tthrow new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', seq ) );\n\t\t}\n\t}\n\tseq = seq || '...';\n\tseqLength = numGraphemeClusters( seq );\n\tstrLength = numGraphemeClusters( str );\n\tfromIndex = 0;\n\tif ( len > strLength ) {\n\t\treturn str;\n\t}\n\tif ( len - seqLength < 0 ) {\n\t\treturn seq.slice( 0, len );\n\t}\n\tseqStart = round( ( len - seqLength ) / 2 );\n\tseqEnd = strLength - floor( ( len - seqLength ) / 2 );\n\tnVisual = 0;\n\twhile ( nVisual < seqStart ) {\n\t\tidx1 = nextGraphemeClusterBreak( str, fromIndex );\n\t\tfromIndex = idx1;\n\t\tnVisual += 1;\n\t}\n\tidx2 = idx1;\n\twhile ( idx2 > 0 ) {\n\t\tidx2 = nextGraphemeClusterBreak( str, fromIndex );\n\t\tif ( idx2 >= seqEnd + fromIndex - nVisual ) {\n\t\t\tbreak;\n\t\t}\n\t\tfromIndex = idx2;\n\t\tnVisual += 1;\n\t}\n\treturn str.substring( 0, idx1 ) + seq + str.substring( idx2 );\n}\n\n\n// EXPORTS //\n\nexport default truncateMiddle;\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 isString } from '@stdlib/assert/is-string';\nimport format from './../../format';\nimport base from './../../base/uncapitalize';\n\n\n// MAIN //\n\n/**\n* Uncapitalizes the first character of a string.\n*\n* @param {string} str - input string\n* @throws {TypeError} must provide a string\n* @returns {string} input string with first character converted to lowercase\n*\n* @example\n* var out = uncapitalize( 'Last man standing' );\n* // returns 'last man standing'\n*\n* @example\n* var out = uncapitalize( 'Presidential election' );\n* // returns 'presidential election'\n*\n* @example\n* var out = uncapitalize( 'JavaScript' );\n* // returns 'javaScript'\n*\n* @example\n* var out = uncapitalize( 'Hidden Treasures' );\n* // returns 'hidden Treasures'\n*/\nfunction uncapitalize( str ) {\n\tif ( !isString( str ) ) {\n\t\tthrow new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) );\n\t}\n\treturn base( str );\n}\n\n\n// EXPORTS //\n\nexport default uncapitalize;\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","spacePad","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","setReadOnly","configurable","enumerable","writable","setNonEnumerableReadOnly","isString","FLG","Symbol","hasToStringTagSupport","toStringTag","has","hasOwnProperty","hasOwnProp","property","Sym","toStrTag","hasToStringTag","v","isOwn","tag","nativeClass","valueOf","test","isPrimitive","isObject","RE_CHARS","rescape","s","isBoolean","Bool","Boolean","self","window","global","globalThis","root","codegen","Function","GlobalThis","Self","Win","Global","getGlobal","nodeList","document","childNodes","typedarray","Int8Array","reFunctionName","RE_FUNCTION_NAME","REGEXP","main$i","arrayfcn","predicate","len","isObjectLike","isBuffer","_isBuffer","constructor","constructorName","name","ctor","arrayfun","ctorName","type","isFunction","typeOf","RegExp","isRegExp","search","newval","removePunctuation","REGEXP_PREFIXES","REGEXP_SUFFIXES","extend","arr","ext","tokenizeSubstring","done","res","prefixes","suffixes","EMOJIS","ABBRS","CONTRACT","split","unshift","pop","keepWhitespace","subtkns","substrs","cache","TYPE","isAccessorArray","GETTERS","complex128","idx","complex64","default","getter","dtype","float64","float32","int32","int16","int8","uint32","uint16","uint8","uint8c","generic","ctor2dtypes","Float32Array","Float64Array","Int16Array","Int32Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray","Complex64Array","Complex128Array","BooleanArray","hasFloat64Array","hasFloat64ArraySupport","bool","GlobalFloat64Array","NaN","Float64Array$1","hasFloat32Array","FLOAT64_PINF","Number","POSITIVE_INFINITY","GlobalFloat32Array","PINF","hasFloat32ArraySupport","Float32Array$1","hasUint32Array","isUint32Array","UINT32_MAX","GlobalUint32Array","hasUint32ArraySupport","Uint32Array$1","hasInt32Array","GlobalInt32Array","INT32_MAX","hasInt32ArraySupport","Int32Array$1","hasUint16Array","GlobalUint16Array","UINT16_MAX","hasUint16ArraySupport","Uint16Array$1","hasInt16Array","GlobalInt16Array","INT16_MAX","hasInt16ArraySupport","Int16Array$1","hasUint8Array","GlobalUint8Array","UINT8_MAX","hasUint8ArraySupport","Uint8Array$1","hasUint8ClampedArray","GlobalUint8ClampedArray","hasUint8ClampedArraySupport","Uint8ClampedArray$1","hasInt8Array","GlobalInt8Array","INT8_MAX","hasInt8ArraySupport","Int8Array$1","main$7","FLOAT64_NINF","NEGATIVE_INFINITY","floor","isInteger","x","NINF","isInt","isNonNegativeInteger","MAX_ARRAY_LENGTH","isArrayLikeObject","MAX_LENGTH","MAX_TYPED_ARRAY_LENGTH","isCollection","hasArrayBuffer","ArrayBuffer","isArrayBuffer","isPrimitiveArray","isObjectArray","isStringArray","Complex128","real","imag","this","setEnumerableReadOnly","re","im","fround","FLOAT32_VIEW","float64ToFloat32$1","Complex64","float64ToFloat32","isComplexLike","isEven","BYTES_PER_ELEMENT","isComplex64Array","isComplex128Array","hasIteratorSymbolSupport","iterator","IteratorSymbol","setNonEnumerableReadOnlyAccessor","z","reinterpret","offset","buffer","byteOffset","fromIterator","it","next","realf","imagf","HAS_ITERATOR_SYMBOL","isComplexArray","_length","_buffer","isComplexArrayConstructor","getComplex64","buf","nargs","fromArray","RangeError","reinterpret64","reinterpret128","byteLength","ITERATOR_SYMBOL","src","thisArg","clbk","tmp","flg","accessorGetter","fromIteratorMap","target","start","copyWithin","iter","entries","end","fcn","searchElement","fromIndex","separator","sep","join","keys","outbuf","reducer","initialValue","acc","N","sbuf","outlen","compareFcn","sort","begin","locales","options","opts","loc","toLocaleString","values","index","getComplex128","isBooleanArray","isBooleanArrayConstructor","val","a","b","CTORS","DTYPES","NTYPES","ctor2dtype","factory","dt","getProto","Obj","getPrototypeOf","proto","getProto$1","objectPrototype","isPlainObject","isPrototypeOf","key","ownProps","validate","stopwords","RE_HYPHEN","atob","globalAtob","Buffer","require$$0","GlobalBuffer","from","hasNodeBufferSupport","string2buffer","Buffer$1","encoding","string2buffer$1","RE_NON_ASCII","hasAtobSupport","atob$1","capitalize","trim","base$4","HAS_BUILTIN","RE_WHITESPACE","RE_SPECIAL","RE_TO_CAMEL","RE_CAMEL","replacer","p1","camelcase","Ox10000","Ox400","OxD800","OxDBFF","OxDC00","OxDFFF","codePointAt","backward","code","low","hi","charCodeAt","constantcase","min","y","isNegativeZero","ns","s1","s2","temp","row","pre","m","k","dotcase","endsWith","endsWith$2","first","reUtf16SurrogatePair","RE_UTF16_SURROGATE_PAIR","RE_UTF16_LOW_SURROGATE","RE_UTF16_HIGH_SURROGATE","ch1","ch2","cnt","hasUTF16SurrogatePairAt","consts","CR","LF","Control","Extend","RegionalIndicator","SpacingMark","L","V","T","LV","LVT","Other","Prepend","ZWJ","NotBreak","BreakStart","Break","BreakLastRegional","BreakPenultimateRegional","ExtendedPictographic","every","lastIndexOf","constants","breaks","emoji","nextEmoji","M","count","breakType","grapheme","breakProperty","emojiProperty","nextGraphemeClusterBreak","cp","forEach","ch","brk","REGEXP_STRING","reWhitespace","capture","REGEXP_CAPTURE","startcase","cap","headercase","kebabCase","last","isPositiveInteger","SETTERS","setter","arraylike2object","data","accessorProtocol","accessors","accessorSetter","CircularBuffer","_count","_i","cbuf","filled","niters","iteratorSymbol","toArray","repeat","base$3","rpt","ceil","lpad","trimLeft","ltrim","base$2","RE_TO_PASCAL","pascalcase","Ox3F","Ox80","OxC0","OxE0","OxF0","Ox3FF","Ox800","OxE000","utf16ToUTF8Array","UNDERSCORE","PERIOD","HYPHEN","TILDE","ZERO","NINE","A","Z","percentEncode","byte","removeFirst","removeLast","numGraphemeClusters","total","replaceBefore","replacement","reverse","cluster","rpad","trimRight","rtrim","base$1","sliceString","numCodePoints","max","snakecase","startsWith","position","setNonEnumerableReadWriteAccessor","isProbability","wrap","noop","FLOAT64_MAX_SAFE_INTEGER","isPositiveZero","imul","la","lb","mul","gcopy","strideX","offsetX","strideY","offsetY","xbuf","ybuf","ix","iy","ox","oy","foo","isFunctionNameSupported","FLOAT16_PINF","Float16Array","setReadWriteAccessor","f16round","isfinite","FLOAT16_EPSILON","FLOAT16_SMALLEST_NORMAL","INVERSE_EPSILON","mod","isNaN","isFiniteNumber","FLOAT16_MIN","f16","FLOAT16_NINF","UINT32_VIEW","toWordf","FLOAT32_EXPONENT_BIAS","EXP_MASK","FLOAT32_SIGNIFICAND_MASK","UINT16_NAN","UINT16_PINF","UINT16_NINF","UINT16_POSITIVE_ZERO","UINT16_NEGATIVE_ZERO","FLOAT32_IMPLICIT_BIT","FLOAT32_SUBNORMAL_STICKY_MASK","FLOAT32_STICKY_MASK","MAX_MANTISSA","toWord","f32Exponent","f16Exponent","stickyBits","mantissa","roundBit","shift","mant","isnanf","isNegativeZerof","absf","w","getWord","BIAS","exponent","FLOAT64_MAX_BASE2_EXPONENT","FLOAT64_MIN_BASE2_EXPONENT","round","FLOAT64_EXPONENT_BIAS","FLOAT64_MAX_BASE2_EXPONENT_SUBNORMAL","FLOAT64_MIN_BASE2_EXPONENT_SUBNORMAL","isInfinite","FLOAT64_HIGH_WORD_SIGN_MASK","FLOAT64_HIGH_WORD_ABS_MASK","ctors","uint16view","HIGH","LOW","isLittleEndian","indices$3","FLOAT64_VIEW","indices","toWords","stride","assign","HIGH$3","getHighWord","indices$1","fromWords","high","WORDS","FLOAT64_SMALLEST_NORMAL","SCALAR","normalize","FLOAT64_HIGH_WORD_EXPONENT_MASK","TWO52_INV","CLEAR_EXP_MASK","FRAC","ldexp","frac","exp","hx","hy","floatExp","MIN_SUBNORMAL_EXPONENT","ABS_MASK","SIGN_MASK","MAX_EXPONENT","MAX_SUBNORMAL_EXPONENT","exp2","px","xx","polyvalP","polyvalQ","fromWord","word","isFloat16Array","isFloatingPointArrayConstructor","ctx","_get","ndarray","GlobalFloat16Array","hasFloat16ArraySupport","polyfill","TypedArray","Dummy","fcnName","hasHasInstanceSymbolSupport","hasInstance","HasInstanceSymbol","hasSupport","instanceOf","typeName","typedarray2json","NAMES","isTypedArray","isComplexTypedArray","MAX","randuint32","random","MAX_SEED","SEED_ARRAY_INIT_STATE","UPPER_MASK","LOWER_MASK","KNUTH_MULTIPLIER","MAGIC_MULTIPLIER_1","MAGIC_MULTIPLIER_2","TEMPERING_COEFFICIENT_1","TEMPERING_COEFFICIENT_2","MAG01","MATRIX_A","FLOAT64_NORMALIZATION_CONSTANT","TWO_26","TWO_32","ONE","MAX_NORMALIZED","STATE_ARRAY_VERSION","NUM_STATE_SECTIONS","STATE_SECTION_OFFSET","OTHER_SECTION_OFFSET","SEED_SECTION_OFFSET","STATE_FIXED_LENGTH","verifyState","state","createState","umul","STATE","seed","slen","copy","initState","mt19937","setReadOnlyAccessor","getSeed","getSeedLength","getState","setState","getStateLength","getStateSize","toJSON","normalized","NAME","params","r","twist","rand","prng","p","randu","constantFunction","seedLength","stateLength","bernoulli","uncapitalize","bytes","distances","firstCodePoint","firstGraphemeCluster","forEachCodePoint","forEachGraphemeCluster","kebabcase","lastCodePoint","lastGraphemeCluster","removeFirstCodePoint","removeFirstGraphemeCluster","removeLastCodePoint","removeLastGraphemeCluster","reverseCodePoints","reverseGraphemeClusters","totalCodePoints","codePoints","numClusters","result","char","seq","finalLength","seqLength","strLength","seqStart","seqEnd","MODES","FCNS","code_point","code_unit","firstCodeUnit","isMode","contains","forEachCodeUnit","UNICODE_MAX","lastCodeUnit","splitGraphemeClusters","ONES","TENS","pluralize","int2wordsDE","rem","UNITS","VAL","DE","int2wordsEN","EN","isNan","LANGUAGE_CODES","lang","decimals","prevGraphemeClusterBreak","ans","removeFirstCodeUnit","removeLastCodeUnit","reverseCodeUnit","isWellFormed","isWellFormedString","string","isStopWord","words","STOPWORDS","mode","cb","pt","chars","nElems","reStr","isStr","parts","nright","nleft","isodd","left","centerRight","ignoreCase","list","graphemeClusters2iterator","graphemeClusters2iteratorRight","modifiedString","ending","endingLength","nVisual","idx2","idx1"],"mappings":";gRAsBA,IAAIA,EAA0C,mBAA1BC,OAAOC,eAAkCD,OAAOC,eAAiB,KCiCrF,IAAIA,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,EA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MAErBmD,GAAUhB,EAGf,MAAUnC,GAAQA,GAAQ,MAC1B,OAAUA,GAAQA,GAAQ,MAErBmD,GAAUf,EAGf,MAAUpC,GAAQA,GAAQ,MAC1B,OAAUA,GAAQA,GAAQ,MAErBmD,GAAUd,EAGR,QAATrC,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,OAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,OAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,GACS,QAATA,EAEOmD,GAAUb,GAGf,OAAUtC,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,GAAQ,OAC1B,OAAUA,GAAQA,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AAYzO,GADZuO,EAAMA,GAAO,OAGbjb,EAAY,EACPtM,GAFL0nB,EAAY1O,GAAqBhjB,IAGhC,OAAOA,EAER,GAAKgK,EAAMynB,EAAY,EACtB,OAAOF,EAAI5sB,MAAO,EAAGqF,GAKtB,IAHA2nB,EAAWvJ,IAASpe,EAAMynB,GAAc,GACxCG,EAASF,EAAYjgB,IAASzH,EAAMynB,GAAc,GAClD4D,EAAU,EACFA,EAAU1D,GAEjBrb,EADAif,EAAOpW,GAA0Bnf,EAAKsW,GAEtC+e,GAAW,EAGZ,IADAC,EAAOC,EACCD,EAAO,MACdA,EAAOnW,GAA0Bnf,EAAKsW,KACzBsb,EAAStb,EAAY+e,IAGlC/e,EAAYgf,EACZD,GAAW,EAEZ,OAAOr1B,EAAImE,UAAW,EAAGoxB,GAAShE,EAAMvxB,EAAImE,UAAWmxB,EACxD,IjCodA5uB,EAAamtB,GAAQ,gBkC1hBrB,SAAuB7zB,GACtB,IAAM+G,EAAU/G,GACf,MAAM,IAAI6D,UAAWiB,GAAQ,kEAAmE9E,IAEjG,OAAOgB,GAAMhB,EACd,IlC+hBA0G,EAAamtB,GAAQ,YAAajzB,IAUlC8F,EAAamtB,GAAQ,mBAAoB1R","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,79,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106,107,108,109,110,111,112,113,114,115,116,117,118,119,120,121,122,123,124,125,126,127,128,129,130,131,132,133,134,135,136,137,138,139,140,141,142,143,144,145,146,147,148,149,150,151,152,153,154,155,156,157,158,159,160,161,162,163,164,165,166,167,168,169,170,171,172,173,174,175,176,177,178,179,180,181,182,183,184,185,186,187,188,189,190,191,192,193,194,195,196,197,198,199,200,201,202,203,204,205,206,207,208,209,210,211,212,213,214,215,216,217,218,219,220,221,222,224,226,228,229,230,231,232,233,234,235,236,239,252,253,254,265,266,267,270,282,283,284,285,287,292,293,294,295,296,297,298,299,300,302,303,309,338,346,347,348,349,350,351,352,353,354,355,356,357,358,359,360,361,362,363,364,365,366,367,368,369,370,371,372,373,374,375,376,377,378,379,380,381,382,383,384,385,386,387,388,389,390,391,392,393,394,395,396,397,398,399,400,401,402,403,404,405,406,407,408,409,410,411,412,413,414,415,416,417,418,419,420,421,422,423,424,425,426,427,428,429,430,431,432,433,434,435,436,437,438,439,440,441,442,443,444,445,446,447,448,449,451,463,466,474,475,476,477,479,488,489,490,491,492,500]} \ No newline at end of file diff --git a/kebabcase/README.md b/kebabcase/README.md deleted file mode 100644 index 0b0a81e7..00000000 --- a/kebabcase/README.md +++ /dev/null @@ -1,209 +0,0 @@ - - -# kebabcase - -> Convert a string to kebab case. - - - -
- -## Usage - -```javascript -var kebabcase = require( '@stdlib/string/kebabcase' ); -``` - -#### kebabcase( str ) - -Converts a string to kebab case. - -```javascript -var str = kebabcase( 'Foo Bar' ); -// returns 'foo-bar' - -str = kebabcase( 'I am a tiny little house' ); -// returns 'i-am-a-tiny-little-house' - -str = kebabcase( 'Hello World!' ); -// returns 'hello-world' -``` - -
- - - - - -
- -## Examples - -```javascript -var kebabcase = require( '@stdlib/string/kebabcase' ); - -var str = 'foo bar baz'; -var out = kebabcase( str ); -// returns 'foo-bar-baz' - -str = 'foo_baz'; -out = kebabcase( str ); -// returns 'foo-baz' - -str = 'foo-bar-baz!'; -out = kebabcase( str ); -// returns 'foo-bar-baz' - -str = 'beep boop!'; -out = kebabcase( str ); -// returns 'beep-boop' - -str = 'foo-baz'; -out = kebabcase( str ); -// returns 'foo-baz' - -str = 'Welcome! 😀'; -out = kebabcase( str ); -// returns 'welcome-😀' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: kebabcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beEp booP\nisMobile' | kebabcase --split /\r?\n/ - - # Escaped... - $ echo -n $'beEp booP\nisMobile' | kebabcase --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ kebabcase 'hello world!' -hello-world -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beEp booP' | kebabcase -beep-boop -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep_boop\tisMobile' | kebabcase --split '\t' -beep-boop -is-mobile -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/kebabcase/benchmark/benchmark.js b/kebabcase/benchmark/benchmark.js deleted file mode 100644 index af63e3e9..00000000 --- a/kebabcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var kebabcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = kebabcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/kebabcase/bin/cli b/kebabcase/bin/cli deleted file mode 100755 index d83ed3c4..00000000 --- a/kebabcase/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var kebabcase = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( kebabcase( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( kebabcase( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/kebabcase/docs/repl.txt b/kebabcase/docs/repl.txt deleted file mode 100644 index 1e1d8ea4..00000000 --- a/kebabcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to kebab case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Kebab-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'hello-world' - > out = {{alias}}( 'I am a tiny little teapot' ) - 'i-am-a-tiny-little-teapot' - - See Also - -------- diff --git a/kebabcase/docs/types/index.d.ts b/kebabcase/docs/types/index.d.ts deleted file mode 100644 index 3ab82131..00000000 --- a/kebabcase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to kebab case. -* -* @param str - string to convert -* @returns kebab-cased string -* -* @example -* var str = kebabcase( 'fooBar' ); -* // returns 'foo-bar' -* -* @example -* var str = kebabcase( 'foo_bar' ); -* // returns 'foo-bar' -* -* @example -* var str = kebabcase( 'foo-bar' ); -* // returns 'foo-bar' -*/ -declare function kebabcase( str: string ): string; - - -// EXPORTS // - -export = kebabcase; diff --git a/kebabcase/docs/types/test.ts b/kebabcase/docs/types/test.ts deleted file mode 100644 index f84a88f6..00000000 --- a/kebabcase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import kebabcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - kebabcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - kebabcase( true ); // $ExpectError - kebabcase( false ); // $ExpectError - kebabcase( null ); // $ExpectError - kebabcase( undefined ); // $ExpectError - kebabcase( 5 ); // $ExpectError - kebabcase( [] ); // $ExpectError - kebabcase( {} ); // $ExpectError - kebabcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - kebabcase(); // $ExpectError -} diff --git a/kebabcase/docs/usage.txt b/kebabcase/docs/usage.txt deleted file mode 100644 index f35d6d11..00000000 --- a/kebabcase/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: kebabcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/kebabcase/etc/cli_opts.json b/kebabcase/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/kebabcase/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/kebabcase/examples/index.js b/kebabcase/examples/index.js deleted file mode 100644 index 996a6ddd..00000000 --- a/kebabcase/examples/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 kebabcase = require( './../lib' ); - -var str = 'foo bar baz'; -var out = kebabcase( str ); -console.log( out ); -// => 'foo-bar-baz' - -str = 'foo_baz'; -out = kebabcase( str ); -console.log( out ); -// => 'foo-baz' - -str = 'foo-bar-baz!'; -out = kebabcase( str ); -console.log( out ); -// => 'foo-bar-baz' - -str = 'beep boop!'; -out = kebabcase( str ); -console.log( out ); -// => 'beep-boop' - -str = 'foo-baz'; -out = kebabcase( str ); -console.log( out ); -// => 'foo-baz' - -str = 'Welcome! 😀'; -out = kebabcase( str ); -console.log( out ); -// => 'welcome-😀' diff --git a/kebabcase/lib/index.js b/kebabcase/lib/index.js deleted file mode 100644 index b1777ba8..00000000 --- a/kebabcase/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to kebab case. -* -* @module @stdlib/string/kebabcase -* -* @example -* var kebabcase = require( '@stdlib/string/kebabcase' ); -* -* var str = kebabcase( 'Foo Bar' ); -* // returns 'foo-bar' -* -* str = kebabcase( 'I am a tiny little house' ); -* // returns 'i-am-a-tiny-little-house' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/kebabcase/lib/main.js b/kebabcase/lib/main.js deleted file mode 100644 index 942d330a..00000000 --- a/kebabcase/lib/main.js +++ /dev/null @@ -1,67 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/kebabcase' ); - - -// MAIN // - -/** -* Converts a string to kebab case. -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {string} kebab-cased string -* -* @example -* var str = kebabCase( 'Hello World!' ); -* // returns 'hello-world' -* -* @example -* var str = kebabCase( 'foo bar' ); -* // returns 'foo-bar' -* -* @example -* var str = kebabCase( 'I am a tiny little teapot' ); -* // returns 'i-am-a-tiny-little-teapot' -* -* @example -* var str = kebabCase( 'BEEP boop' ); -* // returns 'beep-boop' -* -* @example -* var str = kebabCase( 'isMobile' ); -* // returns 'is-mobile' -*/ -function kebabCase( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = kebabCase; diff --git a/kebabcase/package.json b/kebabcase/package.json deleted file mode 100644 index 23f49d12..00000000 --- a/kebabcase/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/kebabcase", - "version": "0.0.0", - "description": "Convert a string to kebab case.", - "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" - } - ], - "bin": { - "kebabcase": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "case", - "convert", - "kebab" - ], - "__stdlib__": {} -} diff --git a/kebabcase/test/fixtures/stdin_error.js.txt b/kebabcase/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/kebabcase/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/kebabcase/test/test.cli.js b/kebabcase/test/test.cli.js deleted file mode 100644 index e3833efe..00000000 --- a/kebabcase/test/test.cli.js +++ /dev/null @@ -1,263 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a string argument to kebab case', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'Hello World!\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'hello-world\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nisMobile"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep-boop\nis-mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep-boop\nis-mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep-boop\nis-mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/kebabcase/test/test.js b/kebabcase/test/test.js deleted file mode 100644 index a210406a..00000000 --- a/kebabcase/test/test.js +++ /dev/null @@ -1,224 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 kebabcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof kebabcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - kebabcase( value ); - }; - } -}); - -tape( 'the function converts a string to kebab case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo', - 'foo-bar', - 'fooBar', - 'foo_bar', - 'foo-bar-baz', - 'foo_bar_baz', - 'foo bar baz', - 'foo bar baz qux', - 'foo_bar_baz_qux', - 'foo_bar baz qux' - ]; - - expected = [ - 'foo', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar-baz', - 'foo-bar-baz', - 'foo-bar-baz', - 'foo-bar-baz-qux', - 'foo-bar-baz-qux', - 'foo-bar-baz-qux' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( kebabcase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function converts a camel case string to kebab case', function test( t ) { - var expected; - var actual; - var str; - - str = 'helloWorld'; - expected = 'hello-world'; - actual = kebabcase( str ); - - str = 'isMobile'; - expected = 'is-mobile'; - actual = kebabcase( str ); - - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to kebab case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'fóoBár', - 'ру́сский язык', - '😀😀 😀', - 'ру́сский язы́к', - 'Привет мир', - '안녕하세요', - '你好世界', - '신규 서비스' - ]; - expected = [ - 'fóo-bár', - 'ру́сский-язык', - '😀😀-😀', - 'ру́сский-язы́к', - 'привет-мир', - '안녕하세요', - '你好世界', - '신규-서비스' - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( kebabcase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function converts a string with special characters to kebab case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo!bar', - 'foo@bar', - 'foo#bar', - 'foo$bar', - 'foo%bar', - 'foo^bar', - 'foo&bar', - 'foo*bar', - 'foo(bar', - 'foo)bar', - 'foo[bar', - 'foo]bar', - 'foo{bar', - 'foo}bar', - 'foo|bar', - 'foo~bar', - 'foo:"bar', - 'foo\'bar', - 'foobar', - 'foo?bar', - 'foo/bar' - ]; - - expected = [ - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar', - 'foo-bar' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( kebabcase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function leaves a string unchanged that is already in kebab case', function test( t ) { - var expected; - var actual; - - expected = 'foo-bar'; - actual = kebabcase( expected ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'client-side-rendering'; - actual = kebabcase( expected ); - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); diff --git a/last/README.md b/last/README.md deleted file mode 100644 index ed2023ce..00000000 --- a/last/README.md +++ /dev/null @@ -1,227 +0,0 @@ - - -# last - -> Return the last character(s) of a string. - -
- -## Usage - -```javascript -var last = require( '@stdlib/string/last' ); -``` - -#### last( str\[, n]\[, options] ) - -Returns the last character(s) of a string. - -```javascript -var out = last( 'last man standing' ); -// returns 'g' - -out = last( 'Hidden Treasures' ); -// returns 's' -``` - -The function supports the following options: - -- **mode**: type of characters to return. Must be one of the following: - - - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - - Default: `'grapheme'`. - -By default, the function returns the last character. To return the last `n` characters, provide a second argument specifying the number of characters to return. - -```javascript -var out = last( 'foo bar', 3 ); -// returns 'bar' - -out = last( 'foo bar', 10 ); -// returns 'foo bar' -``` - -
- - - - - -
- -## Notes - -- By default, the function assumes the general case in which an input string may contain an arbitrary number of grapheme clusters. This assumption comes with a performance cost. Accordingly, if an input string is known to only contain visual characters of a particular type (e.g., only alphanumeric), one can achieve better performance by specifying the appropriate `mode` option. - -
- - - -
- -## Examples - - - -```javascript -var last = require( '@stdlib/string/last' ); - -var str = last( 'last man standing' ); -// returns 'g' - -str = last( 'presidential election' ); -// returns 'n' - -str = last( 'javaScript' ); -// returns 't' - -str = last( 'Hidden Treasures' ); -// returns 's' - -str = last( 'The Last of the Mohicans', 8 ); -// returns 'Mohicans' - -str = last( '🐶🐮🐷🐰🐸', 2 ); -// returns '🐰🐸' - -str = last( '🐶🐮🐷🐰🐸', 10 ); -// returns '🐶🐮🐷🐰🐸' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: last [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n num Number of characters to return. Default: 1. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --mode mode Type of character to return. Default: 'grapheme'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nboop' | last --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nboop' | last --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ last beep -p -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep\nboop' | last --n=2 -ep -op -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tboop' | last --split '\t' -p -p -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/last/benchmark/benchmark.js b/last/benchmark/benchmark.js deleted file mode 100644 index 5bc61d53..00000000 --- a/last/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var last = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = last( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=grapheme', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'grapheme' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = last( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=code_point', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'code_point' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = last( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=code_unit', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'code_unit' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = last( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/last/bin/cli b/last/bin/cli deleted file mode 100755 index 659742b8..00000000 --- a/last/bin/cli +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var last = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var opts; - var cli; - var n; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - if ( flags.n ) { - n = parseInt( flags.n, 10 ); - } else { - n = 1; - } - opts = {}; - if ( flags.mode ) { - opts.mode = flags.mode; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - try { - console.log( last( args[ 0 ], n, opts ) ); // eslint-disable-line no-console - } catch ( error ) { - return cli.error( error ); - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - if ( lines.length ) { - try { - console.log( last( lines[ 0 ], n, opts ) ); // eslint-disable-line no-console - } catch ( error ) { - return cli.error( error ); - } - for ( i = 1; i < lines.length; i++ ) { - console.log( last( lines[ i ], n, opts ) ); // eslint-disable-line no-console - } - } - } -} - -main(); diff --git a/last/docs/repl.txt b/last/docs/repl.txt deleted file mode 100644 index 20b38de7..00000000 --- a/last/docs/repl.txt +++ /dev/null @@ -1,48 +0,0 @@ - -{{alias}}( str[, n][, options] ) - Returns the last character(s) of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer (optional) - Number of characters to return. Default: 1. - - options: Object (optional) - Options. - - options.mode: string (optional) - Type of characters to return. The following modes are supported: - - - grapheme: grapheme clusters. Appropriate for strings containing visual - characters which can span multiple Unicode code points (e.g., emoji). - - code_point: Unicode code points. Appropriate for strings containing - visual characters which are comprised of more than one Unicode code - unit (e.g., ideographic symbols and punctuation and mathematical - alphanumerics). - - code_unit': UTF-16 code units. Appropriate for strings containing - visual characters drawn from the basic multilingual plane (BMP) (e.g., - common characters, such as those from the Latin, Greek, and Cyrillic - alphabets). - - Default: 'grapheme'. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var out = {{alias}}( 'beep' ) - 'p' - > out = {{alias}}( 'Boop', 2 ) - 'op' - > out = {{alias}}( 'foo bar', 3 ) - 'bar' - - See Also - -------- - diff --git a/last/docs/types/index.d.ts b/last/docs/types/index.d.ts deleted file mode 100644 index ebabaea1..00000000 --- a/last/docs/types/index.d.ts +++ /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. -*/ - -// TypeScript Version: 4.1 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/** -* Interface describing function options. -*/ -interface Options { - /** - * Specifies the type of characters to return (default: 'grapheme'). - * - * ## Notes - * - * - The following option values are supported: - * - * - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - * - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - * - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - */ - mode?: 'grapheme' | 'code_point' | 'code_unit'; -} - -/** -* Returns the last `n` characters of a string. -* -* @param str - input string -* @param n - number of characters to return -* @param options - options -* @returns output string -* -* @example -* var out = last( 'last man standing', 2 ); -* // returns 'ng' -* -* @example -* var out = last( '🐶🐮🐷🐰🐸', 2, { -* 'mode': 'grapheme' -* }); -* // returns '🐰🐸' -*/ -declare function last( str: string, n: number, options?: Options ): string; - -/** -* Returns the last character of a string. -* -* @param str - input string -* @param options - options -* @returns output string -* -* @example -* var out = last( 'last man standing', { -* 'mode': 'code_unit' -* }); -* // returns 'g' -* -* @example -* var out = last( '🐶🐮🐷🐰🐸', { -* 'mode': 'grapheme' -* }); -* // returns '🐸' -*/ -declare function last( str: string, options?: Options ): string; - -/** -* Returns the last character(s) of a string. -* -* @param str - input string -* @param n - number of characters to return (default: 1) -* @returns output string -* -* @example -* var out = last( 'last man standing' ); -* // returns 'g' -* -* @example -* var out = last( 'presidential election' ); -* // returns 'n' -* -* @example -* var out = last( 'javaScript' ); -* // returns 't' -* -* @example -* var out = last( 'Hidden Treasures' ); -* // returns 's' -* -* @example -* var out = last( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐰🐸' -* -* @example -* var out = last( 'foo bar', 3 ); -* // returns 'bar' -*/ -declare function last( str: string, n?: number ): string; - - -// EXPORTS // - -export = last; diff --git a/last/docs/types/test.ts b/last/docs/types/test.ts deleted file mode 100644 index d5f37d5c..00000000 --- a/last/docs/types/test.ts +++ /dev/null @@ -1,111 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import last = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - last( 'abc' ); // $ExpectType string - last( 'abc', 1 ); // $ExpectType string - last( 'abc', {} ); // $ExpectType string - last( 'abc', 1, {} ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - last( true ); // $ExpectError - last( false ); // $ExpectError - last( null ); // $ExpectError - last( undefined ); // $ExpectError - last( 5 ); // $ExpectError - last( [] ); // $ExpectError - last( {} ); // $ExpectError - last( ( x: number ): number => x ); // $ExpectError - - last( true, 1 ); // $ExpectError - last( false, 1 ); // $ExpectError - last( null, 1 ); // $ExpectError - last( undefined, 1 ); // $ExpectError - last( 5, 1 ); // $ExpectError - last( [], 1 ); // $ExpectError - last( {}, 1 ); // $ExpectError - last( ( x: number ): number => x, 1 ); // $ExpectError - - last( true, {} ); // $ExpectError - last( false, {} ); // $ExpectError - last( null, {} ); // $ExpectError - last( undefined, {} ); // $ExpectError - last( 5, {} ); // $ExpectError - last( [], {} ); // $ExpectError - last( {}, {} ); // $ExpectError - last( ( x: number ): number => x, {} ); // $ExpectError - - last( true, 1, {} ); // $ExpectError - last( false, 1, {} ); // $ExpectError - last( null, 1, {} ); // $ExpectError - last( undefined, 1, {} ); // $ExpectError - last( 5, 1, {} ); // $ExpectError - last( [], 1, {} ); // $ExpectError - last( {}, 1, {} ); // $ExpectError - last( ( x: number ): number => x, 1, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an invalid second argument... -{ - last( 'abc', true ); // $ExpectError - last( 'abc', false ); // $ExpectError - last( 'abc', null ); // $ExpectError - last( 'abc', '' ); // $ExpectError - last( 'abc', [] ); // $ExpectError - last( 'abc', ( x: number ): number => x ); // $ExpectError - - last( 'abc', true, {} ); // $ExpectError - last( 'abc', false, {} ); // $ExpectError - last( 'abc', null, {} ); // $ExpectError - last( 'abc', '', {} ); // $ExpectError - last( 'abc', [], {} ); // $ExpectError - last( 'abc', {}, {} ); // $ExpectError - last( 'abc', ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an invalid `mode` option... -{ - last( 'abc', { 'mode': true } ); // $ExpectError - last( 'abc', { 'mode': false } ); // $ExpectError - last( 'abc', { 'mode': null } ); // $ExpectError - last( 'abc', { 'mode': '' } ); // $ExpectError - last( 'abc', { 'mode': [] } ); // $ExpectError - last( 'abc', { 'mode': ( x: number ): number => x } ); // $ExpectError - - last( 'abc', 1, { 'mode': true } ); // $ExpectError - last( 'abc', 1, { 'mode': false } ); // $ExpectError - last( 'abc', 1, { 'mode': null } ); // $ExpectError - last( 'abc', 1, { 'mode': '' } ); // $ExpectError - last( 'abc', 1, { 'mode': [] } ); // $ExpectError - last( 'abc', 1, { 'mode': {} } ); // $ExpectError - last( 'abc', 1, { 'mode': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - last(); // $ExpectError - last( 'abc', 1, {}, {} ); // $ExpectError -} diff --git a/last/docs/usage.txt b/last/docs/usage.txt deleted file mode 100644 index 8e24879d..00000000 --- a/last/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: last [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n num Number of characters to return. Default: 1. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --mode mode Type of character to return. Default: 'grapheme'. diff --git a/last/etc/cli_opts.json b/last/etc/cli_opts.json deleted file mode 100644 index 2ceae458..00000000 --- a/last/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "string": [ - "n", - "split", - "mode" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/last/examples/index.js b/last/examples/index.js deleted file mode 100644 index 7e5e6b5b..00000000 --- a/last/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 last = require( './../lib' ); - -console.log( last( 'last man standing' ) ); -// => 'g' - -console.log( last( 'presidential election' ) ); -// => 'n' - -console.log( last( 'javaScript' ) ); -// => 't' - -console.log( last( 'Hidden Treasures' ) ); -// => 's' - -console.log( last( 'The Last of the Mohicans', 8 ) ); -// => 'Mohicans' - -console.log( last( '🐶🐮🐷🐰🐸', 2 ) ); -// => '🐰🐸' - -console.log( last( '🐶🐮🐷🐰🐸', 10 ) ); -// => '🐶🐮🐷🐰🐸' diff --git a/last/lib/index.js b/last/lib/index.js deleted file mode 100644 index d366fde4..00000000 --- a/last/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the last character(s) of a string. -* -* @module @stdlib/string/last -* -* @example -* var last = require( '@stdlib/string/last' ); -* -* var out = last( 'last man standing' ); -* // returns 'g' -* -* out = last( 'Hidden Treasures' ); -* // returns 's' -* -* out = last( '🐮🐷🐸🐵', 2 ); -* // returns '🐸🐵' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/last/lib/main.js b/last/lib/main.js deleted file mode 100644 index 74eb1b81..00000000 --- a/last/lib/main.js +++ /dev/null @@ -1,131 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isPlainObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var lastCodeUnit = require( './../../base/last' ); -var lastCodePoint = require( './../../base/last-code-point' ); -var lastGraphemeCluster = require( './../../base/last-grapheme-cluster' ); -var format = require( './../../format' ); - - -// VARIABLES // - -var MODES = [ 'grapheme', 'code_point', 'code_unit' ]; -var FCNS = { - 'grapheme': lastGraphemeCluster, - 'code_point': lastCodePoint, - 'code_unit': lastCodeUnit -}; -var isMode = contains( MODES ); - - -// MAIN // - -/** -* Returns the last character(s) of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} [n=1] - number of characters to return -* @param {Options} [options] - options -* @param {string} [options.mode="grapheme"] - type of "character" to return (must be either `grapheme`, `code_point`, or `code_unit`) -* @throws {TypeError} last argument must be a string -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @returns {string} output string -* -* @example -* var out = last( 'last man standing' ); -* // returns 'g' -* -* @example -* var out = last( 'presidential election' ); -* // returns 'n' -* -* @example -* var out = last( 'javaScript' ); -* // returns 't' -* -* @example -* var out = last( 'Hidden Treasures' ); -* // returns 's' -* -* @example -* var out = last( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐰🐸' -* -* @example -* var out = last( 'foo bar', 3 ); -* // returns 'bar' -*/ -function last( str ) { - var options; - var nargs; - var opts; - var n; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - opts = { - 'mode': 'grapheme' - }; - nargs = arguments.length; - if ( nargs === 1 ) { - n = 1; - } else if ( nargs === 2 ) { - n = arguments[ 1 ]; - if ( isPlainObject( n ) ) { - options = n; - n = 1; - } else if ( !isNonNegativeInteger( n ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) ); - } - } else { // nargs > 2 - n = arguments[ 1 ]; - if ( !isNonNegativeInteger( n ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) ); - } - options = arguments[ 2 ]; - if ( !isPlainObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - } - if ( options ) { - if ( hasOwnProp( options, 'mode' ) ) { - opts.mode = options.mode; - if ( !isMode( opts.mode ) ) { - throw new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Value: `%s`.', 'mode', MODES.join( '", "' ), opts.mode ) ); - } - } - } - return FCNS[ opts.mode ]( str, n ); -} - - -// EXPORTS // - -module.exports = last; diff --git a/last/package.json b/last/package.json deleted file mode 100644 index 4467cb8b..00000000 --- a/last/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/last", - "version": "0.0.0", - "description": "Return the last character(s) of a string.", - "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" - } - ], - "bin": { - "last": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "last", - "character", - "char", - "grapheme", - "unicode", - "codepoint" - ] -} diff --git a/last/test/fixtures/stdin_error.js.txt b/last/test/fixtures/stdin_error.js.txt deleted file mode 100644 index c7e3c506..00000000 --- a/last/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/last/test/test.cli.js b/last/test/test.cli.js deleted file mode 100644 index dbce6097..00000000 --- a/last/test/test.cli.js +++ /dev/null @@ -1,389 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface returns the last character of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'p\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface returns the last `n` characters of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--n=2\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'ep\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the type of characters to return', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--mode=code_point\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'p\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'if provided an invalid option, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--mode=foo\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString().length > 0, true, 'expected value' ); - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'p\np\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream (return `n` characters)', opts, function test( t ) { - var cmd = [ - 'printf "foo\nbar"', - '|', - EXEC_PATH, - fpath, - '--n=2' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'oo\nar\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'o\nr\nz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the type of characters to return when used as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf \'foo\nbar\nbaz\'', - '|', - EXEC_PATH, - fpath, - '--mode code_point' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'o\nr\nz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'o\nr\nz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if provided an invalid option, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--mode=foo' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString().length > 0, true, 'expected value' ); - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/last/test/test.js b/last/test/test.js deleted file mode 100644 index 5dc3f06d..00000000 --- a/last/test/test.js +++ /dev/null @@ -1,406 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 last = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof last, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - last( value ); - }; - } -}); - -tape( 'the function throws an error if not provided a string (options)', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - last( value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided a second argument which is not a nonnegative integer', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3.14, - null, - true, - void 0, - NaN, - [], - 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() { - last( 'beep', value ); - }; - } -}); - -tape( 'the function throws an error if provided a second argument which is not a nonnegative integer (options)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3.14, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - last( 'beep', value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - last( 'beep', 1, value ); - }; - } -}); - -tape( 'the function throws an error if provided a `mode` option which is not a supported mode (second argument)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - last( 'beep', { - 'mode': value - }); - }; - } -}); - -tape( 'the function throws an error if provided a `mode` option which is not a supported mode (third argument)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - last( 'beep', 1, { - 'mode': value - }); - }; - } -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( last( '' ), '', 'returns expected value' ); - t.strictEqual( last( '', 1 ), '', 'returns expected value' ); - t.strictEqual( last( '', {} ), '', 'returns expected value' ); - t.strictEqual( last( '', 1, {} ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the last character of a provided string', function test( t ) { - var out; - - out = last( 'hello world' ); - t.strictEqual( out, 'd', 'returns expected value' ); - - out = last( '!!!' ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = last( 'Hello' ); - t.strictEqual( out, 'o', 'returns expected value' ); - - out = last( 'अनुच्छेद' ); - t.strictEqual( out, 'द', 'returns expected value' ); - - out = last( '六书/六書' ); - t.strictEqual( out, '書', 'returns expected value' ); - - out = last( '🌷' ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns an empty string if provided zero as the second argument', function test( t ) { - var out; - - out = last( 'hello world', 0 ); - t.strictEqual( out, '', 'returns expected value' ); - - out = last( 'JavaScript', 0, {} ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the last `n` characters of a provided string (default)', function test( t ) { - var out; - - out = last( 'hello world', 1 ); - t.strictEqual( out, 'd', 'returns expected value' ); - - out = last( 'hello world', 7 ); - t.strictEqual( out, 'o world', 'returns expected value' ); - - out = last( '!!!', 1 ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = last( '!!!', 2 ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = last( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'द', 'returns expected value' ); - - out = last( '六书/六書', 1 ); - t.strictEqual( out, '書', 'returns expected value' ); - - out = last( '🌷', 1 ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - out = last( '👉🏿', 1 ); - t.strictEqual( out, '👉🏿', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the last `n` characters of a provided string (mode=grapheme)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'grapheme' - }; - - out = last( 'hello world', 1, opts ); - t.strictEqual( out, 'd', 'returns expected value' ); - - out = last( 'hello world', 7, opts ); - t.strictEqual( out, 'o world', 'returns expected value' ); - - out = last( '!!!', 1, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = last( '!!!', 2, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = last( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'द', 'returns expected value' ); - - out = last( '六书/六書', 1, opts ); - t.strictEqual( out, '書', 'returns expected value' ); - - out = last( '🌷', 1, opts ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - out = last( '👉🏿', 1, opts ); - t.strictEqual( out, '👉🏿', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the last `n` characters of a provided string (mode=code_point)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'code_point' - }; - - out = last( 'hello world', 1, opts ); - t.strictEqual( out, 'd', 'returns expected value' ); - - out = last( 'hello world', 7, opts ); - t.strictEqual( out, 'o world', 'returns expected value' ); - - out = last( '!!!', 1, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = last( '!!!', 2, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = last( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'द', 'returns expected value' ); - - out = last( '六书/六書', 1, opts ); - t.strictEqual( out, '書', 'returns expected value' ); - - out = last( '🌷', 1, opts ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - out = last( '👉🏿', 1, opts ); - t.strictEqual( out, '🏿', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports returning the last `n` characters of a provided string (mode=code_unit)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'code_unit' - }; - - out = last( 'hello world', 1, opts ); - t.strictEqual( out, 'd', 'returns expected value' ); - - out = last( 'hello world', 7, opts ); - t.strictEqual( out, 'o world', 'returns expected value' ); - - out = last( '!!!', 1, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = last( '!!!', 2, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = last( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'द', 'returns expected value' ); - - out = last( '六书/六書', 1, opts ); - t.strictEqual( out, '書', 'returns expected value' ); - - out = last( '🌷', 1, opts ); - t.strictEqual( out, '\udf37', 'returns expected value' ); - - out = last( '👉🏿', 1, opts ); - t.strictEqual( out, '\udfff', 'returns expected value' ); - - t.end(); -}); diff --git a/left-pad/README.md b/left-pad/README.md deleted file mode 100644 index 0fa32458..00000000 --- a/left-pad/README.md +++ /dev/null @@ -1,233 +0,0 @@ - - -# lpad - -> Left pad a string. - -
- -## Usage - -```javascript -var lpad = require( '@stdlib/string/left-pad' ); -``` - -#### lpad( str, len\[, pad] ) - -Left pads a string such that the padded string has a length of **at least** `len`. - -```javascript -var str = lpad( 'a', 5 ); -// returns ' a' -``` - -By default, an input string is padded with a Unicode "space" character (U+0020). To pad with a different character or sequence of characters, provide a `pad` string. - -```javascript -var str = lpad( 'beep', 10, 'b' ); -// returns 'bbbbbbbeep' - -str = lpad( 'boop', 12, 'beep' ); -// returns 'beepbeepboop' -``` - -
- - - -
- -## Notes - -- An output string is **not** guaranteed to have a length of **exactly** `len`, but to have a length of **at least** `len`. To generate a padded string having a length equal to `len` - - ```javascript - var str = lpad( 'boop', 10, 'beep' ); // => length 12 - // returns 'beepbeepboop' - - str = str.substring( str.length-10 ); // => length 10 - // returns 'epbeepboop' - ``` - -- This function differs from [`String.prototype.padStart`][mdn-string-padstart] in the following ways: - - - The function is **not** guaranteed to return a string having a length exactly equal to `len` (as explained above). - - The function does **not** truncate `pad` (from the end) in order to ensure the returned string has length `len`. - - To replicate [`String.prototype.padStart`][mdn-string-padstart] truncation behavior - - ```javascript - var floorb = require( '@stdlib/math/base/special/floorb' ); - - function padStart( str, len, pad ) { - var n; - if ( len <= str.length ) { - return str; - } - n = floorb( len-str.length, 1, pad.length ) + str.length; - return pad.substring( 0, len-n ) + lpad( str, n, pad ); - } - - var str = padStart( 'boop', 10, 'beep' ); - // returns 'bebeepboop' - ``` - -
- - - -
- -## Examples - - - -```javascript -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var lpad = require( '@stdlib/string/left-pad' ); - -var str = 'beep'; -var i; -for ( i = 0; i < 100; i++ ) { - console.log( lpad( str, discreteUniform( str.length, str.length+10 ), 'b' ) ); -} -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: lpad [options] --len= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --len length Minimum string length. - --pad str String used to pad. Default: ' '. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nboop' | lpad -len 8 --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nboop' | lpad -len 8 --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ lpad beep --len 10 --pad b -bbbbbbbeep -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep' | lpad --len 8 - beep -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'boop\tbeep' | lpad --len 8 --split '\t' - boop - beep -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/left-pad/benchmark/benchmark.builtin.js b/left-pad/benchmark/benchmark.builtin.js deleted file mode 100644 index a852062f..00000000 --- a/left-pad/benchmark/benchmark.builtin.js +++ /dev/null @@ -1,106 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; - - -// VARIABLES // - -var opts = { - 'skip': typeof String.prototype.padStart !== 'function' -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - string length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'a', - 'b', - 'c' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = 'beep'.padStart( len, values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - 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 = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - len = 10 * i; - f = createBenchmark( len ); - bench( format( '%s::builtin:len=%d', pkg, len ), opts, f ); - } -} - -main(); diff --git a/left-pad/benchmark/benchmark.js b/left-pad/benchmark/benchmark.js deleted file mode 100644 index d5c059bd..00000000 --- a/left-pad/benchmark/benchmark.js +++ /dev/null @@ -1,100 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var lpad = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - string length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'a', - 'b', - 'c' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = lpad( 'beep', len, values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - 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 = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - len = 10 * i; - f = createBenchmark( len ); - bench( format( '%s:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/left-pad/bin/cli b/left-pad/bin/cli deleted file mode 100755 index 0376dfd0..00000000 --- a/left-pad/bin/cli +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var lpad = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - var len; - var pad; - var str; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - if ( args.length ) { - str = args[ 0 ]; - } else { - // Treat an empty value as an empty string: - str = ''; - } - len = parseInt( flags.len, 10 ); - pad = flags.pad || ' '; - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( lpad( str, len, pad ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( lpad( lines[ i ], len, pad ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/left-pad/docs/repl.txt b/left-pad/docs/repl.txt deleted file mode 100644 index f06bc97b..00000000 --- a/left-pad/docs/repl.txt +++ /dev/null @@ -1,38 +0,0 @@ - -{{alias}}( str, len[, pad] ) - Left pads a string such that the padded string has a length of at least - `len`. - - An output string is not guaranteed to have a length of exactly `len`, but to - have a length of at least `len`. To generate a padded string having a length - equal to `len`, post-process a padded string by trimming off excess - characters. - - Parameters - ---------- - str: string - Input string. - - len: integer - Minimum string length. - - pad: string (optional) - String used to pad. Default: ' '. - - Returns - ------- - out: string - Padded string. - - Examples - -------- - > var out = {{alias}}( 'a', 5 ) - ' a' - > out = {{alias}}( 'beep', 10, 'b' ) - 'bbbbbbbeep' - > out = {{alias}}( 'boop', 12, 'beep' ) - 'beepbeepboop' - - See Also - -------- - diff --git a/left-pad/docs/types/index.d.ts b/left-pad/docs/types/index.d.ts deleted file mode 100644 index 99cf557f..00000000 --- a/left-pad/docs/types/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Left pads a string such that the padded string has a length of at least `len`. -* -* ## Notes -* -* - An output string is not guaranteed to have a length of exactly `len`, but to have a length of at least `len`. To generate a padded string having a length equal to `len`, post-process a padded string by trimming off excess characters. -* -* @param str - string to pad -* @param len - minimum string length -* @param pad - string used to pad (default: ' ') -* @throws second argument must be a nonnegative integer -* @throws padding must have a length greater than `0` -* @returns padded string -* -* @example -* var str = lpad( 'a', 5 ); -* // returns ' a' -* -* @example -* var str = lpad( 'beep', 10, 'b' ); -* // returns 'bbbbbbbeep' -* -* @example -* var str = lpad( 'boop', 12, 'beep' ); -* // returns 'beepbeepboop' -*/ -declare function lpad( str: string, len: number, pad?: string ): string; - - -// EXPORTS // - -export = lpad; diff --git a/left-pad/docs/types/test.ts b/left-pad/docs/types/test.ts deleted file mode 100644 index 183bcc59..00000000 --- a/left-pad/docs/types/test.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import lpad = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - lpad( 'abd', 5, ' ' ); // $ExpectType string - lpad( 'abd', 4, 'x' ); // $ExpectType string - lpad( 'abd', 10 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - lpad( true, 6 ); // $ExpectError - lpad( false, 6 ); // $ExpectError - lpad( 3, 6 ); // $ExpectError - lpad( [], 6 ); // $ExpectError - lpad( {}, 6 ); // $ExpectError - lpad( ( x: number ): number => x, 6 ); // $ExpectError - - lpad( 'abd', true ); // $ExpectError - lpad( 'abd', false ); // $ExpectError - lpad( 'abd', 'abc' ); // $ExpectError - lpad( 'abd', [], 0 ); // $ExpectError - lpad( 'abd', {}, 0 ); // $ExpectError - lpad( 'abd', ( x: number ): number => x, 0 ); // $ExpectError - - lpad( 'abd', 6, true ); // $ExpectError - lpad( 'abd', 6, false ); // $ExpectError - lpad( 'abd', 6, 123 ); // $ExpectError - lpad( 'abd', 6, [] ); // $ExpectError - lpad( 'abd', 6, {} ); // $ExpectError - lpad( 'abd', 6, /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - lpad(); // $ExpectError - lpad( 'abc' ); // $ExpectError -} diff --git a/left-pad/docs/usage.txt b/left-pad/docs/usage.txt deleted file mode 100644 index a0223bbe..00000000 --- a/left-pad/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: lpad [options] --len= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --len length Minimum string length. - --pad str String used to pad. Default: ' '. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/left-pad/etc/cli_opts.json b/left-pad/etc/cli_opts.json deleted file mode 100644 index 702361cc..00000000 --- a/left-pad/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "string": [ - "len", - "pad", - "split" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/left-pad/examples/index.js b/left-pad/examples/index.js deleted file mode 100644 index 798e9ef0..00000000 --- a/left-pad/examples/index.js +++ /dev/null @@ -1,28 +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'; - -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var lpad = require( './../lib' ); - -var str = 'beep'; -var i; -for ( i = 0; i < 100; i++ ) { - console.log( lpad( str, discreteUniform( str.length, str.length+10 ), 'b' ) ); -} diff --git a/left-pad/lib/index.js b/left-pad/lib/index.js deleted file mode 100644 index bef33142..00000000 --- a/left-pad/lib/index.js +++ /dev/null @@ -1,46 +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'; - -/** -* Left pad a string such that the padded string has a length of at least `len`. -* -* @module @stdlib/string/left-pad -* -* @example -* var lpad = require( '@stdlib/string/left-pad' ); -* -* var str = lpad( 'a', 5 ); -* // returns ' a' -* -* str = lpad( 'beep', 10, 'b' ); -* // returns 'bbbbbbbeep' -* -* str = lpad( 'boop', 12, 'beep' ); -* // returns 'beepbeepboop' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/left-pad/lib/main.js b/left-pad/lib/main.js deleted file mode 100644 index 9e040e54..00000000 --- a/left-pad/lib/main.js +++ /dev/null @@ -1,84 +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 isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var FLOAT64_MAX_SAFE_INTEGER = require( '@stdlib/constants/float64/max-safe-integer' ); -var base = require( './../../base/left-pad' ); - - -// MAIN // - -/** -* Left pads a string such that the padded string has a length of at least `len`. -* -* @param {string} str - string to pad -* @param {NonNegativeInteger} len - minimum string length -* @param {string} [pad=' '] - string used to pad -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {TypeError} third argument must be a string -* @throws {RangeError} padding must have a length greater than `0` -* @returns {string} padded string -* -* @example -* var str = lpad( 'a', 5 ); -* // returns ' a' -* -* @example -* var str = lpad( 'beep', 10, 'b' ); -* // returns 'bbbbbbbeep' -* -* @example -* var str = lpad( 'boop', 12, 'beep' ); -* // returns 'beepbeepboop' -*/ -function lpad( str, len, pad ) { - var p; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isNonNegativeInteger( len ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) ); - } - if ( arguments.length > 2 ) { - p = pad; - if ( !isString( p ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', p ) ); - } - if ( p.length === 0 ) { - throw new RangeError( 'invalid argument. Third argument must not be an empty string.' ); - } - } else { - p = ' '; - } - if ( len > FLOAT64_MAX_SAFE_INTEGER ) { - throw new RangeError( format( 'invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.', len ) ); - } - return base( str, len, p ); -} - - -// EXPORTS // - -module.exports = lpad; diff --git a/left-pad/package.json b/left-pad/package.json deleted file mode 100644 index 992ee65e..00000000 --- a/left-pad/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/left-pad", - "version": "0.0.0", - "description": "Left pad a string.", - "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" - } - ], - "bin": { - "lpad": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "pad", - "string", - "str", - "padding", - "lpad", - "left", - "cli" - ] -} diff --git a/left-pad/test/fixtures/stdin_error.js.txt b/left-pad/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/left-pad/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/left-pad/test/test.cli.js b/left-pad/test/test.cli.js deleted file mode 100644 index 528443f2..00000000 --- a/left-pad/test/test.cli.js +++ /dev/null @@ -1,293 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var replace = require( './../../replace' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints a string left-padded with spaces', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--len=8\'; process.argv[ 3 ] = \'beep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === ' beep\n', true, 'prints expected value to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints a string left-padded with a custom pad string', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--len=9\'; process.argv[ 3 ] = \'--pad=!#\'; process.argv[ 4 ] = \'world\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === '!#!#world\n', true, 'prints expected value to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop"', - '|', - EXEC_PATH, - fpath, - '--len=6', - '--pad=!' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '!!beep\n!!boop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'', - '--len=6', - '--pad=!' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '!!beep\n!!boop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/', - '--len=6', - '--pad=!' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '!!beep\n!!boop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/left-pad/test/test.js b/left-pad/test/test.js deleted file mode 100644 index 8a1a40a2..00000000 --- a/left-pad/test/test.js +++ /dev/null @@ -1,156 +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 lpad = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof lpad, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if the first argument is not a string, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - 5, - true, - false, - 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() { - lpad( value, 10 ); - }; - } -}); - -tape( 'if the second argument is not a nonnegative integer, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - '5', - 3.14, - -5, - true, - false, - 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() { - lpad( 'beep', value ); - }; - } -}); - -tape( 'if the third argument is not a string, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - 5, - true, - false, - 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() { - lpad( 'beep', 10, value ); - }; - } -}); - -tape( 'if the output string will exceed the maximum allowed string length, the function will throw an error', function test( t ) { - t.throws( foo, RangeError, 'throws RangeError' ); - t.end(); - function foo() { - lpad( 'beep', 1e300 ); - } -}); - -tape( 'if provided an empty pad string, the function throws an error', function test( t ) { - t.throws( foo, RangeError, 'throws RangeError' ); - t.end(); - function foo() { - lpad( 'beep', 10, '' ); - } -}); - -tape( 'by default, the function left pads a string with spaces', function test( t ) { - var str = lpad( 'a', 5 ); - t.strictEqual( str, ' a', 'left padded with spaces' ); - t.end(); -}); - -tape( 'the function supports left padding a string with a custom pad string', function test( t ) { - var str = lpad( 'beep', 10, 'b' ); - t.strictEqual( str, 'bbbbbbbeep', 'left padded to desired length' ); - t.end(); -}); - -tape( 'the function left pads a string such that an output string may exceed the specified length (minimum bound)', function test( t ) { - var str = lpad( 'a', 5, 'beepboop' ); - t.strictEqual( str, 'beepboopa', 'left padded and length exceeds minimum length' ); - t.end(); -}); - -tape( 'if the specified string length is less than or equal to the input string length, the function returns the input string', function test( t ) { - t.strictEqual( lpad( 'boop', 2, 'beep' ), 'boop', 'returns input string (<)' ); - t.strictEqual( lpad( 'boop', 4, 'beep' ), 'boop', 'returns input string (=)' ); - t.end(); -}); diff --git a/left-trim-n/README.md b/left-trim-n/README.md deleted file mode 100644 index 450afd14..00000000 --- a/left-trim-n/README.md +++ /dev/null @@ -1,232 +0,0 @@ - - -# ltrimN - -> Trim `n` characters from the beginning of a string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var ltrimN = require( '@stdlib/string/left-trim-n' ); -``` - -#### ltrimN( str, n\[, chars] ) - -Trims `n` characters from the beginning of a string. - -```javascript -var str = ' foo '; -var out = ltrimN( str, str.length ); -// returns 'foo ' - -out = ltrimN( str, 1 ); -// returns ' foo ' -``` - -By default, the function trims whitespace characters. To trim a different set of characters instead, provide a string or an array of characters to trim: - -```javascript -var str = '🐶🐶🐶 Animals 🐶🐶🐶'; -var out = ltrimN( str, str.length, [ '🐶', ' ' ] ); -// returns 'Animals 🐶🐶🐶' - -out = ltrimN( str, str.length, '🐶 ' ); -// returns 'Animals 🐶🐶🐶' -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var ltrimN = require( '@stdlib/string/left-trim-n' ); - -var out = ltrimN( ' Whitespace ', 3 ); -// returns 'Whitespace ' - -out = ltrimN( '\t\t\tTabs\t\t\t', 2 ); -// returns '\tTabs\t\t\t' - -out = ltrimN( '~~~CUSTOM~~~', 3, '~' ); -// returns 'CUSTOM~~~' -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: ltrimn [options] --n= - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n number Number of characters to trim. - --chars str Characters to trim. Default: whitespace. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $' foo \n bar \n' | ltrimn --split /\r?\n/ - - # Escaped... - $ echo -n $' foo \n bar \n' | ltrimn --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - - - -
- -### Examples - -```bash -$ ltrimn ' Whitespace ' --n=3 -Whitespace -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n '~~~beep~boop~' | ltrimn --n=2 --chars '~' -~beep~boop~ -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n '~~~foo~~~\t~~~bar~~~\t~~~baz~~~' | ltrimn --split '\t' --chars '~' --n=3 -foo~~~ -bar~~~ -baz~~~ -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/left-trim-n/benchmark/benchmark.js b/left-trim-n/benchmark/benchmark.js deleted file mode 100644 index 80a44c0e..00000000 --- a/left-trim-n/benchmark/benchmark.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var ltrimN = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var whitespace; - var str; - var out; - var i; - - whitespace = '\\f\\n\\r\\t\\v\\u0020\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = whitespace + fromCodePoint( i%126 ) + 'eep boop'; - out = ltrimN( str, i % 10 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::chars_array', pkg ), function benchmark( b ) { - var whitespace; - var str; - var out; - var i; - - whitespace = [ - '\f', - '\n', - '\r', - '\t', - '\v', - ' ' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = whitespace.join( '' ) + fromCodePoint( i%126 ) + 'eep boop'; - out = ltrimN( str, i % 10, whitespace ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::chars_string', pkg ), function benchmark( b ) { - var whitespace; - var str; - var out; - var i; - - whitespace = '\\f\\n\\r\\t\\v'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = whitespace + fromCodePoint( i%126 ) + 'eep boop'; - out = ltrimN( str, i % 10, whitespace ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/left-trim-n/bin/cli b/left-trim-n/bin/cli deleted file mode 100755 index 79d28b67..00000000 --- a/left-trim-n/bin/cli +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var ltrimN = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var chars; - var flags; - var args; - var opts; - var cli; - var n; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - n = parseInt( flags.n, 10 ); - if ( flags.chars ) { - chars = flags.chars; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - opts = {}; - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - opts.split = reFromString( flags.split ); - } else { - opts.split = RE_EOL; - } - return stdin( onRead ); - } - if ( chars ) { - console.log( ltrimN( args[ 0 ], n, chars ) ); // eslint-disable-line no-console - } else { - console.log( ltrimN( args[ 0 ], n ) ); // eslint-disable-line no-console - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( opts.split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - if ( chars ) { - for ( i = 0; i < lines.length; i++ ) { - console.log( ltrimN( lines[ i ], n, chars ) ); // eslint-disable-line no-console - } - } else { - for ( i = 0; i < lines.length; i++ ) { - console.log( ltrimN( lines[ i ], n ) ); // eslint-disable-line no-console - } - } - } -} - -main(); diff --git a/left-trim-n/docs/repl.txt b/left-trim-n/docs/repl.txt deleted file mode 100644 index 5c3e668c..00000000 --- a/left-trim-n/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n[, chars] ) - Trims `n` characters from the beginning of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of characters to trim. - - chars: Array|string (optional) - Characters to trim. Default: whitespace characters. - - Returns - ------- - out: string - Trimmed string. - - Examples - -------- - > var out = {{alias}}( ' abc ', 2 ) - 'abc ' - > var out = {{alias}}( '!!!abc!!!', 2, '!' ) - '!abc!!!' - - See Also - -------- diff --git a/left-trim-n/docs/types/index.d.ts b/left-trim-n/docs/types/index.d.ts deleted file mode 100644 index 68786fbe..00000000 --- a/left-trim-n/docs/types/index.d.ts +++ /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. -*/ - -// TypeScript Version: 4.1 - -/** -* Trims `n` characters from the beginning of a string. -* -* @param str - input string -* @param n - number of characters to trim -* @param chars - characters to trim (default: whitespace characters) -* @returns trimmed string -* -* @example -* var str = ' abc '; -* var out = ltrimN( str, 2 ); -* // returns ' abc ' -* -* @example -* var str = ' abc '; -* var out = ltrimN( str, str.length ); -* // returns 'abc ' -* -* @example -* var str = '~~abc!~~'; -* var out = ltrimN( str, str.length, [ '~', '!' ] ); -* // returns 'abc!~~' -* -* @example -* var str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨'; -* var out = ltrimN( str, str.length, '👨🏼‍🎨🤖' ); -* // returns '' -*/ -declare function ltrimN( str: string, n: number, chars?: string | Array ): string; - - -// EXPORTS // - -export = ltrimN; diff --git a/left-trim-n/docs/types/test.ts b/left-trim-n/docs/types/test.ts deleted file mode 100644 index d5a6c336..00000000 --- a/left-trim-n/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import ltrimN = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - ltrimN( ' abc ', 3 ); // $ExpectType string - ltrimN( '~~~abc~~~', 3, '~' ); // $ExpectType -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - ltrimN( true, 6 ); // $ExpectError - ltrimN( false, 6 ); // $ExpectError - ltrimN( 3, 6 ); // $ExpectError - ltrimN( [], 6 ); // $ExpectError - ltrimN( {}, 6 ); // $ExpectError - ltrimN( ( x: number ): number => x, 6 ); // $ExpectError - - ltrimN( 'abd', true ); // $ExpectError - ltrimN( 'abd', false ); // $ExpectError - ltrimN( 'abd', 'abc' ); // $ExpectError - ltrimN( 'abd', [], 0 ); // $ExpectError - ltrimN( 'abd', {}, 0 ); // $ExpectError - ltrimN( 'abd', ( x: number ): number => x, 0 ); // $ExpectError - - ltrimN( 'abd', 6, true ); // $ExpectError - ltrimN( 'abd', 6, false ); // $ExpectError - ltrimN( 'abd', 6, 123 ); // $ExpectError - ltrimN( 'abd', 6, {} ); // $ExpectError - ltrimN( 'abd', 6, /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided an a third argument which is not a string or an array of strings... -{ - ltrimN( 'abc', 3, true ); // $ExpectError - ltrimN( 'abc', 3, false ); // $ExpectError - ltrimN( 'abc', 3, 123 ); // $ExpectError - ltrimN( 'abc', 3, {} ); // $ExpectError - ltrimN( 'abc', 3, [ true ] ); // $ExpectError - ltrimN( 'abc', 3, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - ltrimN(); // $ExpectError - ltrimN( 'abc' ); // $ExpectError -} diff --git a/left-trim-n/docs/usage.txt b/left-trim-n/docs/usage.txt deleted file mode 100644 index b98a0517..00000000 --- a/left-trim-n/docs/usage.txt +++ /dev/null @@ -1,11 +0,0 @@ - -Usage: ltrimn [options] --n= - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n number Number of characters to trim. - --chars str Characters to trim. Default: whitespace. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - diff --git a/left-trim-n/etc/cli_opts.json b/left-trim-n/etc/cli_opts.json deleted file mode 100644 index 8c4a5b6b..00000000 --- a/left-trim-n/etc/cli_opts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "string": [ - "n", - "chars" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/left-trim-n/examples/index.js b/left-trim-n/examples/index.js deleted file mode 100644 index bf2351a1..00000000 --- a/left-trim-n/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 ltrimN = require( './../lib' ); - -console.log( ltrimN( ' Whitespace ', 3 ) ); -// => 'Whitespace ' - -console.log( ltrimN( '\t\t\tTabs\t\t\t', 2 ) ); -// => '\tTabs\t\t\t' - -console.log( ltrimN( '~~~CUSTOM~~~', 3, '~' ) ); -// => 'CUSTOM~~~' diff --git a/left-trim-n/lib/index.js b/left-trim-n/lib/index.js deleted file mode 100644 index 43a3219a..00000000 --- a/left-trim-n/lib/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Trim `n` characters from the beginning of a string. -* -* @module @stdlib/string/left-trim-n -* -* @example -* var ltrimN = require( '@stdlib/string/left-trim-n' ); -* -* var str = 'foo '; -* var out = ltrimN( str, str.length ); -* // returns 'foo ' -* -* str = '🐶🐶🐶 Animals 🐶🐶🐶'; -* out = ltrimN( str, 4, [ '🐶', ' ' ] ); -* // returns 'Animals 🐶🐶🐶' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/left-trim-n/lib/main.js b/left-trim-n/lib/main.js deleted file mode 100644 index d0976dcf..00000000 --- a/left-trim-n/lib/main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var splitGraphemeClusters = require( './../../split-grapheme-clusters' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var replace = require( './../../replace' ); -var rescape = require( '@stdlib/utils/escape-regexp-string' ); -var format = require( './../../format' ); - - -// VARIABLES // - -var WHITESPACE_CHARS = '\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff'; - - -// MAIN // - -/** -* Trims `n` characters from the beginning of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of characters to trim -* @param {(string|StringArray)} [chars] - characters to trim (defaults to whitespace characters) -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {TypeError} third argument must be a string or an array of strings -* @returns {string} trimmed string -* -* @example -* var str = ' abc '; -* var out = ltrimN( str, 2 ); -* // returns ' abc ' -* -* @example -* var str = ' abc '; -* var out = ltrimN( str, str.length ); -* // returns 'abc ' -* -* @example -* var str = '~~abc!~~'; -* var out = ltrimN( str, str.length, [ '~', '!' ] ); -* // returns 'abc!~~' -* -* @example -* var str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨'; -* var out = ltrimN( str, str.length, '👨🏼‍🎨🤖' ); -* // returns '' -*/ -function ltrimN( str, n, chars ) { - var nElems; - var reStr; - var isStr; - var RE; - var i; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isNonNegativeInteger( n ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) ); - } - if ( arguments.length > 2 ) { - isStr = isString( chars ); - if ( !isStr && !isStringArray( chars ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be a string or an array of strings. Value: `%s`.', chars ) ); - } - if ( isStr ) { - chars = splitGraphemeClusters( chars ); - } - nElems = chars.length - 1; - reStr = ''; - for ( i = 0; i < nElems; i++ ) { - reStr += rescape( chars[ i ] ); - reStr += '|'; - } - reStr += rescape( chars[ nElems ] ); - - // Case: Trim a specific set of characters from the beginning of a string.. - RE = new RegExp( '^(?:' + reStr + '){0,'+n+'}' ); - } else { - // Case: Trim `n` whitespace characters from the beginning of a string... - RE = new RegExp( '^[' + WHITESPACE_CHARS + ']{0,'+n+'}' ); - } - return replace( str, RE, '' ); -} - - -// EXPORTS // - -module.exports = ltrimN; diff --git a/left-trim-n/package.json b/left-trim-n/package.json deleted file mode 100644 index b5e495c2..00000000 --- a/left-trim-n/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@stdlib/string/left-trim-n", - "version": "0.0.0", - "description": "Trim `n` characters from the beginning of a string.", - "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" - } - ], - "bin": { - "ltrimn": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "number", - "custom", - "characters", - "whitespace", - "remove", - "trim", - "trimming", - "replace" - ] -} diff --git a/left-trim-n/test/fixtures/stdin_error.js.txt b/left-trim-n/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/left-trim-n/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/left-trim-n/test/test.cli.js b/left-trim-n/test/test.cli.js deleted file mode 100644 index 540261ac..00000000 --- a/left-trim-n/test/test.cli.js +++ /dev/null @@ -1,266 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var EXEC_PATH = require( '@stdlib/process/exec-path' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface trims whitespace from the beginning of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \' beep boop\'; process.argv[ 3 ] = \'--n=2\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), ' beep boop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop \n hello world"', - '|', - EXEC_PATH, - fpath, - '--n=3' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep boop \nhello world\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \' foo \t bar \t baz \'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'', - '--n=3' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'foo \nbar \nbaz \n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \' foo \t bar \t baz \'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/', - '--n=3' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'foo \nbar \nbaz \n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/left-trim-n/test/test.js b/left-trim-n/test/test.js deleted file mode 100644 index 7e9be3c2..00000000 --- a/left-trim-n/test/test.js +++ /dev/null @@ -1,241 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 ltrimN = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ltrimN, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if the first argument is not a string primitive, the function throws an error', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - ltrimN( value, 2 ); - }; - } -}); - -tape( 'if the second argument is not a nonnegative integer, the function throws an error', function test( t ) { - var values; - var i; - - values = [ - '5', - -1, - -3.14, - null, - void 0, - true, - [], - {}, - 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() { - ltrimN( 'beep', value ); - }; - } -}); - -tape( 'if provided a third argument which is not a string or string array, the function throws an error', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - ltrimN( 'beep', 2, value ); - }; - } -}); - -tape( 'the function trims `n` left-most whitespace characters from a string', function test( t ) { - var expected; - var actual; - var str; - - str = '\t\tbeep\t\t'; - expected = 'beep\t\t'; - actual = ltrimN( str, 4 ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t\tbeep\t\t'; - expected = '\tbeep\t\t'; - actual = ltrimN( str, 1 ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t \nbeep\t \n'; - expected = 'beep\t \n'; - actual = ltrimN( str, str.length ); - - t.end(); -}); - -tape( 'the function trims `n` left-most whitespace characters from a string (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = '\u00A0\u00A0beep\u00A0\u00A0'; - expected = 'beep\u00A0\u00A0'; - actual = ltrimN( str, 4 ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\u00A0\u00A0beep\u00A0\u00A0'; - expected = '\u00A0beep\u00A0\u00A0'; - actual = ltrimN( str, 1 ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\u00A0 \nbeep\u00A0 \n'; - expected = 'beep\u00A0 \n'; - actual = ltrimN( str, str.length ); - - t.end(); -}); - -tape( 'the function trims `n` left-most custom characters from a string when provided a string array as the third argument', function test( t ) { - var expected; - var actual; - var str; - - str = '\t\tbeep\t\t'; - expected = 'beep\t\t'; - actual = ltrimN( str, 4, [ '\t' ] ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t\tbeep\t\t'; - expected = '\t\tbeep\t\t'; - actual = ltrimN( str, 1, [ '\n' ] ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t \nbeep\t \n'; - expected = ' \nbeep\t \n'; - actual = ltrimN( str, str.length, [ '\t', '\n' ] ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function trims `n` left-most custom characters from a string when provided a string array as the third argument (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = '\u00A0\u00A0beep\u00A0\u00A0'; - expected = 'beep\u00A0\u00A0'; - actual = ltrimN( str, 4, [ '\u00A0' ] ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨'; - expected = ''; - actual = ltrimN( str, str.length, [ '🤖', '👨🏼‍🎨' ] ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function trims `n` left-most custom characters from a string when provided a string as the third argument', function test( t ) { - var expected; - var actual; - var str; - - str = '\t\tbeep\t\t'; - expected = 'beep\t\t'; - actual = ltrimN( str, 4, '\t' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t\tbeep\t\t'; - expected = '\t\tbeep\t\t'; - actual = ltrimN( str, 1, '\n' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t \nbeep\t \n'; - expected = ' \nbeep\t \n'; - actual = ltrimN( str, str.length, '\t\n' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function trims `n` left-most custom characters from a string when provided a string as the third argument (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = '\u00A0\u00A0beep\u00A0\u00A0'; - expected = 'beep\u00A0\u00A0'; - actual = ltrimN( str, 4, '\u00A0' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨'; - expected = ''; - actual = ltrimN( str, str.length, '👨🏼‍🎨🤖' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/left-trim/README.md b/left-trim/README.md deleted file mode 100644 index 66f08ac7..00000000 --- a/left-trim/README.md +++ /dev/null @@ -1,209 +0,0 @@ - - -# ltrim - -> Trim whitespace characters from the beginning of a string. - -
- -## Usage - -```javascript -var ltrim = require( '@stdlib/string/left-trim' ); -``` - -#### ltrim( str ) - -Trims whitespace from the beginning of a string. - -```javascript -var out = ltrim( ' \r\n\t Beep \t\t\n ' ); -// returns 'Beep \t\t\n ' -``` - -
- - - -
- -## Notes - -- Following [Unicode 6.3.0][unicode] and later, "whitespace" is defined as the following characters: - - - `\f` - - `\n` - - `\r` - - `\t` - - `\v` - - `\u0020` - - `\u00a0` - - `\u1680` - - `\u2000-\u200a` - - `\u2028` - - `\u2029` - - `\u202f` - - `\u205f` - - `\u3000` - - `\ufeff` - -
- - - -
- -## Examples - - - -```javascript -var ltrim = require( '@stdlib/string/left-trim' ); - -var str = ltrim( ' Whitespace ' ); -// returns 'Whitespace ' - -str = ltrim( '\t\t\tTabs\t\t\t' ); -// returns 'Tabs\t\t\t' - -str = ltrim( '\n\n\nNew Lines\n\n\n' ); -// returns 'New Lines\n\n\n' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: ltrim [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $' foo \n bar ' | ltrim --split /\r?\n/ - - # Escaped... - $ echo -n $' foo \n bar ' | ltrim --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ ltrim ' beep boop' -beep boop -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n ' beep boop' | ltrim -beep boop -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n ' foo \t bar \t baz ' | ltrim --split '\t' -foo -bar -baz -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/left-trim/benchmark/benchmark.js b/left-trim/benchmark/benchmark.js deleted file mode 100644 index 3977d77e..00000000 --- a/left-trim/benchmark/benchmark.js +++ /dev/null @@ -1,90 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var ltrim = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( typeof String.prototype.trimLeft !== 'function' ) -}; -var whitespace = '\\u0020\\f\\n\\r\\t\\v\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff'; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - whitespace + 'beep boop', - whitespace + 'foo bar', - whitespace + 'xyz' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = ltrim( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::built-in', pkg ), opts, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - whitespace + 'beep boop', - whitespace + 'foo bar', - whitespace + 'xyz' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = values[ i%values.length ].trimLeft(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/left-trim/bin/cli b/left-trim/bin/cli deleted file mode 100755 index a838b45e..00000000 --- a/left-trim/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var ltrim = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( ltrim( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( ltrim( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/left-trim/docs/repl.txt b/left-trim/docs/repl.txt deleted file mode 100644 index 35b1914c..00000000 --- a/left-trim/docs/repl.txt +++ /dev/null @@ -1,40 +0,0 @@ - -{{alias}}( str ) - Trims whitespace from the beginning of a string. - - "Whitespace" is defined as the following characters: - - - \f - - \n - - \r - - \t - - \v - - \u0020 - - \u00a0 - - \u1680 - - \u2000-\u200a - - \u2028 - - \u2029 - - \u202f - - \u205f - - \u3000 - - \ufeff - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Trimmed string. - - Examples - -------- - > var out = {{alias}}( ' \r\n\t Beep \t\t\n ' ) - 'Beep \t\t\n ' - - See Also - -------- - diff --git a/left-trim/docs/types/index.d.ts b/left-trim/docs/types/index.d.ts deleted file mode 100644 index f366c96a..00000000 --- a/left-trim/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Trims whitespace characters from the beginning of a string. -* -* @param str - input string -* @returns trimmed string -* -* @example -* var out = ltrim( ' Whitespace ' ); -* // returns 'Whitespace ' -* -* @example -* var out = ltrim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs\t\t\t' -* -* @example -* var out = ltrim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines\n\n\n' -*/ -declare function ltrim( str: string ): string; - - -// EXPORTS // - -export = ltrim; diff --git a/left-trim/docs/types/test.ts b/left-trim/docs/types/test.ts deleted file mode 100644 index 5d40a4ed..00000000 --- a/left-trim/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import ltrim = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - ltrim( ' Whitespace ' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - ltrim( true ); // $ExpectError - ltrim( false ); // $ExpectError - ltrim( null ); // $ExpectError - ltrim( undefined ); // $ExpectError - ltrim( 5 ); // $ExpectError - ltrim( [] ); // $ExpectError - ltrim( {} ); // $ExpectError - ltrim( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - ltrim(); // $ExpectError -} diff --git a/left-trim/docs/usage.txt b/left-trim/docs/usage.txt deleted file mode 100644 index ffa09c22..00000000 --- a/left-trim/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: ltrim [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/left-trim/etc/cli_opts.json b/left-trim/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/left-trim/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/left-trim/examples/index.js b/left-trim/examples/index.js deleted file mode 100644 index 91804d63..00000000 --- a/left-trim/examples/index.js +++ /dev/null @@ -1,30 +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'; - -var ltrim = require( './../lib' ); - -console.log( ltrim( ' Whitespace ' ) ); -// => 'Whitespace ' - -console.log( ltrim( '\t\t\tTabs\t\t\t' ) ); -// => 'Tabs\t\t\t' - -console.log( ltrim( '\n\n\nNew Lines\n\n\n' ) ); -// => 'New Lines\n\n\n' diff --git a/left-trim/lib/index.js b/left-trim/lib/index.js deleted file mode 100644 index 59b7495f..00000000 --- a/left-trim/lib/index.js +++ /dev/null @@ -1,43 +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'; - -/** -* Trim whitespace characters from the beginning of a string. -* -* @module @stdlib/string/left-trim -* -* @example -* var ltrim = require( '@stdlib/string/left-trim' ); -* -* var out = ltrim( ' Whitespace ' ); -* // returns 'Whitespace ' -* -* out = ltrim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs\t\t\t' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/left-trim/lib/main.js b/left-trim/lib/main.js deleted file mode 100644 index 1089a35e..00000000 --- a/left-trim/lib/main.js +++ /dev/null @@ -1,59 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/left-trim' ); - - -// MAIN // - -/** -* Trims whitespace characters from the beginning of a string. -* -* @param {string} str - input string -* @throws {TypeError} must provide a string -* @returns {string} trimmed string -* -* @example -* var out = ltrim( ' Whitespace ' ); -* // returns 'Whitespace ' -* -* @example -* var out = ltrim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs\t\t\t' -* -* @example -* var out = ltrim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines\n\n\n' -*/ -function ltrim( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = ltrim; diff --git a/left-trim/package.json b/left-trim/package.json deleted file mode 100644 index 6809caf7..00000000 --- a/left-trim/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/left-trim", - "version": "0.0.0", - "description": "Trim whitespace characters from the beginning of a string.", - "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" - } - ], - "bin": { - "ltrim": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "whitespace", - "remove", - "trim", - "left", - "left trim", - "trimming" - ] -} diff --git a/left-trim/test/fixtures/stdin_error.js.txt b/left-trim/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/left-trim/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/left-trim/test/test.cli.js b/left-trim/test/test.cli.js deleted file mode 100644 index 5174688d..00000000 --- a/left-trim/test/test.cli.js +++ /dev/null @@ -1,263 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface trims whitespace from the beginning of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \' beep boop\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep boop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf " beep boop\n hello world "', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep boop\nhello world \n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \' foo \t bar \t baz \'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'foo \nbar \nbaz \n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \' foo \t bar \t baz \'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'foo \nbar \nbaz \n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/left-trim/test/test.js b/left-trim/test/test.js deleted file mode 100644 index d029327b..00000000 --- a/left-trim/test/test.js +++ /dev/null @@ -1,186 +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 ltrim = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ltrim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - ltrim( value ); - }; - } -}); - -tape( 'the function removes all whitespace characters at the beginning of a string', function test( t ) { - var expected; - var actual; - - expected = 'Whitespace '; - actual = ltrim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'Tabs\t\t\t'; - actual = ltrim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = 'New Lines\n\n\n'; - actual = ltrim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = 'New Lines\r\n\r\n\r\n'; - actual = ltrim( '\r\n\r\n\r\nNew Lines\r\n\r\n\r\n' ); - t.strictEqual( actual, expected, 'removes all newline and carriage return characters' ); - - expected = 'Beep \r\n \t'; - actual = ltrim( ' \t\r\n Beep \r\n \t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = ltrim( '\fbeep' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = ltrim( '\nbeep' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = ltrim( '\tbeep' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = ltrim( '\vbeep' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = ltrim( '\u1680beep' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = ltrim( '\u2000beep' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = ltrim( '\u2001beep' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = ltrim( '\u2002beep' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = ltrim( '\u2003beep' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = ltrim( '\u2004beep' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = ltrim( '\u2005beep' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = ltrim( '\u2006beep' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = ltrim( '\u2007beep' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = ltrim( '\u2008beep' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = ltrim( '\u2009beep' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = ltrim( '\u200abeep' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = ltrim( '\u2028beep' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = ltrim( '\u2029beep' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = ltrim( '\u202fbeep' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = ltrim( '\u205fbeep' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = ltrim( '\u3000beep' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = ltrim( '\ufeffbeep' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); - -tape( 'the function does not remove the Mongolian space separator in accordance with Unicode 6.3.0 and later', function test( t ) { - var expected; - var actual; - - expected = '\u180ebeep'; - actual = ltrim( '\u180ebeep' ); - t.strictEqual( actual, expected, 'does not remove \\u180e' ); - - t.end(); -}); diff --git a/lib/index.js b/lib/index.js deleted file mode 100644 index a0d3e249..00000000 --- a/lib/index.js +++ /dev/null @@ -1,559 +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'; - -/* -* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. -*/ - -/* -* The following modules are intentionally not exported: tools -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); - - -// MAIN // - -/** -* Top-level namespace. -* -* @namespace string -*/ -var string = {}; - -/** -* @name acronym -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/acronym} -*/ -setReadOnly( string, 'acronym', require( './../acronym' ) ); - -/** -* @name base -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/base} -*/ -setReadOnly( string, 'base', require( './../base' ) ); - -/** -* @name camelcase -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/camelcase} -*/ -setReadOnly( string, 'camelcase', require( './../camelcase' ) ); - -/** -* @name capitalize -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/capitalize} -*/ -setReadOnly( string, 'capitalize', require( './../capitalize' ) ); - -/** -* @name codePointAt -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/code-point-at} -*/ -setReadOnly( string, 'codePointAt', require( './../code-point-at' ) ); - -/** -* @name constantcase -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/constantcase} -*/ -setReadOnly( string, 'constantcase', require( './../constantcase' ) ); - -/** -* @name dotcase -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/dotcase} -*/ -setReadOnly( string, 'dotcase', require( './../dotcase' ) ); - -/** -* @name endsWith -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/ends-with} -*/ -setReadOnly( string, 'endsWith', require( './../ends-with' ) ); - -/** -* @name first -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/first} -*/ -setReadOnly( string, 'first', require( './../first' ) ); - -/** -* @name forEach -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/for-each} -*/ -setReadOnly( string, 'forEach', require( './../for-each' ) ); - -/** -* @name format -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/format} -*/ -setReadOnly( string, 'format', require( './../format' ) ); - -/** -* @name fromCodePoint -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/from-code-point} -*/ -setReadOnly( string, 'fromCodePoint', require( './../from-code-point' ) ); - -/** -* @name headercase -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/headercase} -*/ -setReadOnly( string, 'headercase', require( './../headercase' ) ); - -/** -* @name kebabcase -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/kebabcase} -*/ -setReadOnly( string, 'kebabcase', require( './../kebabcase' ) ); - -/** -* @name last -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/last} -*/ -setReadOnly( string, 'last', require( './../last' ) ); - -/** -* @name lpad -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/left-pad} -*/ -setReadOnly( string, 'lpad', require( './../left-pad' ) ); - -/** -* @name ltrim -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/left-trim} -*/ -setReadOnly( string, 'ltrim', require( './../left-trim' ) ); - -/** -* @name ltrimN -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/left-trim-n} -*/ -setReadOnly( string, 'ltrimN', require( './../left-trim-n' ) ); - -/** -* @name lowercase -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/lowercase} -*/ -setReadOnly( string, 'lowercase', require( './../lowercase' ) ); - -/** -* @name nextCodePointIndex -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/next-code-point-index} -*/ -setReadOnly( string, 'nextCodePointIndex', require( './../next-code-point-index' ) ); - -/** -* @name nextGraphemeClusterBreak -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/next-grapheme-cluster-break} -*/ -setReadOnly( string, 'nextGraphemeClusterBreak', require( './../next-grapheme-cluster-break' ) ); - -/** -* @name numCodePoints -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/num-code-points} -*/ -setReadOnly( string, 'numCodePoints', require( './../num-code-points' ) ); - -/** -* @name numGraphemeClusters -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/num-grapheme-clusters} -*/ -setReadOnly( string, 'numGraphemeClusters', require( './../num-grapheme-clusters' ) ); - -/** -* @name num2words -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/num2words} -*/ -setReadOnly( string, 'num2words', require( './../num2words' ) ); - -/** -* @name pad -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/pad} -*/ -setReadOnly( string, 'pad', require( './../pad' ) ); - -/** -* @name pascalcase -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/pascalcase} -*/ -setReadOnly( string, 'pascalcase', require( './../pascalcase' ) ); - -/** -* @name percentEncode -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/percent-encode} -*/ -setReadOnly( string, 'percentEncode', require( './../percent-encode' ) ); - -/** -* @name prevGraphemeClusterBreak -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/prev-grapheme-cluster-break} -*/ -setReadOnly( string, 'prevGraphemeClusterBreak', require( './../prev-grapheme-cluster-break' ) ); - -/** -* @name removeFirst -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/remove-first} -*/ -setReadOnly( string, 'removeFirst', require( './../remove-first' ) ); - -/** -* @name removeLast -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/remove-last} -*/ -setReadOnly( string, 'removeLast', require( './../remove-last' ) ); - -/** -* @name removePunctuation -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/remove-punctuation} -*/ -setReadOnly( string, 'removePunctuation', require( './../remove-punctuation' ) ); - -/** -* @name removeUTF8BOM -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/remove-utf8-bom} -*/ -setReadOnly( string, 'removeUTF8BOM', require( './../remove-utf8-bom' ) ); - -/** -* @name removeWords -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/remove-words} -*/ -setReadOnly( string, 'removeWords', require( './../remove-words' ) ); - -/** -* @name repeat -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/repeat} -*/ -setReadOnly( string, 'repeat', require( './../repeat' ) ); - -/** -* @name replace -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/replace} -*/ -setReadOnly( string, 'replace', require( './../replace' ) ); - -/** -* @name replaceBefore -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/replace-before} -*/ -setReadOnly( string, 'replaceBefore', require( './../replace-before' ) ); - -/** -* @name reverse -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/reverse} -*/ -setReadOnly( string, 'reverse', require( './../reverse' ) ); - -/** -* @name rpad -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/right-pad} -*/ -setReadOnly( string, 'rpad', require( './../right-pad' ) ); - -/** -* @name rtrim -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/right-trim} -*/ -setReadOnly( string, 'rtrim', require( './../right-trim' ) ); - -/** -* @name rtrimN -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/right-trim-n} -*/ -setReadOnly( string, 'rtrimN', require( './../right-trim-n' ) ); - -/** -* @name snakecase -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/snakecase} -*/ -setReadOnly( string, 'snakecase', require( './../snakecase' ) ); - -/** -* @name splitGraphemeClusters -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/split-grapheme-clusters} -*/ -setReadOnly( string, 'splitGraphemeClusters', require( './../split-grapheme-clusters' ) ); - -/** -* @name startcase -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/startcase} -*/ -setReadOnly( string, 'startcase', require( './../startcase' ) ); - -/** -* @name startsWith -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/starts-with} -*/ -setReadOnly( string, 'startsWith', require( './../starts-with' ) ); - -/** -* @name substringAfter -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/substring-after} -*/ -setReadOnly( string, 'substringAfter', require( './../substring-after' ) ); - -/** -* @name substringAfterLast -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/substring-after-last} -*/ -setReadOnly( string, 'substringAfterLast', require( './../substring-after-last' ) ); - -/** -* @name substringBefore -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/substring-before} -*/ -setReadOnly( string, 'substringBefore', require( './../substring-before' ) ); - -/** -* @name substringBeforeLast -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/substring-before-last} -*/ -setReadOnly( string, 'substringBeforeLast', require( './../substring-before-last' ) ); - -/** -* @name graphemeClusters2iterator -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/to-grapheme-cluster-iterator} -*/ -setReadOnly( string, 'graphemeClusters2iterator', require( './../to-grapheme-cluster-iterator' ) ); - -/** -* @name graphemeClusters2iteratorRight -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/to-grapheme-cluster-iterator-right} -*/ -setReadOnly( string, 'graphemeClusters2iteratorRight', require( './../to-grapheme-cluster-iterator-right' ) ); - -/** -* @name toWellFormed -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/to-well-formed} -*/ -setReadOnly( string, 'toWellFormed', require( './../to-well-formed' ) ); - -/** -* @name trim -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/trim} -*/ -setReadOnly( string, 'trim', require( './../trim' ) ); - -/** -* @name truncate -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/truncate} -*/ -setReadOnly( string, 'truncate', require( './../truncate' ) ); - -/** -* @name truncateMiddle -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/truncate-middle} -*/ -setReadOnly( string, 'truncateMiddle', require( './../truncate-middle' ) ); - -/** -* @name uncapitalize -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/uncapitalize} -*/ -setReadOnly( string, 'uncapitalize', require( './../uncapitalize' ) ); - -/** -* @name uppercase -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/uppercase} -*/ -setReadOnly( string, 'uppercase', require( './../uppercase' ) ); - -/** -* @name utf16ToUTF8Array -* @memberof string -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/utf16-to-utf8-array} -*/ -setReadOnly( string, 'utf16ToUTF8Array', require( './../utf16-to-utf8-array' ) ); - - -// EXPORTS // - -module.exports = string; diff --git a/lowercase/README.md b/lowercase/README.md deleted file mode 100644 index b2f4d793..00000000 --- a/lowercase/README.md +++ /dev/null @@ -1,159 +0,0 @@ - - -# lowercase - -> Convert a string to lowercase. - -
- -
- - - -
- -## Usage - -```javascript -var lowercase = require( '@stdlib/string/lowercase' ); -``` - -#### lowercase( str ) - -Converts a string to lowercase. - -```javascript -var str = lowercase( 'bEEp' ); -// returns 'beep' -``` - -
- - - -
- -## Examples - - - -```javascript -var lowercase = require( '@stdlib/string/lowercase' ); - -var str = lowercase( 'Beep' ); -// returns 'beep' - -str = lowercase( 'BeEp' ); -// returns 'beep' - -str = lowercase( 'Beep BOOP' ); -// returns 'beep boop' - -str = lowercase( '$**_Beep_BoOp_**$' ); -// returns '$**_beep_boop_**$' - -str = lowercase( '' ); -// returns '' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: lowercase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. -``` - -
- - - -
- -### Examples - -```bash -$ lowercase bEEp -beep -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'bEEp' | lowercase -beep -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/lowercase/benchmark/benchmark.js b/lowercase/benchmark/benchmark.js deleted file mode 100644 index 3ed12ae1..00000000 --- a/lowercase/benchmark/benchmark.js +++ /dev/null @@ -1,82 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var lowercase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'BEEP BOOP', - 'FOO BAR', - 'XYZ ABC' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = lowercase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::builtin', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'BEEP BOOP', - 'FOO BAR', - 'XYZ ABC' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = values[ i%values.length ].toLowerCase(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/lowercase/bin/cli b/lowercase/bin/cli deleted file mode 100755 index 5f747785..00000000 --- a/lowercase/bin/cli +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var lowercase = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - return stdin( onRead ); - } - console.log( lowercase( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - if ( error ) { - return cli.error( error ); - } - console.log( lowercase( data.toString() ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/lowercase/docs/repl.txt b/lowercase/docs/repl.txt deleted file mode 100644 index 3781869c..00000000 --- a/lowercase/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( str ) - Converts a string to lowercase. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Lowercase string. - - Examples - -------- - > var out = {{alias}}( 'bEEp' ) - 'beep' - - See Also - -------- - diff --git a/lowercase/docs/types/index.d.ts b/lowercase/docs/types/index.d.ts deleted file mode 100644 index 2d0b221e..00000000 --- a/lowercase/docs/types/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Converts a string to lowercase. -* -* @param str - string to convert -* @returns lowercase string -* -* @example -* var str = lowercase( 'bEEp' ); -* // returns 'beep' -*/ -declare function lowercase( str: S ): Lowercase; - - -// EXPORTS // - -export = lowercase; diff --git a/lowercase/docs/types/test.ts b/lowercase/docs/types/test.ts deleted file mode 100644 index 0f9c1455..00000000 --- a/lowercase/docs/types/test.ts +++ /dev/null @@ -1,46 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import lowercase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - lowercase( 'ABC' ); // $ExpectType "abc" - lowercase( 'Beep BOOP' ); // $ExpectType "beep boop" - lowercase( 'abc' as string ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - lowercase( true ); // $ExpectError - lowercase( false ); // $ExpectError - lowercase( null ); // $ExpectError - lowercase( undefined ); // $ExpectError - lowercase( 5 ); // $ExpectError - lowercase( [] ); // $ExpectError - lowercase( {} ); // $ExpectError - lowercase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - lowercase(); // $ExpectError -} diff --git a/lowercase/docs/usage.txt b/lowercase/docs/usage.txt deleted file mode 100644 index d00e0656..00000000 --- a/lowercase/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: lowercase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - diff --git a/lowercase/etc/cli_opts.json b/lowercase/etc/cli_opts.json deleted file mode 100644 index f245a17e..00000000 --- a/lowercase/etc/cli_opts.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/lowercase/examples/index.js b/lowercase/examples/index.js deleted file mode 100644 index e40629ad..00000000 --- a/lowercase/examples/index.js +++ /dev/null @@ -1,41 +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'; - -var lowercase = require( './../lib' ); - -var str = lowercase( 'Beep' ); -console.log( str ); -// => 'beep' - -str = lowercase( 'BeEp' ); -console.log( str ); -// => 'beep' - -str = lowercase( 'Beep BOOP' ); -console.log( str ); -// => 'beep boop' - -str = lowercase( '$**_Beep_BoOp_**$' ); -console.log( str ); -// => '$**_beep_boop_**$' - -str = lowercase( '' ); -console.log( str ); -// => '' diff --git a/lowercase/lib/index.js b/lowercase/lib/index.js deleted file mode 100644 index 81a1da74..00000000 --- a/lowercase/lib/index.js +++ /dev/null @@ -1,40 +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'; - -/** -* Convert a string to lowercase. -* -* @module @stdlib/string/lowercase -* -* @example -* var lowercase = require( '@stdlib/string/lowercase' ); -* -* var str = lowercase( 'bEEp' ); -* // returns 'beep' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/lowercase/lib/main.js b/lowercase/lib/main.js deleted file mode 100644 index 4fa314b0..00000000 --- a/lowercase/lib/main.js +++ /dev/null @@ -1,51 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/lowercase' ); - - -// MAIN // - -/** -* Converts a string to lowercase. -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {string} lowercase string -* -* @example -* var str = lowercase( 'bEEp' ); -* // returns 'beep' -*/ -function lowercase( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = lowercase; diff --git a/lowercase/package.json b/lowercase/package.json deleted file mode 100644 index 6c701f30..00000000 --- a/lowercase/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/lowercase", - "version": "0.0.0", - "description": "Convert a string to lowercase.", - "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" - } - ], - "bin": { - "lowercase": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "lower", - "case", - "lowercase", - "convert", - "string", - "str" - ] -} diff --git a/lowercase/test/fixtures/stdin_error.js.txt b/lowercase/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/lowercase/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/lowercase/test/test.cli.js b/lowercase/test/test.cli.js deleted file mode 100644 index f35b054e..00000000 --- a/lowercase/test/test.cli.js +++ /dev/null @@ -1,219 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a string argument to lowercase', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'bEEp\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf bEEp', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/lowercase/test/test.js b/lowercase/test/test.js deleted file mode 100644 index 0b3384bc..00000000 --- a/lowercase/test/test.js +++ /dev/null @@ -1,89 +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 lowercase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof lowercase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - lowercase( value ); - }; - } -}); - -tape( 'the function converts a string to lowercase', function test( t ) { - var expected; - var values; - var actual; - var i; - - values = [ - 'beep', - 'Beep', - 'BeEp', - 'Beep BOOP', - '$**_Beep_BoOp_**$', - '' - ]; - expected = [ - 'beep', - 'beep', - 'beep', - 'beep boop', - '$**_beep_boop_**$', - '' - ]; - for ( i = 0; i < values.length; i++ ) { - actual = lowercase( values[i] ); - t.strictEqual( actual, expected[i], 'converts string to '+expected[i] ); - } - t.end(); -}); diff --git a/next-code-point-index/README.md b/next-code-point-index/README.md deleted file mode 100644 index 97034119..00000000 --- a/next-code-point-index/README.md +++ /dev/null @@ -1,193 +0,0 @@ - - -# nextCodePointIndex - -> Return the position of the next Unicode code point in a string after a specified position. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var nextCodePointIndex = require( '@stdlib/string/next-code-point-index' ); -``` - -#### nextCodePointIndex( string\[, fromIndex] ) - -Returns the position of the next Unicode code point in a string after a specified position. - -```javascript -var out = nextCodePointIndex( 'last man standing' ); -// returns 1 -``` - -By default, the function searches for a Unicode code point starting from the first index. To specify an alternative starting search index, provide a `fromIndex` argument. - -```javascript -var out = nextCodePointIndex( 'last man standing', 4 ); -// returns 5 -``` - -
- - - - - -
- -## Notes - -- If `string` is an empty string, the function returns `-1` irrespective of `fromIndex`. -- If a code point does not exist after `fromIndex`, the function returns `-1`. -- Note that `fromIndex` does **not** refer to a visual character position, but to an index in the ordered sequence of [UTF-16][utf-16] code units. - -
- - - - - -
- -## Examples - - - -```javascript -var nextCodePointIndex = require( '@stdlib/string/next-code-point-index' ); - -var out = nextCodePointIndex( 'last man standing', 4 ); -// returns 5 - -out = nextCodePointIndex( 'presidential election', 8 ); -// returns 9 - -out = nextCodePointIndex( '𐒻𐓟𐒻𐓟', 0 ); -// returns 2 - -out = nextCodePointIndex( '🌷', 0 ); -// returns -1 -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: next-code-point-index [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --from index Starting search position in string. Default: 0. -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```bash -$ next-code-point-index --from=0 𐒻𐓟𐒻𐓟 -2 -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n '𐒻𐓟𐒻𐓟' | next-code-point-index --from=0 -2 -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/next-code-point-index/benchmark/benchmark.js b/next-code-point-index/benchmark/benchmark.js deleted file mode 100644 index 1eedf93a..00000000 --- a/next-code-point-index/benchmark/benchmark.js +++ /dev/null @@ -1,64 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var nextCodePointIndex = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var strings; - var len; - var out; - var i; - - strings = [ - 'last man standing', - 'presidential election', - 'अनुच्छेद', - '🌷', - '书/六書', - 'เ❄︎நி', - 'กิิก้้ก็็ก็็กิิก้้ก็็กิิก้้กิิก้้ก็็ก็็กิิก้้ก็็กิิก้้', - '書六/书六', - 'ܶƔλʃݖͱšɕ҆ʧѸؐҜҦɳΏ', - 'âݝΝ‚ҳӌݾҀƳ۵ۧ޳ǁǸΓ' - ]; - len = strings.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = nextCodePointIndex( strings[ i%len ], 1 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/next-code-point-index/bin/cli b/next-code-point-index/bin/cli deleted file mode 100755 index dcc36981..00000000 --- a/next-code-point-index/bin/cli +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var nextCodePointIndex = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var cli; - var pos; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - if ( flags.from ) { - pos = parseInt( flags.from, 10 ); - } else { - pos = 0; - } - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( stdinStream.isTTY ) { - return console.log( nextCodePointIndex( args[ 0 ], pos ) ); // eslint-disable-line no-console - } - return stdin( onRead ); - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - if ( error ) { - return cli.error( error ); - } - console.log( nextCodePointIndex( data.toString(), pos ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/next-code-point-index/docs/repl.txt b/next-code-point-index/docs/repl.txt deleted file mode 100644 index 15203eb6..00000000 --- a/next-code-point-index/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( str[, fromIndex] ) - Returns the position of the next Unicode code point in a string after a - specified position. - - Parameters - ---------- - str: string - Input string. - - fromIndex: integer (optional) - Position. Default: 0. - - Returns - ------- - out: integer - Next code point position. - - Examples - -------- - > var out = {{alias}}( 'last man standing', 4 ) - 5 - > out = {{alias}}( 'presidential election', 8 ) - 9 - > out = {{alias}}( '𐒻𐓟𐒻𐓟', 0 ) - 2 - > out = {{alias}}( '🌷' ) - -1 - - See Also - -------- diff --git a/next-code-point-index/docs/types/index.d.ts b/next-code-point-index/docs/types/index.d.ts deleted file mode 100644 index 986bcf25..00000000 --- a/next-code-point-index/docs/types/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns the position of the next Unicode code point in a string after a specified position. -* -* @param str - input string -* @param fromIndex - position (default: 0) -* @throws first argument must be a string -* @throws second argument must be an integer -* @returns next code point position -* -* @example -* var out = nextCodePointIndex( '𐒻𐓟𐒻𐓟', 0 ); -* // returns 2 -* -* out = nextCodePointIndex( '🌷' ); -* // returns -1 -*/ -declare function nextCodePointIndex( str: string, fromIndex?: number ): number; - - -// EXPORTS // - -export = nextCodePointIndex; diff --git a/next-code-point-index/docs/types/test.ts b/next-code-point-index/docs/types/test.ts deleted file mode 100644 index cf9a4107..00000000 --- a/next-code-point-index/docs/types/test.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import nextCodePointIndex = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - nextCodePointIndex( 'last man standing', 4 ); // $ExpectType number - nextCodePointIndex( 'presidential election', 8 ); // $ExpectType number - nextCodePointIndex( 'अनुच्छेद', 1 ); // $ExpectType number - nextCodePointIndex( '🌷', 0 ); // $ExpectType number -} - -// The compiler throws an error if the function is provided invalid arguments... -{ - nextCodePointIndex( false, 3 ); // $ExpectError - nextCodePointIndex( {}, 3 ); // $ExpectError - nextCodePointIndex( ( x: number ): number => x, 3 ); // $ExpectError - - nextCodePointIndex( 'string', true ); // $ExpectError - nextCodePointIndex( 'string', false ); // $ExpectError - nextCodePointIndex( 'string', {} ); // $ExpectError - nextCodePointIndex( 'string', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - nextCodePointIndex(); // $ExpectError -} diff --git a/next-code-point-index/docs/usage.txt b/next-code-point-index/docs/usage.txt deleted file mode 100644 index 63c838c6..00000000 --- a/next-code-point-index/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: next-code-point-index [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --from index Starting search position in string. Default: 0. diff --git a/next-code-point-index/etc/cli_opts.json b/next-code-point-index/etc/cli_opts.json deleted file mode 100644 index 8a766dc0..00000000 --- a/next-code-point-index/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "from" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/next-code-point-index/examples/index.js b/next-code-point-index/examples/index.js deleted file mode 100644 index a034f6f7..00000000 --- a/next-code-point-index/examples/index.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'; - -var nextCodePointIndex = require( './../lib' ); - -console.log( nextCodePointIndex( 'last man standing', 4 ) ); -// => 5 - -console.log( nextCodePointIndex( 'presidential election', 8 ) ); -// => 9 - -console.log( nextCodePointIndex( '𐒻𐓟𐒻𐓟', 0 ) ); -// => 2 - -console.log( nextCodePointIndex( '🌷', 0 ) ); -// => -1 diff --git a/next-code-point-index/lib/index.js b/next-code-point-index/lib/index.js deleted file mode 100644 index 716736f8..00000000 --- a/next-code-point-index/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the position of the next Unicode code point in a string after a specified position. -* -* @module @stdlib/string/next-code-point-index -* -* @example -* var nextCodePointIndex = require( '@stdlib/string/next-code-point-index' ); -* -* var out = nextCodePointIndex( '𐒻𐓟𐒻𐓟', 0 ); -* // returns 2 -* -* out = nextCodePointIndex( '🌷', 0 ); -* // returns -1 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/next-code-point-index/lib/main.js b/next-code-point-index/lib/main.js deleted file mode 100644 index 94745978..00000000 --- a/next-code-point-index/lib/main.js +++ /dev/null @@ -1,108 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var format = require( './../../format' ); - - -// VARIABLES // - -var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/; // TODO: replace with stdlib pkg -var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/; // TODO: replace with stdlib pkg - - -// MAIN // - -/** -* Returns the position of the next Unicode code point in a string after a specified position. -* -* @param {string} str - input string -* @param {integer} [fromIndex=0] - position -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be an integer -* @returns {integer} position of the next Unicode code point -* -* @example -* var out = nextCodePointIndex( 'last man standing', 4 ); -* // returns 5 -* -* @example -* var out = nextCodePointIndex( 'presidential election', 8 ); -* // returns 9 -* -* @example -* var out = nextCodePointIndex( '𐒻𐓟𐒻𐓟', 0 ); -* // returns 2 -* -* @example -* var out = nextCodePointIndex( '🌷' ); -* // returns -1 -*/ -function nextCodePointIndex( str, fromIndex ) { - var lastIndex; - var len; - var idx; - var i; - var j; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( arguments.length > 1 ) { - if ( !isInteger( fromIndex ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) ); - } - idx = fromIndex; - } else { - idx = 0; - } - len = str.length; - if ( idx < 0 ) { - idx += len; - if ( idx < 0 ) { - idx = 0; - } - } - lastIndex = len - 1; - if ( idx >= lastIndex ) { - return -1; - } - - // Check for a high UTF-16 surrogate... - i = idx + 1; - j = i + 1; - if ( RE_UTF16_HIGH_SURROGATE.test( str[ idx ] ) ) { - // Check whether the high surrogate is paired with a low surrogate... - if ( RE_UTF16_LOW_SURROGATE.test( str[ i ] ) ) { - // We found a surrogate pair: - return ( j >= lastIndex ) ? -1 : j; - } - return i; - } - return i; -} - - -// EXPORTS // - -module.exports = nextCodePointIndex; diff --git a/next-code-point-index/package.json b/next-code-point-index/package.json deleted file mode 100644 index baa059e9..00000000 --- a/next-code-point-index/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@stdlib/string/next-code-point-index", - "version": "0.0.0", - "description": "Return the position of the next Unicode code point in a string after a specified position.", - "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" - } - ], - "bin": { - "next-code-point-index": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "code", - "point", - "pt", - "unicode", - "utf-16", - "utf16", - "surrogate", - "astral", - "segmentation", - "tc39" - ] -} diff --git a/next-code-point-index/test/fixtures/stdin_error.js.txt b/next-code-point-index/test/fixtures/stdin_error.js.txt deleted file mode 100644 index b42c70b3..00000000 --- a/next-code-point-index/test/fixtures/stdin_error.js.txt +++ /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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/next-code-point-index/test/test.cli.js b/next-code-point-index/test/test.cli.js deleted file mode 100644 index 3c114b30..00000000 --- a/next-code-point-index/test/test.cli.js +++ /dev/null @@ -1,260 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface returns the next code point break position in a string', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--from=1\'; process.argv[ 3 ] = \'अनुच्छेद\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '2\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports negative integers when specifying a starting search index', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--from=-7\'; process.argv[ 3 ] = \'अनुच्छेद\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '2\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface uses a default starting search index of `0`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'नुच्छेद\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '1\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf \'अनुच्छेद\'', - '|', - EXEC_PATH, - fpath, - '--from=1' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '2\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/next-code-point-index/test/test.js b/next-code-point-index/test/test.js deleted file mode 100644 index 7a95ca27..00000000 --- a/next-code-point-index/test/test.js +++ /dev/null @@ -1,242 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 nextCodePointIndex = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof nextCodePointIndex, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if the first argument is not a string (one argument)', function test( t ) { - var values; - var i; - - values = [ - -5, - 3.14, - -1.0, - NaN, - true, - false, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - nextCodePointIndex( value ); - }; - } -}); - -tape( 'the function throws an error if the first argument is not a string (two arguments)', function test( t ) { - var values; - var i; - - values = [ - -5, - 3.14, - -1.0, - NaN, - true, - false, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - nextCodePointIndex( value, 0 ); - }; - } -}); - -tape( 'the function throws an error if the second argument is not an integer', function test( t ) { - var values; - var i; - - values = [ - 'bar', - 3.14, - NaN, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - nextCodePointIndex( 'foo', value ); - }; - } -}); - -tape( 'the function returns the next code point position in a provided string', function test( t ) { - var out; - - out = nextCodePointIndex( 'last man standing' ); - t.strictEqual( out, 1, 'returns expected value' ); - - out = nextCodePointIndex( 'presidential election' ); - t.strictEqual( out, 1, 'returns expected value' ); - - out = nextCodePointIndex( 'नुच्छेद' ); - t.strictEqual( out, 1, 'returns expected value' ); - - out = nextCodePointIndex( '\uD800' ); // unpaired ending high surrogate - t.strictEqual( out, -1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing an index from which to begin searching', function test( t ) { - var out; - - out = nextCodePointIndex( 'last man standing', 4 ); - t.strictEqual( out, 5, 'returns expected value' ); - - out = nextCodePointIndex( 'presidential election', 8 ); - t.strictEqual( out, 9, 'returns expected value' ); - - out = nextCodePointIndex( 'अनुच्छेद', 1 ); - t.strictEqual( out, 2, 'returns expected value' ); - - out = nextCodePointIndex( '𐒻𐓟𐒻𐓟', 0 ); - t.strictEqual( out, 2, 'returns expected value' ); - - out = nextCodePointIndex( 'a\uDBFFaaaaaaa', 0 ); // unpaired high surrogate - t.strictEqual( out, 1, 'returns expected value' ); - - out = nextCodePointIndex( 'a\uDBFF', 0 ); // unpaired ending high surrogate - t.strictEqual( out, 1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing a negative integer for the starting search index', function test( t ) { - var out; - - out = nextCodePointIndex( 'last man standing', -13 ); - t.strictEqual( out, 5, 'returns expected value' ); - - out = nextCodePointIndex( 'presidential election', -13 ); - t.strictEqual( out, 9, 'returns expected value' ); - - out = nextCodePointIndex( 'अनुच्छेद', -7 ); - t.strictEqual( out, 2, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `-1` if the starting search index is greater than or equal to the string length', function test( t ) { - var out; - - out = nextCodePointIndex( 'last man standing', 17 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( 'presidential election', 22 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( 'अनुच्छेद', 10 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( '🌷', 2 ); - t.strictEqual( out, -1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `-1` if the starting search index resides within the last code point of the string', function test( t ) { - var out; - - out = nextCodePointIndex( 'last man standing', 16 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( 'presidential election', 20 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( 'अनुच्छेद', 7 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( '🌷', 1 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( '🌷' ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( '六', 0 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( '六' ); - t.strictEqual( out, -1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `-1` if provided an empty string', function test( t ) { - var out; - - out = nextCodePointIndex( '', -2 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( '', 2 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( '', 0 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextCodePointIndex( '' ); - t.strictEqual( out, -1, 'returns expected value' ); - - t.end(); -}); diff --git a/next-grapheme-cluster-break/README.md b/next-grapheme-cluster-break/README.md deleted file mode 100644 index 07227e02..00000000 --- a/next-grapheme-cluster-break/README.md +++ /dev/null @@ -1,208 +0,0 @@ - - -# nextGraphemeClusterBreak - -> Return the next extended grapheme cluster break in a string after a specified position. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var nextGraphemeClusterBreak = require( '@stdlib/string/next-grapheme-cluster-break' ); -``` - -#### nextGraphemeClusterBreak( string\[, fromIndex] ) - -Returns the next extended grapheme cluster break in a string after a specified position. - -```javascript -var out = nextGraphemeClusterBreak( 'last man standing' ); -// returns 1 -``` - -By default, the function searches for a grapheme cluster break starting from the first index. To specify an alternative starting search index, provide a `fromIndex` argument. - -```javascript -var out = nextGraphemeClusterBreak( 'last man standing', 4 ); -// returns 5 -``` - -
- - - - - -
- -## Notes - -- If `string` is an empty string, the function returns `-1` irrespective of `fromIndex`. -- If an extended grapheme cluster break does not exist after `fromIndex`, the function returns `-1`. -- Note that `fromIndex` does **not** refer to a visual character position, but to an index in the ordered sequence of [UTF-16][utf-16] code units. - -
- - - - - -
- -## Examples - - - -```javascript -var nextGraphemeClusterBreak = require( '@stdlib/string/next-grapheme-cluster-break' ); - -var out = nextGraphemeClusterBreak( 'last man standing', 4 ); -// returns 5 - -out = nextGraphemeClusterBreak( 'presidential election', 8 ); -// returns 9 - -out = nextGraphemeClusterBreak( 'अनुच्छेद', 1 ); -// returns 3 - -out = nextGraphemeClusterBreak( '🌷', 0 ); -// returns -1 -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: next-grapheme-cluster-break [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --from index Starting search position in string. Default: 0. -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```bash -$ next-grapheme-cluster-break --from=1 अनुच्छेद -3 -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'अनुच्छेद' | next-grapheme-cluster-break --from=1 -3 -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/next-grapheme-cluster-break/benchmark/benchmark.js b/next-grapheme-cluster-break/benchmark/benchmark.js deleted file mode 100644 index 718309d4..00000000 --- a/next-grapheme-cluster-break/benchmark/benchmark.js +++ /dev/null @@ -1,64 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var nextGraphemeClusterBreak = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var strings; - var len; - var out; - var i; - - strings = [ - 'last man standing', - 'presidential election', - 'अनुच्छेद', - '🌷', - '书/六書', - 'เ❄︎நி', - 'กิิก้้ก็็ก็็กิิก้้ก็็กิิก้้กิิก้้ก็็ก็็กิิก้้ก็็กิิก้้', - '書六/书六', - 'ܶƔλʃݖͱšɕ҆ʧѸؐҜҦɳΏ', - 'âݝΝ‚ҳӌݾҀƳ۵ۧ޳ǁǸΓ' - ]; - len = strings.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = nextGraphemeClusterBreak( strings[ i%len ], 1 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/next-grapheme-cluster-break/bin/cli b/next-grapheme-cluster-break/bin/cli deleted file mode 100755 index ffa4c3a3..00000000 --- a/next-grapheme-cluster-break/bin/cli +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var nextGraphemeClusterBreak = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var cli; - var pos; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - if ( flags.from ) { - pos = parseInt( flags.from, 10 ); - } else { - pos = 0; - } - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( stdinStream.isTTY ) { - return console.log( nextGraphemeClusterBreak( args[ 0 ], pos ) ); // eslint-disable-line no-console - } - return stdin( onRead ); - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - if ( error ) { - return cli.error( error ); - } - console.log( nextGraphemeClusterBreak( data.toString(), pos ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/next-grapheme-cluster-break/docs/repl.txt b/next-grapheme-cluster-break/docs/repl.txt deleted file mode 100644 index 66b5aa3d..00000000 --- a/next-grapheme-cluster-break/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( str[, fromIndex] ) - Returns the next extended grapheme cluster break in a string after a - specified position. - - Parameters - ---------- - str: string - Input string. - - fromIndex: integer (optional) - Position. Default: 0. - - Returns - ------- - out: integer - Next extended grapheme cluster break position. - - Examples - -------- - > var out = {{alias}}( 'last man standing', 4 ) - 5 - > out = {{alias}}( 'presidential election', 8 ) - 9 - > out = {{alias}}( 'अनुच्छेद', 1 ) - 3 - > out = {{alias}}( '🌷' ) - -1 - - See Also - -------- diff --git a/next-grapheme-cluster-break/docs/types/index.d.ts b/next-grapheme-cluster-break/docs/types/index.d.ts deleted file mode 100644 index bcec48d0..00000000 --- a/next-grapheme-cluster-break/docs/types/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns the next extended grapheme cluster break in a string after a specified position. -* -* @param str - input string -* @param fromIndex - position (default: 0) -* @throws first argument must be a string -* @throws second argument must be an integer -* @returns next grapheme break position -* -* @example -* var out = nextGraphemeClusterBreak( 'अनुच्छेद', 1 ); -* // returns 3 -* -* out = nextGraphemeClusterBreak( '🌷' ); -* // returns -1 -*/ -declare function nextGraphemeClusterBreak( str: string, fromIndex?: number ): number; - - -// EXPORTS // - -export = nextGraphemeClusterBreak; diff --git a/next-grapheme-cluster-break/docs/types/test.ts b/next-grapheme-cluster-break/docs/types/test.ts deleted file mode 100644 index 8e0ebfc5..00000000 --- a/next-grapheme-cluster-break/docs/types/test.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import nextGraphemeClusterBreak = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - nextGraphemeClusterBreak( 'last man standing', 4 ); // $ExpectType number - nextGraphemeClusterBreak( 'presidential election', 8 ); // $ExpectType number - nextGraphemeClusterBreak( 'अनुच्छेद', 1 ); // $ExpectType number - nextGraphemeClusterBreak( '🌷', 0 ); // $ExpectType number -} - -// The compiler throws an error if the function is provided invalid arguments... -{ - nextGraphemeClusterBreak( false, 3 ); // $ExpectError - nextGraphemeClusterBreak( {}, 3 ); // $ExpectError - nextGraphemeClusterBreak( ( x: number ): number => x, 3 ); // $ExpectError - - nextGraphemeClusterBreak( 'string', true ); // $ExpectError - nextGraphemeClusterBreak( 'string', false ); // $ExpectError - nextGraphemeClusterBreak( 'string', {} ); // $ExpectError - nextGraphemeClusterBreak( 'string', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - nextGraphemeClusterBreak(); // $ExpectError -} diff --git a/next-grapheme-cluster-break/docs/usage.txt b/next-grapheme-cluster-break/docs/usage.txt deleted file mode 100644 index 42542ca2..00000000 --- a/next-grapheme-cluster-break/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: next-grapheme-cluster-break [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --from index Starting search position in string. Default: 0. diff --git a/next-grapheme-cluster-break/etc/cli_opts.json b/next-grapheme-cluster-break/etc/cli_opts.json deleted file mode 100644 index 8a766dc0..00000000 --- a/next-grapheme-cluster-break/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "from" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/next-grapheme-cluster-break/examples/index.js b/next-grapheme-cluster-break/examples/index.js deleted file mode 100644 index 71187c2f..00000000 --- a/next-grapheme-cluster-break/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 nextGraphemeClusterBreak = require( './../lib' ); - -console.log( nextGraphemeClusterBreak( 'last man standing', 4 ) ); -// => 5 - -console.log( nextGraphemeClusterBreak( 'presidential election', 8 ) ); -// => 9 - -console.log( nextGraphemeClusterBreak( 'अनुच्छेद', 1 ) ); -// => 3 - -console.log( nextGraphemeClusterBreak( '🌷', 0 ) ); -// => -1 diff --git a/next-grapheme-cluster-break/lib/index.js b/next-grapheme-cluster-break/lib/index.js deleted file mode 100644 index 40daf464..00000000 --- a/next-grapheme-cluster-break/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the next extended grapheme cluster break in a string after a specified position. -* -* @module @stdlib/string/next-grapheme-cluster-break -* -* @example -* var nextGraphemeClusterBreak = require( '@stdlib/string/next-grapheme-cluster-break' ); -* -* var out = nextGraphemeClusterBreak( 'अनुच्छेद', 1 ); -* // returns 3 -* -* out = nextGraphemeClusterBreak( '🌷', 0 ); -* // returns -1 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/next-grapheme-cluster-break/lib/main.js b/next-grapheme-cluster-break/lib/main.js deleted file mode 100644 index f9e6ad3a..00000000 --- a/next-grapheme-cluster-break/lib/main.js +++ /dev/null @@ -1,131 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var codePointAt = require( './../../code-point-at' ); -var hasUTF16SurrogatePairAt = require( '@stdlib/assert/has-utf16-surrogate-pair-at' ); -var grapheme = require( './../../tools/grapheme-cluster-break' ); -var format = require( './../../format' ); - - -// VARIABLES // - -var breakType = grapheme.breakType; -var breakProperty = grapheme.breakProperty; -var emojiProperty = grapheme.emojiProperty; - - -// MAIN // - -/** -* Returns the next extended grapheme cluster break in a string after a specified position. -* -* @param {string} str - input string -* @param {integer} [fromIndex=0] - position -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be an integer -* @returns {NonNegativeInteger} next grapheme break position -* -* @example -* var out = nextGraphemeClusterBreak( 'last man standing', 4 ); -* // returns 5 -* -* @example -* var out = nextGraphemeClusterBreak( 'presidential election', 8 ); -* // returns 9 -* -* @example -* var out = nextGraphemeClusterBreak( 'अनुच्छेद', 1 ); -* // returns 3 -* -* @example -* var out = nextGraphemeClusterBreak( '🌷' ); -* // returns -1 -*/ -function nextGraphemeClusterBreak( str, fromIndex ) { - var breaks; - var emoji; - var len; - var idx; - var cp; - var i; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( arguments.length > 1 ) { - if ( !isInteger( fromIndex ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) ); - } - idx = fromIndex; - } else { - idx = 0; - } - len = str.length; - if ( idx < 0 ) { - idx += len; - if ( idx < 0 ) { - idx = 0; - } - } - if ( len === 0 || idx >= len ) { - return -1; - } - // Initialize caches for storing grapheme break and emoji properties: - breaks = []; - emoji = []; - - // Get the code point for the starting index: - cp = codePointAt( str, idx ); - - // Get the corresponding grapheme break and emoji properties: - breaks.push( breakProperty( cp ) ); - emoji.push( emojiProperty( cp ) ); - - // Begin searching for the next grapheme cluster break... - for ( i = idx+1; i < len; i++ ) { - // If the current character is part of a surrogate pair, move along... - if ( hasUTF16SurrogatePairAt( str, i-1 ) ) { - continue; - } - // Get the next code point: - cp = codePointAt( str, i ); - - // Get the corresponding grapheme break and emoji properties: - breaks.push( breakProperty( cp ) ); - emoji.push( emojiProperty( cp ) ); - - // Determine if we've encountered a grapheme cluster break... - if ( breakType( breaks, emoji ) > 0 ) { - // We've found a break! - return i; - } - } - // Unable to find a grapheme cluster break: - return -1; -} - - -// EXPORTS // - -module.exports = nextGraphemeClusterBreak; diff --git a/next-grapheme-cluster-break/package.json b/next-grapheme-cluster-break/package.json deleted file mode 100644 index bdcb9cdb..00000000 --- a/next-grapheme-cluster-break/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "@stdlib/string/next-grapheme-cluster-break", - "version": "0.0.0", - "description": "Return the next extended grapheme cluster break in a string after a specified position.", - "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" - } - ], - "bin": { - "next-grapheme-cluster-break": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "code", - "point", - "pt", - "unicode", - "utf-16", - "utf16", - "surrogate", - "astral", - "grapheme", - "cluster", - "segmentation", - "tc39" - ] -} diff --git a/next-grapheme-cluster-break/test/fixtures/stdin_error.js.txt b/next-grapheme-cluster-break/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 103efa25..00000000 --- a/next-grapheme-cluster-break/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/next-grapheme-cluster-break/test/test.cli.js b/next-grapheme-cluster-break/test/test.cli.js deleted file mode 100644 index a7e03d9b..00000000 --- a/next-grapheme-cluster-break/test/test.cli.js +++ /dev/null @@ -1,260 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface returns the next grapheme break position in a string', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--from=1\'; process.argv[ 3 ] = \'अनुच्छेद\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '3\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports negative integers when specifying a starting search index', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--from=-7\'; process.argv[ 3 ] = \'अनुच्छेद\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '3\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface uses a default starting search index of `0`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'नुच्छेद\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '2\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf \'अनुच्छेद\'', - '|', - EXEC_PATH, - fpath, - '--from=1' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '3\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/next-grapheme-cluster-break/test/test.js b/next-grapheme-cluster-break/test/test.js deleted file mode 100644 index 388ca261..00000000 --- a/next-grapheme-cluster-break/test/test.js +++ /dev/null @@ -1,230 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 nextGraphemeClusterBreak = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof nextGraphemeClusterBreak, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if the first argument is not a string (one argument)', function test( t ) { - var values; - var i; - - values = [ - -5, - 3.14, - -1.0, - NaN, - true, - false, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - nextGraphemeClusterBreak( value ); - }; - } -}); - -tape( 'the function throws an error if the first argument is not a string (two arguments)', function test( t ) { - var values; - var i; - - values = [ - -5, - 3.14, - -1.0, - NaN, - true, - false, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - nextGraphemeClusterBreak( value, 0 ); - }; - } -}); - -tape( 'the function throws an error if the second argument is not an integer', function test( t ) { - var values; - var i; - - values = [ - 'bar', - 3.14, - NaN, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - nextGraphemeClusterBreak( 'foo', value ); - }; - } -}); - -tape( 'the function returns the next grapheme cluster break position in a provided string', function test( t ) { - var out; - - out = nextGraphemeClusterBreak( 'last man standing' ); - t.strictEqual( out, 1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( 'presidential election' ); - t.strictEqual( out, 1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( 'नुच्छेद' ); - t.strictEqual( out, 2, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing an index from which to begin searching', function test( t ) { - var out; - - out = nextGraphemeClusterBreak( 'last man standing', 4 ); - t.strictEqual( out, 5, 'returns expected value' ); - - out = nextGraphemeClusterBreak( 'presidential election', 8 ); - t.strictEqual( out, 9, 'returns expected value' ); - - out = nextGraphemeClusterBreak( 'अनुच्छेद', 1 ); - t.strictEqual( out, 3, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing a negative integer for the starting search index', function test( t ) { - var out; - - out = nextGraphemeClusterBreak( 'last man standing', -13 ); - t.strictEqual( out, 5, 'returns expected value' ); - - out = nextGraphemeClusterBreak( 'presidential election', -13 ); - t.strictEqual( out, 9, 'returns expected value' ); - - out = nextGraphemeClusterBreak( 'अनुच्छेद', -7 ); - t.strictEqual( out, 3, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `-1` if the starting search index is greater than or equal to the string length', function test( t ) { - var out; - - out = nextGraphemeClusterBreak( 'last man standing', 17 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( 'presidential election', 22 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( 'अनुच्छेद', 10 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( '🌷', 2 ); - t.strictEqual( out, -1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `-1` if the starting search index resides within the last extended grapheme cluster of the string', function test( t ) { - var out; - - out = nextGraphemeClusterBreak( 'last man standing', 16 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( 'presidential election', 20 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( 'अनुच्छेद', 7 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( '🌷', 1 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( '🌷' ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( '六', 0 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( '六' ); - t.strictEqual( out, -1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `-1` if provided an empty string', function test( t ) { - var out; - - out = nextGraphemeClusterBreak( '', -2 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( '', 2 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( '', 0 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = nextGraphemeClusterBreak( '' ); - t.strictEqual( out, -1, 'returns expected value' ); - - t.end(); -}); diff --git a/num-code-points/README.md b/num-code-points/README.md deleted file mode 100644 index 93bfba83..00000000 --- a/num-code-points/README.md +++ /dev/null @@ -1,152 +0,0 @@ - - -# numCodePoints - -> Return the number of Unicode code points in a string. - -
- -## Usage - -```javascript -var numCodePoints = require( '@stdlib/string/num-code-points' ); -``` - -#### numCodePoints( str ) - -Returns the number of code points in a string. - -```javascript -var out = numCodePoints( 'last man standing' ); -// returns 17 - -out = numCodePoints( 'Hidden Treasures' ); -// returns 16 - -out = numCodePoints( '👋👋👋' ); -// returns 3 -``` - -
- - - -
- -## Examples - - - -```javascript -var numCodePoints = require( '@stdlib/string/num-code-points' ); - -console.log( numCodePoints( 'last man standing' ) ); -// => 17 - -console.log( numCodePoints( '六书/六書' ) ); -// => 5 - -console.log( numCodePoints( '🐶🐮🐷🐰🐸' ) ); -// => 5 - -console.log( numCodePoints( 'Hello 👋 World' ) ); -// => 13 -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: num-code-points [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - -l, --lines Analyze individual lines. -``` - -
- - - -
- -### Examples - -```bash -$ num-code-points beep -4 -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep\nboop書' | num-code-points -10 -``` - -```bash -$ echo -n 'beep\nboop書' | num-code-points -l -4 -5 -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/num-code-points/benchmark/benchmark.js b/num-code-points/benchmark/benchmark.js deleted file mode 100644 index 577ba7c1..00000000 --- a/num-code-points/benchmark/benchmark.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ); -var pkg = require( './../package.json' ).name; -var numCodePoints = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var strings; - var out; - var i; - - strings = [ - 'last man standing', - 'presidential election', - 'अनुच्छेद', - '🌷', - '书/六書', - 'เ❄︎நி', - 'กิิก้้ก็็ก็็กิิก้้ก็็กิิก้้กิิก้้ก็็ก็็กิิก้้ก็็กิิก้้', - '書六/书六', - 'ܶƔλʃݖͱšɕ҆ʧѸؐҜҦɳΏ', - 'âݝΝ‚ҳӌݾҀƳ۵ۧ޳ǁǸΓ' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = numCodePoints( strings[ i%strings.length ] ); - if ( out < 0 ) { - b.fail( 'should never be a negative integer' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/num-code-points/bin/cli b/num-code-points/bin/cli deleted file mode 100755 index abf22268..00000000 --- a/num-code-points/bin/cli +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var numCodePoints = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var lines; - var args; - var cli; - var i; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - return stdin( onRead ); - } - if ( flags.lines ) { - lines = args[ 0 ].split( RE_EOL ); - for ( i = 0; i < lines.length; i++ ) { - console.log( numCodePoints( lines[ i ] ) ); // eslint-disable-line no-console - } - } else { - console.log( numCodePoints( args[ 0 ] ) ); // eslint-disable-line no-console - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - data = data.toString(); - if ( flags.lines ) { - lines = data.split( RE_EOL ); - for ( i = 0; i < lines.length; i++ ) { - console.log( numCodePoints( lines[ i ] ) ); // eslint-disable-line no-console - } - } else { - console.log( numCodePoints( data ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/num-code-points/docs/repl.txt b/num-code-points/docs/repl.txt deleted file mode 100644 index 53aaaadf..00000000 --- a/num-code-points/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Returns the number of code points in a string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Number of code points. - - Examples - -------- - > var out = {{alias}}( 'beep' ) - 4 - > out = {{alias}}( '六' ) - 1 - - See Also - -------- diff --git a/num-code-points/docs/types/index.d.ts b/num-code-points/docs/types/index.d.ts deleted file mode 100644 index 89dcfe77..00000000 --- a/num-code-points/docs/types/index.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Returns the number of code points in a string. -* -* @param str - input string -* @returns number of code points -* -* @example -* var out = numCodePoints( 'last man standing' ); -* // returns 17 -* -* @example -* var out = numCodePoints( 'presidential election' ); -* // returns 21 -* -* @example -* var out = numCodePoints( '六' ); -* // returns 1 -* -* @example -* var out = numCodePoints( 'अनुच्छेद' ); -* // returns 8 -*/ -declare function numCodePoints( str: string ): number; - - -// EXPORTS // - -export = numCodePoints; diff --git a/num-code-points/docs/types/test.ts b/num-code-points/docs/types/test.ts deleted file mode 100644 index 0e277c7c..00000000 --- a/num-code-points/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import numCodePoints = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - numCodePoints( 'abc' ); // $ExpectType number -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - numCodePoints( true ); // $ExpectError - numCodePoints( false ); // $ExpectError - numCodePoints( null ); // $ExpectError - numCodePoints( undefined ); // $ExpectError - numCodePoints( 5 ); // $ExpectError - numCodePoints( [] ); // $ExpectError - numCodePoints( {} ); // $ExpectError - numCodePoints( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - numCodePoints(); // $ExpectError -} diff --git a/num-code-points/docs/usage.txt b/num-code-points/docs/usage.txt deleted file mode 100644 index 3214f114..00000000 --- a/num-code-points/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: num-code-points [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - -l, --lines Analyze individual lines. diff --git a/num-code-points/etc/cli_opts.json b/num-code-points/etc/cli_opts.json deleted file mode 100644 index d5d5629e..00000000 --- a/num-code-points/etc/cli_opts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "boolean": [ - "help", - "version", - "lines" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ], - "lines": [ - "l" - ] - } -} diff --git a/num-code-points/examples/index.js b/num-code-points/examples/index.js deleted file mode 100644 index 845e339a..00000000 --- a/num-code-points/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var numCodePoints = require( './../lib' ); - -console.log( numCodePoints( 'last man standing' ) ); -// => 17 - -console.log( numCodePoints( '六书/六書' ) ); -// => 5 - -console.log( numCodePoints( '🐶🐮🐷🐰🐸' ) ); -// => 5 - -console.log( numCodePoints( 'Hello 👋 World' ) ); -// => 13 diff --git a/num-code-points/lib/index.js b/num-code-points/lib/index.js deleted file mode 100644 index bcc3f732..00000000 --- a/num-code-points/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the number of code points in a string. -* -* @module @stdlib/string/num-code-points -* -* @example -* var numCodePoints = require( '@stdlib/string/num-code-points' ); -* -* var out = numCodePoints( 'last man standing' ); -* // returns 17 -* -* out = numCodePoints( '六' ); -* // returns 1 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/num-code-points/lib/main.js b/num-code-points/lib/main.js deleted file mode 100644 index 162f4707..00000000 --- a/num-code-points/lib/main.js +++ /dev/null @@ -1,89 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); - - -// VARIABLES // - -var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/; // TODO: replace with stdlib pkg -var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/; // TODO: replace with stdlib pkg - - -// MAIN // - -/** -* Returns the number of code points in a string. -* -* @param {string} str - input string -* @throws {TypeError} must provide a string -* @returns {NonNegativeInteger} number of code points -* -* @example -* var out = numCodePoints( 'last man standing' ); -* // returns 17 -* -* @example -* var out = numCodePoints( 'presidential election' ); -* // returns 21 -* -* @example -* var out = numCodePoints( 'अनुच्छेद' ); -* // returns 8 -*/ -function numCodePoints( str ) { - var count; - var i; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - count = 0; - - // Process the string one Unicode code unit at a time and count UTF-16 surrogate pairs as a single Unicode code point... - for ( i = 0; i < str.length; i++ ) { - // Check for a high UTF-16 surrogate... - if ( RE_UTF16_HIGH_SURROGATE.test( str[ i ] ) ) { - // Check for an unpaired surrogate at the end of the input string... - if ( i === str.length-1 ) { - // We found an unpaired surrogate... - count += 1; - break; - } - // Check whether the high surrogate is paired with a low surrogate... - if ( RE_UTF16_LOW_SURROGATE.test( str[ i+1 ] ) ) { - // We found a surrogate pair: - i += 1; // bump the index to process the next code unit - count += 1; - } - } else { - count += 1; - } - } - return count; -} - - -// EXPORTS // - -module.exports = numCodePoints; diff --git a/num-code-points/package.json b/num-code-points/package.json deleted file mode 100644 index dec608ec..00000000 --- a/num-code-points/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "@stdlib/string/num-code-points", - "version": "0.0.0", - "description": "Return the number of code points in a string.", - "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" - } - ], - "bin": { - "num-code-points": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "length", - "len", - "unicode", - "code", - "point", - "segmentation", - "surrogate", - "astral", - "emojis" - ] -} diff --git a/num-code-points/test/fixtures/stdin_error.js.txt b/num-code-points/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 7b3cc56d..00000000 --- a/num-code-points/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/num-code-points/test/test.cli.js b/num-code-points/test/test.cli.js deleted file mode 100644 index 7d2f3921..00000000 --- a/num-code-points/test/test.cli.js +++ /dev/null @@ -1,261 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints the number of code points', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\\nboop\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '9\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-l` flag, the command-line interface prints the number of code points for individual lines', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\\nboop\'; process.argv[ 3 ] = \'-l\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '4\n4\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop六"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '10\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream with `-l` flag, the command-line interface prints the number of code points for each line', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop六"', - '|', - EXEC_PATH, - fpath, - '-l' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '4\n5\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/num-code-points/test/test.js b/num-code-points/test/test.js deleted file mode 100644 index e4b2684c..00000000 --- a/num-code-points/test/test.js +++ /dev/null @@ -1,98 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2025 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var numCodePoints = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof numCodePoints, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - numCodePoints( value ); - }; - } -}); - -tape( 'the function returns 0 if provided an empty string', function test( t ) { - t.strictEqual( numCodePoints( '' ), 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the Unicode aware length of a provided string', function test( t ) { - var out; - - out = numCodePoints( 'hello world' ); - t.strictEqual( out, 11, 'returns expected value' ); - - out = numCodePoints( '!!!' ); - t.strictEqual( out, 3, 'returns expected value' ); - - out = numCodePoints( 'अनुच्छेद' ); - t.strictEqual( out, 8, 'returns expected value' ); - - out = numCodePoints( '六' ); - t.strictEqual( out, 1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the number of code points (surrogates)', function test( t ) { - var out; - - out = numCodePoints( '𐒻𐓟' ); - t.strictEqual( out, 2, 'returns expected value' ); - - out = numCodePoints( '𐒻' ); - t.strictEqual( out, 1, 'returns expected value' ); - - out = numCodePoints( '\uD800' ); // trailing unpaired high surrogate - t.strictEqual( out, 1, 'returns expected value' ); - - t.end(); -}); diff --git a/num-grapheme-clusters/README.md b/num-grapheme-clusters/README.md deleted file mode 100644 index 29252c55..00000000 --- a/num-grapheme-clusters/README.md +++ /dev/null @@ -1,159 +0,0 @@ - - -# numGraphemeClusters - -> Return the number of [grapheme clusters][unicode-text-segmentation] in a string. - -
- -## Usage - -```javascript -var numGraphemeClusters = require( '@stdlib/string/num-grapheme-clusters' ); -``` - -#### numGraphemeClusters( str ) - -Returns the number of [grapheme clusters][unicode-text-segmentation] in a `string`. - -```javascript -var out = numGraphemeClusters( 'last man standing' ); -// returns 17 - -out = numGraphemeClusters( 'Hidden Treasures' ); -// returns 16 -``` - -
- - - -
- -## Examples - - - -```javascript -var numGraphemeClusters = require( '@stdlib/string/num-grapheme-clusters' ); - -var str = numGraphemeClusters( 'last man standing' ); -// returns 17 - -str = numGraphemeClusters( '六书/六書' ); -// returns 5 - -str = numGraphemeClusters( 'अनुच्छेद' ); -// returns 5 - -str = numGraphemeClusters( '🌷' ); -// returns 1 -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: num-grapheme-clusters [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - -l, --lines Analyze individual lines. -``` - -
- - - -
- -### Examples - -```bash -$ num-grapheme-clusters beep -4 -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep\nboop🌷' | num-grapheme-clusters -10 -``` - -```bash -$ echo -n 'beep\nboop🌷' | num-grapheme-clusters -l -4 -5 -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/num-grapheme-clusters/benchmark/benchmark.js b/num-grapheme-clusters/benchmark/benchmark.js deleted file mode 100644 index 6be93e45..00000000 --- a/num-grapheme-clusters/benchmark/benchmark.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var fromCodePoint = require( './../../from-code-point' ); -var UNICODE_MAX = require( '@stdlib/constants/unicode/max' ); -var randu = require( '@stdlib/random/base/randu' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var pkg = require( './../package.json' ).name; -var numGraphemeClusters = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var str; - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = fromCodePoint( floor( randu() * UNICODE_MAX ) ) + 'eep boop'; - out = numGraphemeClusters( str ); - if ( out !== 9 ) { - b.fail( 'should return the Unicode aware length' ); - } - } - b.toc(); - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/num-grapheme-clusters/bin/cli b/num-grapheme-clusters/bin/cli deleted file mode 100755 index 272764bf..00000000 --- a/num-grapheme-clusters/bin/cli +++ /dev/null @@ -1,106 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var numGraphemeClusters = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var lines; - var args; - var cli; - var i; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - return stdin( onRead ); - } - if ( flags.lines ) { - lines = args[ 0 ].split( RE_EOL ); - for ( i = 0; i < lines.length; i++ ) { - console.log( numGraphemeClusters( lines[ i ] ) ); // eslint-disable-line no-console - } - } else { - console.log( numGraphemeClusters( args[ 0 ] ) ); // eslint-disable-line no-console - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - data = data.toString(); - if ( flags.lines ) { - lines = data.split( RE_EOL ); - for ( i = 0; i < lines.length; i++ ) { - console.log( numGraphemeClusters( lines[ i ] ) ); // eslint-disable-line no-console - } - } else { - console.log( numGraphemeClusters( data ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/num-grapheme-clusters/docs/repl.txt b/num-grapheme-clusters/docs/repl.txt deleted file mode 100644 index d89deeea..00000000 --- a/num-grapheme-clusters/docs/repl.txt +++ /dev/null @@ -1,24 +0,0 @@ - -{{alias}}( str ) - Returns the number of grapheme clusters in a string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Number of grapheme clusters. - - Examples - -------- - > var out = {{alias}}( 'beep' ) - 4 - > out = {{alias}}( '🌷' ) - 1 - - See Also - -------- - diff --git a/num-grapheme-clusters/docs/types/index.d.ts b/num-grapheme-clusters/docs/types/index.d.ts deleted file mode 100644 index e54b57d5..00000000 --- a/num-grapheme-clusters/docs/types/index.d.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns the number of grapheme clusters in a string. -* -* @param str - input string -* @returns number of grapheme clusters -* -* @example -* var out = numGraphemeClusters( 'last man standing' ); -* // returns 17 -* -* @example -* var out = numGraphemeClusters( 'presidential election' ); -* // returns 21 -* -* @example -* var out = numGraphemeClusters( '🌷' ); -* // returns 1 -* -* @example -* var out = numGraphemeClusters( 'अनुच्छेद' ); -* // returns 5 -*/ -declare function numGraphemeClusters( str: string ): number; - - -// EXPORTS // - -export = numGraphemeClusters; diff --git a/num-grapheme-clusters/docs/types/test.ts b/num-grapheme-clusters/docs/types/test.ts deleted file mode 100644 index 5ebaa7cc..00000000 --- a/num-grapheme-clusters/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import numGraphemeClusters = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - numGraphemeClusters( 'abc' ); // $ExpectType number -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - numGraphemeClusters( true ); // $ExpectError - numGraphemeClusters( false ); // $ExpectError - numGraphemeClusters( null ); // $ExpectError - numGraphemeClusters( undefined ); // $ExpectError - numGraphemeClusters( 5 ); // $ExpectError - numGraphemeClusters( [] ); // $ExpectError - numGraphemeClusters( {} ); // $ExpectError - numGraphemeClusters( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - numGraphemeClusters(); // $ExpectError -} diff --git a/num-grapheme-clusters/docs/usage.txt b/num-grapheme-clusters/docs/usage.txt deleted file mode 100644 index edf817a6..00000000 --- a/num-grapheme-clusters/docs/usage.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Usage: num-grapheme-clusters [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - -l, --lines Analyze individual lines. - diff --git a/num-grapheme-clusters/etc/cli_opts.json b/num-grapheme-clusters/etc/cli_opts.json deleted file mode 100644 index d5d5629e..00000000 --- a/num-grapheme-clusters/etc/cli_opts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "boolean": [ - "help", - "version", - "lines" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ], - "lines": [ - "l" - ] - } -} diff --git a/num-grapheme-clusters/examples/index.js b/num-grapheme-clusters/examples/index.js deleted file mode 100644 index fa6ce867..00000000 --- a/num-grapheme-clusters/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 numGraphemeClusters = require( './../lib' ); - -console.log( numGraphemeClusters( 'last man standing' ) ); -// => 17 - -console.log( numGraphemeClusters( '六书/六書' ) ); -// => 5 - -console.log( numGraphemeClusters( 'अनुच्छेद' ) ); -// => 5 - -console.log( numGraphemeClusters( '🌷' ) ); -// => 1 diff --git a/num-grapheme-clusters/lib/index.js b/num-grapheme-clusters/lib/index.js deleted file mode 100644 index 1a97b9bd..00000000 --- a/num-grapheme-clusters/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the number of grapheme clusters in a string. -* -* @module @stdlib/string/num-grapheme-clusters -* -* @example -* var numGraphemeClusters = require( '@stdlib/string/num-grapheme-clusters' ); -* -* var out = numGraphemeClusters( 'last man standing' ); -* // returns 17 -* -* out = numGraphemeClusters( '🌷' ); -* // returns 1 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/num-grapheme-clusters/lib/main.js b/num-grapheme-clusters/lib/main.js deleted file mode 100644 index 18629c97..00000000 --- a/num-grapheme-clusters/lib/main.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var nextGraphemeClusterBreak = require( './../../next-grapheme-cluster-break' ); -var format = require( './../../format' ); - - -// MAIN // - -/** -* Returns the number of grapheme clusters in a string. -* -* @param {string} str - input string -* @throws {TypeError} must provide a string -* @returns {NonNegativeInteger} number of grapheme clusters -* -* @example -* var out = numGraphemeClusters( 'last man standing' ); -* // returns 17 -* -* @example -* var out = numGraphemeClusters( 'presidential election' ); -* // returns 21 -* -* @example -* var out = numGraphemeClusters( 'अनुच्छेद' ); -* // returns 5 -* -* @example -* var out = numGraphemeClusters( '🌷' ); -* // returns 1 -*/ -function numGraphemeClusters( str ) { - var count; - var idx; - var brk; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - count = 0; - idx = 0; - - brk = nextGraphemeClusterBreak( str, idx ); - while ( brk !== -1 ) { - count += 1; - idx = brk; - brk = nextGraphemeClusterBreak( str, idx ); - } - if ( idx < str.length ) { - count += 1; - } - return count; -} - - -// EXPORTS // - -module.exports = numGraphemeClusters; diff --git a/num-grapheme-clusters/package.json b/num-grapheme-clusters/package.json deleted file mode 100644 index d2c5c4f9..00000000 --- a/num-grapheme-clusters/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@stdlib/string/num-grapheme-clusters", - "version": "0.0.0", - "description": "Return the number of grapheme clusters in a string.", - "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" - } - ], - "bin": { - "num-grapheme-clusters": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "length", - "len", - "unicode", - "grapheme", - "segmentation", - "surrogate", - "astral", - "emojis" - ] -} diff --git a/num-grapheme-clusters/test/fixtures/grapheme_break_test.txt b/num-grapheme-clusters/test/fixtures/grapheme_break_test.txt deleted file mode 100644 index 5baf292a..00000000 --- a/num-grapheme-clusters/test/fixtures/grapheme_break_test.txt +++ /dev/null @@ -1,630 +0,0 @@ -# GraphemeBreakTest-13.0.0.txt -# Date: 2019-11-15, 19:49:10 GMT -# © 2019 Unicode®, Inc. -# Unicode and the Unicode Logo are registered trademarks of Unicode, Inc. in the U.S. and other countries. -# For terms of use, see http://www.unicode.org/terms_of_use.html -# -# Unicode Character Database -# For documentation, see http://www.unicode.org/reports/tr44/ -# -# Default Grapheme_Cluster_Break Test -# -# Format: -# (# )? -# contains hex Unicode code points, with -# ÷ wherever there is a break opportunity, and -# × wherever there is not. -# the format can change, but currently it shows: -# - the sample character name -# - (x) the Grapheme_Cluster_Break property value for the sample character -# - [x] the rule that determines whether there is a break or not, -# as listed in the Rules section of GraphemeBreakTest.html -# -# These samples may be extended or changed in the future. -# -÷ 0020 ÷ 0020 ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 0020 × 0308 ÷ 0020 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 0020 ÷ 000D ÷ # ÷ [0.2] SPACE (Other) ÷ [5.0] (CR) ÷ [0.3] -÷ 0020 × 0308 ÷ 000D ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 0020 ÷ 000A ÷ # ÷ [0.2] SPACE (Other) ÷ [5.0] (LF) ÷ [0.3] -÷ 0020 × 0308 ÷ 000A ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 0020 ÷ 0001 ÷ # ÷ [0.2] SPACE (Other) ÷ [5.0] (Control) ÷ [0.3] -÷ 0020 × 0308 ÷ 0001 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 0020 × 034F ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0020 × 0308 × 034F ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0020 ÷ 1F1E6 ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0020 × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0020 ÷ 0600 ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0020 × 0308 ÷ 0600 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0020 × 0903 ÷ # ÷ [0.2] SPACE (Other) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0020 × 0308 × 0903 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0020 ÷ 1100 ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0020 × 0308 ÷ 1100 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0020 ÷ 1160 ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0020 × 0308 ÷ 1160 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0020 ÷ 11A8 ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0020 × 0308 ÷ 11A8 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0020 ÷ AC00 ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0020 × 0308 ÷ AC00 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0020 ÷ AC01 ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0020 × 0308 ÷ AC01 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0020 ÷ 231A ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 0020 × 0308 ÷ 231A ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 0020 × 0300 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0020 × 0308 × 0300 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0020 × 200D ÷ # ÷ [0.2] SPACE (Other) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0020 × 0308 × 200D ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0020 ÷ 0378 ÷ # ÷ [0.2] SPACE (Other) ÷ [999.0] (Other) ÷ [0.3] -÷ 0020 × 0308 ÷ 0378 ÷ # ÷ [0.2] SPACE (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 000D ÷ 0020 ÷ # ÷ [0.2] (CR) ÷ [4.0] SPACE (Other) ÷ [0.3] -÷ 000D ÷ 0308 ÷ 0020 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 000D ÷ 000D ÷ # ÷ [0.2] (CR) ÷ [4.0] (CR) ÷ [0.3] -÷ 000D ÷ 0308 ÷ 000D ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 000D × 000A ÷ # ÷ [0.2] (CR) × [3.0] (LF) ÷ [0.3] -÷ 000D ÷ 0308 ÷ 000A ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 000D ÷ 0001 ÷ # ÷ [0.2] (CR) ÷ [4.0] (Control) ÷ [0.3] -÷ 000D ÷ 0308 ÷ 0001 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 000D ÷ 034F ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 000D ÷ 0308 × 034F ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 000D ÷ 1F1E6 ÷ # ÷ [0.2] (CR) ÷ [4.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 000D ÷ 0308 ÷ 1F1E6 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 000D ÷ 0600 ÷ # ÷ [0.2] (CR) ÷ [4.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 000D ÷ 0308 ÷ 0600 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 000D ÷ 0903 ÷ # ÷ [0.2] (CR) ÷ [4.0] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 000D ÷ 0308 × 0903 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 000D ÷ 1100 ÷ # ÷ [0.2] (CR) ÷ [4.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 000D ÷ 0308 ÷ 1100 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 000D ÷ 1160 ÷ # ÷ [0.2] (CR) ÷ [4.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 000D ÷ 0308 ÷ 1160 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 000D ÷ 11A8 ÷ # ÷ [0.2] (CR) ÷ [4.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 000D ÷ 0308 ÷ 11A8 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 000D ÷ AC00 ÷ # ÷ [0.2] (CR) ÷ [4.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 000D ÷ 0308 ÷ AC00 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 000D ÷ AC01 ÷ # ÷ [0.2] (CR) ÷ [4.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 000D ÷ 0308 ÷ AC01 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 000D ÷ 231A ÷ # ÷ [0.2] (CR) ÷ [4.0] WATCH (ExtPict) ÷ [0.3] -÷ 000D ÷ 0308 ÷ 231A ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 000D ÷ 0300 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 000D ÷ 0308 × 0300 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 000D ÷ 200D ÷ # ÷ [0.2] (CR) ÷ [4.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 000D ÷ 0308 × 200D ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 000D ÷ 0378 ÷ # ÷ [0.2] (CR) ÷ [4.0] (Other) ÷ [0.3] -÷ 000D ÷ 0308 ÷ 0378 ÷ # ÷ [0.2] (CR) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 000A ÷ 0020 ÷ # ÷ [0.2] (LF) ÷ [4.0] SPACE (Other) ÷ [0.3] -÷ 000A ÷ 0308 ÷ 0020 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 000A ÷ 000D ÷ # ÷ [0.2] (LF) ÷ [4.0] (CR) ÷ [0.3] -÷ 000A ÷ 0308 ÷ 000D ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 000A ÷ 000A ÷ # ÷ [0.2] (LF) ÷ [4.0] (LF) ÷ [0.3] -÷ 000A ÷ 0308 ÷ 000A ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 000A ÷ 0001 ÷ # ÷ [0.2] (LF) ÷ [4.0] (Control) ÷ [0.3] -÷ 000A ÷ 0308 ÷ 0001 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 000A ÷ 034F ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 000A ÷ 0308 × 034F ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 000A ÷ 1F1E6 ÷ # ÷ [0.2] (LF) ÷ [4.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 000A ÷ 0308 ÷ 1F1E6 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 000A ÷ 0600 ÷ # ÷ [0.2] (LF) ÷ [4.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 000A ÷ 0308 ÷ 0600 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 000A ÷ 0903 ÷ # ÷ [0.2] (LF) ÷ [4.0] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 000A ÷ 0308 × 0903 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 000A ÷ 1100 ÷ # ÷ [0.2] (LF) ÷ [4.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 000A ÷ 0308 ÷ 1100 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 000A ÷ 1160 ÷ # ÷ [0.2] (LF) ÷ [4.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 000A ÷ 0308 ÷ 1160 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 000A ÷ 11A8 ÷ # ÷ [0.2] (LF) ÷ [4.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 000A ÷ 0308 ÷ 11A8 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 000A ÷ AC00 ÷ # ÷ [0.2] (LF) ÷ [4.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 000A ÷ 0308 ÷ AC00 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 000A ÷ AC01 ÷ # ÷ [0.2] (LF) ÷ [4.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 000A ÷ 0308 ÷ AC01 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 000A ÷ 231A ÷ # ÷ [0.2] (LF) ÷ [4.0] WATCH (ExtPict) ÷ [0.3] -÷ 000A ÷ 0308 ÷ 231A ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 000A ÷ 0300 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 000A ÷ 0308 × 0300 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 000A ÷ 200D ÷ # ÷ [0.2] (LF) ÷ [4.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 000A ÷ 0308 × 200D ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 000A ÷ 0378 ÷ # ÷ [0.2] (LF) ÷ [4.0] (Other) ÷ [0.3] -÷ 000A ÷ 0308 ÷ 0378 ÷ # ÷ [0.2] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 0001 ÷ 0020 ÷ # ÷ [0.2] (Control) ÷ [4.0] SPACE (Other) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ 0020 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 0001 ÷ 000D ÷ # ÷ [0.2] (Control) ÷ [4.0] (CR) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ 000D ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 0001 ÷ 000A ÷ # ÷ [0.2] (Control) ÷ [4.0] (LF) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ 000A ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 0001 ÷ 0001 ÷ # ÷ [0.2] (Control) ÷ [4.0] (Control) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ 0001 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 0001 ÷ 034F ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0001 ÷ 0308 × 034F ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0001 ÷ 1F1E6 ÷ # ÷ [0.2] (Control) ÷ [4.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ 1F1E6 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0001 ÷ 0600 ÷ # ÷ [0.2] (Control) ÷ [4.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ 0600 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0001 ÷ 0903 ÷ # ÷ [0.2] (Control) ÷ [4.0] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0001 ÷ 0308 × 0903 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0001 ÷ 1100 ÷ # ÷ [0.2] (Control) ÷ [4.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ 1100 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0001 ÷ 1160 ÷ # ÷ [0.2] (Control) ÷ [4.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ 1160 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0001 ÷ 11A8 ÷ # ÷ [0.2] (Control) ÷ [4.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ 11A8 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0001 ÷ AC00 ÷ # ÷ [0.2] (Control) ÷ [4.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ AC00 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0001 ÷ AC01 ÷ # ÷ [0.2] (Control) ÷ [4.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ AC01 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0001 ÷ 231A ÷ # ÷ [0.2] (Control) ÷ [4.0] WATCH (ExtPict) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ 231A ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 0001 ÷ 0300 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0001 ÷ 0308 × 0300 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0001 ÷ 200D ÷ # ÷ [0.2] (Control) ÷ [4.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0001 ÷ 0308 × 200D ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0001 ÷ 0378 ÷ # ÷ [0.2] (Control) ÷ [4.0] (Other) ÷ [0.3] -÷ 0001 ÷ 0308 ÷ 0378 ÷ # ÷ [0.2] (Control) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 034F ÷ 0020 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 034F × 0308 ÷ 0020 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 034F ÷ 000D ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [5.0] (CR) ÷ [0.3] -÷ 034F × 0308 ÷ 000D ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 034F ÷ 000A ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [5.0] (LF) ÷ [0.3] -÷ 034F × 0308 ÷ 000A ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 034F ÷ 0001 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [5.0] (Control) ÷ [0.3] -÷ 034F × 0308 ÷ 0001 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 034F × 034F ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 034F × 0308 × 034F ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 034F ÷ 1F1E6 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 034F × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 034F ÷ 0600 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 034F × 0308 ÷ 0600 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 034F × 0903 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 034F × 0308 × 0903 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 034F ÷ 1100 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 034F × 0308 ÷ 1100 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 034F ÷ 1160 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 034F × 0308 ÷ 1160 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 034F ÷ 11A8 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 034F × 0308 ÷ 11A8 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 034F ÷ AC00 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 034F × 0308 ÷ AC00 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 034F ÷ AC01 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 034F × 0308 ÷ AC01 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 034F ÷ 231A ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 034F × 0308 ÷ 231A ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 034F × 0300 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 034F × 0308 × 0300 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 034F × 200D ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 034F × 0308 × 200D ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 034F ÷ 0378 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) ÷ [999.0] (Other) ÷ [0.3] -÷ 034F × 0308 ÷ 0378 ÷ # ÷ [0.2] COMBINING GRAPHEME JOINER (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 1F1E6 ÷ 0020 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ 0020 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 1F1E6 ÷ 000D ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [5.0] (CR) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ 000D ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 1F1E6 ÷ 000A ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [5.0] (LF) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ 000A ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 1F1E6 ÷ 0001 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [5.0] (Control) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ 0001 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 1F1E6 × 034F ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 1F1E6 × 0308 × 034F ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 1F1E6 × 1F1E6 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [12.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 1F1E6 ÷ 0600 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ 0600 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 1F1E6 × 0903 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 1F1E6 × 0308 × 0903 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 1F1E6 ÷ 1100 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ 1100 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 1F1E6 ÷ 1160 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ 1160 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 1F1E6 ÷ 11A8 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ 11A8 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 1F1E6 ÷ AC00 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ AC00 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 1F1E6 ÷ AC01 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ AC01 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 1F1E6 ÷ 231A ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ 231A ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 1F1E6 × 0300 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 1F1E6 × 0308 × 0300 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 1F1E6 × 200D ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 1F1E6 × 0308 × 200D ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 1F1E6 ÷ 0378 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [999.0] (Other) ÷ [0.3] -÷ 1F1E6 × 0308 ÷ 0378 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 0600 × 0020 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] SPACE (Other) ÷ [0.3] -÷ 0600 × 0308 ÷ 0020 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 0600 ÷ 000D ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) ÷ [5.0] (CR) ÷ [0.3] -÷ 0600 × 0308 ÷ 000D ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 0600 ÷ 000A ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) ÷ [5.0] (LF) ÷ [0.3] -÷ 0600 × 0308 ÷ 000A ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 0600 ÷ 0001 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) ÷ [5.0] (Control) ÷ [0.3] -÷ 0600 × 0308 ÷ 0001 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 0600 × 034F ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0600 × 0308 × 034F ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0600 × 1F1E6 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0600 × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0600 × 0600 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0600 × 0308 ÷ 0600 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0600 × 0903 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0600 × 0308 × 0903 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0600 × 1100 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0600 × 0308 ÷ 1100 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0600 × 1160 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0600 × 0308 ÷ 1160 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0600 × 11A8 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0600 × 0308 ÷ 11A8 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0600 × AC00 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0600 × 0308 ÷ AC00 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0600 × AC01 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0600 × 0308 ÷ AC01 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0600 × 231A ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] WATCH (ExtPict) ÷ [0.3] -÷ 0600 × 0308 ÷ 231A ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 0600 × 0300 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0600 × 0308 × 0300 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0600 × 200D ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0600 × 0308 × 200D ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0600 × 0378 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.2] (Other) ÷ [0.3] -÷ 0600 × 0308 ÷ 0378 ÷ # ÷ [0.2] ARABIC NUMBER SIGN (Prepend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 0903 ÷ 0020 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 0903 × 0308 ÷ 0020 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 0903 ÷ 000D ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [5.0] (CR) ÷ [0.3] -÷ 0903 × 0308 ÷ 000D ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 0903 ÷ 000A ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [5.0] (LF) ÷ [0.3] -÷ 0903 × 0308 ÷ 000A ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 0903 ÷ 0001 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [5.0] (Control) ÷ [0.3] -÷ 0903 × 0308 ÷ 0001 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 0903 × 034F ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0903 × 0308 × 034F ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0903 ÷ 1F1E6 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0903 × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0903 ÷ 0600 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0903 × 0308 ÷ 0600 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0903 × 0903 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0903 × 0308 × 0903 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0903 ÷ 1100 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0903 × 0308 ÷ 1100 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0903 ÷ 1160 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0903 × 0308 ÷ 1160 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0903 ÷ 11A8 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0903 × 0308 ÷ 11A8 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0903 ÷ AC00 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0903 × 0308 ÷ AC00 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0903 ÷ AC01 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0903 × 0308 ÷ AC01 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0903 ÷ 231A ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 0903 × 0308 ÷ 231A ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 0903 × 0300 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0903 × 0308 × 0300 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0903 × 200D ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0903 × 0308 × 200D ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0903 ÷ 0378 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] (Other) ÷ [0.3] -÷ 0903 × 0308 ÷ 0378 ÷ # ÷ [0.2] DEVANAGARI SIGN VISARGA (SpacingMark) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 1100 ÷ 0020 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 1100 × 0308 ÷ 0020 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 1100 ÷ 000D ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) ÷ [5.0] (CR) ÷ [0.3] -÷ 1100 × 0308 ÷ 000D ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 1100 ÷ 000A ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) ÷ [5.0] (LF) ÷ [0.3] -÷ 1100 × 0308 ÷ 000A ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 1100 ÷ 0001 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) ÷ [5.0] (Control) ÷ [0.3] -÷ 1100 × 0308 ÷ 0001 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 1100 × 034F ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 1100 × 0308 × 034F ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 1100 ÷ 1F1E6 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 1100 × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 1100 ÷ 0600 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 1100 × 0308 ÷ 0600 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 1100 × 0903 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 1100 × 0308 × 0903 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 1100 × 1100 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [6.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 1100 × 0308 ÷ 1100 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 1100 × 1160 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [6.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 1100 × 0308 ÷ 1160 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 1100 ÷ 11A8 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 1100 × 0308 ÷ 11A8 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 1100 × AC00 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [6.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 1100 × 0308 ÷ AC00 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 1100 × AC01 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [6.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 1100 × 0308 ÷ AC01 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 1100 ÷ 231A ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 1100 × 0308 ÷ 231A ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 1100 × 0300 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 1100 × 0308 × 0300 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 1100 × 200D ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 1100 × 0308 × 200D ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 1100 ÷ 0378 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) ÷ [999.0] (Other) ÷ [0.3] -÷ 1100 × 0308 ÷ 0378 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 1160 ÷ 0020 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 1160 × 0308 ÷ 0020 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 1160 ÷ 000D ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) ÷ [5.0] (CR) ÷ [0.3] -÷ 1160 × 0308 ÷ 000D ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 1160 ÷ 000A ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) ÷ [5.0] (LF) ÷ [0.3] -÷ 1160 × 0308 ÷ 000A ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 1160 ÷ 0001 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) ÷ [5.0] (Control) ÷ [0.3] -÷ 1160 × 0308 ÷ 0001 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 1160 × 034F ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 1160 × 0308 × 034F ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 1160 ÷ 1F1E6 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 1160 × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 1160 ÷ 0600 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 1160 × 0308 ÷ 0600 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 1160 × 0903 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 1160 × 0308 × 0903 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 1160 ÷ 1100 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 1160 × 0308 ÷ 1100 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 1160 × 1160 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [7.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 1160 × 0308 ÷ 1160 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 1160 × 11A8 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [7.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 1160 × 0308 ÷ 11A8 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 1160 ÷ AC00 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 1160 × 0308 ÷ AC00 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 1160 ÷ AC01 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 1160 × 0308 ÷ AC01 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 1160 ÷ 231A ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 1160 × 0308 ÷ 231A ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 1160 × 0300 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 1160 × 0308 × 0300 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 1160 × 200D ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 1160 × 0308 × 200D ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 1160 ÷ 0378 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) ÷ [999.0] (Other) ÷ [0.3] -÷ 1160 × 0308 ÷ 0378 ÷ # ÷ [0.2] HANGUL JUNGSEONG FILLER (V) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 11A8 ÷ 0020 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 11A8 × 0308 ÷ 0020 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 11A8 ÷ 000D ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [5.0] (CR) ÷ [0.3] -÷ 11A8 × 0308 ÷ 000D ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 11A8 ÷ 000A ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [5.0] (LF) ÷ [0.3] -÷ 11A8 × 0308 ÷ 000A ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 11A8 ÷ 0001 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [5.0] (Control) ÷ [0.3] -÷ 11A8 × 0308 ÷ 0001 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 11A8 × 034F ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 11A8 × 0308 × 034F ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 11A8 ÷ 1F1E6 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 11A8 × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 11A8 ÷ 0600 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 11A8 × 0308 ÷ 0600 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 11A8 × 0903 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 11A8 × 0308 × 0903 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 11A8 ÷ 1100 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 11A8 × 0308 ÷ 1100 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 11A8 ÷ 1160 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 11A8 × 0308 ÷ 1160 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 11A8 × 11A8 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [8.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 11A8 × 0308 ÷ 11A8 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 11A8 ÷ AC00 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 11A8 × 0308 ÷ AC00 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 11A8 ÷ AC01 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 11A8 × 0308 ÷ AC01 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 11A8 ÷ 231A ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 11A8 × 0308 ÷ 231A ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 11A8 × 0300 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 11A8 × 0308 × 0300 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 11A8 × 200D ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 11A8 × 0308 × 200D ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 11A8 ÷ 0378 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) ÷ [999.0] (Other) ÷ [0.3] -÷ 11A8 × 0308 ÷ 0378 ÷ # ÷ [0.2] HANGUL JONGSEONG KIYEOK (T) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ AC00 ÷ 0020 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ AC00 × 0308 ÷ 0020 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ AC00 ÷ 000D ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) ÷ [5.0] (CR) ÷ [0.3] -÷ AC00 × 0308 ÷ 000D ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ AC00 ÷ 000A ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) ÷ [5.0] (LF) ÷ [0.3] -÷ AC00 × 0308 ÷ 000A ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ AC00 ÷ 0001 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) ÷ [5.0] (Control) ÷ [0.3] -÷ AC00 × 0308 ÷ 0001 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ AC00 × 034F ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ AC00 × 0308 × 034F ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ AC00 ÷ 1F1E6 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ AC00 × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ AC00 ÷ 0600 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ AC00 × 0308 ÷ 0600 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ AC00 × 0903 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ AC00 × 0308 × 0903 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ AC00 ÷ 1100 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ AC00 × 0308 ÷ 1100 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ AC00 × 1160 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [7.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ AC00 × 0308 ÷ 1160 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ AC00 × 11A8 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [7.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ AC00 × 0308 ÷ 11A8 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ AC00 ÷ AC00 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ AC00 × 0308 ÷ AC00 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ AC00 ÷ AC01 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ AC00 × 0308 ÷ AC01 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ AC00 ÷ 231A ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ AC00 × 0308 ÷ 231A ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ AC00 × 0300 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ AC00 × 0308 × 0300 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ AC00 × 200D ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ AC00 × 0308 × 200D ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ AC00 ÷ 0378 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) ÷ [999.0] (Other) ÷ [0.3] -÷ AC00 × 0308 ÷ 0378 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ AC01 ÷ 0020 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ AC01 × 0308 ÷ 0020 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ AC01 ÷ 000D ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [5.0] (CR) ÷ [0.3] -÷ AC01 × 0308 ÷ 000D ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ AC01 ÷ 000A ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [5.0] (LF) ÷ [0.3] -÷ AC01 × 0308 ÷ 000A ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ AC01 ÷ 0001 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [5.0] (Control) ÷ [0.3] -÷ AC01 × 0308 ÷ 0001 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ AC01 × 034F ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ AC01 × 0308 × 034F ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ AC01 ÷ 1F1E6 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ AC01 × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ AC01 ÷ 0600 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ AC01 × 0308 ÷ 0600 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ AC01 × 0903 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ AC01 × 0308 × 0903 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ AC01 ÷ 1100 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ AC01 × 0308 ÷ 1100 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ AC01 ÷ 1160 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ AC01 × 0308 ÷ 1160 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ AC01 × 11A8 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [8.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ AC01 × 0308 ÷ 11A8 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ AC01 ÷ AC00 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ AC01 × 0308 ÷ AC00 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ AC01 ÷ AC01 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ AC01 × 0308 ÷ AC01 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ AC01 ÷ 231A ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ AC01 × 0308 ÷ 231A ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ AC01 × 0300 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ AC01 × 0308 × 0300 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ AC01 × 200D ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ AC01 × 0308 × 200D ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ AC01 ÷ 0378 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) ÷ [999.0] (Other) ÷ [0.3] -÷ AC01 × 0308 ÷ 0378 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 231A ÷ 0020 ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 231A × 0308 ÷ 0020 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 231A ÷ 000D ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [5.0] (CR) ÷ [0.3] -÷ 231A × 0308 ÷ 000D ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 231A ÷ 000A ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [5.0] (LF) ÷ [0.3] -÷ 231A × 0308 ÷ 000A ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 231A ÷ 0001 ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [5.0] (Control) ÷ [0.3] -÷ 231A × 0308 ÷ 0001 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 231A × 034F ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 231A × 0308 × 034F ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 231A ÷ 1F1E6 ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 231A × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 231A ÷ 0600 ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 231A × 0308 ÷ 0600 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 231A × 0903 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 231A × 0308 × 0903 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 231A ÷ 1100 ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 231A × 0308 ÷ 1100 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 231A ÷ 1160 ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 231A × 0308 ÷ 1160 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 231A ÷ 11A8 ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 231A × 0308 ÷ 11A8 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 231A ÷ AC00 ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 231A × 0308 ÷ AC00 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 231A ÷ AC01 ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 231A × 0308 ÷ AC01 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 231A ÷ 231A ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 231A × 0308 ÷ 231A ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 231A × 0300 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 231A × 0308 × 0300 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 231A × 200D ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 231A × 0308 × 200D ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 231A ÷ 0378 ÷ # ÷ [0.2] WATCH (ExtPict) ÷ [999.0] (Other) ÷ [0.3] -÷ 231A × 0308 ÷ 0378 ÷ # ÷ [0.2] WATCH (ExtPict) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 0300 ÷ 0020 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 0300 × 0308 ÷ 0020 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 0300 ÷ 000D ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 0300 × 0308 ÷ 000D ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 0300 ÷ 000A ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 0300 × 0308 ÷ 000A ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 0300 ÷ 0001 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 0300 × 0308 ÷ 0001 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 0300 × 034F ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0300 × 0308 × 034F ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0300 ÷ 1F1E6 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0300 × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0300 ÷ 0600 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0300 × 0308 ÷ 0600 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0300 × 0903 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0300 × 0308 × 0903 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0300 ÷ 1100 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0300 × 0308 ÷ 1100 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0300 ÷ 1160 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0300 × 0308 ÷ 1160 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0300 ÷ 11A8 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0300 × 0308 ÷ 11A8 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0300 ÷ AC00 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0300 × 0308 ÷ AC00 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0300 ÷ AC01 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0300 × 0308 ÷ AC01 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0300 ÷ 231A ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 0300 × 0308 ÷ 231A ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 0300 × 0300 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0300 × 0308 × 0300 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0300 × 200D ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0300 × 0308 × 200D ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0300 ÷ 0378 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 0300 × 0308 ÷ 0378 ÷ # ÷ [0.2] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 200D ÷ 0020 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 200D × 0308 ÷ 0020 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 200D ÷ 000D ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 200D × 0308 ÷ 000D ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 200D ÷ 000A ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 200D × 0308 ÷ 000A ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 200D ÷ 0001 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 200D × 0308 ÷ 0001 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 200D × 034F ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 200D × 0308 × 034F ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 200D ÷ 1F1E6 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 200D × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 200D ÷ 0600 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 200D × 0308 ÷ 0600 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 200D × 0903 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 200D × 0308 × 0903 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 200D ÷ 1100 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 200D × 0308 ÷ 1100 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 200D ÷ 1160 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 200D × 0308 ÷ 1160 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 200D ÷ 11A8 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 200D × 0308 ÷ 11A8 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 200D ÷ AC00 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 200D × 0308 ÷ AC00 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 200D ÷ AC01 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 200D × 0308 ÷ AC01 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 200D ÷ 231A ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 200D × 0308 ÷ 231A ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 200D × 0300 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 200D × 0308 × 0300 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 200D × 200D ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 200D × 0308 × 200D ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 200D ÷ 0378 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 200D × 0308 ÷ 0378 ÷ # ÷ [0.2] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 0378 ÷ 0020 ÷ # ÷ [0.2] (Other) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 0378 × 0308 ÷ 0020 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 0378 ÷ 000D ÷ # ÷ [0.2] (Other) ÷ [5.0] (CR) ÷ [0.3] -÷ 0378 × 0308 ÷ 000D ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (CR) ÷ [0.3] -÷ 0378 ÷ 000A ÷ # ÷ [0.2] (Other) ÷ [5.0] (LF) ÷ [0.3] -÷ 0378 × 0308 ÷ 000A ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (LF) ÷ [0.3] -÷ 0378 ÷ 0001 ÷ # ÷ [0.2] (Other) ÷ [5.0] (Control) ÷ [0.3] -÷ 0378 × 0308 ÷ 0001 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [5.0] (Control) ÷ [0.3] -÷ 0378 × 034F ÷ # ÷ [0.2] (Other) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0378 × 0308 × 034F ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAPHEME JOINER (Extend) ÷ [0.3] -÷ 0378 ÷ 1F1E6 ÷ # ÷ [0.2] (Other) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0378 × 0308 ÷ 1F1E6 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) ÷ [0.3] -÷ 0378 ÷ 0600 ÷ # ÷ [0.2] (Other) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0378 × 0308 ÷ 0600 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) ÷ [0.3] -÷ 0378 × 0903 ÷ # ÷ [0.2] (Other) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0378 × 0308 × 0903 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [0.3] -÷ 0378 ÷ 1100 ÷ # ÷ [0.2] (Other) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0378 × 0308 ÷ 1100 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 0378 ÷ 1160 ÷ # ÷ [0.2] (Other) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0378 × 0308 ÷ 1160 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JUNGSEONG FILLER (V) ÷ [0.3] -÷ 0378 ÷ 11A8 ÷ # ÷ [0.2] (Other) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0378 × 0308 ÷ 11A8 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL JONGSEONG KIYEOK (T) ÷ [0.3] -÷ 0378 ÷ AC00 ÷ # ÷ [0.2] (Other) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0378 × 0308 ÷ AC00 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GA (LV) ÷ [0.3] -÷ 0378 ÷ AC01 ÷ # ÷ [0.2] (Other) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0378 × 0308 ÷ AC01 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] HANGUL SYLLABLE GAG (LVT) ÷ [0.3] -÷ 0378 ÷ 231A ÷ # ÷ [0.2] (Other) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 0378 × 0308 ÷ 231A ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] WATCH (ExtPict) ÷ [0.3] -÷ 0378 × 0300 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0378 × 0308 × 0300 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] COMBINING GRAVE ACCENT (Extend_ExtCccZwj) ÷ [0.3] -÷ 0378 × 200D ÷ # ÷ [0.2] (Other) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0378 × 0308 × 200D ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0378 ÷ 0378 ÷ # ÷ [0.2] (Other) ÷ [999.0] (Other) ÷ [0.3] -÷ 0378 × 0308 ÷ 0378 ÷ # ÷ [0.2] (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] (Other) ÷ [0.3] -÷ 000D × 000A ÷ 0061 ÷ 000A ÷ 0308 ÷ # ÷ [0.2] (CR) × [3.0] (LF) ÷ [4.0] LATIN SMALL LETTER A (Other) ÷ [5.0] (LF) ÷ [4.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [0.3] -÷ 0061 × 0308 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [0.3] -÷ 0020 × 200D ÷ 0646 ÷ # ÷ [0.2] SPACE (Other) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] ARABIC LETTER NOON (Other) ÷ [0.3] -÷ 0646 × 200D ÷ 0020 ÷ # ÷ [0.2] ARABIC LETTER NOON (Other) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] SPACE (Other) ÷ [0.3] -÷ 1100 × 1100 ÷ # ÷ [0.2] HANGUL CHOSEONG KIYEOK (L) × [6.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ AC00 × 11A8 ÷ 1100 ÷ # ÷ [0.2] HANGUL SYLLABLE GA (LV) × [7.0] HANGUL JONGSEONG KIYEOK (T) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ AC01 × 11A8 ÷ 1100 ÷ # ÷ [0.2] HANGUL SYLLABLE GAG (LVT) × [8.0] HANGUL JONGSEONG KIYEOK (T) ÷ [999.0] HANGUL CHOSEONG KIYEOK (L) ÷ [0.3] -÷ 1F1E6 × 1F1E7 ÷ 1F1E8 ÷ 0062 ÷ # ÷ [0.2] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [12.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ÷ [999.0] LATIN SMALL LETTER B (Other) ÷ [0.3] -÷ 0061 ÷ 1F1E6 × 1F1E7 ÷ 1F1E8 ÷ 0062 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ÷ [999.0] LATIN SMALL LETTER B (Other) ÷ [0.3] -÷ 0061 ÷ 1F1E6 × 1F1E7 × 200D ÷ 1F1E8 ÷ 0062 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ÷ [999.0] LATIN SMALL LETTER B (Other) ÷ [0.3] -÷ 0061 ÷ 1F1E6 × 200D ÷ 1F1E7 × 1F1E8 ÷ 0062 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) × [13.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) ÷ [999.0] LATIN SMALL LETTER B (Other) ÷ [0.3] -÷ 0061 ÷ 1F1E6 × 1F1E7 ÷ 1F1E8 × 1F1E9 ÷ 0062 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER A (RI) × [13.0] REGIONAL INDICATOR SYMBOL LETTER B (RI) ÷ [999.0] REGIONAL INDICATOR SYMBOL LETTER C (RI) × [13.0] REGIONAL INDICATOR SYMBOL LETTER D (RI) ÷ [999.0] LATIN SMALL LETTER B (Other) ÷ [0.3] -÷ 0061 × 200D ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [0.3] -÷ 0061 × 0308 ÷ 0062 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) ÷ [999.0] LATIN SMALL LETTER B (Other) ÷ [0.3] -÷ 0061 × 0903 ÷ 0062 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) × [9.1] DEVANAGARI SIGN VISARGA (SpacingMark) ÷ [999.0] LATIN SMALL LETTER B (Other) ÷ [0.3] -÷ 0061 ÷ 0600 × 0062 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) ÷ [999.0] ARABIC NUMBER SIGN (Prepend) × [9.2] LATIN SMALL LETTER B (Other) ÷ [0.3] -÷ 1F476 × 1F3FF ÷ 1F476 ÷ # ÷ [0.2] BABY (ExtPict) × [9.0] EMOJI MODIFIER FITZPATRICK TYPE-6 (Extend) ÷ [999.0] BABY (ExtPict) ÷ [0.3] -÷ 0061 × 1F3FF ÷ 1F476 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) × [9.0] EMOJI MODIFIER FITZPATRICK TYPE-6 (Extend) ÷ [999.0] BABY (ExtPict) ÷ [0.3] -÷ 0061 × 1F3FF ÷ 1F476 × 200D × 1F6D1 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) × [9.0] EMOJI MODIFIER FITZPATRICK TYPE-6 (Extend) ÷ [999.0] BABY (ExtPict) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [11.0] OCTAGONAL SIGN (ExtPict) ÷ [0.3] -÷ 1F476 × 1F3FF × 0308 × 200D × 1F476 × 1F3FF ÷ # ÷ [0.2] BABY (ExtPict) × [9.0] EMOJI MODIFIER FITZPATRICK TYPE-6 (Extend) × [9.0] COMBINING DIAERESIS (Extend_ExtCccZwj) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [11.0] BABY (ExtPict) × [9.0] EMOJI MODIFIER FITZPATRICK TYPE-6 (Extend) ÷ [0.3] -÷ 1F6D1 × 200D × 1F6D1 ÷ # ÷ [0.2] OCTAGONAL SIGN (ExtPict) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [11.0] OCTAGONAL SIGN (ExtPict) ÷ [0.3] -÷ 0061 × 200D ÷ 1F6D1 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] OCTAGONAL SIGN (ExtPict) ÷ [0.3] -÷ 2701 × 200D × 2701 ÷ # ÷ [0.2] UPPER BLADE SCISSORS (Other) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) × [11.0] UPPER BLADE SCISSORS (Other) ÷ [0.3] -÷ 0061 × 200D ÷ 2701 ÷ # ÷ [0.2] LATIN SMALL LETTER A (Other) × [9.0] ZERO WIDTH JOINER (ZWJ_ExtCccZwj) ÷ [999.0] UPPER BLADE SCISSORS (Other) ÷ [0.3] -# -# Lines: 602 -# -# EOF diff --git a/num-grapheme-clusters/test/fixtures/script.js b/num-grapheme-clusters/test/fixtures/script.js deleted file mode 100644 index 80000594..00000000 --- a/num-grapheme-clusters/test/fixtures/script.js +++ /dev/null @@ -1,154 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var join = require( 'path' ).join; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var writeFileSync = require( '@stdlib/fs/write-file' ).sync; -var startsWith = require( './../../../starts-with' ); -var inmap = require( '@stdlib/utils/inmap' ); - - -// FUNCTIONS // - -/** -* Returns the UCS-2 encoding from code points. -* -* @private -* @param {NonNegativeIntegerArray} arr - array of code points -* @returns {string} UCS-2 encoded string -*/ -function ucs2encode( arr ) { - var out; - var tmp; - var i; - - out = []; - for ( i = 0; i < arr.length; i++ ) { - tmp = arr[ i ]; - if ( tmp > 0xFFFF ) { - tmp -= 0x10000; - out.push( String.fromCharCode( ( (tmp >>> 10) & 0x3FF ) | 0xD800 ) ); // eslint-disable-line max-len - tmp = 0xDC00 | ( tmp & 0x3FF ); - } - out.push( String.fromCharCode( tmp ) ); - } - return out.join( '' ); -} - -/** -* Returns the hexadecimal form of argument. -* -* @private -* @param {integer} c - temp -* @returns {integer} hexadecimal form -*/ -function convertToHex( c ) { - return parseInt( c, 16 ); -} - -/** -* Transforms a test case line into a UCS-2 encoded string. -* -* @private -* @param {string} sequence - temp -* @returns {string} encoded string -*/ -function mapper( sequence ) { - var codePoints = inmap( sequence.split(/\s*×\s*/), convertToHex ); - return ucs2encode( codePoints ); -} - -/** -* Returns the test data from a single line. -* -* @private -* @param {string} line - line -* @returns {Object} test data -*/ -function generateTestData( line ) { - var codePoints; - var expected; - var input; - - codePoints = inmap( line.split( /\s*[×÷]\s*/ ), convertToHex ); - input = ucs2encode( codePoints ); - - expected = inmap( line.split( /\s*÷\s*/ ), mapper ); - - return { - 'input': input, - 'expected': expected - }; -} - -/** -* Removes comments from a line of test. -* -* @private -* @param {string} line - line -* @returns {string} line without comments -*/ -function removeComments( line ) { - return line.split( '#' )[ 0 ]; -} - -/** -* Filters lines. -* -* @private -* @param {string} line - line -* @returns {boolean} boolean indicating whether to include a line for generating test data -*/ -function filter( line ) { - return line !== null && line.length > 0 && !startsWith( line, '#' ); -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @param {string} filename - input filename -* @param {string} out - output filename -*/ -function main( filename, out ) { - var fpath; - var fopts; - var data; - - fopts = { - 'encoding': 'utf8' - }; - fpath = resolve( __dirname, filename ); - data = readFileSync( fpath, fopts ).split( '\n' ).filter( filter ); - - inmap( data, removeComments ); - inmap( data, generateTestData ); - - fpath = join( __dirname, out ); - writeFileSync( fpath, JSON.stringify( data )+'\n' ); -} - -main( 'grapheme_break_test.txt', 'test_data.json' ); diff --git a/num-grapheme-clusters/test/fixtures/stdin_error.js.txt b/num-grapheme-clusters/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 103efa25..00000000 --- a/num-grapheme-clusters/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/num-grapheme-clusters/test/fixtures/test_data.json b/num-grapheme-clusters/test/fixtures/test_data.json deleted file mode 100644 index 31d81658..00000000 --- a/num-grapheme-clusters/test/fixtures/test_data.json +++ /dev/null @@ -1 +0,0 @@ -[{"input":"\u0000 \u0000","expected":["\u0000"," "," ","\u0000"]},{"input":"\u0000 ̈ \u0000","expected":["\u0000"," ̈"," ","\u0000"]},{"input":"\u0000 \r\u0000","expected":["\u0000"," ","\r","\u0000"]},{"input":"\u0000 ̈\r\u0000","expected":["\u0000"," ̈","\r","\u0000"]},{"input":"\u0000 \n\u0000","expected":["\u0000"," ","\n","\u0000"]},{"input":"\u0000 ̈\n\u0000","expected":["\u0000"," ̈","\n","\u0000"]},{"input":"\u0000 \u0001\u0000","expected":["\u0000"," ","\u0001","\u0000"]},{"input":"\u0000 ̈\u0001\u0000","expected":["\u0000"," ̈","\u0001","\u0000"]},{"input":"\u0000 ͏\u0000","expected":["\u0000"," ͏","\u0000"]},{"input":"\u0000 ̈͏\u0000","expected":["\u0000"," ̈͏","\u0000"]},{"input":"\u0000 🇦\u0000","expected":["\u0000"," ","🇦","\u0000"]},{"input":"\u0000 ̈🇦\u0000","expected":["\u0000"," ̈","🇦","\u0000"]},{"input":"\u0000 ؀\u0000","expected":["\u0000"," ","؀","\u0000"]},{"input":"\u0000 ̈؀\u0000","expected":["\u0000"," ̈","؀","\u0000"]},{"input":"\u0000 ः\u0000","expected":["\u0000"," ः","\u0000"]},{"input":"\u0000 ̈ः\u0000","expected":["\u0000"," ̈ः","\u0000"]},{"input":"\u0000 ᄀ\u0000","expected":["\u0000"," ","ᄀ","\u0000"]},{"input":"\u0000 ̈ᄀ\u0000","expected":["\u0000"," ̈","ᄀ","\u0000"]},{"input":"\u0000 ᅠ\u0000","expected":["\u0000"," ","ᅠ","\u0000"]},{"input":"\u0000 ̈ᅠ\u0000","expected":["\u0000"," ̈","ᅠ","\u0000"]},{"input":"\u0000 ᆨ\u0000","expected":["\u0000"," ","ᆨ","\u0000"]},{"input":"\u0000 ̈ᆨ\u0000","expected":["\u0000"," ̈","ᆨ","\u0000"]},{"input":"\u0000 가\u0000","expected":["\u0000"," ","가","\u0000"]},{"input":"\u0000 ̈가\u0000","expected":["\u0000"," ̈","가","\u0000"]},{"input":"\u0000 각\u0000","expected":["\u0000"," ","각","\u0000"]},{"input":"\u0000 ̈각\u0000","expected":["\u0000"," ̈","각","\u0000"]},{"input":"\u0000 ⌚\u0000","expected":["\u0000"," ","⌚","\u0000"]},{"input":"\u0000 ̈⌚\u0000","expected":["\u0000"," ̈","⌚","\u0000"]},{"input":"\u0000 ̀\u0000","expected":["\u0000"," ̀","\u0000"]},{"input":"\u0000 ̈̀\u0000","expected":["\u0000"," ̈̀","\u0000"]},{"input":"\u0000 ‍\u0000","expected":["\u0000"," ‍","\u0000"]},{"input":"\u0000 ̈‍\u0000","expected":["\u0000"," ̈‍","\u0000"]},{"input":"\u0000 ͸\u0000","expected":["\u0000"," ","͸","\u0000"]},{"input":"\u0000 ̈͸\u0000","expected":["\u0000"," ̈","͸","\u0000"]},{"input":"\u0000\r \u0000","expected":["\u0000","\r"," ","\u0000"]},{"input":"\u0000\r̈ \u0000","expected":["\u0000","\r","̈"," ","\u0000"]},{"input":"\u0000\r\r\u0000","expected":["\u0000","\r","\r","\u0000"]},{"input":"\u0000\r̈\r\u0000","expected":["\u0000","\r","̈","\r","\u0000"]},{"input":"\u0000\r\n\u0000","expected":["\u0000","\r\n","\u0000"]},{"input":"\u0000\r̈\n\u0000","expected":["\u0000","\r","̈","\n","\u0000"]},{"input":"\u0000\r\u0001\u0000","expected":["\u0000","\r","\u0001","\u0000"]},{"input":"\u0000\r̈\u0001\u0000","expected":["\u0000","\r","̈","\u0001","\u0000"]},{"input":"\u0000\r͏\u0000","expected":["\u0000","\r","͏","\u0000"]},{"input":"\u0000\r̈͏\u0000","expected":["\u0000","\r","̈͏","\u0000"]},{"input":"\u0000\r🇦\u0000","expected":["\u0000","\r","🇦","\u0000"]},{"input":"\u0000\r̈🇦\u0000","expected":["\u0000","\r","̈","🇦","\u0000"]},{"input":"\u0000\r؀\u0000","expected":["\u0000","\r","؀","\u0000"]},{"input":"\u0000\r̈؀\u0000","expected":["\u0000","\r","̈","؀","\u0000"]},{"input":"\u0000\rः\u0000","expected":["\u0000","\r","ः","\u0000"]},{"input":"\u0000\r̈ः\u0000","expected":["\u0000","\r","̈ः","\u0000"]},{"input":"\u0000\rᄀ\u0000","expected":["\u0000","\r","ᄀ","\u0000"]},{"input":"\u0000\r̈ᄀ\u0000","expected":["\u0000","\r","̈","ᄀ","\u0000"]},{"input":"\u0000\rᅠ\u0000","expected":["\u0000","\r","ᅠ","\u0000"]},{"input":"\u0000\r̈ᅠ\u0000","expected":["\u0000","\r","̈","ᅠ","\u0000"]},{"input":"\u0000\rᆨ\u0000","expected":["\u0000","\r","ᆨ","\u0000"]},{"input":"\u0000\r̈ᆨ\u0000","expected":["\u0000","\r","̈","ᆨ","\u0000"]},{"input":"\u0000\r가\u0000","expected":["\u0000","\r","가","\u0000"]},{"input":"\u0000\r̈가\u0000","expected":["\u0000","\r","̈","가","\u0000"]},{"input":"\u0000\r각\u0000","expected":["\u0000","\r","각","\u0000"]},{"input":"\u0000\r̈각\u0000","expected":["\u0000","\r","̈","각","\u0000"]},{"input":"\u0000\r⌚\u0000","expected":["\u0000","\r","⌚","\u0000"]},{"input":"\u0000\r̈⌚\u0000","expected":["\u0000","\r","̈","⌚","\u0000"]},{"input":"\u0000\r̀\u0000","expected":["\u0000","\r","̀","\u0000"]},{"input":"\u0000\r̈̀\u0000","expected":["\u0000","\r","̈̀","\u0000"]},{"input":"\u0000\r‍\u0000","expected":["\u0000","\r","‍","\u0000"]},{"input":"\u0000\r̈‍\u0000","expected":["\u0000","\r","̈‍","\u0000"]},{"input":"\u0000\r͸\u0000","expected":["\u0000","\r","͸","\u0000"]},{"input":"\u0000\r̈͸\u0000","expected":["\u0000","\r","̈","͸","\u0000"]},{"input":"\u0000\n \u0000","expected":["\u0000","\n"," ","\u0000"]},{"input":"\u0000\n̈ \u0000","expected":["\u0000","\n","̈"," ","\u0000"]},{"input":"\u0000\n\r\u0000","expected":["\u0000","\n","\r","\u0000"]},{"input":"\u0000\n̈\r\u0000","expected":["\u0000","\n","̈","\r","\u0000"]},{"input":"\u0000\n\n\u0000","expected":["\u0000","\n","\n","\u0000"]},{"input":"\u0000\n̈\n\u0000","expected":["\u0000","\n","̈","\n","\u0000"]},{"input":"\u0000\n\u0001\u0000","expected":["\u0000","\n","\u0001","\u0000"]},{"input":"\u0000\n̈\u0001\u0000","expected":["\u0000","\n","̈","\u0001","\u0000"]},{"input":"\u0000\n͏\u0000","expected":["\u0000","\n","͏","\u0000"]},{"input":"\u0000\n̈͏\u0000","expected":["\u0000","\n","̈͏","\u0000"]},{"input":"\u0000\n🇦\u0000","expected":["\u0000","\n","🇦","\u0000"]},{"input":"\u0000\n̈🇦\u0000","expected":["\u0000","\n","̈","🇦","\u0000"]},{"input":"\u0000\n؀\u0000","expected":["\u0000","\n","؀","\u0000"]},{"input":"\u0000\n̈؀\u0000","expected":["\u0000","\n","̈","؀","\u0000"]},{"input":"\u0000\nः\u0000","expected":["\u0000","\n","ः","\u0000"]},{"input":"\u0000\n̈ः\u0000","expected":["\u0000","\n","̈ः","\u0000"]},{"input":"\u0000\nᄀ\u0000","expected":["\u0000","\n","ᄀ","\u0000"]},{"input":"\u0000\n̈ᄀ\u0000","expected":["\u0000","\n","̈","ᄀ","\u0000"]},{"input":"\u0000\nᅠ\u0000","expected":["\u0000","\n","ᅠ","\u0000"]},{"input":"\u0000\n̈ᅠ\u0000","expected":["\u0000","\n","̈","ᅠ","\u0000"]},{"input":"\u0000\nᆨ\u0000","expected":["\u0000","\n","ᆨ","\u0000"]},{"input":"\u0000\n̈ᆨ\u0000","expected":["\u0000","\n","̈","ᆨ","\u0000"]},{"input":"\u0000\n가\u0000","expected":["\u0000","\n","가","\u0000"]},{"input":"\u0000\n̈가\u0000","expected":["\u0000","\n","̈","가","\u0000"]},{"input":"\u0000\n각\u0000","expected":["\u0000","\n","각","\u0000"]},{"input":"\u0000\n̈각\u0000","expected":["\u0000","\n","̈","각","\u0000"]},{"input":"\u0000\n⌚\u0000","expected":["\u0000","\n","⌚","\u0000"]},{"input":"\u0000\n̈⌚\u0000","expected":["\u0000","\n","̈","⌚","\u0000"]},{"input":"\u0000\ǹ\u0000","expected":["\u0000","\n","̀","\u0000"]},{"input":"\u0000\n̈̀\u0000","expected":["\u0000","\n","̈̀","\u0000"]},{"input":"\u0000\n‍\u0000","expected":["\u0000","\n","‍","\u0000"]},{"input":"\u0000\n̈‍\u0000","expected":["\u0000","\n","̈‍","\u0000"]},{"input":"\u0000\n͸\u0000","expected":["\u0000","\n","͸","\u0000"]},{"input":"\u0000\n̈͸\u0000","expected":["\u0000","\n","̈","͸","\u0000"]},{"input":"\u0000\u0001 \u0000","expected":["\u0000","\u0001"," ","\u0000"]},{"input":"\u0000\u0001̈ \u0000","expected":["\u0000","\u0001","̈"," ","\u0000"]},{"input":"\u0000\u0001\r\u0000","expected":["\u0000","\u0001","\r","\u0000"]},{"input":"\u0000\u0001̈\r\u0000","expected":["\u0000","\u0001","̈","\r","\u0000"]},{"input":"\u0000\u0001\n\u0000","expected":["\u0000","\u0001","\n","\u0000"]},{"input":"\u0000\u0001̈\n\u0000","expected":["\u0000","\u0001","̈","\n","\u0000"]},{"input":"\u0000\u0001\u0001\u0000","expected":["\u0000","\u0001","\u0001","\u0000"]},{"input":"\u0000\u0001̈\u0001\u0000","expected":["\u0000","\u0001","̈","\u0001","\u0000"]},{"input":"\u0000\u0001͏\u0000","expected":["\u0000","\u0001","͏","\u0000"]},{"input":"\u0000\u0001̈͏\u0000","expected":["\u0000","\u0001","̈͏","\u0000"]},{"input":"\u0000\u0001🇦\u0000","expected":["\u0000","\u0001","🇦","\u0000"]},{"input":"\u0000\u0001̈🇦\u0000","expected":["\u0000","\u0001","̈","🇦","\u0000"]},{"input":"\u0000\u0001؀\u0000","expected":["\u0000","\u0001","؀","\u0000"]},{"input":"\u0000\u0001̈؀\u0000","expected":["\u0000","\u0001","̈","؀","\u0000"]},{"input":"\u0000\u0001ः\u0000","expected":["\u0000","\u0001","ः","\u0000"]},{"input":"\u0000\u0001̈ः\u0000","expected":["\u0000","\u0001","̈ः","\u0000"]},{"input":"\u0000\u0001ᄀ\u0000","expected":["\u0000","\u0001","ᄀ","\u0000"]},{"input":"\u0000\u0001̈ᄀ\u0000","expected":["\u0000","\u0001","̈","ᄀ","\u0000"]},{"input":"\u0000\u0001ᅠ\u0000","expected":["\u0000","\u0001","ᅠ","\u0000"]},{"input":"\u0000\u0001̈ᅠ\u0000","expected":["\u0000","\u0001","̈","ᅠ","\u0000"]},{"input":"\u0000\u0001ᆨ\u0000","expected":["\u0000","\u0001","ᆨ","\u0000"]},{"input":"\u0000\u0001̈ᆨ\u0000","expected":["\u0000","\u0001","̈","ᆨ","\u0000"]},{"input":"\u0000\u0001가\u0000","expected":["\u0000","\u0001","가","\u0000"]},{"input":"\u0000\u0001̈가\u0000","expected":["\u0000","\u0001","̈","가","\u0000"]},{"input":"\u0000\u0001각\u0000","expected":["\u0000","\u0001","각","\u0000"]},{"input":"\u0000\u0001̈각\u0000","expected":["\u0000","\u0001","̈","각","\u0000"]},{"input":"\u0000\u0001⌚\u0000","expected":["\u0000","\u0001","⌚","\u0000"]},{"input":"\u0000\u0001̈⌚\u0000","expected":["\u0000","\u0001","̈","⌚","\u0000"]},{"input":"\u0000\u0001̀\u0000","expected":["\u0000","\u0001","̀","\u0000"]},{"input":"\u0000\u0001̈̀\u0000","expected":["\u0000","\u0001","̈̀","\u0000"]},{"input":"\u0000\u0001‍\u0000","expected":["\u0000","\u0001","‍","\u0000"]},{"input":"\u0000\u0001̈‍\u0000","expected":["\u0000","\u0001","̈‍","\u0000"]},{"input":"\u0000\u0001͸\u0000","expected":["\u0000","\u0001","͸","\u0000"]},{"input":"\u0000\u0001̈͸\u0000","expected":["\u0000","\u0001","̈","͸","\u0000"]},{"input":"\u0000͏ \u0000","expected":["\u0000","͏"," ","\u0000"]},{"input":"\u0000͏̈ \u0000","expected":["\u0000","͏̈"," ","\u0000"]},{"input":"\u0000͏\r\u0000","expected":["\u0000","͏","\r","\u0000"]},{"input":"\u0000͏̈\r\u0000","expected":["\u0000","͏̈","\r","\u0000"]},{"input":"\u0000͏\n\u0000","expected":["\u0000","͏","\n","\u0000"]},{"input":"\u0000͏̈\n\u0000","expected":["\u0000","͏̈","\n","\u0000"]},{"input":"\u0000͏\u0001\u0000","expected":["\u0000","͏","\u0001","\u0000"]},{"input":"\u0000͏̈\u0001\u0000","expected":["\u0000","͏̈","\u0001","\u0000"]},{"input":"\u0000͏͏\u0000","expected":["\u0000","͏͏","\u0000"]},{"input":"\u0000͏̈͏\u0000","expected":["\u0000","͏̈͏","\u0000"]},{"input":"\u0000͏🇦\u0000","expected":["\u0000","͏","🇦","\u0000"]},{"input":"\u0000͏̈🇦\u0000","expected":["\u0000","͏̈","🇦","\u0000"]},{"input":"\u0000͏؀\u0000","expected":["\u0000","͏","؀","\u0000"]},{"input":"\u0000͏̈؀\u0000","expected":["\u0000","͏̈","؀","\u0000"]},{"input":"\u0000͏ः\u0000","expected":["\u0000","͏ः","\u0000"]},{"input":"\u0000͏̈ः\u0000","expected":["\u0000","͏̈ः","\u0000"]},{"input":"\u0000͏ᄀ\u0000","expected":["\u0000","͏","ᄀ","\u0000"]},{"input":"\u0000͏̈ᄀ\u0000","expected":["\u0000","͏̈","ᄀ","\u0000"]},{"input":"\u0000͏ᅠ\u0000","expected":["\u0000","͏","ᅠ","\u0000"]},{"input":"\u0000͏̈ᅠ\u0000","expected":["\u0000","͏̈","ᅠ","\u0000"]},{"input":"\u0000͏ᆨ\u0000","expected":["\u0000","͏","ᆨ","\u0000"]},{"input":"\u0000͏̈ᆨ\u0000","expected":["\u0000","͏̈","ᆨ","\u0000"]},{"input":"\u0000͏가\u0000","expected":["\u0000","͏","가","\u0000"]},{"input":"\u0000͏̈가\u0000","expected":["\u0000","͏̈","가","\u0000"]},{"input":"\u0000͏각\u0000","expected":["\u0000","͏","각","\u0000"]},{"input":"\u0000͏̈각\u0000","expected":["\u0000","͏̈","각","\u0000"]},{"input":"\u0000͏⌚\u0000","expected":["\u0000","͏","⌚","\u0000"]},{"input":"\u0000͏̈⌚\u0000","expected":["\u0000","͏̈","⌚","\u0000"]},{"input":"\u0000͏̀\u0000","expected":["\u0000","͏̀","\u0000"]},{"input":"\u0000͏̈̀\u0000","expected":["\u0000","͏̈̀","\u0000"]},{"input":"\u0000͏‍\u0000","expected":["\u0000","͏‍","\u0000"]},{"input":"\u0000͏̈‍\u0000","expected":["\u0000","͏̈‍","\u0000"]},{"input":"\u0000͏͸\u0000","expected":["\u0000","͏","͸","\u0000"]},{"input":"\u0000͏̈͸\u0000","expected":["\u0000","͏̈","͸","\u0000"]},{"input":"\u0000🇦 \u0000","expected":["\u0000","🇦"," ","\u0000"]},{"input":"\u0000🇦̈ \u0000","expected":["\u0000","🇦̈"," ","\u0000"]},{"input":"\u0000🇦\r\u0000","expected":["\u0000","🇦","\r","\u0000"]},{"input":"\u0000🇦̈\r\u0000","expected":["\u0000","🇦̈","\r","\u0000"]},{"input":"\u0000🇦\n\u0000","expected":["\u0000","🇦","\n","\u0000"]},{"input":"\u0000🇦̈\n\u0000","expected":["\u0000","🇦̈","\n","\u0000"]},{"input":"\u0000🇦\u0001\u0000","expected":["\u0000","🇦","\u0001","\u0000"]},{"input":"\u0000🇦̈\u0001\u0000","expected":["\u0000","🇦̈","\u0001","\u0000"]},{"input":"\u0000🇦͏\u0000","expected":["\u0000","🇦͏","\u0000"]},{"input":"\u0000🇦̈͏\u0000","expected":["\u0000","🇦̈͏","\u0000"]},{"input":"\u0000🇦🇦\u0000","expected":["\u0000","🇦🇦","\u0000"]},{"input":"\u0000🇦̈🇦\u0000","expected":["\u0000","🇦̈","🇦","\u0000"]},{"input":"\u0000🇦؀\u0000","expected":["\u0000","🇦","؀","\u0000"]},{"input":"\u0000🇦̈؀\u0000","expected":["\u0000","🇦̈","؀","\u0000"]},{"input":"\u0000🇦ः\u0000","expected":["\u0000","🇦ः","\u0000"]},{"input":"\u0000🇦̈ः\u0000","expected":["\u0000","🇦̈ः","\u0000"]},{"input":"\u0000🇦ᄀ\u0000","expected":["\u0000","🇦","ᄀ","\u0000"]},{"input":"\u0000🇦̈ᄀ\u0000","expected":["\u0000","🇦̈","ᄀ","\u0000"]},{"input":"\u0000🇦ᅠ\u0000","expected":["\u0000","🇦","ᅠ","\u0000"]},{"input":"\u0000🇦̈ᅠ\u0000","expected":["\u0000","🇦̈","ᅠ","\u0000"]},{"input":"\u0000🇦ᆨ\u0000","expected":["\u0000","🇦","ᆨ","\u0000"]},{"input":"\u0000🇦̈ᆨ\u0000","expected":["\u0000","🇦̈","ᆨ","\u0000"]},{"input":"\u0000🇦가\u0000","expected":["\u0000","🇦","가","\u0000"]},{"input":"\u0000🇦̈가\u0000","expected":["\u0000","🇦̈","가","\u0000"]},{"input":"\u0000🇦각\u0000","expected":["\u0000","🇦","각","\u0000"]},{"input":"\u0000🇦̈각\u0000","expected":["\u0000","🇦̈","각","\u0000"]},{"input":"\u0000🇦⌚\u0000","expected":["\u0000","🇦","⌚","\u0000"]},{"input":"\u0000🇦̈⌚\u0000","expected":["\u0000","🇦̈","⌚","\u0000"]},{"input":"\u0000🇦̀\u0000","expected":["\u0000","🇦̀","\u0000"]},{"input":"\u0000🇦̈̀\u0000","expected":["\u0000","🇦̈̀","\u0000"]},{"input":"\u0000🇦‍\u0000","expected":["\u0000","🇦‍","\u0000"]},{"input":"\u0000🇦̈‍\u0000","expected":["\u0000","🇦̈‍","\u0000"]},{"input":"\u0000🇦͸\u0000","expected":["\u0000","🇦","͸","\u0000"]},{"input":"\u0000🇦̈͸\u0000","expected":["\u0000","🇦̈","͸","\u0000"]},{"input":"\u0000؀ \u0000","expected":["\u0000","؀ ","\u0000"]},{"input":"\u0000؀̈ \u0000","expected":["\u0000","؀̈"," ","\u0000"]},{"input":"\u0000؀\r\u0000","expected":["\u0000","؀","\r","\u0000"]},{"input":"\u0000؀̈\r\u0000","expected":["\u0000","؀̈","\r","\u0000"]},{"input":"\u0000؀\n\u0000","expected":["\u0000","؀","\n","\u0000"]},{"input":"\u0000؀̈\n\u0000","expected":["\u0000","؀̈","\n","\u0000"]},{"input":"\u0000؀\u0001\u0000","expected":["\u0000","؀","\u0001","\u0000"]},{"input":"\u0000؀̈\u0001\u0000","expected":["\u0000","؀̈","\u0001","\u0000"]},{"input":"\u0000؀͏\u0000","expected":["\u0000","؀͏","\u0000"]},{"input":"\u0000؀̈͏\u0000","expected":["\u0000","؀̈͏","\u0000"]},{"input":"\u0000؀🇦\u0000","expected":["\u0000","؀🇦","\u0000"]},{"input":"\u0000؀̈🇦\u0000","expected":["\u0000","؀̈","🇦","\u0000"]},{"input":"\u0000؀؀\u0000","expected":["\u0000","؀؀","\u0000"]},{"input":"\u0000؀̈؀\u0000","expected":["\u0000","؀̈","؀","\u0000"]},{"input":"\u0000؀ः\u0000","expected":["\u0000","؀ः","\u0000"]},{"input":"\u0000؀̈ः\u0000","expected":["\u0000","؀̈ः","\u0000"]},{"input":"\u0000؀ᄀ\u0000","expected":["\u0000","؀ᄀ","\u0000"]},{"input":"\u0000؀̈ᄀ\u0000","expected":["\u0000","؀̈","ᄀ","\u0000"]},{"input":"\u0000؀ᅠ\u0000","expected":["\u0000","؀ᅠ","\u0000"]},{"input":"\u0000؀̈ᅠ\u0000","expected":["\u0000","؀̈","ᅠ","\u0000"]},{"input":"\u0000؀ᆨ\u0000","expected":["\u0000","؀ᆨ","\u0000"]},{"input":"\u0000؀̈ᆨ\u0000","expected":["\u0000","؀̈","ᆨ","\u0000"]},{"input":"\u0000؀가\u0000","expected":["\u0000","؀가","\u0000"]},{"input":"\u0000؀̈가\u0000","expected":["\u0000","؀̈","가","\u0000"]},{"input":"\u0000؀각\u0000","expected":["\u0000","؀각","\u0000"]},{"input":"\u0000؀̈각\u0000","expected":["\u0000","؀̈","각","\u0000"]},{"input":"\u0000؀⌚\u0000","expected":["\u0000","؀⌚","\u0000"]},{"input":"\u0000؀̈⌚\u0000","expected":["\u0000","؀̈","⌚","\u0000"]},{"input":"\u0000؀̀\u0000","expected":["\u0000","؀̀","\u0000"]},{"input":"\u0000؀̈̀\u0000","expected":["\u0000","؀̈̀","\u0000"]},{"input":"\u0000؀‍\u0000","expected":["\u0000","؀‍","\u0000"]},{"input":"\u0000؀̈‍\u0000","expected":["\u0000","؀̈‍","\u0000"]},{"input":"\u0000؀͸\u0000","expected":["\u0000","؀͸","\u0000"]},{"input":"\u0000؀̈͸\u0000","expected":["\u0000","؀̈","͸","\u0000"]},{"input":"\u0000ः \u0000","expected":["\u0000","ः"," ","\u0000"]},{"input":"\u0000ः̈ \u0000","expected":["\u0000","ः̈"," ","\u0000"]},{"input":"\u0000ः\r\u0000","expected":["\u0000","ः","\r","\u0000"]},{"input":"\u0000ः̈\r\u0000","expected":["\u0000","ः̈","\r","\u0000"]},{"input":"\u0000ः\n\u0000","expected":["\u0000","ः","\n","\u0000"]},{"input":"\u0000ः̈\n\u0000","expected":["\u0000","ः̈","\n","\u0000"]},{"input":"\u0000ः\u0001\u0000","expected":["\u0000","ः","\u0001","\u0000"]},{"input":"\u0000ः̈\u0001\u0000","expected":["\u0000","ः̈","\u0001","\u0000"]},{"input":"\u0000ः͏\u0000","expected":["\u0000","ः͏","\u0000"]},{"input":"\u0000ः̈͏\u0000","expected":["\u0000","ः̈͏","\u0000"]},{"input":"\u0000ः🇦\u0000","expected":["\u0000","ः","🇦","\u0000"]},{"input":"\u0000ः̈🇦\u0000","expected":["\u0000","ः̈","🇦","\u0000"]},{"input":"\u0000ः؀\u0000","expected":["\u0000","ः","؀","\u0000"]},{"input":"\u0000ः̈؀\u0000","expected":["\u0000","ः̈","؀","\u0000"]},{"input":"\u0000ःः\u0000","expected":["\u0000","ःः","\u0000"]},{"input":"\u0000ः̈ः\u0000","expected":["\u0000","ः̈ः","\u0000"]},{"input":"\u0000ःᄀ\u0000","expected":["\u0000","ः","ᄀ","\u0000"]},{"input":"\u0000ः̈ᄀ\u0000","expected":["\u0000","ः̈","ᄀ","\u0000"]},{"input":"\u0000ःᅠ\u0000","expected":["\u0000","ः","ᅠ","\u0000"]},{"input":"\u0000ः̈ᅠ\u0000","expected":["\u0000","ः̈","ᅠ","\u0000"]},{"input":"\u0000ःᆨ\u0000","expected":["\u0000","ः","ᆨ","\u0000"]},{"input":"\u0000ः̈ᆨ\u0000","expected":["\u0000","ः̈","ᆨ","\u0000"]},{"input":"\u0000ः가\u0000","expected":["\u0000","ः","가","\u0000"]},{"input":"\u0000ः̈가\u0000","expected":["\u0000","ः̈","가","\u0000"]},{"input":"\u0000ः각\u0000","expected":["\u0000","ः","각","\u0000"]},{"input":"\u0000ः̈각\u0000","expected":["\u0000","ः̈","각","\u0000"]},{"input":"\u0000ः⌚\u0000","expected":["\u0000","ः","⌚","\u0000"]},{"input":"\u0000ः̈⌚\u0000","expected":["\u0000","ः̈","⌚","\u0000"]},{"input":"\u0000ः̀\u0000","expected":["\u0000","ः̀","\u0000"]},{"input":"\u0000ः̈̀\u0000","expected":["\u0000","ः̈̀","\u0000"]},{"input":"\u0000ः‍\u0000","expected":["\u0000","ः‍","\u0000"]},{"input":"\u0000ः̈‍\u0000","expected":["\u0000","ः̈‍","\u0000"]},{"input":"\u0000ः͸\u0000","expected":["\u0000","ः","͸","\u0000"]},{"input":"\u0000ः̈͸\u0000","expected":["\u0000","ः̈","͸","\u0000"]},{"input":"\u0000ᄀ \u0000","expected":["\u0000","ᄀ"," ","\u0000"]},{"input":"\u0000ᄀ̈ \u0000","expected":["\u0000","ᄀ̈"," ","\u0000"]},{"input":"\u0000ᄀ\r\u0000","expected":["\u0000","ᄀ","\r","\u0000"]},{"input":"\u0000ᄀ̈\r\u0000","expected":["\u0000","ᄀ̈","\r","\u0000"]},{"input":"\u0000ᄀ\n\u0000","expected":["\u0000","ᄀ","\n","\u0000"]},{"input":"\u0000ᄀ̈\n\u0000","expected":["\u0000","ᄀ̈","\n","\u0000"]},{"input":"\u0000ᄀ\u0001\u0000","expected":["\u0000","ᄀ","\u0001","\u0000"]},{"input":"\u0000ᄀ̈\u0001\u0000","expected":["\u0000","ᄀ̈","\u0001","\u0000"]},{"input":"\u0000ᄀ͏\u0000","expected":["\u0000","ᄀ͏","\u0000"]},{"input":"\u0000ᄀ̈͏\u0000","expected":["\u0000","ᄀ̈͏","\u0000"]},{"input":"\u0000ᄀ🇦\u0000","expected":["\u0000","ᄀ","🇦","\u0000"]},{"input":"\u0000ᄀ̈🇦\u0000","expected":["\u0000","ᄀ̈","🇦","\u0000"]},{"input":"\u0000ᄀ؀\u0000","expected":["\u0000","ᄀ","؀","\u0000"]},{"input":"\u0000ᄀ̈؀\u0000","expected":["\u0000","ᄀ̈","؀","\u0000"]},{"input":"\u0000ᄀः\u0000","expected":["\u0000","ᄀः","\u0000"]},{"input":"\u0000ᄀ̈ः\u0000","expected":["\u0000","ᄀ̈ः","\u0000"]},{"input":"\u0000ᄀᄀ\u0000","expected":["\u0000","ᄀᄀ","\u0000"]},{"input":"\u0000ᄀ̈ᄀ\u0000","expected":["\u0000","ᄀ̈","ᄀ","\u0000"]},{"input":"\u0000ᄀᅠ\u0000","expected":["\u0000","ᄀᅠ","\u0000"]},{"input":"\u0000ᄀ̈ᅠ\u0000","expected":["\u0000","ᄀ̈","ᅠ","\u0000"]},{"input":"\u0000ᄀᆨ\u0000","expected":["\u0000","ᄀ","ᆨ","\u0000"]},{"input":"\u0000ᄀ̈ᆨ\u0000","expected":["\u0000","ᄀ̈","ᆨ","\u0000"]},{"input":"\u0000ᄀ가\u0000","expected":["\u0000","ᄀ가","\u0000"]},{"input":"\u0000ᄀ̈가\u0000","expected":["\u0000","ᄀ̈","가","\u0000"]},{"input":"\u0000ᄀ각\u0000","expected":["\u0000","ᄀ각","\u0000"]},{"input":"\u0000ᄀ̈각\u0000","expected":["\u0000","ᄀ̈","각","\u0000"]},{"input":"\u0000ᄀ⌚\u0000","expected":["\u0000","ᄀ","⌚","\u0000"]},{"input":"\u0000ᄀ̈⌚\u0000","expected":["\u0000","ᄀ̈","⌚","\u0000"]},{"input":"\u0000ᄀ̀\u0000","expected":["\u0000","ᄀ̀","\u0000"]},{"input":"\u0000ᄀ̈̀\u0000","expected":["\u0000","ᄀ̈̀","\u0000"]},{"input":"\u0000ᄀ‍\u0000","expected":["\u0000","ᄀ‍","\u0000"]},{"input":"\u0000ᄀ̈‍\u0000","expected":["\u0000","ᄀ̈‍","\u0000"]},{"input":"\u0000ᄀ͸\u0000","expected":["\u0000","ᄀ","͸","\u0000"]},{"input":"\u0000ᄀ̈͸\u0000","expected":["\u0000","ᄀ̈","͸","\u0000"]},{"input":"\u0000ᅠ \u0000","expected":["\u0000","ᅠ"," ","\u0000"]},{"input":"\u0000ᅠ̈ \u0000","expected":["\u0000","ᅠ̈"," ","\u0000"]},{"input":"\u0000ᅠ\r\u0000","expected":["\u0000","ᅠ","\r","\u0000"]},{"input":"\u0000ᅠ̈\r\u0000","expected":["\u0000","ᅠ̈","\r","\u0000"]},{"input":"\u0000ᅠ\n\u0000","expected":["\u0000","ᅠ","\n","\u0000"]},{"input":"\u0000ᅠ̈\n\u0000","expected":["\u0000","ᅠ̈","\n","\u0000"]},{"input":"\u0000ᅠ\u0001\u0000","expected":["\u0000","ᅠ","\u0001","\u0000"]},{"input":"\u0000ᅠ̈\u0001\u0000","expected":["\u0000","ᅠ̈","\u0001","\u0000"]},{"input":"\u0000ᅠ͏\u0000","expected":["\u0000","ᅠ͏","\u0000"]},{"input":"\u0000ᅠ̈͏\u0000","expected":["\u0000","ᅠ̈͏","\u0000"]},{"input":"\u0000ᅠ🇦\u0000","expected":["\u0000","ᅠ","🇦","\u0000"]},{"input":"\u0000ᅠ̈🇦\u0000","expected":["\u0000","ᅠ̈","🇦","\u0000"]},{"input":"\u0000ᅠ؀\u0000","expected":["\u0000","ᅠ","؀","\u0000"]},{"input":"\u0000ᅠ̈؀\u0000","expected":["\u0000","ᅠ̈","؀","\u0000"]},{"input":"\u0000ᅠः\u0000","expected":["\u0000","ᅠः","\u0000"]},{"input":"\u0000ᅠ̈ः\u0000","expected":["\u0000","ᅠ̈ः","\u0000"]},{"input":"\u0000ᅠᄀ\u0000","expected":["\u0000","ᅠ","ᄀ","\u0000"]},{"input":"\u0000ᅠ̈ᄀ\u0000","expected":["\u0000","ᅠ̈","ᄀ","\u0000"]},{"input":"\u0000ᅠᅠ\u0000","expected":["\u0000","ᅠᅠ","\u0000"]},{"input":"\u0000ᅠ̈ᅠ\u0000","expected":["\u0000","ᅠ̈","ᅠ","\u0000"]},{"input":"\u0000ᅠᆨ\u0000","expected":["\u0000","ᅠᆨ","\u0000"]},{"input":"\u0000ᅠ̈ᆨ\u0000","expected":["\u0000","ᅠ̈","ᆨ","\u0000"]},{"input":"\u0000ᅠ가\u0000","expected":["\u0000","ᅠ","가","\u0000"]},{"input":"\u0000ᅠ̈가\u0000","expected":["\u0000","ᅠ̈","가","\u0000"]},{"input":"\u0000ᅠ각\u0000","expected":["\u0000","ᅠ","각","\u0000"]},{"input":"\u0000ᅠ̈각\u0000","expected":["\u0000","ᅠ̈","각","\u0000"]},{"input":"\u0000ᅠ⌚\u0000","expected":["\u0000","ᅠ","⌚","\u0000"]},{"input":"\u0000ᅠ̈⌚\u0000","expected":["\u0000","ᅠ̈","⌚","\u0000"]},{"input":"\u0000ᅠ̀\u0000","expected":["\u0000","ᅠ̀","\u0000"]},{"input":"\u0000ᅠ̈̀\u0000","expected":["\u0000","ᅠ̈̀","\u0000"]},{"input":"\u0000ᅠ‍\u0000","expected":["\u0000","ᅠ‍","\u0000"]},{"input":"\u0000ᅠ̈‍\u0000","expected":["\u0000","ᅠ̈‍","\u0000"]},{"input":"\u0000ᅠ͸\u0000","expected":["\u0000","ᅠ","͸","\u0000"]},{"input":"\u0000ᅠ̈͸\u0000","expected":["\u0000","ᅠ̈","͸","\u0000"]},{"input":"\u0000ᆨ \u0000","expected":["\u0000","ᆨ"," ","\u0000"]},{"input":"\u0000ᆨ̈ \u0000","expected":["\u0000","ᆨ̈"," ","\u0000"]},{"input":"\u0000ᆨ\r\u0000","expected":["\u0000","ᆨ","\r","\u0000"]},{"input":"\u0000ᆨ̈\r\u0000","expected":["\u0000","ᆨ̈","\r","\u0000"]},{"input":"\u0000ᆨ\n\u0000","expected":["\u0000","ᆨ","\n","\u0000"]},{"input":"\u0000ᆨ̈\n\u0000","expected":["\u0000","ᆨ̈","\n","\u0000"]},{"input":"\u0000ᆨ\u0001\u0000","expected":["\u0000","ᆨ","\u0001","\u0000"]},{"input":"\u0000ᆨ̈\u0001\u0000","expected":["\u0000","ᆨ̈","\u0001","\u0000"]},{"input":"\u0000ᆨ͏\u0000","expected":["\u0000","ᆨ͏","\u0000"]},{"input":"\u0000ᆨ̈͏\u0000","expected":["\u0000","ᆨ̈͏","\u0000"]},{"input":"\u0000ᆨ🇦\u0000","expected":["\u0000","ᆨ","🇦","\u0000"]},{"input":"\u0000ᆨ̈🇦\u0000","expected":["\u0000","ᆨ̈","🇦","\u0000"]},{"input":"\u0000ᆨ؀\u0000","expected":["\u0000","ᆨ","؀","\u0000"]},{"input":"\u0000ᆨ̈؀\u0000","expected":["\u0000","ᆨ̈","؀","\u0000"]},{"input":"\u0000ᆨः\u0000","expected":["\u0000","ᆨः","\u0000"]},{"input":"\u0000ᆨ̈ः\u0000","expected":["\u0000","ᆨ̈ः","\u0000"]},{"input":"\u0000ᆨᄀ\u0000","expected":["\u0000","ᆨ","ᄀ","\u0000"]},{"input":"\u0000ᆨ̈ᄀ\u0000","expected":["\u0000","ᆨ̈","ᄀ","\u0000"]},{"input":"\u0000ᆨᅠ\u0000","expected":["\u0000","ᆨ","ᅠ","\u0000"]},{"input":"\u0000ᆨ̈ᅠ\u0000","expected":["\u0000","ᆨ̈","ᅠ","\u0000"]},{"input":"\u0000ᆨᆨ\u0000","expected":["\u0000","ᆨᆨ","\u0000"]},{"input":"\u0000ᆨ̈ᆨ\u0000","expected":["\u0000","ᆨ̈","ᆨ","\u0000"]},{"input":"\u0000ᆨ가\u0000","expected":["\u0000","ᆨ","가","\u0000"]},{"input":"\u0000ᆨ̈가\u0000","expected":["\u0000","ᆨ̈","가","\u0000"]},{"input":"\u0000ᆨ각\u0000","expected":["\u0000","ᆨ","각","\u0000"]},{"input":"\u0000ᆨ̈각\u0000","expected":["\u0000","ᆨ̈","각","\u0000"]},{"input":"\u0000ᆨ⌚\u0000","expected":["\u0000","ᆨ","⌚","\u0000"]},{"input":"\u0000ᆨ̈⌚\u0000","expected":["\u0000","ᆨ̈","⌚","\u0000"]},{"input":"\u0000ᆨ̀\u0000","expected":["\u0000","ᆨ̀","\u0000"]},{"input":"\u0000ᆨ̈̀\u0000","expected":["\u0000","ᆨ̈̀","\u0000"]},{"input":"\u0000ᆨ‍\u0000","expected":["\u0000","ᆨ‍","\u0000"]},{"input":"\u0000ᆨ̈‍\u0000","expected":["\u0000","ᆨ̈‍","\u0000"]},{"input":"\u0000ᆨ͸\u0000","expected":["\u0000","ᆨ","͸","\u0000"]},{"input":"\u0000ᆨ̈͸\u0000","expected":["\u0000","ᆨ̈","͸","\u0000"]},{"input":"\u0000가 \u0000","expected":["\u0000","가"," ","\u0000"]},{"input":"\u0000가̈ \u0000","expected":["\u0000","가̈"," ","\u0000"]},{"input":"\u0000가\r\u0000","expected":["\u0000","가","\r","\u0000"]},{"input":"\u0000가̈\r\u0000","expected":["\u0000","가̈","\r","\u0000"]},{"input":"\u0000가\n\u0000","expected":["\u0000","가","\n","\u0000"]},{"input":"\u0000가̈\n\u0000","expected":["\u0000","가̈","\n","\u0000"]},{"input":"\u0000가\u0001\u0000","expected":["\u0000","가","\u0001","\u0000"]},{"input":"\u0000가̈\u0001\u0000","expected":["\u0000","가̈","\u0001","\u0000"]},{"input":"\u0000가͏\u0000","expected":["\u0000","가͏","\u0000"]},{"input":"\u0000가̈͏\u0000","expected":["\u0000","가̈͏","\u0000"]},{"input":"\u0000가🇦\u0000","expected":["\u0000","가","🇦","\u0000"]},{"input":"\u0000가̈🇦\u0000","expected":["\u0000","가̈","🇦","\u0000"]},{"input":"\u0000가؀\u0000","expected":["\u0000","가","؀","\u0000"]},{"input":"\u0000가̈؀\u0000","expected":["\u0000","가̈","؀","\u0000"]},{"input":"\u0000가ः\u0000","expected":["\u0000","가ः","\u0000"]},{"input":"\u0000가̈ः\u0000","expected":["\u0000","가̈ः","\u0000"]},{"input":"\u0000가ᄀ\u0000","expected":["\u0000","가","ᄀ","\u0000"]},{"input":"\u0000가̈ᄀ\u0000","expected":["\u0000","가̈","ᄀ","\u0000"]},{"input":"\u0000가ᅠ\u0000","expected":["\u0000","가ᅠ","\u0000"]},{"input":"\u0000가̈ᅠ\u0000","expected":["\u0000","가̈","ᅠ","\u0000"]},{"input":"\u0000각\u0000","expected":["\u0000","각","\u0000"]},{"input":"\u0000가̈ᆨ\u0000","expected":["\u0000","가̈","ᆨ","\u0000"]},{"input":"\u0000가가\u0000","expected":["\u0000","가","가","\u0000"]},{"input":"\u0000가̈가\u0000","expected":["\u0000","가̈","가","\u0000"]},{"input":"\u0000가각\u0000","expected":["\u0000","가","각","\u0000"]},{"input":"\u0000가̈각\u0000","expected":["\u0000","가̈","각","\u0000"]},{"input":"\u0000가⌚\u0000","expected":["\u0000","가","⌚","\u0000"]},{"input":"\u0000가̈⌚\u0000","expected":["\u0000","가̈","⌚","\u0000"]},{"input":"\u0000가̀\u0000","expected":["\u0000","가̀","\u0000"]},{"input":"\u0000가̈̀\u0000","expected":["\u0000","가̈̀","\u0000"]},{"input":"\u0000가‍\u0000","expected":["\u0000","가‍","\u0000"]},{"input":"\u0000가̈‍\u0000","expected":["\u0000","가̈‍","\u0000"]},{"input":"\u0000가͸\u0000","expected":["\u0000","가","͸","\u0000"]},{"input":"\u0000가̈͸\u0000","expected":["\u0000","가̈","͸","\u0000"]},{"input":"\u0000각 \u0000","expected":["\u0000","각"," ","\u0000"]},{"input":"\u0000각̈ \u0000","expected":["\u0000","각̈"," ","\u0000"]},{"input":"\u0000각\r\u0000","expected":["\u0000","각","\r","\u0000"]},{"input":"\u0000각̈\r\u0000","expected":["\u0000","각̈","\r","\u0000"]},{"input":"\u0000각\n\u0000","expected":["\u0000","각","\n","\u0000"]},{"input":"\u0000각̈\n\u0000","expected":["\u0000","각̈","\n","\u0000"]},{"input":"\u0000각\u0001\u0000","expected":["\u0000","각","\u0001","\u0000"]},{"input":"\u0000각̈\u0001\u0000","expected":["\u0000","각̈","\u0001","\u0000"]},{"input":"\u0000각͏\u0000","expected":["\u0000","각͏","\u0000"]},{"input":"\u0000각̈͏\u0000","expected":["\u0000","각̈͏","\u0000"]},{"input":"\u0000각🇦\u0000","expected":["\u0000","각","🇦","\u0000"]},{"input":"\u0000각̈🇦\u0000","expected":["\u0000","각̈","🇦","\u0000"]},{"input":"\u0000각؀\u0000","expected":["\u0000","각","؀","\u0000"]},{"input":"\u0000각̈؀\u0000","expected":["\u0000","각̈","؀","\u0000"]},{"input":"\u0000각ः\u0000","expected":["\u0000","각ः","\u0000"]},{"input":"\u0000각̈ः\u0000","expected":["\u0000","각̈ः","\u0000"]},{"input":"\u0000각ᄀ\u0000","expected":["\u0000","각","ᄀ","\u0000"]},{"input":"\u0000각̈ᄀ\u0000","expected":["\u0000","각̈","ᄀ","\u0000"]},{"input":"\u0000각ᅠ\u0000","expected":["\u0000","각","ᅠ","\u0000"]},{"input":"\u0000각̈ᅠ\u0000","expected":["\u0000","각̈","ᅠ","\u0000"]},{"input":"\u0000각ᆨ\u0000","expected":["\u0000","각ᆨ","\u0000"]},{"input":"\u0000각̈ᆨ\u0000","expected":["\u0000","각̈","ᆨ","\u0000"]},{"input":"\u0000각가\u0000","expected":["\u0000","각","가","\u0000"]},{"input":"\u0000각̈가\u0000","expected":["\u0000","각̈","가","\u0000"]},{"input":"\u0000각각\u0000","expected":["\u0000","각","각","\u0000"]},{"input":"\u0000각̈각\u0000","expected":["\u0000","각̈","각","\u0000"]},{"input":"\u0000각⌚\u0000","expected":["\u0000","각","⌚","\u0000"]},{"input":"\u0000각̈⌚\u0000","expected":["\u0000","각̈","⌚","\u0000"]},{"input":"\u0000각̀\u0000","expected":["\u0000","각̀","\u0000"]},{"input":"\u0000각̈̀\u0000","expected":["\u0000","각̈̀","\u0000"]},{"input":"\u0000각‍\u0000","expected":["\u0000","각‍","\u0000"]},{"input":"\u0000각̈‍\u0000","expected":["\u0000","각̈‍","\u0000"]},{"input":"\u0000각͸\u0000","expected":["\u0000","각","͸","\u0000"]},{"input":"\u0000각̈͸\u0000","expected":["\u0000","각̈","͸","\u0000"]},{"input":"\u0000⌚ \u0000","expected":["\u0000","⌚"," ","\u0000"]},{"input":"\u0000⌚̈ \u0000","expected":["\u0000","⌚̈"," ","\u0000"]},{"input":"\u0000⌚\r\u0000","expected":["\u0000","⌚","\r","\u0000"]},{"input":"\u0000⌚̈\r\u0000","expected":["\u0000","⌚̈","\r","\u0000"]},{"input":"\u0000⌚\n\u0000","expected":["\u0000","⌚","\n","\u0000"]},{"input":"\u0000⌚̈\n\u0000","expected":["\u0000","⌚̈","\n","\u0000"]},{"input":"\u0000⌚\u0001\u0000","expected":["\u0000","⌚","\u0001","\u0000"]},{"input":"\u0000⌚̈\u0001\u0000","expected":["\u0000","⌚̈","\u0001","\u0000"]},{"input":"\u0000⌚͏\u0000","expected":["\u0000","⌚͏","\u0000"]},{"input":"\u0000⌚̈͏\u0000","expected":["\u0000","⌚̈͏","\u0000"]},{"input":"\u0000⌚🇦\u0000","expected":["\u0000","⌚","🇦","\u0000"]},{"input":"\u0000⌚̈🇦\u0000","expected":["\u0000","⌚̈","🇦","\u0000"]},{"input":"\u0000⌚؀\u0000","expected":["\u0000","⌚","؀","\u0000"]},{"input":"\u0000⌚̈؀\u0000","expected":["\u0000","⌚̈","؀","\u0000"]},{"input":"\u0000⌚ः\u0000","expected":["\u0000","⌚ः","\u0000"]},{"input":"\u0000⌚̈ः\u0000","expected":["\u0000","⌚̈ः","\u0000"]},{"input":"\u0000⌚ᄀ\u0000","expected":["\u0000","⌚","ᄀ","\u0000"]},{"input":"\u0000⌚̈ᄀ\u0000","expected":["\u0000","⌚̈","ᄀ","\u0000"]},{"input":"\u0000⌚ᅠ\u0000","expected":["\u0000","⌚","ᅠ","\u0000"]},{"input":"\u0000⌚̈ᅠ\u0000","expected":["\u0000","⌚̈","ᅠ","\u0000"]},{"input":"\u0000⌚ᆨ\u0000","expected":["\u0000","⌚","ᆨ","\u0000"]},{"input":"\u0000⌚̈ᆨ\u0000","expected":["\u0000","⌚̈","ᆨ","\u0000"]},{"input":"\u0000⌚가\u0000","expected":["\u0000","⌚","가","\u0000"]},{"input":"\u0000⌚̈가\u0000","expected":["\u0000","⌚̈","가","\u0000"]},{"input":"\u0000⌚각\u0000","expected":["\u0000","⌚","각","\u0000"]},{"input":"\u0000⌚̈각\u0000","expected":["\u0000","⌚̈","각","\u0000"]},{"input":"\u0000⌚⌚\u0000","expected":["\u0000","⌚","⌚","\u0000"]},{"input":"\u0000⌚̈⌚\u0000","expected":["\u0000","⌚̈","⌚","\u0000"]},{"input":"\u0000⌚̀\u0000","expected":["\u0000","⌚̀","\u0000"]},{"input":"\u0000⌚̈̀\u0000","expected":["\u0000","⌚̈̀","\u0000"]},{"input":"\u0000⌚‍\u0000","expected":["\u0000","⌚‍","\u0000"]},{"input":"\u0000⌚̈‍\u0000","expected":["\u0000","⌚̈‍","\u0000"]},{"input":"\u0000⌚͸\u0000","expected":["\u0000","⌚","͸","\u0000"]},{"input":"\u0000⌚̈͸\u0000","expected":["\u0000","⌚̈","͸","\u0000"]},{"input":"\u0000̀ \u0000","expected":["\u0000","̀"," ","\u0000"]},{"input":"\u0000̀̈ \u0000","expected":["\u0000","̀̈"," ","\u0000"]},{"input":"\u0000̀\r\u0000","expected":["\u0000","̀","\r","\u0000"]},{"input":"\u0000̀̈\r\u0000","expected":["\u0000","̀̈","\r","\u0000"]},{"input":"\u0000̀\n\u0000","expected":["\u0000","̀","\n","\u0000"]},{"input":"\u0000̀̈\n\u0000","expected":["\u0000","̀̈","\n","\u0000"]},{"input":"\u0000̀\u0001\u0000","expected":["\u0000","̀","\u0001","\u0000"]},{"input":"\u0000̀̈\u0001\u0000","expected":["\u0000","̀̈","\u0001","\u0000"]},{"input":"\u0000̀͏\u0000","expected":["\u0000","̀͏","\u0000"]},{"input":"\u0000̀̈͏\u0000","expected":["\u0000","̀̈͏","\u0000"]},{"input":"\u0000̀🇦\u0000","expected":["\u0000","̀","🇦","\u0000"]},{"input":"\u0000̀̈🇦\u0000","expected":["\u0000","̀̈","🇦","\u0000"]},{"input":"\u0000̀؀\u0000","expected":["\u0000","̀","؀","\u0000"]},{"input":"\u0000̀̈؀\u0000","expected":["\u0000","̀̈","؀","\u0000"]},{"input":"\u0000̀ः\u0000","expected":["\u0000","̀ः","\u0000"]},{"input":"\u0000̀̈ः\u0000","expected":["\u0000","̀̈ः","\u0000"]},{"input":"\u0000̀ᄀ\u0000","expected":["\u0000","̀","ᄀ","\u0000"]},{"input":"\u0000̀̈ᄀ\u0000","expected":["\u0000","̀̈","ᄀ","\u0000"]},{"input":"\u0000̀ᅠ\u0000","expected":["\u0000","̀","ᅠ","\u0000"]},{"input":"\u0000̀̈ᅠ\u0000","expected":["\u0000","̀̈","ᅠ","\u0000"]},{"input":"\u0000̀ᆨ\u0000","expected":["\u0000","̀","ᆨ","\u0000"]},{"input":"\u0000̀̈ᆨ\u0000","expected":["\u0000","̀̈","ᆨ","\u0000"]},{"input":"\u0000̀가\u0000","expected":["\u0000","̀","가","\u0000"]},{"input":"\u0000̀̈가\u0000","expected":["\u0000","̀̈","가","\u0000"]},{"input":"\u0000̀각\u0000","expected":["\u0000","̀","각","\u0000"]},{"input":"\u0000̀̈각\u0000","expected":["\u0000","̀̈","각","\u0000"]},{"input":"\u0000̀⌚\u0000","expected":["\u0000","̀","⌚","\u0000"]},{"input":"\u0000̀̈⌚\u0000","expected":["\u0000","̀̈","⌚","\u0000"]},{"input":"\u0000̀̀\u0000","expected":["\u0000","̀̀","\u0000"]},{"input":"\u0000̀̈̀\u0000","expected":["\u0000","̀̈̀","\u0000"]},{"input":"\u0000̀‍\u0000","expected":["\u0000","̀‍","\u0000"]},{"input":"\u0000̀̈‍\u0000","expected":["\u0000","̀̈‍","\u0000"]},{"input":"\u0000̀͸\u0000","expected":["\u0000","̀","͸","\u0000"]},{"input":"\u0000̀̈͸\u0000","expected":["\u0000","̀̈","͸","\u0000"]},{"input":"\u0000‍ \u0000","expected":["\u0000","‍"," ","\u0000"]},{"input":"\u0000‍̈ \u0000","expected":["\u0000","‍̈"," ","\u0000"]},{"input":"\u0000‍\r\u0000","expected":["\u0000","‍","\r","\u0000"]},{"input":"\u0000‍̈\r\u0000","expected":["\u0000","‍̈","\r","\u0000"]},{"input":"\u0000‍\n\u0000","expected":["\u0000","‍","\n","\u0000"]},{"input":"\u0000‍̈\n\u0000","expected":["\u0000","‍̈","\n","\u0000"]},{"input":"\u0000‍\u0001\u0000","expected":["\u0000","‍","\u0001","\u0000"]},{"input":"\u0000‍̈\u0001\u0000","expected":["\u0000","‍̈","\u0001","\u0000"]},{"input":"\u0000‍͏\u0000","expected":["\u0000","‍͏","\u0000"]},{"input":"\u0000‍̈͏\u0000","expected":["\u0000","‍̈͏","\u0000"]},{"input":"\u0000‍🇦\u0000","expected":["\u0000","‍","🇦","\u0000"]},{"input":"\u0000‍̈🇦\u0000","expected":["\u0000","‍̈","🇦","\u0000"]},{"input":"\u0000‍؀\u0000","expected":["\u0000","‍","؀","\u0000"]},{"input":"\u0000‍̈؀\u0000","expected":["\u0000","‍̈","؀","\u0000"]},{"input":"\u0000‍ः\u0000","expected":["\u0000","‍ः","\u0000"]},{"input":"\u0000‍̈ः\u0000","expected":["\u0000","‍̈ः","\u0000"]},{"input":"\u0000‍ᄀ\u0000","expected":["\u0000","‍","ᄀ","\u0000"]},{"input":"\u0000‍̈ᄀ\u0000","expected":["\u0000","‍̈","ᄀ","\u0000"]},{"input":"\u0000‍ᅠ\u0000","expected":["\u0000","‍","ᅠ","\u0000"]},{"input":"\u0000‍̈ᅠ\u0000","expected":["\u0000","‍̈","ᅠ","\u0000"]},{"input":"\u0000‍ᆨ\u0000","expected":["\u0000","‍","ᆨ","\u0000"]},{"input":"\u0000‍̈ᆨ\u0000","expected":["\u0000","‍̈","ᆨ","\u0000"]},{"input":"\u0000‍가\u0000","expected":["\u0000","‍","가","\u0000"]},{"input":"\u0000‍̈가\u0000","expected":["\u0000","‍̈","가","\u0000"]},{"input":"\u0000‍각\u0000","expected":["\u0000","‍","각","\u0000"]},{"input":"\u0000‍̈각\u0000","expected":["\u0000","‍̈","각","\u0000"]},{"input":"\u0000‍⌚\u0000","expected":["\u0000","‍","⌚","\u0000"]},{"input":"\u0000‍̈⌚\u0000","expected":["\u0000","‍̈","⌚","\u0000"]},{"input":"\u0000‍̀\u0000","expected":["\u0000","‍̀","\u0000"]},{"input":"\u0000‍̈̀\u0000","expected":["\u0000","‍̈̀","\u0000"]},{"input":"\u0000‍‍\u0000","expected":["\u0000","‍‍","\u0000"]},{"input":"\u0000‍̈‍\u0000","expected":["\u0000","‍̈‍","\u0000"]},{"input":"\u0000‍͸\u0000","expected":["\u0000","‍","͸","\u0000"]},{"input":"\u0000‍̈͸\u0000","expected":["\u0000","‍̈","͸","\u0000"]},{"input":"\u0000͸ \u0000","expected":["\u0000","͸"," ","\u0000"]},{"input":"\u0000͸̈ \u0000","expected":["\u0000","͸̈"," ","\u0000"]},{"input":"\u0000͸\r\u0000","expected":["\u0000","͸","\r","\u0000"]},{"input":"\u0000͸̈\r\u0000","expected":["\u0000","͸̈","\r","\u0000"]},{"input":"\u0000͸\n\u0000","expected":["\u0000","͸","\n","\u0000"]},{"input":"\u0000͸̈\n\u0000","expected":["\u0000","͸̈","\n","\u0000"]},{"input":"\u0000͸\u0001\u0000","expected":["\u0000","͸","\u0001","\u0000"]},{"input":"\u0000͸̈\u0001\u0000","expected":["\u0000","͸̈","\u0001","\u0000"]},{"input":"\u0000͸͏\u0000","expected":["\u0000","͸͏","\u0000"]},{"input":"\u0000͸̈͏\u0000","expected":["\u0000","͸̈͏","\u0000"]},{"input":"\u0000͸🇦\u0000","expected":["\u0000","͸","🇦","\u0000"]},{"input":"\u0000͸̈🇦\u0000","expected":["\u0000","͸̈","🇦","\u0000"]},{"input":"\u0000͸؀\u0000","expected":["\u0000","͸","؀","\u0000"]},{"input":"\u0000͸̈؀\u0000","expected":["\u0000","͸̈","؀","\u0000"]},{"input":"\u0000͸ः\u0000","expected":["\u0000","͸ः","\u0000"]},{"input":"\u0000͸̈ः\u0000","expected":["\u0000","͸̈ः","\u0000"]},{"input":"\u0000͸ᄀ\u0000","expected":["\u0000","͸","ᄀ","\u0000"]},{"input":"\u0000͸̈ᄀ\u0000","expected":["\u0000","͸̈","ᄀ","\u0000"]},{"input":"\u0000͸ᅠ\u0000","expected":["\u0000","͸","ᅠ","\u0000"]},{"input":"\u0000͸̈ᅠ\u0000","expected":["\u0000","͸̈","ᅠ","\u0000"]},{"input":"\u0000͸ᆨ\u0000","expected":["\u0000","͸","ᆨ","\u0000"]},{"input":"\u0000͸̈ᆨ\u0000","expected":["\u0000","͸̈","ᆨ","\u0000"]},{"input":"\u0000͸가\u0000","expected":["\u0000","͸","가","\u0000"]},{"input":"\u0000͸̈가\u0000","expected":["\u0000","͸̈","가","\u0000"]},{"input":"\u0000͸각\u0000","expected":["\u0000","͸","각","\u0000"]},{"input":"\u0000͸̈각\u0000","expected":["\u0000","͸̈","각","\u0000"]},{"input":"\u0000͸⌚\u0000","expected":["\u0000","͸","⌚","\u0000"]},{"input":"\u0000͸̈⌚\u0000","expected":["\u0000","͸̈","⌚","\u0000"]},{"input":"\u0000͸̀\u0000","expected":["\u0000","͸̀","\u0000"]},{"input":"\u0000͸̈̀\u0000","expected":["\u0000","͸̈̀","\u0000"]},{"input":"\u0000͸‍\u0000","expected":["\u0000","͸‍","\u0000"]},{"input":"\u0000͸̈‍\u0000","expected":["\u0000","͸̈‍","\u0000"]},{"input":"\u0000͸͸\u0000","expected":["\u0000","͸","͸","\u0000"]},{"input":"\u0000͸̈͸\u0000","expected":["\u0000","͸̈","͸","\u0000"]},{"input":"\u0000\r\na\n̈\u0000","expected":["\u0000","\r\n","a","\n","̈","\u0000"]},{"input":"\u0000ä\u0000","expected":["\u0000","ä","\u0000"]},{"input":"\u0000 ‍ن\u0000","expected":["\u0000"," ‍","ن","\u0000"]},{"input":"\u0000ن‍ \u0000","expected":["\u0000","ن‍"," ","\u0000"]},{"input":"\u0000ᄀᄀ\u0000","expected":["\u0000","ᄀᄀ","\u0000"]},{"input":"\u0000각ᄀ\u0000","expected":["\u0000","각","ᄀ","\u0000"]},{"input":"\u0000각ᆨᄀ\u0000","expected":["\u0000","각ᆨ","ᄀ","\u0000"]},{"input":"\u0000🇦🇧🇨b\u0000","expected":["\u0000","🇦🇧","🇨","b","\u0000"]},{"input":"\u0000a🇦🇧🇨b\u0000","expected":["\u0000","a","🇦🇧","🇨","b","\u0000"]},{"input":"\u0000a🇦🇧‍🇨b\u0000","expected":["\u0000","a","🇦🇧‍","🇨","b","\u0000"]},{"input":"\u0000a🇦‍🇧🇨b\u0000","expected":["\u0000","a","🇦‍","🇧🇨","b","\u0000"]},{"input":"\u0000a🇦🇧🇨🇩b\u0000","expected":["\u0000","a","🇦🇧","🇨🇩","b","\u0000"]},{"input":"\u0000a‍\u0000","expected":["\u0000","a‍","\u0000"]},{"input":"\u0000äb\u0000","expected":["\u0000","ä","b","\u0000"]},{"input":"\u0000aःb\u0000","expected":["\u0000","aः","b","\u0000"]},{"input":"\u0000a؀b\u0000","expected":["\u0000","a","؀b","\u0000"]},{"input":"\u0000👶🏿👶\u0000","expected":["\u0000","👶🏿","👶","\u0000"]},{"input":"\u0000a🏿👶\u0000","expected":["\u0000","a🏿","👶","\u0000"]},{"input":"\u0000a🏿👶‍🛑\u0000","expected":["\u0000","a🏿","👶‍🛑","\u0000"]},{"input":"\u0000👶🏿̈‍👶🏿\u0000","expected":["\u0000","👶🏿̈‍👶🏿","\u0000"]},{"input":"\u0000🛑‍🛑\u0000","expected":["\u0000","🛑‍🛑","\u0000"]},{"input":"\u0000a‍🛑\u0000","expected":["\u0000","a‍","🛑","\u0000"]},{"input":"\u0000✁‍✁\u0000","expected":["\u0000","✁‍✁","\u0000"]},{"input":"\u0000a‍✁\u0000","expected":["\u0000","a‍","✁","\u0000"]}] diff --git a/num-grapheme-clusters/test/test.cli.js b/num-grapheme-clusters/test/test.cli.js deleted file mode 100644 index 5b2e8e86..00000000 --- a/num-grapheme-clusters/test/test.cli.js +++ /dev/null @@ -1,261 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints the number of grapheme clusters', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\\nboop\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '9\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-l` flag, the command-line interface prints the number of grapheme clusters for individual lines', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\\nboop\'; process.argv[ 3 ] = \'-l\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '4\n4\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop🌷"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '10\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream with `-l` flag, the command-line interface prints the number of grapheme clusters for each line', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop🌷"', - '|', - EXEC_PATH, - fpath, - '-l' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '4\n5\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/num-grapheme-clusters/test/test.js b/num-grapheme-clusters/test/test.js deleted file mode 100644 index 84597e0f..00000000 --- a/num-grapheme-clusters/test/test.js +++ /dev/null @@ -1,101 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 numGraphemeClusters = require( './../lib' ); - - -// FIXTURES // - -var fixtures = require( './fixtures/test_data.json' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof numGraphemeClusters, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - numGraphemeClusters( value ); - }; - } -}); - -tape( 'the function returns 0 if provided an empty string', function test( t ) { - t.strictEqual( numGraphemeClusters( '' ), 0, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns the Unicode aware length of a provided string', function test( t ) { - var out; - - out = numGraphemeClusters( 'hello world' ); - t.strictEqual( out, 11, 'returns expected value' ); - - out = numGraphemeClusters( '!!!' ); - t.strictEqual( out, 3, 'returns expected value' ); - - out = numGraphemeClusters( 'अनुच्छेद' ); - t.strictEqual( out, 5, 'returns expected value' ); - - out = numGraphemeClusters( '🌷' ); - t.strictEqual( out, 1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the number of grapheme clusters (Unicode 13 test cases)', function test( t ) { - var actual; - var d; - var i; - - for ( i = 0; i < fixtures.length; i++ ) { - d = fixtures[ i ]; - actual = numGraphemeClusters( d.input ); - t.strictEqual( actual, d.expected.length, 'returns expected value. Index: '+i+'. Input: '+d.input+'. Actual: '+actual+'. Expected: '+d.expected.length+'.' ); - } - t.end(); -}); diff --git a/num2words/README.md b/num2words/README.md deleted file mode 100644 index 9d001bac..00000000 --- a/num2words/README.md +++ /dev/null @@ -1,222 +0,0 @@ - - -# num2words - -> Convert a number to a word representation. - -
- -
- - - -
- -## Usage - -```javascript -var num2words = require( '@stdlib/string/num2words' ); -``` - -#### num2words( value\[, options] ) - -Converts a number to a word representation. - -```javascript -var out = num2words( 87 ); -// returns 'eighty-seven' - -out = num2words( 23101 ); -// returns 'twenty-three thousand one hundred one' - -out = num2words( 0.53 ); -// returns 'zero point five three' -``` - -The function accepts the following `options`: - -- **lang**: `string` indicating the language. Default: `'en'`. - -By default, the function returns a word representation of a number in English. To return a word representation of a number in a different language, set the `lang` option. - -```javascript -var out = num2words( 22, { - 'lang': 'de' -}); -// returns 'zweiundzwanzig' - -out = num2words( 0.53, { - 'lang': 'de' -}); -// returns 'null Komma fünf drei' -``` - -
- - - - - -
- -## Notes - -- The following languages are supported: - - - **en**: English. - - **de**: German. - -
- - - -
- -## Examples - - - -```javascript -var num2words = require( '@stdlib/string/num2words' ); - -var out = num2words( 29 ); -// returns 'twenty-nine' - -out = num2words( 113 ); -// returns 'one hundred thirteen' - -out = num2words( 13.52 ); -// returns 'thirteen point five two' - -out = num2words( 47, { - 'lang': 'de' -}); -// returns 'siebenundvierzig' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: num2words [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --lang lang Language. Default: 'en'. -``` - -
- - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'15\n23' | num2words --split /\r?\n/ - - # Escaped... - $ echo -n $'15\n23' | num2words --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ num2words '10' -ten -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n '23' | num2words -twenty-three -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n '10.3\t23.1' | num2words --split '\t' -ten point three -twenty-three point one -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/num2words/benchmark/benchmark.js b/num2words/benchmark/benchmark.js deleted file mode 100644 index 5dd9793a..00000000 --- a/num2words/benchmark/benchmark.js +++ /dev/null @@ -1,62 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var num2words = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var str; - var i; - - values = [ - 0, - 1, - 21, - 100, - 1000, - 10319, - 1000000, - 13029111, - 1000000000000, - 1000000000000000 - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = num2words( values[ i % values.length ] ); - if ( typeof str !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( str ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/num2words/bin/cli b/num2words/bin/cli deleted file mode 100755 index 3c974940..00000000 --- a/num2words/bin/cli +++ /dev/null @@ -1,113 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var Number = require( '@stdlib/number/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var num2words = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var opts; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - opts = { - 'lang': flags.lang || 'en' - }; - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( num2words( Number( args[ 0 ] ), opts ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( num2words( Number( lines[ i ] ), opts ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/num2words/docs/repl.txt b/num2words/docs/repl.txt deleted file mode 100644 index 73439f32..00000000 --- a/num2words/docs/repl.txt +++ /dev/null @@ -1,39 +0,0 @@ - -{{alias}}( value[, options] ) - Converts a number to a word representation. - - Parameters - ---------- - value: integer - Input value. - - options: Object (optional) - Options. - - options.lang: string (optional) - Language code. Supported languages: - - - en: English. - - de: German. - - Default: `'en'`. - - Returns - ------- - out: string - Word representation of number. - - Examples - -------- - > var out = {{alias}}( 123 ) - 'one hundred twenty-three' - - > out = {{alias}}( 16.31 ) - 'sixteen point three one' - - > out = {{alias}}( 123, { 'lang': 'de' } ) - 'einhundertdreiundzwanzig' - - See Also - -------- - diff --git a/num2words/docs/types/index.d.ts b/num2words/docs/types/index.d.ts deleted file mode 100644 index c240952f..00000000 --- a/num2words/docs/types/index.d.ts +++ /dev/null @@ -1,68 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Interface defining function options. -*/ -interface Options { - /** - * Language code (default: 'en'). - * - * ## Notes - * - * Supported languages: - * - * - **en**: English. - * - **de**: German. - */ - lang?: 'en' | 'de'; -} - - -/** -* Converts a number to a word representation. -* -* @param num - number to convert -* @param options - options -* @param options.lang - language code (default: 'en') -* @returns string representation of a number -* -* @example -* var out = num2words( 12 ); -* // returns 'twelve' -* -* @example -* var out = num2words( 21.8 ); -* // returns 'twenty-one point eight' -* -* @example -* var out = num2words( 1234 ); -* // returns 'one thousand two hundred thirty-four' -* -* @example -* var out = num2words( 100381 ); -* // returns 'one hundred thousand three hundred eighty-one' -*/ -declare function num2words( num: number, options?: Options ): string; - - -// EXPORTS // - -export = num2words; diff --git a/num2words/docs/types/test.ts b/num2words/docs/types/test.ts deleted file mode 100644 index f2700ff4..00000000 --- a/num2words/docs/types/test.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import num2words = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - num2words( 3 ); // $ExpectType string - num2words( 5, { 'lang': 'en' } ); // $ExpectType string -} - -// The compiler throws an error if the function is not provided a number as its first argument... -{ - num2words( 'abc' ); // $ExpectError - num2words( true ); // $ExpectError - num2words( false ); // $ExpectError - num2words( [] ); // $ExpectError - num2words( {} ); // $ExpectError - num2words( ( x: number ): number => x ); // $ExpectError - - num2words( 'abc', {} ); // $ExpectError - num2words( true, {} ); // $ExpectError - num2words( false, {} ); // $ExpectError - num2words( [], {} ); // $ExpectError - num2words( {}, {} ); // $ExpectError - num2words( ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an options argument which is not an object... -{ - num2words( 2, null ); // $ExpectError -} - -// The compiler throws an error if the function is provided a `lang` option which is not a recognized language code... -{ - num2words( 3, { 'lang': 'hello' } ); // $ExpectError - num2words( 3, { 'lang': 123 } ); // $ExpectError - num2words( 3, { 'lang': true } ); // $ExpectError - num2words( 3, { 'lang': false } ); // $ExpectError - num2words( 3, { 'lang': {} } ); // $ExpectError - num2words( 3, { 'lang': [] } ); // $ExpectError - num2words( 3, { 'lang': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - num2words(); // $ExpectError -} diff --git a/num2words/docs/usage.txt b/num2words/docs/usage.txt deleted file mode 100644 index 67624263..00000000 --- a/num2words/docs/usage.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Usage: num2words [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --lang lang Language. Default: 'en'. diff --git a/num2words/etc/cli_opts.json b/num2words/etc/cli_opts.json deleted file mode 100644 index 0fe57125..00000000 --- a/num2words/etc/cli_opts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "string": [ - "lang", - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/num2words/examples/index.js b/num2words/examples/index.js deleted file mode 100644 index a9f552ba..00000000 --- a/num2words/examples/index.js +++ /dev/null @@ -1,39 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -var num2words = require( './../lib' ); - -var out = num2words( 29 ); -console.log( out ); -// => 'twenty-nine' - -out = num2words( 113 ); -console.log( out ); -// => 'one hundred thirteen' - -out = num2words( 13.52 ); -console.log( out ); -// => 'thirteen point five two' - -out = num2words( 47, { - 'lang': 'de' -}); -console.log( out ); -// => 'siebenundvierzig' diff --git a/num2words/lib/decimals.js b/num2words/lib/decimals.js deleted file mode 100644 index 655bea17..00000000 --- a/num2words/lib/decimals.js +++ /dev/null @@ -1,50 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -/** -* Processes a string of decimal numbers and applies a function mapping decimal numbers to words to each character. -* -* @private -* @param {string} x - string of decimal numbers -* @param {Function} fcn - function mapping decimal numbers to words -* @returns {string} string of words -*/ -function decimals( x, fcn ) { - var out; - var len; - var i; - - len = x.length; - out = ''; - for ( i = 0; i < len; i++ ) { - out += fcn( x[ i ], '' ); - if ( i < len-1 ) { - out += ' '; - } - } - return out; -} - - -// EXPORTS // - -module.exports = decimals; diff --git a/num2words/lib/index.js b/num2words/lib/index.js deleted file mode 100644 index 76b2fb95..00000000 --- a/num2words/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a number to a word representation. -* -* @module @stdlib/string/num2words -* -* @example -* var num2words = require( '@stdlib/string/num2words' ); -* -* var out = num2words( 29 ); -* // returns 'twenty-nine' -* -* out = num2words( 13072 ); -* // returns 'thirteen thousand seventy-two' -* -* out = num2words( 183, { 'lang': 'de' } ); -* // returns 'einhundertdreiundachtzig' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/num2words/lib/int2words_de.js b/num2words/lib/int2words_de.js deleted file mode 100644 index 97332d69..00000000 --- a/num2words/lib/int2words_de.js +++ /dev/null @@ -1,146 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 @cspell/spellchecker */ - -'use strict'; - -// MODULES // - -var floor = require( '@stdlib/math/base/special/floor' ); -var endsWith = require( './../../base/ends-with' ); -var UNITS = require( './units.json' ); - - -// VARIABLES // - -var ONES = [ 'null', 'eins', 'zwei', 'drei', 'vier', 'fünf', 'sechs', 'sieben', 'acht', 'neun', 'zehn', 'elf', 'zwölf', 'dreizehn', 'vierzehn', 'fünfzehn', 'sechzehn', 'siebzehn', 'achtzehn', 'neunzehn' ]; -var TENS = [ 'null', 'zehn', 'zwanzig', 'dreißig', 'vierzig', 'fünfzig', 'sechzig', 'siebzig', 'achtzig', 'neunzig' ]; - - -// FUNCTIONS // - -/** -* Pluralizes a word by adding a 'n' or 'en' suffix. -* -* @private -* @param {string} word - word to pluralize -* @returns {string} pluralized word -*/ -function pluralize( word ) { - if ( endsWith( word, 'e' ) ) { - return word + 'n'; - } - return word + 'en'; -} - - -// MAIN // - -/** -* Converts a number to a word representation in German. -* -* @private -* @param {number} num - number to convert -* @param {string} out - output string -* @returns {string} word representation -* -* @example -* var words = int2wordsDE( 1243, '' ); -* // returns 'eintausendzweihundertdreiundvierzig' -* -* @example -* var words = int2wordsDE( 387, '' ); -* // returns 'dreihundertsiebenundachtzig' -* -* @example -* var words = int2wordsDE( 100, '' ); -* // returns 'einhundert' -* -* @example -* var words = int2wordsDE( 1421, '' ); -* // returns 'eintausendvierhunderteinundzwanzig' -* -* @example -* var words = int2wordsDE( 100381, '' ); -* // returns 'einhunderttausenddreihunderteinundachtzig' -* -* @example -* var words = int2wordsDE( -13, '' ); -* // returns 'minus dreizehn' -*/ -function int2wordsDE( num, out ) { - var word; - var rem; - var i; - if ( num === 0 ) { - // Case: We have reached the end of the number and the number is zero. - return out || 'null'; - } - if ( num < 0 ) { - out += 'minus '; - num *= -1; - } - if ( num < 20 ) { - rem = 0; - if ( num === 1 && out.length === 0 ) { - word = 'ein'; - } else { - word = ONES[ num ]; - } - } - else if ( num < 100 ) { - rem = num % 10; - word = TENS[ floor( num / 10 ) ]; - if ( rem ) { - word = ( ( rem === 1 ) ? 'ein' : ONES[ rem ] ) + 'und' + word; - rem = 0; - } - } - else if ( num < 1e3 ) { - rem = num % 100; - word = int2wordsDE( floor( num / 100 ), '' ) + 'hundert'; - } - else if ( num < 1e6 ) { - rem = num % 1e3; - word = int2wordsDE( floor( num / 1e3 ), '' ) + 'tausend'; - } - else { - for ( i = 5; i < UNITS.length; i++ ) { - if ( num < UNITS[ i ].VAL ) { - rem = num % UNITS[ i-1 ].VAL; - if ( floor( num / UNITS[ i-1 ].VAL ) === 1 ) { - word = 'eine ' + UNITS[ i-1 ].DE; - } else { - word = int2wordsDE( floor( num / UNITS[ i-1 ].VAL ), '' ) + ' ' + pluralize( UNITS[ i-1 ].DE ); - } - if ( rem ) { - word += ' '; - } - break; - } - } - } - out += word; - return int2wordsDE( rem, out ); -} - - -// EXPORTS // - -module.exports = int2wordsDE; diff --git a/num2words/lib/int2words_en.js b/num2words/lib/int2words_en.js deleted file mode 100644 index abed40ed..00000000 --- a/num2words/lib/int2words_en.js +++ /dev/null @@ -1,102 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var floor = require( '@stdlib/math/base/special/floor' ); -var UNITS = require( './units.json' ); - - -// VARIABLES // - -var ONES = [ 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen' ]; -var TENS = [ 'zero', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety' ]; - - -// MAIN // - -/** -* Converts a number to a word representation in English. -* -* @private -* @param {number} num - number to convert -* @param {string} out - output string -* @returns {string} word representation -* -* @example -* var words = int2wordsEN( 1234, '' ); -* // returns 'one thousand two hundred thirty-four' -* -* @example -* var words = int2wordsEN( -129, '' ); -* // returns 'minus one hundred twenty-nine' -* -* @example -* var words = int2wordsEN( 0, '' ); -* // returns 'zero' -*/ -function int2wordsEN( num, out ) { - var word; - var rem; - var i; - if ( num === 0 ) { - // Case: We have reached the end of the number and the number is zero. - return out || 'zero'; - } - if ( num < 0 ) { - out += 'minus'; - num *= -1; - } - if ( num < 20 ) { - rem = 0; - word = ONES[ num ]; - } - else if ( num < 100 ) { - rem = num % 10; - word = TENS[ floor( num / 10 ) ]; - if ( rem > 0 ) { - word += '-' + ONES[ rem ]; - rem = 0; - } - } - else { - for ( i = 3; i < UNITS.length - 1; i++ ) { - if ( num < UNITS[ i ].VAL ) { - rem = num % UNITS[ i-1 ].VAL; - word = int2wordsEN( floor( num / UNITS[ i-1 ].VAL ), '' ) + ' ' + UNITS[ i-1 ].EN; - break; - } - } - if ( i === UNITS.length - 1 ) { - rem = num % UNITS[ i-1 ].VAL; - word = int2wordsEN( floor( num / UNITS[ i-1 ].VAL ), '' ) + ' ' + UNITS[ i-1 ].EN; - } - } - if ( out.length > 0 ) { - out += ' '; - } - out += word; - return int2wordsEN( rem, out ); -} - - -// EXPORTS // - -module.exports = int2wordsEN; diff --git a/num2words/lib/main.js b/num2words/lib/main.js deleted file mode 100644 index d039310a..00000000 --- a/num2words/lib/main.js +++ /dev/null @@ -1,106 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isNumber = require( '@stdlib/assert/is-number' ).isPrimitive; -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var isfinite = require( '@stdlib/math/base/assert/is-finite' ); -var format = require( './../../format' ); -var int2wordsDE = require( './int2words_de.js' ); -var int2wordsEN = require( './int2words_en.js' ); -var validate = require( './validate.js' ); -var decimals = require( './decimals.js' ); - - -// MAIN // - -/** -* Converts a number to a word representation. -* -* @param {number} num - number to convert -* @param {Object} [options] - options -* @param {string} [options.lang='en'] - language code -* @throws {TypeError} must provide valid options -* @returns {string} word representation of number -* -* @example -* var out = num2words( 12 ); -* // returns 'twelve' -* -* @example -* var out = num2words( 21.8 ); -* // returns 'twenty-one point eight' -* -* @example -* var out = num2words( 1234 ); -* // returns 'one thousand two hundred thirty-four' -* -* @example -* var out = num2words( 100381 ); -* // returns 'one hundred thousand three hundred eighty-one' -*/ -function num2words( num, options ) { - var parts; - var opts; - var err; - - if ( !isNumber( num ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a number. Value: `%s`.', num ) ); - } - opts = {}; - if ( arguments.length > 1 ) { - err = validate( opts, options ); - if ( err ) { - throw err; - } - } - if ( isInteger( num ) ) { - switch ( opts.lang ) { - case 'de': - return int2wordsDE( num, '' ); - case 'en': - default: - return int2wordsEN( num, '' ); - } - } - if ( !isfinite( num ) ) { - switch ( opts.lang ) { - case 'de': - return ( num < 0 ) ? 'minus unendlich' : 'unendlich'; - case 'en': - default: - return ( num < 0 ) ? 'negative infinity' : 'infinity'; - } - } - parts = num.toString().split( '.' ); - switch ( opts.lang ) { - case 'de': - return int2wordsDE( parts[ 0 ], '' ) + ' Komma ' + decimals( parts[ 1 ], int2wordsDE ); - case 'en': - default: - return int2wordsEN( parts[ 0 ], '' ) + ' point ' + decimals( parts[ 1 ], int2wordsEN ); - } -} - - -// EXPORTS // - -module.exports = num2words; diff --git a/num2words/lib/units.json b/num2words/lib/units.json deleted file mode 100644 index a0c6150a..00000000 --- a/num2words/lib/units.json +++ /dev/null @@ -1,53 +0,0 @@ -[ - { "VAL": 1e0, "EN": "zero", "DE": "null" }, - { "VAL": 1e1, "EN": "ten", "DE": "zehn" }, - { "VAL": 1e2, "EN": "hundred", "DE": "hundert" }, - { "VAL": 1e3, "EN": "thousand", "DE": "tausend" }, - { "VAL": 1e6, "EN": "million", "DE": "Million" }, - { "VAL": 1e9, "EN": "billion", "DE": "Milliarde" }, - { "VAL": 1e12, "EN": "trillion", "DE": "Billion" }, - { "VAL": 1e15, "EN": "quadrillion", "DE": "Billiarde" }, - { "VAL": 1e18, "EN": "quintillion", "DE": "Trillion" }, - { "VAL": 1e21, "EN": "sextillion", "DE": "Trilliarde" }, - { "VAL": 1e24, "EN": "septillion", "DE": "Quadrillion" }, - { "VAL": 1e27, "EN": "octillion", "DE": "Quadrilliarde" }, - { "VAL": 1e30, "EN": "nonillion", "DE": "Quintillion" }, - { "VAL": 1e33, "EN": "decillion", "DE": "Quintilliarde" }, - { "VAL": 1e36, "EN": "undecillion", "DE": "Sextillion" }, - { "VAL": 1e39, "EN": "duodecillion", "DE": "Sextilliarde" }, - { "VAL": 1e42, "EN": "tredecillion", "DE": "Septillion" }, - { "VAL": 1e45, "EN": "quattuordecillion", "DE": "Septilliarde" }, - { "VAL": 1e48, "EN": "quindecillion", "DE": "Octillion" }, - { "VAL": 1e51, "EN": "sedecillion", "DE": "Octilliarde" }, - { "VAL": 1e54, "EN": "septendecillion", "DE": "Nonillion" }, - { "VAL": 1e57, "EN": "octodecillion", "DE": "Nonilliarde" }, - { "VAL": 1e60, "EN": "novendecillion", "DE": "Decillion" }, - { "VAL": 1e63, "EN": "vigintillion", "DE": "Decilliarde" }, - { "VAL": 1e66, "EN": "unvigintillion", "DE": "Undecillion" }, - { "VAL": 1e69, "EN": "duovigintillion", "DE": "Undecilliarde" }, - { "VAL": 1e72, "EN": "tresvigintillion", "DE": "Duodecillion" }, - { "VAL": 1e75, "EN": "quattuorvigintillion", "DE": "Duodecilliarde" }, - { "VAL": 1e78, "EN": "quinquavigintillion", "DE": "Tredecillion" }, - { "VAL": 1e81, "EN": "sesvigintillion", "DE": "Tredecilliarde" }, - { "VAL": 1e84, "EN": "septemvigintillion", "DE": "Quattuordecillion" }, - { "VAL": 1e87, "EN": "octovigintillion", "DE": "Quattuordecilliarde" }, - { "VAL": 1e90, "EN": "novemvigintillion", "DE": "Quindecillion" }, - { "VAL": 1e93, "EN": "trigintillion", "DE": "Quindecilliarde" }, - { "VAL": 1e96, "EN": "untrigintillion", "DE": "Sedecillion" }, - { "VAL": 1e99, "EN": "duotrigintillion", "DE": "Sedecilliarde" }, - { "VAL": 1e102, "EN": "trestrigintillion", "DE": "Septendecillion" }, - { "VAL": 1e105, "EN": "quattuortrigintillion", "DE": "Septendecilliarde" }, - { "VAL": 1e108, "EN": "quinquatrigintillion", "DE": "Octodecillion" }, - { "VAL": 1e111, "EN": "sestrigintillion", "DE": "Octodecilliarde" }, - { "VAL": 1e114, "EN": "septentrigintillion", "DE": "Novendecillion" }, - { "VAL": 1e117, "EN": "octotrigintillion", "DE": "Novendecilliarde" }, - { "VAL": 1e120, "EN": "noventrigintillion", "DE": "Vigintillion" }, - { "VAL": 1e123, "EN": "quadragintillion", "DE": "Vigintilliarde" }, - { "VAL": 1e153, "EN": "quinquagintillion", "DE": "Quinvigintilliarde" }, - { "VAL": 1e183, "EN": "sexagintillion", "DE": "Trigintilliarde" }, - { "VAL": 1e213, "EN": "septuagintillion", "DE": "Quintrigintilliarde" }, - { "VAL": 1e243, "EN": "octogintillion", "DE": "Quadragintilliarde" }, - { "VAL": 1e273, "EN": "nonagintillion", "DE": "Quin­quadra­gint­illiarde" }, - { "VAL": 1e303, "EN": "centillion", "DE": "Quinquagintilliarde" }, - { "VAL": 1e306, "EN": "uncentillion", "DE": "Unquinquagintillione" } -] diff --git a/num2words/lib/validate.js b/num2words/lib/validate.js deleted file mode 100644 index 649990c9..00000000 --- a/num2words/lib/validate.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isPlainObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var indexOf = require( '@stdlib/utils/index-of' ); -var format = require( './../../format' ); - - -// VARIABLES // - -var LANGUAGE_CODES = [ 'en', 'de' ]; - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - options to validate -* @param {string} [options.lang] - language code -* @returns {(null|Error)} error object or null -* -* @example -* var opts = {}; -* var options = { -* 'lang': 'es' -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - if ( !isPlainObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - if ( hasOwnProp( options, 'lang' ) ) { - opts.lang = options.lang; - if ( indexOf( LANGUAGE_CODES, opts.lang ) === -1 ) { - return new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Value: `%s`.', 'lang', LANGUAGE_CODES.join( '", "' ), opts.lang ) ); - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/num2words/package.json b/num2words/package.json deleted file mode 100644 index 8cad1c46..00000000 --- a/num2words/package.json +++ /dev/null @@ -1,65 +0,0 @@ -{ - "name": "@stdlib/string/num2words", - "version": "0.0.0", - "description": "Convert a number to a word representation.", - "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" - } - ], - "bin": { - "num2words": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "words", - "word" - ] -} diff --git a/num2words/test/fixtures/stdin_error.js.txt b/num2words/test/fixtures/stdin_error.js.txt deleted file mode 100644 index b42c70b3..00000000 --- a/num2words/test/fixtures/stdin_error.js.txt +++ /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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/num2words/test/test.cli.js b/num2words/test/test.cli.js deleted file mode 100644 index f2b39b39..00000000 --- a/num2words/test/test.cli.js +++ /dev/null @@ -1,305 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a number to a word representation', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'13\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'thirteen\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a number to a word representation (lang=de)', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'193\'; process.argv[ 3 ] = \'--lang=de\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'einhundertdreiundneunzig\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "10\n13"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'ten\nthirteen\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream (lang=de)', opts, function test( t ) { - var cmd = [ - 'printf "10\n13"', - '|', - EXEC_PATH, - fpath, - '--lang=de' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'zehn\ndreizehn\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'2\t3\t4\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'two\nthree\nfour\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'2\t3\t4\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'two\nthree\nfour\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/num2words/test/test.js b/num2words/test/test.js deleted file mode 100644 index 7b06a12c..00000000 --- a/num2words/test/test.js +++ /dev/null @@ -1,394 +0,0 @@ - -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 PINF = require( '@stdlib/constants/float64/pinf' ); -var NINF = require( '@stdlib/constants/float64/ninf' ); -var num2words = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof num2words, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if the first argument is not a number, the function throws an error', function test( t ) { - var values; - var i; - - values = [ - '123', - null, - true, - 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() { - num2words( value ); - }; - } -}); - -tape( 'if the first argument is not a number, the function throws an error (options)', function test( t ) { - var values; - var i; - - values = [ - '123', - null, - true, - 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() { - num2words( value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided an invalid options argument', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 5, - null, - true, - void 0, - NaN, - 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 zipper() { - num2words( 8, value ); - }; - } -}); - -tape( 'the function throws an error if provided an invalid `lang` option', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 5, - null, - [], - {}, - true, - void 0, - NaN, - 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 zipper() { - num2words( 8, { - 'lang': value - }); - }; - } -}); - -tape( 'the function converts an integer to its word representation (default language)', function test( t ) { - var expected; - var values; - var i; - - values = [ - 0, - 10, - 23, - 193, - 1000, - 1001, - 100312, - 1000000, - 1000001, - 1000000000, - 1e81 - ]; - expected = [ - 'zero', - 'ten', - 'twenty-three', - 'one hundred ninety-three', - 'one thousand', - 'one thousand one', - 'one hundred thousand three hundred twelve', - 'one million', - 'one million one', - 'one billion', - 'one sesvigintillion' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( num2words( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a decimal number to its word representation (default language)', function test( t ) { - var expected; - var values; - var i; - - values = [ - 10.3, - 23.1, - 193.12, - 1000.187, - 100312.12, - 1000000.999 - ]; - expected = [ - 'ten point three', - 'twenty-three point one', - 'one hundred ninety-three point one two', - 'one thousand point one eight seven', - 'one hundred thousand three hundred twelve point one two', - 'one million point nine nine nine' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( num2words( values[i] ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts an integer to its word representation (lang=en)', function test( t ) { - var expected; - var values; - var opts; - var i; - - values = [ - 0, - 10, - 23, - 193, - 1000, - 1001, - 100312, - 1000000, - 1000001, - 1000000000 - ]; - expected = [ - 'zero', - 'ten', - 'twenty-three', - 'one hundred ninety-three', - 'one thousand', - 'one thousand one', - 'one hundred thousand three hundred twelve', - 'one million', - 'one million one', - 'one billion' - ]; - opts = { - 'lang': 'en' - }; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( num2words( values[i], opts ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a decimal number to its word representation (lang=en)', function test( t ) { - var expected; - var values; - var opts; - var i; - - values = [ - 10.3, - 23.1, - 193.12, - 1000.187, - 100312.12, - 1000000.999 - ]; - expected = [ - 'ten point three', - 'twenty-three point one', - 'one hundred ninety-three point one two', - 'one thousand point one eight seven', - 'one hundred thousand three hundred twelve point one two', - 'one million point nine nine nine' - ]; - opts = { - 'lang': 'en' - }; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( num2words( values[i], opts ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts an integer to its word representation (lang=de)', function test( t ) { - var expected; - var values; - var opts; - var i; - - values = [ - 0, - 10, - 23, - 193, - 1000, - 1001, - 100312, - 1000000, - 1000001, - 1000000000, - 381, - 1066, - -10, - -23, - -193, - 1234567890, - 999999, - 1e102 - ]; - expected = [ - 'null', - 'zehn', - 'dreiundzwanzig', - 'einhundertdreiundneunzig', - 'eintausend', - 'eintausendeins', - 'einhunderttausenddreihundertzwölf', - 'eine Million', - 'eine Million eins', - 'eine Milliarde', - 'dreihunderteinundachtzig', - 'eintausendsechsundsechzig', - 'minus zehn', - 'minus dreiundzwanzig', - 'minus einhundertdreiundneunzig', - 'eine Milliarde zweihundertvierunddreißig Millionen fünfhundertsiebenundsechzigtausendachthundertneunzig', - 'neunhundertneunundneunzigtausendneunhundertneunundneunzig', - 'eine Septendecillion' - ]; - - opts = { - 'lang': 'de' - }; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( num2words( values[i], opts ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function converts a decimal number to its word representation (lang=de)', function test( t ) { - var expected; - var values; - var opts; - var i; - - values = [ - 10.3, - 23.1, - 193.12, - -10.3, - -123.11 - ]; - expected = [ - 'zehn Komma drei', - 'dreiundzwanzig Komma eins', - 'einhundertdreiundneunzig Komma eins zwei', - 'minus zehn Komma drei', - 'minus einhundertdreiundzwanzig Komma eins eins' - ]; - - opts = { - 'lang': 'de' - }; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( num2words( values[i], opts ), expected[i], 'returns expected value' ); - } - t.end(); -}); - -tape( 'the function handles infinity (default language)', function test( t ) { - t.strictEqual( num2words( PINF ), 'infinity', 'returns expected value' ); - t.strictEqual( num2words( NINF ), 'negative infinity', 'returns expected value' ); - t.end(); -}); - -tape( 'the function handles infinity (lang=en)', function test( t ) { - var opts = { - 'lang': 'en' - }; - t.strictEqual( num2words( PINF, opts ), 'infinity', 'returns expected value' ); - t.strictEqual( num2words( NINF, opts ), 'negative infinity', 'returns expected value' ); - t.end(); -}); - -tape( 'the function handles infinity (lang=de)', function test( t ) { - var opts = { - 'lang': 'de' - }; - t.strictEqual( num2words( PINF, opts ), 'unendlich', 'returns expected value' ); - t.strictEqual( num2words( NINF, opts ), 'minus unendlich', 'returns expected value' ); - t.end(); -}); diff --git a/num2words/test/test.validate.js b/num2words/test/test.validate.js deleted file mode 100644 index 76a7e079..00000000 --- a/num2words/test/test.validate.js +++ /dev/null @@ -1,126 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 validate = require( './../lib/validate.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof validate, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a type error if not provided an options object', function test( t ) { - var values; - var err; - var i; - - values = [ - '5', - 5, - NaN, - true, - null, - void 0, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - err = validate( {}, values[i] ); - t.strictEqual( err instanceof TypeError, true, 'returns a TypeError when provided '+values[i] ); - } - t.end(); -}); - -tape( 'the function returns a type error if provided a `lang` option which is not a recognized language code', function test( t ) { - var values; - var err; - var i; - - values = [ - 123, - '5', - false, - NaN, - null, - void 0, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - err = validate( {}, { - 'lang': values[i] - }); - t.strictEqual( err instanceof TypeError, true, 'returns a TypeError when provided '+values[i] ); - } - t.end(); -}); - -tape( 'the function returns `null` if all options are valid', function test( t ) { - var expected; - var options; - var opts; - var err; - - options = { - 'lang': 'en' - }; - opts = {}; - - expected = { - 'lang': options.lang - }; - - err = validate( opts, options ); - - t.strictEqual( err, null, 'returns expected value' ); - t.deepEqual( opts, expected, 'extracts options' ); - - t.end(); -}); - -tape( 'the function ignores unrecognized options', function test( t ) { - var options; - var opts; - var err; - - options = { - 'beep': 'boop', - 'foo': 5, - 'bar': {} - }; - - opts = {}; - - err = validate( opts, options ); - - t.strictEqual( err, null, 'returns expected value' ); - t.deepEqual( opts, {}, 'ignores unrecognized options' ); - - t.end(); -}); diff --git a/package.json b/package.json index 0d35a62d..b2c7e5d2 100644 --- a/package.json +++ b/package.json @@ -3,30 +3,7 @@ "version": "0.4.1", "description": "String manipulation functions.", "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": { - "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", @@ -35,50 +12,6 @@ "bugs": { "url": "https://github.com/stdlib-js/stdlib/issues" }, - "dependencies": { - "@stdlib/array": "github:stdlib-js/array#main", - "@stdlib/assert": "github:stdlib-js/assert#main", - "@stdlib/buffer": "github:stdlib-js/buffer#main", - "@stdlib/cli": "github:stdlib-js/cli#main", - "@stdlib/constants": "github:stdlib-js/constants#main", - "@stdlib/dstructs": "github:stdlib-js/dstructs#main", - "@stdlib/fs": "github:stdlib-js/fs#main", - "@stdlib/math": "github:stdlib-js/math#main", - "@stdlib/nlp": "github:stdlib-js/nlp#main", - "@stdlib/number": "github:stdlib-js/number#main", - "@stdlib/process": "github:stdlib-js/process#main", - "@stdlib/random": "github:stdlib-js/random#main", - "@stdlib/regexp": "github:stdlib-js/regexp#main", - "@stdlib/streams": "github:stdlib-js/streams#main", - "@stdlib/symbol": "github:stdlib-js/symbol#main", - "@stdlib/types": "github:stdlib-js/types#main", - "@stdlib/utils": "github:stdlib-js/utils#main" - }, - "devDependencies": { - "@stdlib/bench": "github:stdlib-js/bench#main", - "@stdlib/blas": "github:stdlib-js/blas#main", - "@stdlib/console": "github:stdlib-js/console#main", - "@stdlib/datasets": "github:stdlib-js/datasets#main", - "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" - }, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], "keywords": [ "stdlib", "standard", diff --git a/pad/README.md b/pad/README.md deleted file mode 100644 index 54a0df5b..00000000 --- a/pad/README.md +++ /dev/null @@ -1,309 +0,0 @@ - - -# pad - -> Pad a string. - -
- -
- - - -
- -## Usage - -```javascript -var pad = require( '@stdlib/string/pad' ); -``` - -#### pad( str, len\[, options] ) - -Pads a `string` such that the padded `string` has a `length` of `len`. - -```javascript -var str = pad( 'a', 5 ); -// returns 'a ' -``` - -The function accepts the following `options`: - -- **lpad**: `string` used to left pad. Default: `''`. -- **rpad**: `string` used to right pad. Default: `' '`. -- **centerRight**: `boolean` indicating whether to center right in the event of a tie. Default: `false` (i.e., center left). - -By default, an input `string` is padded with spaces. To pad with a different character or sequence of characters, provide a pad `string`. - -```javascript -var str = pad( 'a', 10, { - 'lpad': 'b' -}); -// returns 'bbbbbbbbba' - -str = pad( 'a', 12, { - 'rpad': 'b' -}); -// returns 'abbbbbbbbbbb' -``` - -To center an input `string`, provide both `lpad` and `rpad` options. - -```javascript -var opts = { - 'lpad': 'a', - 'rpad': 'c' -}; - -var str = pad( 'b', 11, opts ); -// returns 'aaaaabccccc' -``` - -When both `lpad` and `rpad` are specified and `len-str.length` is **odd**, left and right padding cannot equally split the available padding space. By default, right padding receives the extra character (i.e., the input `string` is left-centered). - -```javascript -var opts = { - 'lpad': 'a', - 'rpad': 'c' -}; - -var str = pad( 'b', 10, opts ); -// returns 'aaaabccccc' -``` - -To center right, set the `centerRight` option. - -```javascript -var opts = { - 'lpad': 'a', - 'rpad': 'c', - 'centerRight': true -}; - -var str = pad( 'b', 10, opts ); -// returns 'aaaaabcccc' -``` - -
- - - -
- -## Notes - -- In contrast to [lpad][@stdlib/string/left-pad] and [rpad][@stdlib/string/right-pad], any padding which does not evenly divide available space is trimmed such that the returned `string` length is **always** `len`. - - ```javascript - var opts = { - 'lpad': 'boop', - 'rpad': 'woot' - }; - var str = pad( 'beep', 10, opts ); - // returns 'boobeepwoo' - ``` - -- Similarly, if `len < str.length`, the input `string` is trimmed. - - ```javascript - // Pad right, trim right: - var str = pad( 'beep', 2 ); - // returns 'be' - - // Pad left, trim left: - str = pad( 'beep', 2, { - 'lpad': 'b' - }); - // returns 'ep' - - // Pad both, trim both: - str = pad( 'beep', 2, { - 'lpad': '@', - 'rpad': '!' - }); - // returns 'ee' - - // Pad both, trim both starting from left: - str = pad( 'abcdef', 3, { - 'lpad': '@', - 'rpad': '!' - }); - // returns 'cde' - - // Pad both, trim both starting from right: - str = pad( 'abcdef', 3, { - 'lpad': '@', - 'rpad': '!', - 'centerRight': true - }); - // returns 'bcd' - ``` - -
- - - -
- -## Examples - - - -```javascript -var round = require( '@stdlib/math/base/special/round' ); -var randu = require( '@stdlib/random/base/randu' ); -var pad = require( '@stdlib/string/pad' ); - -var str = 'boop'; -var out; -var len; -var i; - -for ( i = 0; i < 100; i++ ) { - len = round( randu()*10.0 ) + str.length; - out = pad( str, len, { - 'lpad': 'beep', - 'rpad': 'p' - }); - console.log( '%s. %d. %d.', out, len, out.length ); -} -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: padstr [options] [] --len - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --len length String length. - --lpad str String used to left pad. Default: ''. - --rpad str String used to right pad. Default: ' '. - --cright Center right in the event of a tie. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nboop' | padstr --len 10 --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nboop' | padstr --len 10 --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ padstr beep --len 10 --lpad b --rpad p -bbbbeepppp -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep' | pad --len 9 --lpad a --rpad o -aabeepooo -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tboop' | pad --len 9 --lpad a --rpad o --split '\t' -aabeepooo -aaboopooo -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/pad/benchmark/benchmark.center.js b/pad/benchmark/benchmark.center.js deleted file mode 100644 index afa6d913..00000000 --- a/pad/benchmark/benchmark.center.js +++ /dev/null @@ -1,99 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var pad = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - string length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - var opts = { - 'lpad': 'a', - 'rpad': 'bc', - 'centerRight': true - }; - 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 = pad( fromCodePoint( i%126 ), len, opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - 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 = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - len = 10 * i; - f = createBenchmark( len ); - bench( format( '%s::center:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/pad/benchmark/benchmark.js b/pad/benchmark/benchmark.js deleted file mode 100644 index f4085e66..00000000 --- a/pad/benchmark/benchmark.js +++ /dev/null @@ -1,94 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var pad = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - string length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - 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 = pad( fromCodePoint( i%126 ), len ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - 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 = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - len = 10 * i; - f = createBenchmark( len ); - bench( format( '%s:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/pad/bin/cli b/pad/bin/cli deleted file mode 100755 index c7934a0f..00000000 --- a/pad/bin/cli +++ /dev/null @@ -1,128 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var pad = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var opts; - var cli; - var len; - var str; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - if ( args.length ) { - str = args[ 0 ]; - } else { - // Treat an empty value as an empty string: - str = ''; - } - len = parseInt( flags.len, 10 ); - opts = {}; - if ( flags.lpad ) { - opts.lpad = flags.lpad; - } - if ( flags.rpad ) { - opts.rpad = flags.rpad; - } - if ( flags.cright ) { - opts.centerRight = flags.cright; - } - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - opts.split = reFromString( flags.split ); - } else { - opts.split = RE_EOL; - } - return stdin( onRead ); - } - console.log( pad( str, len, opts ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( opts.split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( pad( lines[ i ], len, opts ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/pad/docs/repl.txt b/pad/docs/repl.txt deleted file mode 100644 index ac979f7c..00000000 --- a/pad/docs/repl.txt +++ /dev/null @@ -1,95 +0,0 @@ - -{{alias}}( str, len[, options] ) - Pads a `string` such that the padded `string` has length `len`. - - Any padding which does not evenly divide available space is trimmed such - that the returned string length is always `len`. - - If `len < str.length`, the input string is trimmed. - - Parameters - ---------- - str: string - Input string. - - len: integer - Output string length. - - options: Object (optional) - Options. - - options.lpad: string (optional) - String used to left pad. - - options.rpad: string (optional) - String used to right pad. - - options.centerRight: boolean (optional) - Boolean indicating whether to center right in the event of a tie. - Default: `false` (i.e., center left). - - Returns - ------- - out: string - Padded string. - - Examples - -------- - // Standard usage: - > var out = {{alias}}( 'a', 5 ) - 'a ' - - // Left pad: - > out = {{alias}}( 'a', 10, { 'lpad': 'b' } ) - 'bbbbbbbbba' - - // Right pad: - > out = {{alias}}( 'a', 12, { 'rpad': 'b' } ) - 'abbbbbbbbbbb' - - // Center an input string: - > var opts = { 'lpad': 'a', 'rpad': 'c' }; - > out = {{alias}}( 'b', 11, opts ) - 'aaaaabccccc' - - // Left center: - > opts.centerRight = false; - > out = {{alias}}( 'b', 10, opts ) - 'aaaabccccc' - - // Right center: - > opts.centerRight = true; - > out = {{alias}}( 'b', 10, opts ) - 'aaaaabcccc' - - // Output string always length `len`: - > opts = { 'lpad': 'boop', 'rpad': 'woot' }; - > out = {{alias}}( 'beep', 10, opts ) - 'boobeepwoo' - - // Pad right, trim right: - > out = {{alias}}( 'beep', 2 ) - 'be' - - // Pad left, trim left: - > opts = { 'lpad': 'b' }; - > out = {{alias}}( 'beep', 2, opts ) - 'ep' - - // Pad both, trim both: - > opts = { 'lpad': '@', 'rpad': '!' }; - > out = {{alias}}( 'beep', 2, opts ) - 'ee' - - // Pad both, trim both starting from left: - > out = {{alias}}( 'abcdef', 3, opts ) - 'cde' - - // Pad both, trim both starting from right: - > opts.centerRight = true; - > out = {{alias}}( 'abcdef', 3, opts ) - 'bcd' - - See Also - -------- - diff --git a/pad/docs/types/index.d.ts b/pad/docs/types/index.d.ts deleted file mode 100644 index 1bb1b189..00000000 --- a/pad/docs/types/index.d.ts +++ /dev/null @@ -1,93 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Interface defining function options. -*/ -interface Options { - /** - * String used to left pad. - */ - lpad?: string; - - /** - * String used to right pad. - */ - rpad?: string; - - /** - * Boolean indicating whether to center right in the event of a tie. - */ - centerRight?: boolean; -} - -/** -* Pads a string such that the padded string has a length of `len`. -* -* @param str - string to pad -* @param len - string length -* @param options - function options -* @param options.lpad - string used to left pad (default: '') -* @param options.rpad - string used to right pad (default: ' ') -* @param options.centerRight - boolean indicating whether to center right in the event of a tie (default: false) -* @throws second argument must be a nonnegative integer -* @throws must provide valid options -* @throws at least one padding must have a length greater than `0` -* @returns padded string -* -* @example -* var str = pad( 'a', 5 ); -* // returns 'a ' -* -* @example -* var str = pad( 'a', 10, { -* 'lpad': 'b' -* }); -* // returns 'bbbbbbbbba' -* -* @example -* var str = pad( 'a', 12, { -* 'rpad': 'b' -* }); -* // returns 'abbbbbbbbbbb' -* -* @example -* var opts = { -* 'lpad': 'a', -* 'rpad': 'c' -* }; -* var str = pad( 'b', 10, opts ); -* // returns 'aaaabccccc' -* -* @example -* var opts = { -* 'lpad': 'a', -* 'rpad': 'c', -* 'centerRight': true -* }; -* var str = pad( 'b', 10, opts ); -* // returns 'aaaaabcccc' -*/ -declare function pad( str: string, len: number, options?: Options ): string; - - -// EXPORTS // - -export = pad; diff --git a/pad/docs/types/test.ts b/pad/docs/types/test.ts deleted file mode 100644 index c22b265d..00000000 --- a/pad/docs/types/test.ts +++ /dev/null @@ -1,89 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import pad = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - pad( 'abd', 10 ); // $ExpectType string - pad( 'abd', 10, { 'lpad': 'a', 'rpad': 'c' } ); // $ExpectType string - pad( 'abd', 10, { 'centerRight': true } ); // $ExpectType string -} - -// The compiler throws an error if the function is not provided a string as its first argument... -{ - pad( true, 6 ); // $ExpectError - pad( false, 6 ); // $ExpectError - pad( 3, 6 ); // $ExpectError - pad( [], 6 ); // $ExpectError - pad( {}, 6 ); // $ExpectError - pad( ( x: number ): number => x, 6 ); // $ExpectError -} - -// The compiler throws an error if the function is not provided a number as its second argument... -{ - pad( 'abd', true ); // $ExpectError - pad( 'abd', false ); // $ExpectError - pad( 'abd', 'abc' ); // $ExpectError - pad( 'abd', [], 0 ); // $ExpectError - pad( 'abd', {}, 0 ); // $ExpectError - pad( 'abd', ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the function is provided an options argument which is not an object... -{ - pad( 'abc', 5, null ); // $ExpectError -} - -// The compiler throws an error if the function is provided a `lpad` option which is not a string... -{ - pad( 'abd', 10, { 'lpad': 123 } ); // $ExpectError - pad( 'abd', 10, { 'lpad': true } ); // $ExpectError - pad( 'abd', 10, { 'lpad': false } ); // $ExpectError - pad( 'abd', 10, { 'lpad': {} } ); // $ExpectError - pad( 'abd', 10, { 'lpad': [] } ); // $ExpectError - pad( 'abd', 10, { 'lpad': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided a `rpad` option which is not a string... -{ - pad( 'abd', 10, { 'rpad': 123 } ); // $ExpectError - pad( 'abd', 10, { 'rpad': true } ); // $ExpectError - pad( 'abd', 10, { 'rpad': false } ); // $ExpectError - pad( 'abd', 10, { 'rpad': {} } ); // $ExpectError - pad( 'abd', 10, { 'rpad': [] } ); // $ExpectError - pad( 'abd', 10, { 'rpad': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided a `centerRight` option which is not a boolean... -{ - pad( 'abd', 10, { 'centerRight': 123 } ); // $ExpectError - pad( 'abd', 10, { 'centerRight': 'abc' } ); // $ExpectError - pad( 'abd', 10, { 'centerRight': {} } ); // $ExpectError - pad( 'abd', 10, { 'centerRight': [] } ); // $ExpectError - pad( 'abd', 10, { 'centerRight': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - pad(); // $ExpectError - pad( 'abc' ); // $ExpectError -} diff --git a/pad/docs/usage.txt b/pad/docs/usage.txt deleted file mode 100644 index dc5fb2cd..00000000 --- a/pad/docs/usage.txt +++ /dev/null @@ -1,12 +0,0 @@ - -Usage: padstr [options] [] --len - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --len length String length. - --lpad str String used to left pad. Default: ''. - --rpad str String used to right pad. Default: ' '. - --cright Center right in the event of a tie. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/pad/etc/cli_opts.json b/pad/etc/cli_opts.json deleted file mode 100644 index 73a26d04..00000000 --- a/pad/etc/cli_opts.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "boolean": [ - "help", - "version", - "cright" - ], - "string": [ - "len", - "lpad", - "rpad", - "split" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/pad/examples/index.js b/pad/examples/index.js deleted file mode 100644 index 9741cdb3..00000000 --- a/pad/examples/index.js +++ /dev/null @@ -1,37 +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'; - -var round = require( '@stdlib/math/base/special/round' ); -var randu = require( '@stdlib/random/base/randu' ); -var pad = require( './../lib' ); - -var str = 'boop'; -var out; -var len; -var i; - -for ( i = 0; i < 100; i++ ) { - len = round( randu()*10.0 ) + str.length; - out = pad( str, len, { - 'lpad': 'beep', - 'rpad': 'p' - }); - console.log( '%s. %d. %d.', out, len, out.length ); -} diff --git a/pad/lib/index.js b/pad/lib/index.js deleted file mode 100644 index d4c3f855..00000000 --- a/pad/lib/index.js +++ /dev/null @@ -1,65 +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'; - -/** -* Pad a string. -* -* @module @stdlib/string/pad -* -* @example -* var pad = require( '@stdlib/string/pad' ); -* -* var str = pad( 'a', 5 ); -* // returns 'a ' -* -* str = pad( 'a', 10, { -* 'lpad': 'b' -* }); -* // returns 'bbbbbbbbba' -* -* str = pad( 'a', 12, { -* 'rpad': 'b' -* }); -* // returns 'abbbbbbbbbbb' -* -* var opts = { -* 'lpad': 'a', -* 'rpad': 'c' -* }; -* str = pad( 'b', 10, opts ); -* // returns 'aaaabccccc' -* -* opts = { -* 'lpad': 'a', -* 'rpad': 'c', -* 'centerRight': true -* }; -* str = pad( 'b', 10, opts ); -* // returns 'aaaaabcccc' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/pad/lib/main.js b/pad/lib/main.js deleted file mode 100644 index 0dcc7b8d..00000000 --- a/pad/lib/main.js +++ /dev/null @@ -1,174 +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 isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var repeat = require( './../../repeat' ); -var format = require( './../../format' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var ceil = require( '@stdlib/math/base/special/ceil' ); -var lpad = require( './../../left-pad' ); -var rpad = require( './../../right-pad' ); -var abs = require( '@stdlib/math/base/special/abs' ); -var FLOAT64_MAX_SAFE_INTEGER = require( '@stdlib/constants/float64/max-safe-integer' ); -var validate = require( './validate.js' ); - - -// MAIN // - -/** -* Pads a string such that the padded string has a length of `len`. -* -* @param {string} str - string to pad -* @param {NonNegativeInteger} len - string length -* @param {Options} [options] - function options -* @param {string} [options.lpad=''] - string used to left pad -* @param {string} [options.rpad=' '] - string used to right pad -* @param {boolean} [options.centerRight=false] - boolean indicating whether to center right in the event of a tie -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @throws {RangeError} at least one padding must have a length greater than `0` -* @returns {string} padded string -* -* @example -* var str = pad( 'a', 5 ); -* // returns 'a ' -* -* @example -* var str = pad( 'a', 10, { -* 'lpad': 'b' -* }); -* // returns 'bbbbbbbbba' -* -* @example -* var str = pad( 'a', 12, { -* 'rpad': 'b' -* }); -* // returns 'abbbbbbbbbbb' -* -* @example -* var opts = { -* 'lpad': 'a', -* 'rpad': 'c' -* }; -* var str = pad( 'b', 10, opts ); -* // returns 'aaaabccccc' -* -* @example -* var opts = { -* 'lpad': 'a', -* 'rpad': 'c', -* 'centerRight': true -* }; -* var str = pad( 'b', 10, opts ); -* // returns 'aaaaabcccc' -*/ -function pad( str, len, options ) { - var nright; - var nleft; - var isodd; - var right; - var left; - var opts; - var err; - var tmp; - var n; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isNonNegativeInteger( len ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) ); - } - if ( len > FLOAT64_MAX_SAFE_INTEGER ) { - throw new RangeError( format( 'invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.', len ) ); - } - opts = {}; - if ( arguments.length > 2 ) { - err = validate( opts, options ); - if ( err ) { - throw err; - } - } - if ( opts.lpad && opts.rpad ) { - n = ( len-str.length ) / 2; - if ( n === 0 ) { - return str; - } - tmp = floor( n ); - if ( tmp !== n ) { - isodd = true; - } - if ( n < 0 ) { - n = floor( abs( n ) ); - nleft = n; - nright = str.length - n; - - // If |len-str.length| is an odd number, take away an additional character from one side... - if ( isodd ) { - if ( opts.centerRight ) { - nright -= 1; - } else { - nleft += 1; - } - } - return str.substring( nleft, nright ); - } - nleft = ceil( n / opts.lpad.length ); - left = repeat( opts.lpad, nleft ); - - nright = ceil( n / opts.rpad.length ); - right = repeat( opts.rpad, nright ); - - // If (len-str.length) is an odd number, give one side one extra character... - n = tmp; - nleft = n; - nright = n; - if ( isodd ) { - if ( opts.centerRight ) { - nleft += 1; - } else { - nright += 1; - } - } - left = left.substring( 0, nleft ); - right = right.substring( 0, nright ); - return left + str + right; - } - if ( opts.lpad ) { - tmp = lpad( str, len, opts.lpad ); - return tmp.substring( tmp.length-len ); - } - if ( opts.rpad ) { - return ( rpad( str, len, opts.rpad ) ).substring( 0, len ); - } - if ( opts.rpad === void 0 ) { - return ( rpad( str, len, ' ' ) ).substring( 0, len ); - } - throw new RangeError( format( 'invalid argument. At least one padding option must have a length greater than 0. Left padding: `%s`. Right padding: `%s`.', opts.lpad, opts.rpad ) ); -} - - -// EXPORTS // - -module.exports = pad; diff --git a/pad/lib/validate.js b/pad/lib/validate.js deleted file mode 100644 index e1f7076e..00000000 --- a/pad/lib/validate.js +++ /dev/null @@ -1,82 +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 isPlainObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( './../../format' ); - - -// MAIN // - -/** -* Validates function options. -* -* @private -* @param {Object} opts - destination object -* @param {Options} options - options to validate -* @param {string} [options.lpad] - string used to left pad -* @param {string} [options.rpad] - string used to right pad -* @param {boolean} [options.centerRight] - boolean indicating whether to center right in the event of a tie -* @returns {(null|Error)} error object or null -* -* @example -* var opts = {}; -* var options = { -* 'lpad': 'a', -* 'rpad': 'b' -* }; -* var err = validate( opts, options ); -* if ( err ) { -* throw err; -* } -*/ -function validate( opts, options ) { - if ( !isPlainObject( options ) ) { - return new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - if ( hasOwnProp( options, 'lpad' ) ) { - opts.lpad = options.lpad; - if ( !isString( opts.lpad ) ) { - return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'lpad', opts.lpad ) ); - } - } - if ( hasOwnProp( options, 'rpad' ) ) { - opts.rpad = options.rpad; - if ( !isString( opts.rpad ) ) { - return new TypeError( format( 'invalid option. `%s` option must be a string. Option: `%s`.', 'rpad', opts.rpad ) ); - } - } - if ( hasOwnProp( options, 'centerRight' ) ) { - opts.centerRight = options.centerRight; - if ( !isBoolean( opts.centerRight ) ) { - return new TypeError( format( 'invalid option. `%s` option must be a boolean. Option: `%s`.', 'centerRight', opts.centerRight ) ); - } - } - return null; -} - - -// EXPORTS // - -module.exports = validate; diff --git a/pad/package.json b/pad/package.json deleted file mode 100644 index 64986904..00000000 --- a/pad/package.json +++ /dev/null @@ -1,74 +0,0 @@ -{ - "name": "@stdlib/string/pad", - "version": "0.0.0", - "description": "Pad a string.", - "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" - } - ], - "bin": { - "padstr": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "pad", - "string", - "str", - "padding", - "padstr", - "left", - "right", - "center", - "justify", - "align", - "lpad", - "rpad" - ] -} diff --git a/pad/test/fixtures/stdin_error.js.txt b/pad/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/pad/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/pad/test/test.cli.js b/pad/test/test.cli.js deleted file mode 100644 index 310ae947..00000000 --- a/pad/test/test.cli.js +++ /dev/null @@ -1,318 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var replace = require( './../../replace' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints a string right-padded with spaces (default)', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--len=8\'; process.argv[ 3 ] = \'beep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'beep \n', true, 'prints expected value to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints a string left- and right-padded with custom pad strings (centering left in the event of a tie)', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--len=8\'; process.argv[ 3 ] = \'--lpad=!\'; process.argv[ 4 ] = \'--rpad=&\';process.argv[ 5 ] = \'world\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === '!world&&\n', true, 'prints expected value to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints a string left- and right-padded with custom pad strings (centering right in the event of a tie)', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--len=8\'; process.argv[ 3 ] = \'--lpad=!\'; process.argv[ 4 ] = \'--rpad=&\'; process.argv[ 5 ] = \'--cright\'; process.argv[ 6 ] = \'world\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === '!!world&\n', true, 'prints expected value to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop"', - '|', - EXEC_PATH, - fpath, - '--len=6', - '--rpad=!', - '--lpad=%' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '%beep!\n%boop!\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'', - '--len=6', - '--rpad=!', - '--lpad=%' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '%beep!\n%boop!\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/', - '--len=6', - '--rpad=!', - '--lpad=%' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '%beep!\n%boop!\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/pad/test/test.js b/pad/test/test.js deleted file mode 100644 index c7202d3d..00000000 --- a/pad/test/test.js +++ /dev/null @@ -1,291 +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 pad = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof pad, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if the first argument is not a string primitive, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - 5, - true, - 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() { - pad( value, 10 ); - }; - } -}); - -tape( 'if the second argument is not a nonnegative integer, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - '5', - 3.14, - -5, - true, - 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() { - pad( 'beep', value ); - }; - } -}); - -tape( 'if the third argument is not an object, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - '5', - 5, - true, - 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() { - pad( 'beep', 10, value ); - }; - } -}); - -tape( 'if provided an invalid option, the function will throw', function test( t ) { - t.throws( foo, Error, 'throws Error' ); - t.end(); - function foo() { - pad( 'beep', 10, { - 'lpad': null - }); - } -}); - -tape( 'if the output string will exceed the maximum allowed string length, the function will throw an error', function test( t ) { - t.throws( foo, RangeError, 'throws RangeError' ); - t.end(); - function foo() { - pad( 'beep', 1e300 ); - } -}); - -tape( 'if no pad strings have a positive length, the function throws an error', function test( t ) { - t.throws( foo, RangeError, 'throws RangeError' ); - t.end(); - function foo() { - pad( 'beep', 10, { - 'lpad': '', - 'rpad': '' - }); - } -}); - -tape( 'by default, the function right pads a string with spaces', function test( t ) { - var str = pad( 'a', 5 ); - t.strictEqual( str, 'a ', 'right padded with spaces' ); - t.end(); -}); - -tape( 'the function supports right padding a string with a custom pad string', function test( t ) { - var str = pad( 'beep', 10, { - 'rpad': 'p' - }); - t.strictEqual( str, 'beeppppppp', 'right padded to desired length' ); - t.end(); -}); - -tape( 'the function right pads a string and trims any excess padding', function test( t ) { - var str = pad( 'a', 5, { - 'rpad': 'beepboop' - }); - t.strictEqual( str, 'abeep', 'right padded and trimmed' ); - t.end(); -}); - -tape( 'the function supports left padding a string with a custom pad string', function test( t ) { - var str = pad( 'beep', 10, { - 'lpad': 'b' - }); - t.strictEqual( str, 'bbbbbbbeep', 'left padded to desired length' ); - t.end(); -}); - -tape( 'the function left pads a string and trims any excess padding', function test( t ) { - var str = pad( 'a', 5, { - 'lpad': 'beepboop' - }); - t.strictEqual( str, 'boopa', 'left padded and trimmed' ); - t.end(); -}); - -tape( 'the function supports centering a string', function test( t ) { - var str; - - str = pad( 'beep', 10, { - 'lpad': 'b', - 'rpad': 'p' - }); - t.strictEqual( str, 'bbbbeepppp', 'returns centered string (simple)' ); - - str = pad( 'beep', 10, { - 'lpad': 'b!', - 'rpad': 'p?*' - }); - t.strictEqual( str, 'b!bbeepp?*', 'returns centered string (harder)' ); - - t.end(); -}); - -tape( 'by default, the function centers an input string left in the event of a tie', function test( t ) { - var str; - - str = pad( 'beep', 11, { - 'lpad': 'b', - 'rpad': 'p' - }); - t.strictEqual( str, 'bbbbeeppppp', 'returns left centered string (simple)' ); - - str = pad( 'beep', 11, { - 'lpad': 'b!', - 'rpad': 'p?*' - }); - t.strictEqual( str, 'b!bbeepp?*p', 'returns left centered string (harder)' ); - - t.end(); -}); - -tape( 'the function supports centering an input string to the right in the event of a tie', function test( t ) { - var str; - - str = pad( 'beep', 11, { - 'lpad': 'b', - 'rpad': 'p', - 'centerRight': true - }); - t.strictEqual( str, 'bbbbbeepppp', 'returns right centered string (simple)' ); - - str = pad( 'beep', 11, { - 'lpad': 'b!', - 'rpad': 'p?*', - 'centerRight': true - }); - t.strictEqual( str, 'b!b!beepp?*', 'returns right centered string (harder)' ); - - t.end(); -}); - -tape( 'if the specified string length is less than or equal to the input string length, the function returns a trimmed input string', function test( t ) { - var str; - - // Right padded: - str = pad( 'beep', 2, { - 'rpad': 'boop' - }); - t.strictEqual( str, 'be', 'returns trimmed input string (right padded; <)' ); - - str = pad( 'beep', 4, { - 'rpad': 'boop' - }); - t.strictEqual( str, 'beep', 'returns input string (right padded; =)' ); - - // Left padded: - str = pad( 'beep', 2, { - 'lpad': 'boop' - }); - t.strictEqual( str, 'ep', 'returns trimmed input string (left padded; <)' ); - - str = pad( 'beep', 4, { - 'lpad': 'boop' - }); - t.strictEqual( str, 'beep', 'returns input string (left padded; =)' ); - - // Centered: - str = pad( 'beep', 2, { - 'rpad': 'p', - 'lpad': 'boop' - }); - t.strictEqual( str, 'ee', 'returns trimmed input string (center; <)' ); - - str = pad( 'beep', 4, { - 'lpad': 'boop', - 'rpad': 'p' - }); - t.strictEqual( str, 'beep', 'returns input string (center; =)' ); - - // Centered left/right: - str = pad( 'abcdef', 3, { - 'lpad': '@', - 'rpad': '!' - }); - t.strictEqual( str, 'cde', 'returns input string (center right; <)' ); - - str = pad( 'abcdef', 3, { - 'lpad': '@', - 'rpad': '!', - 'centerRight': true - }); - t.strictEqual( str, 'bcd', 'returns input string (center left; <)' ); - - t.end(); -}); diff --git a/pad/test/test.validate.js b/pad/test/test.validate.js deleted file mode 100644 index eb95b40c..00000000 --- a/pad/test/test.validate.js +++ /dev/null @@ -1,162 +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 validate = require( './../lib/validate.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof validate, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if provided an `options` argument which is not an object, the function returns an error', function test( t ) { - var values; - var err; - var i; - - values = [ - '5', - 5, - null, - NaN, - void 0, - true, - [], - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - err = validate( {}, values[ i ] ); - t.ok( err instanceof TypeError, 'returns TypeError' ); - } - t.end(); -}); - -tape( 'if provided an invalid `lpad` option, the function returns an error', function test( t ) { - var values; - var err; - var i; - - values = [ - 5, - null, - NaN, - void 0, - true, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - err = validate( {}, { - 'lpad': values[ i ] - }); - t.ok( err instanceof TypeError, 'returns TypeError' ); - } - t.end(); -}); - -tape( 'if provided an invalid `rpad` option, the function returns an error', function test( t ) { - var values; - var err; - var i; - - values = [ - 5, - null, - NaN, - void 0, - true, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - err = validate( {}, { - 'rpad': values[ i ] - }); - t.ok( err instanceof TypeError, 'returns TypeError' ); - } - t.end(); -}); - -tape( 'if provided an invalid `centerRight` option, the function returns an error', function test( t ) { - var values; - var err; - var i; - - values = [ - '5', - 5, - null, - NaN, - void 0, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - err = validate( {}, { - 'centerRight': values[ i ] - }); - t.ok( err instanceof TypeError, 'returns TypeError' ); - } - t.end(); -}); - -tape( 'if all options are valid, the function returns null', function test( t ) { - var options; - var opts; - var err; - - opts = {}; - options = { - 'lpad': 'a', - 'rpad': 'b', - 'centerRight': true - }; - err = validate( opts, options ); - - t.strictEqual( err, null, 'returns expected value' ); - t.strictEqual( opts.lpad, options.lpad, 'sets the `lpad` option' ); - t.strictEqual( opts.rpad, options.rpad, 'sets the `rpad` option' ); - t.strictEqual( opts.centerRight, options.centerRight, 'sets the `centerRight` option' ); - - t.end(); -}); - -tape( 'the function ignores unrecognized options', function test( t ) { - var err = validate( {}, { - 'beep': 'boop', - 'a': null, - 'b': 5 - }); - t.strictEqual( err, null, 'returns expected value' ); - t.end(); -}); diff --git a/pascalcase/README.md b/pascalcase/README.md deleted file mode 100644 index 713337e4..00000000 --- a/pascalcase/README.md +++ /dev/null @@ -1,201 +0,0 @@ - - -# pascalcase - -> Convert a string to Pascal case. - - - -
- -## Usage - -```javascript -var pascalcase = require( '@stdlib/string/pascalcase' ); -``` - -#### pascalcase( str ) - -Converts a string to Pascal case. - -```javascript -var out = pascalcase( 'foo bar' ); -// returns 'FooBar' - -out = pascalcase( 'IS_MOBILE' ); -// returns 'IsMobile' - -out = pascalcase( 'Hello World!' ); -// returns 'HelloWorld' - -out = pascalcase( '--foo-bar--' ); -// returns 'FooBar' - -out = pascalcase( 'fooBar' ); -// returns 'FooBar' -``` - -
- - - - - -
- -## Examples - -```javascript -var pascalcase = require( '@stdlib/string/pascalcase' ); - -var str = 'Hello World!'; -var out = pascalcase( str ); -// returns 'HelloWorld' - -str = 'HELLO WORLD!'; -out = pascalcase( str ); -// returns 'HelloWorld' - -str = 'To be, or not to be: that is the question.'; -out = pascalcase( str ); -// returns 'ToBeOrNotToBeThatIsTheQuestion' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: pascalcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beEp booP\nisMobile' | pascalcase --split /\r?\n/ - - # Escaped... - $ echo -n $'beEp booP\nisMobile' | pascalcase --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ pascalcase 'hello world!' -HelloWorld -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beEp booP' | pascalcase -BeEpBooP -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep_boop\tisMobile' | pascalcase --split '\t' -BeepBoop -IsMobile -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/pascalcase/benchmark/benchmark.js b/pascalcase/benchmark/benchmark.js deleted file mode 100644 index 7a245f68..00000000 --- a/pascalcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var pascalcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = pascalcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/pascalcase/bin/cli b/pascalcase/bin/cli deleted file mode 100755 index 2528af8c..00000000 --- a/pascalcase/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var pascalcase = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( pascalcase( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( pascalcase( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/pascalcase/docs/repl.txt b/pascalcase/docs/repl.txt deleted file mode 100644 index 1f9edcf5..00000000 --- a/pascalcase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to Pascal case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Pascal-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'HelloWorld' - > out = {{alias}}( 'beep boop' ) - 'BeepBoop' - - See Also - -------- diff --git a/pascalcase/docs/types/index.d.ts b/pascalcase/docs/types/index.d.ts deleted file mode 100644 index fb46c34f..00000000 --- a/pascalcase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to Pascal case. -* -* @param str - string to convert -* @returns Pascal-cased string -* -* @example -* var str = pascalcase( 'Hello World!' ); -* // returns 'HelloWorld' -* -* @example -* var str = pascalcase( 'foo_bar' ); -* // returns 'FooBar' -* -* @example -* var str = pascalcase( 'foo-bar' ); -* // returns 'FooBar' -*/ -declare function pascalcase( str: string ): string; - - -// EXPORTS // - -export = pascalcase; diff --git a/pascalcase/docs/types/test.ts b/pascalcase/docs/types/test.ts deleted file mode 100644 index d390b75e..00000000 --- a/pascalcase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import pascalcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - pascalcase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - pascalcase( true ); // $ExpectError - pascalcase( false ); // $ExpectError - pascalcase( null ); // $ExpectError - pascalcase( undefined ); // $ExpectError - pascalcase( 5 ); // $ExpectError - pascalcase( [] ); // $ExpectError - pascalcase( {} ); // $ExpectError - pascalcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - pascalcase(); // $ExpectError -} diff --git a/pascalcase/docs/usage.txt b/pascalcase/docs/usage.txt deleted file mode 100644 index 0e3fd618..00000000 --- a/pascalcase/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: pascalcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/pascalcase/etc/cli_opts.json b/pascalcase/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/pascalcase/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/pascalcase/examples/index.js b/pascalcase/examples/index.js deleted file mode 100644 index 257745c9..00000000 --- a/pascalcase/examples/index.js +++ /dev/null @@ -1,36 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 pascalcase = require( './../lib' ); - -var str = 'Hello World!'; -var out = pascalcase( str ); -console.log( out ); -// => 'HelloWorld' - -str = 'HELLO WORLD!'; -out = pascalcase( str ); -console.log( out ); -// => 'HelloWorld' - -str = 'To be, or not to be: that is the question.'; -out = pascalcase( str ); -console.log( out ); -// => 'ToBeOrNotToBeThatIsTheQuestion' diff --git a/pascalcase/lib/index.js b/pascalcase/lib/index.js deleted file mode 100644 index f4789761..00000000 --- a/pascalcase/lib/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to Pascal case. -* -* @module @stdlib/string/pascalcase -* -* @example -* var pascalcase = require( '@stdlib/string/pascalcase' ); -* -* var str = pascalcase( 'foo bar' ); -* // returns 'FooBar' -* -* str = pascalcase( '--foo-bar--' ); -* // returns 'FooBar' -* -* str = pascalcase( 'Hello World!' ); -* // returns 'HelloWorld' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/pascalcase/lib/main.js b/pascalcase/lib/main.js deleted file mode 100644 index 3fb15acc..00000000 --- a/pascalcase/lib/main.js +++ /dev/null @@ -1,63 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/pascalcase' ); - - -// MAIN // - -/** -* Converts a string to Pascal case. -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {string} Pascal-cased string -* -* @example -* var out = pascalcase( 'foo bar' ); -* // returns 'FooBar' -* -* @example -* var out = pascalcase( 'IS_MOBILE' ); -* // returns 'IsMobile' -* -* @example -* var out = pascalcase( 'Hello World!' ); -* // returns 'HelloWorld' -* -* @example -* var out = pascalcase( '--foo-bar--' ); -* // returns 'FooBar' -*/ -function pascalcase( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = pascalcase; diff --git a/pascalcase/package.json b/pascalcase/package.json deleted file mode 100644 index 47e2c8fe..00000000 --- a/pascalcase/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/pascalcase", - "version": "0.0.0", - "description": "Convert a string to Pascal case.", - "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" - } - ], - "bin": { - "pascalcase": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "case", - "convert", - "pascalcase", - "pascal" - ], - "__stdlib__": {} -} diff --git a/pascalcase/test/fixtures/stdin_error.js.txt b/pascalcase/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/pascalcase/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/pascalcase/test/test.cli.js b/pascalcase/test/test.cli.js deleted file mode 100644 index 747d3e9b..00000000 --- a/pascalcase/test/test.cli.js +++ /dev/null @@ -1,263 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a string argument to Pascal case', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'HELLO_WORLD!\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'HelloWorld\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nis-mobile"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'BeepBoop\nIsMobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'BeepBoop\nIsMobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'BeepBoop\nIsMobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/pascalcase/test/test.js b/pascalcase/test/test.js deleted file mode 100644 index 39e192df..00000000 --- a/pascalcase/test/test.js +++ /dev/null @@ -1,203 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 pascalcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof pascalcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - pascalcase( value ); - }; - } -}); - -tape( 'the function converts a string to Pascal case', function test( t ) { - var expected; - var actual; - - expected = 'FooBar'; - actual = pascalcase( 'foo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'FooBar'; - actual = pascalcase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'FooBar'; - actual = pascalcase( 'foo.bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'HelloWorld'; - actual = pascalcase( 'Hello World!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'BEepBOop'; - actual = pascalcase( 'bEep bOOP' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to Pascal case', function test( t ) { - var expected; - var actual; - - expected = 'FóoBar'; - actual = pascalcase( 'fóo_bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'FóoBar'; - actual = pascalcase( 'fóo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'FóoBar'; - actual = pascalcase( 'fóo.bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'HélloWórld'; - actual = pascalcase( 'héllo Wórld!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in constant case to Pascal case', function test( t ) { - var expected; - var actual; - - expected = 'FooBar'; - actual = pascalcase( 'FOO_BAR' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMostlyCamelCase'; - actual = pascalcase( 'IS_MOSTLY_CAMEL_CASE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMobile'; - actual = pascalcase( 'IS_MOBILE' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsNodeRepl'; - actual = pascalcase( 'IS_NODE_REPL' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in kebab case to Pascal case', function test( t ) { - var expected; - var actual; - - expected = 'FooBar'; - actual = pascalcase( 'foo-bar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMostlyCamelCase'; - actual = pascalcase( 'is-mostly-camel-case' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMobile'; - actual = pascalcase( 'is-mobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsNodeRepl'; - actual = pascalcase( 'is-node-repl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function converts a string in camel case to Pascal case', function test( t ) { - var expected; - var actual; - - expected = 'FooBar'; - actual = pascalcase( 'fooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMostlyCamelCase'; - actual = pascalcase( 'isMostlyCamelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMobile'; - actual = pascalcase( 'isMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsNodeRepl'; - actual = pascalcase( 'isNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns a string that is already in Pascal case unchanged', function test( t ) { - var expected; - var actual; - - expected = 'FooBar'; - actual = pascalcase( 'FooBar' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMostlyCamelCase'; - actual = pascalcase( 'IsMostlyCamelCase' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsMobile'; - actual = pascalcase( 'IsMobile' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'IsNodeRepl'; - actual = pascalcase( 'IsNodeRepl' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/percent-encode/README.md b/percent-encode/README.md deleted file mode 100644 index 15d1a296..00000000 --- a/percent-encode/README.md +++ /dev/null @@ -1,195 +0,0 @@ - - -# percentEncode - -> [Percent-encode][percent-encoding] a [UTF-16][utf-16] encoded string according to [RFC 3986][rfc-3986-percent-encoding]. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var percentEncode = require( '@stdlib/string/percent-encode' ); -``` - -#### percentEncode( str ) - -[Percent-encodes][percent-encoding] a [UTF-16][utf-16] encoded string according to [RFC 3986][rfc-3986-percent-encoding]. - -```javascript -var out = percentEncode( '☃' ); -// returns '%E2%98%83' -``` - -
- - - - - -
- -## Notes - -- The function [percent-encodes][percent-encoding] an **entire** string. Hence, if provided a URI, the function [percent-encodes][percent-encoding] the entire URI. - - ```javascript - var out = percentEncode( 'https://en.wikipedia.org/wiki/Mode_(statistics)' ); - // returns 'https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FMode_%28statistics%29' - ``` - - To [percent-encode][percent-encoding] a URI, split the URI into separate components, [percent-encode][percent-encoding] relevant components, and then reassemble. - -
- - - - - -
- -## Examples - - - -```javascript -var percentEncode = require( '@stdlib/string/percent-encode' ); - -var values = [ - 'Ladies + Gentlemen', - 'An encoded string!', - 'Dogs, Cats & Mice', - '☃', - 'æ', - '𐐷' -]; -var i; -for ( i = 0; i < values.length; i++ ) { - console.log( '%s: %s', values[ i ], percentEncode( values[ i ] ) ); -} -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: percent-encode [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```bash -$ percent-encode ☃ -%E2%98%83 -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n '☃' | percent-encode -%E2%98%83 -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/percent-encode/benchmark/benchmark.js b/percent-encode/benchmark/benchmark.js deleted file mode 100644 index 62aae63b..00000000 --- a/percent-encode/benchmark/benchmark.js +++ /dev/null @@ -1,58 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var percentEncode = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Ladies + Gentlemen', - 'An encoded string!', - 'Dogs, Cats & Mice', - '☃', - 'æ', - '𐐷' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = percentEncode( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/percent-encode/bin/cli b/percent-encode/bin/cli deleted file mode 100755 index 64b53cf9..00000000 --- a/percent-encode/bin/cli +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var percentEncode = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - return stdin( onRead ); - } - console.log( percentEncode( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - if ( error ) { - return cli.error( error ); - } - console.log( percentEncode( data.toString() ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/percent-encode/docs/repl.txt b/percent-encode/docs/repl.txt deleted file mode 100644 index 2c3caa06..00000000 --- a/percent-encode/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( str ) - Percent-encodes a UTF-16 encoded string according to RFC 3986. - - Parameters - ---------- - str: string - UTF-16 encoded string. - - Returns - ------- - out: string - Percent-encoded string. - - Examples - -------- - > var out = {{alias}}( '☃' ) - '%E2%98%83' - - See Also - -------- - diff --git a/percent-encode/docs/types/index.d.ts b/percent-encode/docs/types/index.d.ts deleted file mode 100644 index 3e0612ba..00000000 --- a/percent-encode/docs/types/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Percent-encodes a UTF-16 encoded string according to [RFC 3986][1]. -* -* [1]: https://tools.ietf.org/html/rfc3986#section-2.1 -* -* @param str - string to percent-encode -* @returns percent-encoded string -* -* @example -* var str1 = 'Ladies + Gentlemen'; -* -* var str2 = percentEncode( str1 ); -* // returns 'Ladies%20%2B%20Gentlemen' -*/ -declare function percentEncode( str: string ): string; - - -// EXPORTS // - -export = percentEncode; diff --git a/percent-encode/docs/types/test.ts b/percent-encode/docs/types/test.ts deleted file mode 100644 index cc9cf1b4..00000000 --- a/percent-encode/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import percentEncode = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - percentEncode( 'Ladies + Gentlemen' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - percentEncode( true ); // $ExpectError - percentEncode( false ); // $ExpectError - percentEncode( null ); // $ExpectError - percentEncode( undefined ); // $ExpectError - percentEncode( 5 ); // $ExpectError - percentEncode( [] ); // $ExpectError - percentEncode( {} ); // $ExpectError - percentEncode( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - percentEncode(); // $ExpectError -} diff --git a/percent-encode/docs/usage.txt b/percent-encode/docs/usage.txt deleted file mode 100644 index 298acf5a..00000000 --- a/percent-encode/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: percent-encode [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - diff --git a/percent-encode/etc/cli_opts.json b/percent-encode/etc/cli_opts.json deleted file mode 100644 index 92119c45..00000000 --- a/percent-encode/etc/cli_opts.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "string": [], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/percent-encode/examples/index.js b/percent-encode/examples/index.js deleted file mode 100644 index ccee7cba..00000000 --- a/percent-encode/examples/index.js +++ /dev/null @@ -1,34 +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'; - -var percentEncode = require( './../lib' ); - -var values = [ - 'Ladies + Gentlemen', - 'An encoded string!', - 'Dogs, Cats & Mice', - '☃', - 'æ', - '𐐷' -]; -var i; -for ( i = 0; i < values.length; i++ ) { - console.log( '%s: %s', values[ i ], percentEncode( values[ i ] ) ); -} diff --git a/percent-encode/lib/index.js b/percent-encode/lib/index.js deleted file mode 100644 index 36e718a3..00000000 --- a/percent-encode/lib/index.js +++ /dev/null @@ -1,42 +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'; - -/** -* Percent-encode a UTF-16 encoded string according to RFC 3986. -* -* @module @stdlib/string/percent-encode -* -* @example -* var percentEncode = require( '@stdlib/string/percent-encode' ); -* -* var str1 = 'Ladies + Gentlemen'; -* -* var str2 = percentEncode( str1 ); -* // returns 'Ladies%20%2B%20Gentlemen' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/percent-encode/lib/main.js b/percent-encode/lib/main.js deleted file mode 100644 index 3c4e6ebb..00000000 --- a/percent-encode/lib/main.js +++ /dev/null @@ -1,55 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/percent-encode' ); - - -// MAIN // - -/** -* Percent-encodes a UTF-16 encoded string according to [RFC 3986][1]. -* -* [1]: https://tools.ietf.org/html/rfc3986#section-2.1 -* -* @param {string} str - string to percent-encode -* @throws {TypeError} must provide a string -* @returns {string} percent-encoded string -* -* @example -* var str1 = 'Ladies + Gentlemen'; -* -* var str2 = percentEncode( str1 ); -* // returns 'Ladies%20%2B%20Gentlemen' -*/ -function percentEncode( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = percentEncode; diff --git a/percent-encode/package.json b/percent-encode/package.json deleted file mode 100644 index 07a10275..00000000 --- a/percent-encode/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "@stdlib/string/percent-encode", - "version": "0.0.0", - "description": "Percent-encode a UTF-16 encoded string according to RFC 3986.", - "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" - } - ], - "bin": { - "percent-encode": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "utf-16", - "utf16", - "utf8", - "utf-8", - "percent", - "encode", - "percent-encode", - "percent-encoding", - "encoding", - "escape", - "uri", - "url" - ] -} diff --git a/percent-encode/test/fixtures/stdin_error.js.txt b/percent-encode/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/percent-encode/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/percent-encode/test/test.cli.js b/percent-encode/test/test.cli.js deleted file mode 100644 index e5802345..00000000 --- a/percent-encode/test/test.cli.js +++ /dev/null @@ -1,219 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface percent-encodes a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'☃\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '%E2%98%83\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "☃\n𐐷"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '%E2%98%83%A%F0%90%90%B7\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/percent-encode/test/test.js b/percent-encode/test/test.js deleted file mode 100644 index 9c07d04b..00000000 --- a/percent-encode/test/test.js +++ /dev/null @@ -1,97 +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 percentEncode = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof percentEncode, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - 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() { - percentEncode( value ); - }; - } -}); - -tape( 'the function percent-encodes a string', function test( t ) { - var expected; - var values; - var out; - var i; - - // Some test values are from https://dev.twitter.com/oauth/overview/percent-encoding-parameters. - values = [ - 'Ladies + Gentlemen', - 'An encoded string!', - 'Dogs, Cats & Mice', - '☃', - 'æ', - '𐐷', - '()', - 'https://en.wikipedia.org/wiki/Mode_(statistics)' - ]; - - expected = [ - 'Ladies%20%2B%20Gentlemen', - 'An%20encoded%20string%21', - 'Dogs%2C%20Cats%20%26%20Mice', - '%E2%98%83', - '%C3%A6', - '%F0%90%90%B7', - '%28%29', - 'https%3A%2F%2Fen.wikipedia.org%2Fwiki%2FMode_%28statistics%29' - ]; - - for ( i = 0; i < values.length; i++ ) { - out = percentEncode( values[ i ] ); - t.strictEqual( out, expected[ i ], 'returns expected value for '+values[i] ); - } - t.end(); -}); diff --git a/prev-grapheme-cluster-break/README.md b/prev-grapheme-cluster-break/README.md deleted file mode 100644 index 7e133bb0..00000000 --- a/prev-grapheme-cluster-break/README.md +++ /dev/null @@ -1,208 +0,0 @@ - - -# prevGraphemeClusterBreak - -> Return the previous extended grapheme cluster break in a string before a specified position. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var prevGraphemeClusterBreak = require( '@stdlib/string/prev-grapheme-cluster-break' ); -``` - -#### prevGraphemeClusterBreak( string\[, fromIndex] ) - -Returns the previous extended grapheme cluster break in a string before a specified position. - -```javascript -var out = prevGraphemeClusterBreak( 'last man standing' ); -// returns 15 -``` - -By default, the last extended grapheme cluster break in the string is returned. For the previous extended grapheme cluster break before a specified position in the string, provide a `fromIndex`. - -```javascript -var out = prevGraphemeClusterBreak( 'last man standing', 4 ); -// returns 3 -``` - -
- - - - - -
- -## Notes - -- If `string` is an empty string, the function returns `-1` irrespective of `fromIndex`. -- If there is no extended grapheme cluster break before `fromIndex`, the function returns `-1`. -- Note that `fromIndex` does **not** refer to a visual character position, but to an index in the ordered sequence of [UTF-16][utf-16] code units. - -
- - - - - -
- -## Examples - - - -```javascript -var prevGraphemeClusterBreak = require( '@stdlib/string/prev-grapheme-cluster-break' ); - -console.log( prevGraphemeClusterBreak( 'last man standing', 4 ) ); -// => 3 - -console.log( prevGraphemeClusterBreak( 'presidential election', 8 ) ); -// => 7 - -console.log( prevGraphemeClusterBreak( 'अनुच्छेद', 2 ) ); -// => 0 - -console.log( prevGraphemeClusterBreak( '🌷', 1 ) ); -// => -1 -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: prev-grapheme-cluster-break [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --fromIndex index Position in string. Default: string.length-1. -``` - -
- - - - - -
- -
- - - - - -
- -### Examples - -```bash -$ prev-grapheme-cluster-break --fromIndex=2 अनुच्छेद -0 -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'अनुच्छेद' | prev-grapheme-cluster-break --fromIndex=2 -0 -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/prev-grapheme-cluster-break/benchmark/benchmark.js b/prev-grapheme-cluster-break/benchmark/benchmark.js deleted file mode 100644 index 87349729..00000000 --- a/prev-grapheme-cluster-break/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var prevGraphemeClusterBreak = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var strings; - var len; - var out; - var i; - - strings = [ - 'last man standing', - 'presidential election', - 'अनुच्छेद', - '🌷', - '书/六書', - 'เ❄︎நி', - 'กิิก้้ก็็ก็็กิิก้้ก็็กิิก้้กิิก้้ก็็ก็็กิิก้้ก็็กิิก้้', - '書六/书六', - 'ܶƔλʃݖͱšɕ҆ʧѸؐҜҦɳΏ', - 'âݝΝ‚ҳӌݾҀƳ۵ۧ޳ǁǸΓ' - ]; - len = strings.length; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = prevGraphemeClusterBreak( strings[ i%len ], 1 ); - if ( out !== out ) { - b.fail( 'should not return NaN' ); - } - } - b.toc(); - if ( !isInteger( out ) ) { - b.fail( 'should return an integer' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/prev-grapheme-cluster-break/bin/cli b/prev-grapheme-cluster-break/bin/cli deleted file mode 100755 index ee267c7d..00000000 --- a/prev-grapheme-cluster-break/bin/cli +++ /dev/null @@ -1,91 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var prevGraphemeClusterBreak = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var cli; - var pos; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - if ( flags.from ) { - pos = parseInt( flags.from, 10 ); - } else { - pos = 0; - } - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( stdinStream.isTTY ) { - return console.log( prevGraphemeClusterBreak( args[ 0 ], pos ) ); // eslint-disable-line no-console - } - return stdin( onRead ); - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - if ( error ) { - return cli.error( error ); - } - console.log( prevGraphemeClusterBreak( data.toString(), pos ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/prev-grapheme-cluster-break/docs/repl.txt b/prev-grapheme-cluster-break/docs/repl.txt deleted file mode 100644 index 7bf092f5..00000000 --- a/prev-grapheme-cluster-break/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( str[, fromIndex] ) - Returns the previous extended grapheme cluster break in a string before a - specified position. - - Parameters - ---------- - str: string - Input string. - - fromIndex: integer (optional) - Position. Default: str.length-1. - - Returns - ------- - out: integer - Previous extended grapheme cluster break position. - - Examples - -------- - > var out = {{alias}}( 'last man standing', 4 ) - 3 - > out = {{alias}}( 'presidential election', 8 ) - 7 - > out = {{alias}}( 'अनुच्छेद', 2 ) - 0 - > out = {{alias}}( '🌷', 1 ) - -1 - - See Also - -------- diff --git a/prev-grapheme-cluster-break/docs/types/index.d.ts b/prev-grapheme-cluster-break/docs/types/index.d.ts deleted file mode 100644 index f12a431c..00000000 --- a/prev-grapheme-cluster-break/docs/types/index.d.ts +++ /dev/null @@ -1,42 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Returns the previous extended grapheme cluster break in a string before a specified position. -* -* @param str - input string -* @param fromIndex - position (default: str.length-1) -* @throws first argument must be a string -* @throws second argument must be an integer -* @returns previous grapheme break position -* -* @example -* var out = prevGraphemeClusterBreak( 'अनुच्छेद', 2 ); -* // returns 0 -* -* out = prevGraphemeClusterBreak( '🌷', 1 ); -* // returns -1 -*/ -declare function prevGraphemeClusterBreak( str: string, fromIndex?: number ): number; - - -// EXPORTS // - -export = prevGraphemeClusterBreak; diff --git a/prev-grapheme-cluster-break/docs/types/test.ts b/prev-grapheme-cluster-break/docs/types/test.ts deleted file mode 100644 index f970bf25..00000000 --- a/prev-grapheme-cluster-break/docs/types/test.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import prevGraphemeClusterBreak = require( './index' ); - - -// TESTS // - -// The function returns a number... -{ - prevGraphemeClusterBreak( 'last man standing', 4 ); // $ExpectType number - prevGraphemeClusterBreak( 'presidential election', 8 ); // $ExpectType number - prevGraphemeClusterBreak( 'अनुच्छेद', 1 ); // $ExpectType number - prevGraphemeClusterBreak( '🌷', 0 ); // $ExpectType number -} - -// The compiler throws an error if the function is provided incorrect arguments... -{ - prevGraphemeClusterBreak( false, 3 ); // $ExpectError - prevGraphemeClusterBreak( {}, 3 ); // $ExpectError - prevGraphemeClusterBreak( ( x: number ): number => x, 3 ); // $ExpectError - - prevGraphemeClusterBreak( 'string', true ); // $ExpectError - prevGraphemeClusterBreak( 'string', false ); // $ExpectError - prevGraphemeClusterBreak( 'string', {} ); // $ExpectError - prevGraphemeClusterBreak( 'string', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - prevGraphemeClusterBreak(); // $ExpectError -} diff --git a/prev-grapheme-cluster-break/docs/usage.txt b/prev-grapheme-cluster-break/docs/usage.txt deleted file mode 100644 index 54364b0a..00000000 --- a/prev-grapheme-cluster-break/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: prev-grapheme-cluster-break [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --from index Starting search position. Default: str.length-1. diff --git a/prev-grapheme-cluster-break/etc/cli_opts.json b/prev-grapheme-cluster-break/etc/cli_opts.json deleted file mode 100644 index 8a766dc0..00000000 --- a/prev-grapheme-cluster-break/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "from" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/prev-grapheme-cluster-break/examples/index.js b/prev-grapheme-cluster-break/examples/index.js deleted file mode 100644 index 10dc1b64..00000000 --- a/prev-grapheme-cluster-break/examples/index.js +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 prevGraphemeClusterBreak = require( './../lib' ); - -console.log( prevGraphemeClusterBreak( 'last man standing', 4 ) ); -// => 3 - -console.log( prevGraphemeClusterBreak( 'presidential election', 8 ) ); -// => 7 - -console.log( prevGraphemeClusterBreak( 'अनुच्छेद', 2 ) ); -// => 0 - -console.log( prevGraphemeClusterBreak( '🌷', 1 ) ); -// => -1 diff --git a/prev-grapheme-cluster-break/lib/index.js b/prev-grapheme-cluster-break/lib/index.js deleted file mode 100644 index 23fbbdae..00000000 --- a/prev-grapheme-cluster-break/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the prev extended grapheme cluster break in a string before a specified position. -* -* @module @stdlib/string/prev-grapheme-cluster-break -* -* @example -* var prevGraphemeClusterBreak = require( '@stdlib/string/prev-grapheme-cluster-break' ); -* -* var out = prevGraphemeClusterBreak( 'अनुच्छेद', 2 ); -* // returns 0 -* -* out = prevGraphemeClusterBreak( '🌷', 1 ); -* // returns -1 -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/prev-grapheme-cluster-break/lib/main.js b/prev-grapheme-cluster-break/lib/main.js deleted file mode 100644 index 0cf336f3..00000000 --- a/prev-grapheme-cluster-break/lib/main.js +++ /dev/null @@ -1,133 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isInteger = require( '@stdlib/assert/is-integer' ); -var codePointAt = require( './../../code-point-at' ); -var hasUTF16SurrogatePairAt = require( '@stdlib/assert/has-utf16-surrogate-pair-at' ); -var grapheme = require( './../../tools/grapheme-cluster-break' ); -var format = require( './../../format' ); - - -// VARIABLES // - -var breakType = grapheme.breakType; -var breakProperty = grapheme.breakProperty; -var emojiProperty = grapheme.emojiProperty; - - -// MAIN // - -/** -* Returns the previous extended grapheme cluster break in a string before a specified position. -* -* @param {string} str - input string -* @param {integer} [fromIndex=str.length-1] - position -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be an integer -* @returns {NonNegativeInteger} previous grapheme break position -* -* @example -* var out = prevGraphemeClusterBreak( 'last man standing', 4 ); -* // returns 3 -* -* @example -* var out = prevGraphemeClusterBreak( 'presidential election', 8 ); -* // returns 7 -* -* @example -* var out = prevGraphemeClusterBreak( 'अनुच्छेद', 2 ); -* // returns 0 -* -* @example -* var out = prevGraphemeClusterBreak( '🌷', 1 ); -* // returns -1 -*/ -function prevGraphemeClusterBreak( str, fromIndex ) { - var breaks; - var emoji; - var ans; - var len; - var idx; - var cp; - var i; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - len = str.length; - if ( arguments.length > 1 ) { - if ( !isInteger( fromIndex ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an integer. Value: `%s`.', fromIndex ) ); - } - idx = fromIndex; - } else { - idx = len - 1; - } - if ( len === 0 || idx <= 0 ) { - return -1; - } - if ( idx >= len ) { - idx = len - 1; - } - - // Initialize caches for storing grapheme break and emoji properties: - breaks = []; - emoji = []; - - // Get the code point for the starting index: - cp = codePointAt( str, 0 ); - - // Get the corresponding grapheme break and emoji properties: - breaks.push( breakProperty( cp ) ); - emoji.push( emojiProperty( cp ) ); - - ans = -1; - for ( i = 1; i <= idx; i++ ) { - // If the current character is part of a surrogate pair, move along... - if ( hasUTF16SurrogatePairAt( str, i-1 ) ) { - ans = i-2; - breaks.length = 0; - emoji.length = 0; - continue; - } - cp = codePointAt( str, i ); - - // Get the corresponding grapheme break and emoji properties: - breaks.push( breakProperty( cp ) ); - emoji.push( emojiProperty( cp ) ); - - // Determine if we've encountered a grapheme cluster break... - if ( breakType( breaks, emoji ) > 0 ) { - ans = i-1; - breaks.length = 0; - emoji.length = 0; - continue; - } - } - return ans; -} - - -// EXPORTS // - -module.exports = prevGraphemeClusterBreak; diff --git a/prev-grapheme-cluster-break/package.json b/prev-grapheme-cluster-break/package.json deleted file mode 100644 index d3703e4d..00000000 --- a/prev-grapheme-cluster-break/package.json +++ /dev/null @@ -1,76 +0,0 @@ -{ - "name": "@stdlib/string/prev-grapheme-cluster-break", - "version": "0.0.0", - "description": "Return the previous extended grapheme cluster break in a string before a specified position.", - "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" - } - ], - "bin": { - "prev-grapheme-cluster-break": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "code", - "point", - "pt", - "unicode", - "utf-16", - "utf16", - "surrogate", - "astral", - "grapheme", - "cluster", - "segmentation", - "tc39" - ] -} diff --git a/prev-grapheme-cluster-break/test/fixtures/stdin_error.js.txt b/prev-grapheme-cluster-break/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 103efa25..00000000 --- a/prev-grapheme-cluster-break/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/prev-grapheme-cluster-break/test/test.cli.js b/prev-grapheme-cluster-break/test/test.cli.js deleted file mode 100644 index dddaa74f..00000000 --- a/prev-grapheme-cluster-break/test/test.cli.js +++ /dev/null @@ -1,240 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface returns the previous grapheme break position in a string', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--from=3\'; process.argv[ 3 ] = \'अनुच्छेद\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '2\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface uses a default starting search index of `string.length-1`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'नुच्छेद\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '-1\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf \'अनुच्छेद\'', - '|', - EXEC_PATH, - fpath, - '--from=1' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '0\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/prev-grapheme-cluster-break/test/test.js b/prev-grapheme-cluster-break/test/test.js deleted file mode 100644 index e0811d47..00000000 --- a/prev-grapheme-cluster-break/test/test.js +++ /dev/null @@ -1,247 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 prevGraphemeClusterBreak = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof prevGraphemeClusterBreak, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if the first argument is not a string primitive', function test( t ) { - var values; - var i; - - values = [ - -5, - 3.14, - -1.0, - NaN, - true, - false, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - prevGraphemeClusterBreak( value ); - }; - } -}); - -tape( 'the function throws an error if the first argument is not a string primitive (with second argument)', function test( t ) { - var values; - var i; - - values = [ - -5, - 3.14, - -1.0, - NaN, - true, - false, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - prevGraphemeClusterBreak( value, 0 ); - }; - } -}); - -tape( 'the function throws an error if the second argument is not an integer', function test( t ) { - var values; - var i; - - values = [ - 'bar', - 3.14, - NaN, - null, - void 0, - [ 'beep', 'boop' ], - [ 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() { - prevGraphemeClusterBreak( 'foo', value ); - }; - } -}); - -tape( 'the function returns uses the default position if the provided position is greater than or equal to the string length', function test( t ) { - var expected; - var out; - - out = prevGraphemeClusterBreak( 'last man standing', 17 ); - expected = prevGraphemeClusterBreak( 'last man standing' ); - t.strictEqual( out, expected, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'presidential election', 22 ); - expected = prevGraphemeClusterBreak( 'presidential election' ); - t.strictEqual( out, expected, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'अनुच्छेद', 10 ); - expected = prevGraphemeClusterBreak( 'अनुच्छेद' ); - t.strictEqual( out, expected, 'returns expected value' ); - - out = prevGraphemeClusterBreak( '🌷', 2 ); - expected = prevGraphemeClusterBreak( '🌷' ); - t.strictEqual( out, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns -1 if the provided position is in the first extended grapheme cluster of the string', function test( t ) { - var out; - - out = prevGraphemeClusterBreak( 'last man standing', 0 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'presidential election', 0 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'नुच्छेद', 1 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( '🌷', 1 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( '六', 0 ); - t.strictEqual( out, -1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the previous grapheme break position in a specified string', function test( t ) { - var out; - - out = prevGraphemeClusterBreak( 'last man standing', 4 ); - t.strictEqual( out, 3, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'presidential election', 8 ); - t.strictEqual( out, 7, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'अनुच्छेद', 2 ); - t.strictEqual( out, 0, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'अनुच्छेद', 3 ); - t.strictEqual( out, 2, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'अनुच्छेद', 6 ); - t.strictEqual( out, 4, 'returns expected value' ); - - out = prevGraphemeClusterBreak( '🌷', 1 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( '🌷🐷', 2 ); - t.strictEqual( out, 1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns zero when the second argument is a negative integer (equivalent to clamping the second argument to zero)', function test( t ) { - var out; - - out = prevGraphemeClusterBreak( 'last man standing', -13 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'presidential election', -13 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'अनुच्छेद', -6 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'अनुच्छेद', -5 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'अनुच्छेद', -2 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( '🌷🐷', -2 ); - t.strictEqual( out, -1, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports a default `fromIndex` of `str.length-1` if second argument is not provided', function test( t ) { - var out; - - out = prevGraphemeClusterBreak( 'last man standing' ); - t.strictEqual( out, 15, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'presidential election' ); - t.strictEqual( out, 19, 'returns expected value' ); - - out = prevGraphemeClusterBreak( 'नुच्छे' ); - t.strictEqual( out, 3, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns -1 if provided an empty string', function test( t ) { - var out; - - out = prevGraphemeClusterBreak( '', -2 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( '', 2 ); - t.strictEqual( out, -1, 'returns expected value' ); - - out = prevGraphemeClusterBreak( '', 0 ); - t.strictEqual( out, -1, 'returns expected value' ); - - t.end(); -}); diff --git a/remove-first/README.md b/remove-first/README.md deleted file mode 100644 index 41a77761..00000000 --- a/remove-first/README.md +++ /dev/null @@ -1,227 +0,0 @@ - - -# removeFirst - -> Remove the first character(s) of a string. - -
- -## Usage - -```javascript -var removeFirst = require( '@stdlib/string/remove-first' ); -``` - -#### removeFirst( str\[, n]\[, options] ) - -Removes the first character(s) of a `string`. - -```javascript -var out = removeFirst( 'last man standing' ); -// returns 'ast man standing' - -out = removeFirst( 'Hidden Treasures' ); -// returns 'idden Treasures' -``` - -The function supports the following options: - -- **mode**: type of characters to return. Must be one of the following: - - - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - - Default: `'grapheme'`. - -By default, the function returns the first character. To return the first `n` characters, provide a second argument specifying the number of characters to return. - -```javascript -var out = removeFirst( 'foo bar', 4 ); -// returns 'bar' - -out = removeFirst( 'foo bar', 10 ); -// returns '' -``` - -
- - - - - -
- -## Notes - -- By default, the function assumes the general case in which an input string may contain an arbitrary number of grapheme clusters. This assumption comes with a performance cost. Accordingly, if an input string is known to only contain visual characters of a particular type (e.g., only alphanumeric), one can achieve better performance by specifying the appropriate `mode` option. - -
- - - -
- -## Examples - - - -```javascript -var removeFirst = require( '@stdlib/string/remove-first' ); - -var str = removeFirst( 'last man standing' ); -// returns 'ast man standing' - -str = removeFirst( 'presidential election' ); -// returns 'residential election' - -str = removeFirst( 'JavaScript' ); -// returns 'avaScript' - -str = removeFirst( 'Hidden Treasures' ); -// returns 'idden Treasures' - -str = removeFirst( 'The Last of the Mohicans', 4 ); -// returns 'Last of the Mohicans' - -str = removeFirst( '🐶🐮🐷🐰🐸', 2 ); -// returns '🐷🐰🐸' - -str = removeFirst( '🐶🐮🐷🐰🐸', 10 ); -// returns '' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: remove-first [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n Number of characters to remove. Default: 1. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --mode mode Type of character to return. Default: 'grapheme'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nboop' | remove-first --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nboop' | remove-first --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ remove-first beep -eep -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep\nboop' | remove-first --n=2 -be -bo -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tboop' | remove-first --split '\t' -eep -oop -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/remove-first/benchmark/benchmark.js b/remove-first/benchmark/benchmark.js deleted file mode 100644 index 9049988b..00000000 --- a/remove-first/benchmark/benchmark.js +++ /dev/null @@ -1,146 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var removeFirst = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeFirst( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=grapheme', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'grapheme' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeFirst( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=code_point', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'code_point' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeFirst( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=code_unit', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'code_unit' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeFirst( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/remove-first/bin/cli b/remove-first/bin/cli deleted file mode 100755 index b2bb3a07..00000000 --- a/remove-first/bin/cli +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var removeFirst = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var opts; - var cli; - var n; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - if ( flags.n ) { - n = parseInt( flags.n, 10 ); - } else { - n = 1; - } - opts = {}; - if ( flags.mode ) { - opts.mode = flags.mode; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - try { - console.log( removeFirst( args[ 0 ], n, opts ) ); // eslint-disable-line no-console - } catch ( error ) { - return cli.error( error ); - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - if ( lines.length ) { - try { - console.log( removeFirst( lines[ 0 ], n, opts ) ); // eslint-disable-line no-console - } catch ( error ) { - return cli.error( error ); - } - for ( i = 1; i < lines.length; i++ ) { - console.log( removeFirst( lines[ i ], n, opts ) ); // eslint-disable-line no-console - } - } - } -} - -main(); diff --git a/remove-first/docs/repl.txt b/remove-first/docs/repl.txt deleted file mode 100644 index aeca5def..00000000 --- a/remove-first/docs/repl.txt +++ /dev/null @@ -1,48 +0,0 @@ - -{{alias}}( str[, n][, options] ) - Removes the first character(s) of a `string`. - - Parameters - ---------- - str: string - Input string. - - n: integer (optional) - Number of characters to remove. Default: 1. - - options: Object (optional) - Options. - - options.mode: string (optional) - Type of characters to return. The following modes are supported: - - - grapheme: grapheme clusters. Appropriate for strings containing visual - characters which can span multiple Unicode code points (e.g., emoji). - - code_point: Unicode code points. Appropriate for strings containing - visual characters which are comprised of more than one Unicode code - unit (e.g., ideographic symbols and punctuation and mathematical - alphanumerics). - - code_unit': UTF-16 code units. Appropriate for strings containing - visual characters drawn from the basic multilingual plane (BMP) (e.g., - common characters, such as those from the Latin, Greek, and Cyrillic - alphabets). - - Default: 'grapheme'. - - Returns - ------- - out: string - Updated string. - - Examples - -------- - > var out = {{alias}}( 'beep' ) - 'eep' - > out = {{alias}}( 'Boop' ) - 'oop' - > out = {{alias}}( 'foo bar', 4 ) - 'bar' - - See Also - -------- - diff --git a/remove-first/docs/types/index.d.ts b/remove-first/docs/types/index.d.ts deleted file mode 100644 index 4494dd0d..00000000 --- a/remove-first/docs/types/index.d.ts +++ /dev/null @@ -1,120 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/** -* Interface describing function options. -*/ -interface Options { - /** - * Specifies the type of characters to return (default: 'grapheme'). - * - * ## Notes - * - * - The following option values are supported: - * - * - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - * - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - * - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - */ - mode?: 'grapheme' | 'code_point' | 'code_unit'; -} - -/** -* Removes the first character(s) of a string. -* -* @param str - input string -* @param n - number of characters to remove (default: 1) -* @param options - options -* @returns updated string -* -* @example -* var out = removeFirst( 'last man standing', 1, { -* 'mode': 'code_unit' -* }); -* // returns 'ast man standing' -* -* @example -* var out = removeFirst( '🐶🐮🐷🐰🐸', 2, { -* 'mode': 'grapheme' -* }); -* // returns '🐷🐰🐸' -*/ -declare function removeFirst( str: string, n: number, options?: Options ): string; - -/** -* Removes the first character of a string. -* -* @param str - input string -* @param options - options -* @returns updated string -* -* @example -* var out = removeFirst( 'last man standing', { -* 'mode': 'code_unit' -* }); -* // returns 'ast man standing' -* -* @example -* var out = removeFirst( '🐶🐮🐷🐰🐸', { -* 'mode': 'grapheme' -* }); -* // returns '🐮🐷🐰🐸' -*/ -declare function removeFirst( str: string, options?: Options ): string; - -/** -* Removes the first character(s) of a string. -* -* @param str - input string -* @param n - number of characters to remove (default: 1) -* @returns updated string -* -* @example -* var out = removeFirst( 'last man standing' ); -* // returns 'ast man standing' -* -* @example -* var out = removeFirst( 'presidential election' ); -* // returns 'residential election' -* -* @example -* var out = removeFirst( 'JavaScript' ); -* // returns 'avaScript' -* -* @example -* var out = removeFirst( 'Hidden Treasures' ); -* // returns 'idden Treasures' -* -* @example -* var out = removeFirst( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐷🐰🐸' -* -* @example -* var out = removeFirst( 'foo bar', 4 ); -* // returns 'bar' -*/ -declare function removeFirst( str: string, n?: number ): string; - - -// EXPORTS // - -export = removeFirst; diff --git a/remove-first/docs/types/test.ts b/remove-first/docs/types/test.ts deleted file mode 100644 index 67c92c81..00000000 --- a/remove-first/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import removeFirst = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - removeFirst( 'abc' ); // $ExpectType string - removeFirst( 'abc', 1 ); // $ExpectType string - removeFirst( 'abc', {} ); // $ExpectType string - removeFirst( 'abc', 1, {} ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - removeFirst( true ); // $ExpectError - removeFirst( false ); // $ExpectError - removeFirst( null ); // $ExpectError - removeFirst( undefined ); // $ExpectError - removeFirst( 5 ); // $ExpectError - removeFirst( [] ); // $ExpectError - removeFirst( {} ); // $ExpectError - removeFirst( ( x: number ): number => x ); // $ExpectError - - removeFirst( true, 1 ); // $ExpectError - removeFirst( false, 1 ); // $ExpectError - removeFirst( null, 1 ); // $ExpectError - removeFirst( undefined, 1 ); // $ExpectError - removeFirst( 5, 1 ); // $ExpectError - removeFirst( [], 1 ); // $ExpectError - removeFirst( {}, 1 ); // $ExpectError - removeFirst( ( x: number ): number => x, 1 ); // $ExpectError - - removeFirst( true, {} ); // $ExpectError - removeFirst( false, {} ); // $ExpectError - removeFirst( null, {} ); // $ExpectError - removeFirst( undefined, {} ); // $ExpectError - removeFirst( 5, {} ); // $ExpectError - removeFirst( [], {} ); // $ExpectError - removeFirst( {}, {} ); // $ExpectError - removeFirst( ( x: number ): number => x, {} ); // $ExpectError - - removeFirst( true, 1, {} ); // $ExpectError - removeFirst( false, 1, {} ); // $ExpectError - removeFirst( null, 1, {} ); // $ExpectError - removeFirst( undefined, 1, {} ); // $ExpectError - removeFirst( 5, 1, {} ); // $ExpectError - removeFirst( [], 1, {} ); // $ExpectError - removeFirst( {}, 1, {} ); // $ExpectError - removeFirst( ( x: number ): number => x, 1, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an invalid second argument... -{ - removeFirst( 'abc', true ); // $ExpectError - removeFirst( 'abc', false ); // $ExpectError - removeFirst( 'abc', null ); // $ExpectError - removeFirst( 'abc', 'abc' ); // $ExpectError - removeFirst( 'abc', [] ); // $ExpectError - removeFirst( 'abc', ( x: number ): number => x ); // $ExpectError - - removeFirst( 'abc', true, {} ); // $ExpectError - removeFirst( 'abc', false, {} ); // $ExpectError - removeFirst( 'abc', null, {} ); // $ExpectError - removeFirst( 'abc', '', {} ); // $ExpectError - removeFirst( 'abc', [], {} ); // $ExpectError - removeFirst( 'abc', {}, {} ); // $ExpectError - removeFirst( 'abc', ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an invalid `mode` option... -{ - removeFirst( 'abc', { 'mode': true } ); // $ExpectError - removeFirst( 'abc', { 'mode': false } ); // $ExpectError - removeFirst( 'abc', { 'mode': null } ); // $ExpectError - removeFirst( 'abc', { 'mode': '' } ); // $ExpectError - removeFirst( 'abc', { 'mode': [] } ); // $ExpectError - removeFirst( 'abc', { 'mode': ( x: number ): number => x } ); // $ExpectError - - removeFirst( 'abc', 1, { 'mode': true } ); // $ExpectError - removeFirst( 'abc', 1, { 'mode': false } ); // $ExpectError - removeFirst( 'abc', 1, { 'mode': null } ); // $ExpectError - removeFirst( 'abc', 1, { 'mode': '' } ); // $ExpectError - removeFirst( 'abc', 1, { 'mode': [] } ); // $ExpectError - removeFirst( 'abc', 1, { 'mode': {} } ); // $ExpectError - removeFirst( 'abc', 1, { 'mode': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - removeFirst(); // $ExpectError -} diff --git a/remove-first/docs/usage.txt b/remove-first/docs/usage.txt deleted file mode 100644 index 9dd960a5..00000000 --- a/remove-first/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: remove-first [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n Number of characters to remove. Default: 1. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --mode mode Type of character to return. Default: 'grapheme'. diff --git a/remove-first/etc/cli_opts.json b/remove-first/etc/cli_opts.json deleted file mode 100644 index 2ceae458..00000000 --- a/remove-first/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "string": [ - "n", - "split", - "mode" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/remove-first/examples/index.js b/remove-first/examples/index.js deleted file mode 100644 index 6e7e23e7..00000000 --- a/remove-first/examples/index.js +++ /dev/null @@ -1,42 +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'; - -var removeFirst = require( './../lib' ); - -console.log( removeFirst( 'last man standing' ) ); -// => 'ast man standing' - -console.log( removeFirst( 'presidential election' ) ); -// => 'residential election' - -console.log( removeFirst( 'JavaScript' ) ); -// => 'avaScript' - -console.log( removeFirst( 'Hidden Treasures' ) ); -// => 'idden Treasures' - -console.log( removeFirst( 'The Last of the Mohicans', 4 ) ); -// => 'Last of the Mohicans' - -console.log( removeFirst( '🐶🐮🐷🐰🐸', 2 ) ); -// => '🐷🐰🐸' - -console.log( removeFirst( '🐶🐮🐷🐰🐸', 10 ) ); -// => '' diff --git a/remove-first/lib/index.js b/remove-first/lib/index.js deleted file mode 100644 index 524077c9..00000000 --- a/remove-first/lib/index.js +++ /dev/null @@ -1,46 +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'; - -/** -* Remove the first character(s) of a string. -* -* @module @stdlib/string/remove-first -* -* @example -* var removeFirst = require( '@stdlib/string/remove-first' ); -* -* var out = removeFirst( 'last man standing' ); -* // returns 'ast man standing' -* -* out = removeFirst( 'Hidden Treasures' ); -* // returns 'idden Treasures' -* -* out = removeFirst( '🐮🐷🐸🐵', 2 ); -* // returns '🐸🐵' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/remove-first/lib/main.js b/remove-first/lib/main.js deleted file mode 100644 index 2f598664..00000000 --- a/remove-first/lib/main.js +++ /dev/null @@ -1,131 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isPlainObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var removeFirstCodeUnit = require( './../../base/remove-first' ); -var removeFirstCodePoint = require( './../../base/remove-first-code-point' ); -var removeFirstGraphemeCluster = require( './../../base/remove-first-grapheme-cluster' ); // eslint-disable-line id-length -var format = require( './../../format' ); - - -// VARIABLES // - -var MODES = [ 'grapheme', 'code_point', 'code_unit' ]; -var FCNS = { - 'grapheme': removeFirstGraphemeCluster, - 'code_point': removeFirstCodePoint, - 'code_unit': removeFirstCodeUnit -}; -var isMode = contains( MODES ); - - -// MAIN // - -/** -* Removes the first character(s) of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} [n=1] - number of characters to remove -* @param {Options} [options] - options -* @param {string} [options.mode="grapheme"] - type of "character" to return (must be either `grapheme`, `code_point`, or `code_unit`) -* @throws {TypeError} must provide a string primitive -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @returns {string} updated string -* -* @example -* var out = removeFirst( 'last man standing' ); -* // returns 'ast man standing' -* -* @example -* var out = removeFirst( 'presidential election' ); -* // returns 'residential election' -* -* @example -* var out = removeFirst( 'JavaScript' ); -* // returns 'avaScript' -* -* @example -* var out = removeFirst( 'Hidden Treasures' ); -* // returns 'idden Treasures' -* -* @example -* var out = removeFirst( '🐶🐮🐷🐰🐸', 2 ); -* // returns '🐷🐰🐸' -* -* @example -* var out = removeFirst( 'foo bar', 4 ); -* // returns 'bar' -*/ -function removeFirst( str ) { - var options; - var nargs; - var opts; - var n; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - opts = { - 'mode': 'grapheme' - }; - nargs = arguments.length; - if ( nargs === 1 ) { - n = 1; - } else if ( nargs === 2 ) { - n = arguments[ 1 ]; - if ( isPlainObject( n ) ) { - options = n; - n = 1; - } else if ( !isNonNegativeInteger( n ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) ); - } - } else { // nargs > 2 - n = arguments[ 1 ]; - if ( !isNonNegativeInteger( n ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) ); - } - options = arguments[ 2 ]; - if ( !isPlainObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - } - if ( options ) { - if ( hasOwnProp( options, 'mode' ) ) { - opts.mode = options.mode; - if ( !isMode( opts.mode ) ) { - throw new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Value: `%s`.', 'mode', MODES.join( '", "' ), opts.mode ) ); - } - } - } - return FCNS[ opts.mode ]( str, n ); -} - - -// EXPORTS // - -module.exports = removeFirst; diff --git a/remove-first/package.json b/remove-first/package.json deleted file mode 100644 index a57f36d5..00000000 --- a/remove-first/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/remove-first", - "version": "0.0.0", - "description": "Remove the first character(s) of a string.", - "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" - } - ], - "bin": { - "remove-first": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "remove", - "first", - "character", - "char" - ] -} diff --git a/remove-first/test/fixtures/stdin_error.js.txt b/remove-first/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/remove-first/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/remove-first/test/test.cli.js b/remove-first/test/test.cli.js deleted file mode 100644 index 7cf5e7d8..00000000 --- a/remove-first/test/test.cli.js +++ /dev/null @@ -1,389 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface removes the first character of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'eep\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface removes the first `n` characters of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--n=2\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'ep\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the type of characters to return', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--mode=code_point\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'eep\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'if provided an invalid option, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--mode=foo\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString().length > 0, true, 'expected value' ); - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'eep\noop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream (remove `n` characters)', opts, function test( t ) { - var cmd = [ - 'printf "foo\nbar"', - '|', - EXEC_PATH, - fpath, - '--n=2' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'o\nr\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'oo\nar\naz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the type of characters to return when used as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf \'foo\nbar\nbaz\'', - '|', - EXEC_PATH, - fpath, - '--mode code_point' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'oo\nar\naz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'oo\nar\naz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if provided an invalid option, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--mode=foo' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString().length > 0, true, 'expected value' ); - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/remove-first/test/test.js b/remove-first/test/test.js deleted file mode 100644 index ebed95cf..00000000 --- a/remove-first/test/test.js +++ /dev/null @@ -1,395 +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 removeFirst = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof removeFirst, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - removeFirst( value ); - }; - } -}); - -tape( 'the function throws an error if not provided a string (options)', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - removeFirst( value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided a second argument which is not a nonnegative integer', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3.14, - null, - true, - void 0, - NaN, - [], - 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() { - removeFirst( 'beep', value ); - }; - } -}); - -tape( 'the function throws an error if provided a second argument which is not a nonnegative integer (options)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3.14, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - removeFirst( 'beep', value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - removeFirst( 'beep', 1, value ); - }; - } -}); - -tape( 'the function throws an error if provided a `mode` option which is not a supported mode (second argument)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - removeFirst( 'beep', { - 'mode': value - }); - }; - } -}); - -tape( 'the function throws an error if provided a `mode` option which is not a supported mode (third argument)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - removeFirst( 'beep', 1, { - 'mode': value - }); - }; - } -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( removeFirst( '' ), '', 'returns empty string' ); - t.strictEqual( removeFirst( '', 1 ), '', 'returns expected value' ); - t.strictEqual( removeFirst( '', {} ), '', 'returns expected value' ); - t.strictEqual( removeFirst( '', 1, {} ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function removes the first character of a given string', function test( t ) { - var out; - - out = removeFirst( 'hello world' ); - t.strictEqual( out, 'ello world', 'removes first character' ); - - out = removeFirst( '!!!' ); - t.strictEqual( out, '!!', 'removes character' ); - - out = removeFirst( 'Hello World' ); - t.strictEqual( out, 'ello World', 'removes character' ); - - out = removeFirst( 'अनुच्छेद' ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - out = removeFirst( '六书/六書' ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - out = removeFirst( '🌷' ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the original string if provided zero as the second argument', function test( t ) { - var out; - - out = removeFirst( 'hello world', 0 ); - t.strictEqual( out, 'hello world', 'returns original string' ); - - out = removeFirst( 'hello world', 0, {} ); - t.strictEqual( out, 'hello world', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function removes the first `n` characters of a given string (default)', function test( t ) { - var out; - - out = removeFirst( 'hello world', 1 ); - t.strictEqual( out, 'ello world', 'removes first character' ); - - out = removeFirst( 'hello world', 6 ); - t.strictEqual( out, 'world', 'returns expected value' ); - - out = removeFirst( '!!!', 1 ); - t.strictEqual( out, '!!', 'removes character' ); - - out = removeFirst( '!!!', 2 ); - t.strictEqual( out, '!', 'removes character' ); - - out = removeFirst( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - out = removeFirst( '六书/六書', 1 ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - out = removeFirst( '🌷', 1 ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports removing the first `n` characters of a provided string (mode=grapheme)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'grapheme' - }; - - out = removeFirst( 'hello world', 1, opts ); - t.strictEqual( out, 'ello world', 'returns expected value' ); - - out = removeFirst( 'hello world', 7, opts ); - t.strictEqual( out, 'orld', 'returns expected value' ); - - out = removeFirst( '!!!', 1, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeFirst( '!!!', 2, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = removeFirst( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - out = removeFirst( '六书/六書', 1, opts ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - out = removeFirst( '🌷', 1, opts ); - t.strictEqual( out, '', 'returns expected value' ); - - out = removeFirst( '👉🏿', 1, opts ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports removing the first `n` characters of a provided string (mode=code_point)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'code_point' - }; - - out = removeFirst( 'hello world', 1, opts ); - t.strictEqual( out, 'ello world', 'returns expected value' ); - - out = removeFirst( 'hello world', 7, opts ); - t.strictEqual( out, 'orld', 'returns expected value' ); - - out = removeFirst( '!!!', 1, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeFirst( '!!!', 2, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = removeFirst( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - out = removeFirst( '六书/六書', 1, opts ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - out = removeFirst( '🌷', 1, opts ); - t.strictEqual( out, '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports removing the first `n` characters of a provided string (mode=code_unit)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'code_unit' - }; - - out = removeFirst( 'hello world', 1, opts ); - t.strictEqual( out, 'ello world', 'returns expected value' ); - - out = removeFirst( 'hello world', 7, opts ); - t.strictEqual( out, 'orld', 'returns expected value' ); - - out = removeFirst( '!!!', 1, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeFirst( '!!!', 2, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = removeFirst( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'नुच्छेद', 'returns expected value' ); - - out = removeFirst( '六书/六書', 1, opts ); - t.strictEqual( out, '书/六書', 'returns expected value' ); - - out = removeFirst( '🌷', 1, opts ); - t.strictEqual( out, '\udf37', 'returns expected value' ); - t.end(); -}); diff --git a/remove-last/README.md b/remove-last/README.md deleted file mode 100644 index c825ef70..00000000 --- a/remove-last/README.md +++ /dev/null @@ -1,224 +0,0 @@ - - -# removeLast - -> Remove the last character(s) of a string. - -
- -## Usage - -```javascript -var removeLast = require( '@stdlib/string/remove-last' ); -``` - -#### removeLast( str\[, n]\[, options] ) - -Removes the last character(s) of an input string. - -```javascript -var out = removeLast( 'last man standing' ); -// returns 'last man standin' - -out = removeLast( 'Hidden Treasures' ); -// returns 'Hidden Treasure' -``` - -The function supports the following options: - -- **mode**: type of characters to remove. Must be one of the following: - - - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - - Default: `'grapheme'`. - -By default, the function returns the last character. To return the last `n` characters, provide a second argument specifying the number of characters to return. - -```javascript -var out = removeLast( 'foo bar', 4 ); -// returns 'foo' - -out = removeLast( 'foo bar', 0 ); -// returns 'foo bar' -``` - -
- - - - - -
- -## Notes - -- By default, the function assumes the general case in which an input string may contain an arbitrary number of grapheme clusters. This assumption comes with a performance cost. Accordingly, if an input string is known to only contain visual characters of a particular type (e.g., only alphanumeric), one can achieve better performance by specifying the appropriate `mode` option. - -
- - - -
- -## Examples - - - -```javascript -var removeLast = require( '@stdlib/string/remove-last' ); - -var str = removeLast( 'last man standing' ); -// returns 'last man standin' - -str = removeLast( 'presidential election' ); -// returns 'presidential electio' - -str = removeLast( 'javaScript' ); -// returns 'javaScrip' - -str = removeLast( 'Hidden Treasures' ); -// returns 'Hidden Treasure' - -str = removeLast( 'Lorem ipsum dolor sit amet', 4 ); -// returns 'Lorem ipsum dolor sit ' - -str = removeLast( '🐮🐷🐸🐵', 2 ); -// returns '🐮🐷' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: remove-last [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n Number of characters to remove. Default: 1. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --mode mode Type of character to remove. Default: 'grapheme'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nboop' | remove-last --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nboop' | remove-last --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ remove-last beep -bee -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep\nboop' | remove-last --n 2 -be -bo -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tboop' | remove-last --split '\t' -bee -boo -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/remove-last/benchmark/benchmark.js b/remove-last/benchmark/benchmark.js deleted file mode 100644 index b8100607..00000000 --- a/remove-last/benchmark/benchmark.js +++ /dev/null @@ -1,142 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var removeLast = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var str; - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = fromCodePoint( i%126 ) + 'eep boop'; - out = removeLast( str ); - if ( out.length !== str.length-1 ) { - b.fail( 'should return a shorter string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=grapheme', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'grapheme' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeLast( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=code_point', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'code_point' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeLast( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=code_unit', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'code_unit' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = removeLast( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/remove-last/bin/cli b/remove-last/bin/cli deleted file mode 100755 index d76e824f..00000000 --- a/remove-last/bin/cli +++ /dev/null @@ -1,130 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var removeLast = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var opts; - var cli; - var n; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - if ( flags.n ) { - n = parseInt( flags.n, 10 ); - } else { - n = 1; - } - opts = {}; - if ( flags.mode ) { - opts.mode = flags.mode; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - try { - console.log( removeLast( args[ 0 ], n, opts ) ); // eslint-disable-line no-console - } catch ( error ) { - return cli.error( error ); - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - if ( lines.length ) { - try { - console.log( removeLast( lines[ 0 ], n, opts ) ); // eslint-disable-line no-console - } catch ( error ) { - return cli.error( error ); - } - for ( i = 1; i < lines.length; i++ ) { - console.log( removeLast( lines[ i ], n, opts ) ); // eslint-disable-line no-console - } - } - } -} - -main(); diff --git a/remove-last/docs/repl.txt b/remove-last/docs/repl.txt deleted file mode 100644 index 2b500266..00000000 --- a/remove-last/docs/repl.txt +++ /dev/null @@ -1,48 +0,0 @@ - -{{alias}}( str[, n][, options] ) - Removes the last character(s) of a `string`. - - Parameters - ---------- - str: string - Input string. - - n: integer (optional) - Number of characters to remove. Default: 1. - - options: Object (optional) - Options. - - options.mode: string (optional) - Type of characters to remove. The following modes are supported: - - - grapheme: grapheme clusters. Appropriate for strings containing visual - characters which can span multiple Unicode code points (e.g., emoji). - - code_point: Unicode code points. Appropriate for strings containing - visual characters which are comprised of more than one Unicode code - unit (e.g., ideographic symbols and punctuation and mathematical - alphanumerics). - - code_unit': UTF-16 code units. Appropriate for strings containing - visual characters drawn from the basic multilingual plane (BMP) (e.g., - common characters, such as those from the Latin, Greek, and Cyrillic - alphabets). - - Default: 'grapheme'. - - Returns - ------- - out: string - Updated string. - - Examples - -------- - > var out = {{alias}}( 'beep' ) - 'bee' - > out = {{alias}}( 'Boop' ) - 'Boo' - > out = {{alias}}( 'foo bar', 4 ) - 'foo' - - See Also - -------- - diff --git a/remove-last/docs/types/index.d.ts b/remove-last/docs/types/index.d.ts deleted file mode 100644 index 70ff6e44..00000000 --- a/remove-last/docs/types/index.d.ts +++ /dev/null @@ -1,116 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/* eslint-disable @typescript-eslint/unified-signatures */ - -/** -* Interface describing function options. -*/ -interface Options { - /** - * Specifies the type of characters to remove (default: 'grapheme'). - * - * ## Notes - * - * - The following option values are supported: - * - * - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - * - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - * - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - */ - mode?: 'grapheme' | 'code_point' | 'code_unit'; -} - -/** -* Removes the last character(s) of a string. -* -* @param str - input string -* @param n - number of characters to remove (default: 1) -* @param options - options -* @returns updated string -* -* @example -* var out = removeLast( 'last man standing', 1, { -* 'mode': 'code_unit' -* }); -* // returns 'last man standin' -* -* @example -* var out = removeLast( '🐶🐮🐷🐰🐸', 2, { -* 'mode': 'grapheme' -* }); -* // returns '🐶🐮🐷' -*/ -declare function removeLast( str: string, n: number, options?: Options ): string; - -/** -* Removes the last character of a string. -* -* @param str - input string -* @param options - options -* @returns updated string -* -* @example -* var out = removeLast( 'last man standing', { -* 'mode': 'code_unit' -* }); -* // returns 'last man standin' -* -* @example -* var out = removeLast( '🐶🐮🐷🐰🐸', { -* 'mode': 'grapheme' -* }); -* // returns '🐶🐮🐷🐰' -*/ -declare function removeLast( str: string, options?: Options ): string; - -/** -* Removes the last character(s) of a string. -* -* @param str - input string -* @param n - number of characters to remove (default: 1) -* @returns updated string -* -* @example -* var out = removeLast( 'last man standing' ); -* // returns 'last man standin' -* -* @example -* var out = removeLast( 'presidential election' ); -* // returns 'presidential electio' -* -* @example -* var out = removeLast( 'javaScript' ); -* // returns 'javaScrip' -* -* @example -* var out = removeLast( 'Hidden Treasures' ); -* // returns 'Hidden Treasure' -* -* @example -* var out = removeLast( 'leader', 2 ); -* // returns 'lead' -*/ -declare function removeLast( str: string, n?: number ): string; - - -// EXPORTS // - -export = removeLast; diff --git a/remove-last/docs/types/test.ts b/remove-last/docs/types/test.ts deleted file mode 100644 index 486e4f76..00000000 --- a/remove-last/docs/types/test.ts +++ /dev/null @@ -1,110 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import removeLast = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - removeLast( 'abc' ); // $ExpectType string - removeLast( 'abc', 1 ); // $ExpectType string - removeLast( 'abc', {} ); // $ExpectType string - removeLast( 'abc', 1, {} ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - removeLast( true ); // $ExpectError - removeLast( false ); // $ExpectError - removeLast( null ); // $ExpectError - removeLast( undefined ); // $ExpectError - removeLast( 5 ); // $ExpectError - removeLast( [] ); // $ExpectError - removeLast( {} ); // $ExpectError - removeLast( ( x: number ): number => x ); // $ExpectError - - removeLast( true, 1 ); // $ExpectError - removeLast( false, 1 ); // $ExpectError - removeLast( null, 1 ); // $ExpectError - removeLast( undefined, 1 ); // $ExpectError - removeLast( 5, 1 ); // $ExpectError - removeLast( [], 1 ); // $ExpectError - removeLast( {}, 1 ); // $ExpectError - removeLast( ( x: number ): number => x, 1 ); // $ExpectError - - removeLast( true, {} ); // $ExpectError - removeLast( false, {} ); // $ExpectError - removeLast( null, {} ); // $ExpectError - removeLast( undefined, {} ); // $ExpectError - removeLast( 5, {} ); // $ExpectError - removeLast( [], {} ); // $ExpectError - removeLast( {}, {} ); // $ExpectError - removeLast( ( x: number ): number => x, {} ); // $ExpectError - - removeLast( true, 1, {} ); // $ExpectError - removeLast( false, 1, {} ); // $ExpectError - removeLast( null, 1, {} ); // $ExpectError - removeLast( undefined, 1, {} ); // $ExpectError - removeLast( 5, 1, {} ); // $ExpectError - removeLast( [], 1, {} ); // $ExpectError - removeLast( {}, 1, {} ); // $ExpectError - removeLast( ( x: number ): number => x, 1, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an invalid second argument... -{ - removeLast( 'abc', true ); // $ExpectError - removeLast( 'abc', false ); // $ExpectError - removeLast( 'abc', null ); // $ExpectError - removeLast( 'abc', 'abc' ); // $ExpectError - removeLast( 'abc', [] ); // $ExpectError - removeLast( 'abc', ( x: number ): number => x ); // $ExpectError - - removeLast( 'abc', true, {} ); // $ExpectError - removeLast( 'abc', false, {} ); // $ExpectError - removeLast( 'abc', null, {} ); // $ExpectError - removeLast( 'abc', '', {} ); // $ExpectError - removeLast( 'abc', [], {} ); // $ExpectError - removeLast( 'abc', {}, {} ); // $ExpectError - removeLast( 'abc', ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided an invalid `mode` option... -{ - removeLast( 'abc', { 'mode': true } ); // $ExpectError - removeLast( 'abc', { 'mode': false } ); // $ExpectError - removeLast( 'abc', { 'mode': null } ); // $ExpectError - removeLast( 'abc', { 'mode': '' } ); // $ExpectError - removeLast( 'abc', { 'mode': [] } ); // $ExpectError - removeLast( 'abc', { 'mode': ( x: number ): number => x } ); // $ExpectError - - removeLast( 'abc', 1, { 'mode': true } ); // $ExpectError - removeLast( 'abc', 1, { 'mode': false } ); // $ExpectError - removeLast( 'abc', 1, { 'mode': null } ); // $ExpectError - removeLast( 'abc', 1, { 'mode': '' } ); // $ExpectError - removeLast( 'abc', 1, { 'mode': [] } ); // $ExpectError - removeLast( 'abc', 1, { 'mode': {} } ); // $ExpectError - removeLast( 'abc', 1, { 'mode': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - removeLast(); // $ExpectError -} diff --git a/remove-last/docs/usage.txt b/remove-last/docs/usage.txt deleted file mode 100644 index bc7c9401..00000000 --- a/remove-last/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: remove-last [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n Number of characters to remove. Default: 1. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --mode mode Type of character to remove. Default: 'grapheme'. diff --git a/remove-last/etc/cli_opts.json b/remove-last/etc/cli_opts.json deleted file mode 100644 index 2ceae458..00000000 --- a/remove-last/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "string": [ - "n", - "split", - "mode" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/remove-last/examples/index.js b/remove-last/examples/index.js deleted file mode 100644 index 9b7aee19..00000000 --- a/remove-last/examples/index.js +++ /dev/null @@ -1,39 +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'; - -var removeLast = require( './../lib' ); - -console.log( removeLast( 'last man standing' ) ); -// => 'last man standin' - -console.log( removeLast( 'presidential election' ) ); -// => 'presidential electio' - -console.log( removeLast( 'javaScript' ) ); -// => 'javaScrip' - -console.log( removeLast( 'Hidden Treasures' ) ); -// => 'Hidden Treasure' - -console.log( removeLast( 'Lorem ipsum dolor sit amet', 4 ) ); -// => 'Lorem ipsum dolor sit ' - -console.log( removeLast( '🐮🐷🐸🐵', 2 ) ); -// => '🐮🐷' diff --git a/remove-last/lib/index.js b/remove-last/lib/index.js deleted file mode 100644 index f704f1da..00000000 --- a/remove-last/lib/index.js +++ /dev/null @@ -1,46 +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'; - -/** -* Remove the last character(s) of a string. -* -* @module @stdlib/string/remove-last -* -* @example -* var removeLast = require( '@stdlib/string/remove-last' ); -* -* var out = removeLast( 'last man standing' ); -* // returns 'last man standin' -* -* out = removeLast( 'Hidden Treasures' ); -* // returns 'Hidden Treasure' -* -* out = removeLast( '🐮🐷🐸🐵', 2 ); -* // returns '🐮🐷' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/remove-last/lib/main.js b/remove-last/lib/main.js deleted file mode 100644 index ba58b544..00000000 --- a/remove-last/lib/main.js +++ /dev/null @@ -1,127 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isPlainObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var removeLastCodeUnit = require( './../../base/remove-last' ); -var removeLastCodePoint = require( './../../base/remove-last-code-point' ); -var removeLastGraphemeCluster = require( './../../base/remove-last-grapheme-cluster' ); -var format = require( './../../format' ); - - -// VARIABLES // - -var MODES = [ 'grapheme', 'code_point', 'code_unit' ]; -var FCNS = { - 'grapheme': removeLastGraphemeCluster, - 'code_point': removeLastCodePoint, - 'code_unit': removeLastCodeUnit -}; -var isMode = contains( MODES ); - - -// MAIN // - -/** -* Removes the last character(s) of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} [n=1] - number of character to remove -* @param {Options} [options] - options -* @param {string} [options.mode="grapheme"] - type of "character" to return (must be either `grapheme`, `code_point`, or `code_unit`) -* @throws {TypeError} must provide a string primitive -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @returns {string} updated string -* -* @example -* var out = removeLast( 'last man standing' ); -* // returns 'last man standin' -* -* @example -* var out = removeLast( 'presidential election' ); -* // returns 'presidential electio' -* -* @example -* var out = removeLast( 'javaScript' ); -* // returns 'javaScrip' -* -* @example -* var out = removeLast( 'Hidden Treasures' ); -* // returns 'Hidden Treasure' -* -* @example -* var out = removeLast( 'leader', 2 ); -* // returns 'lead' -*/ -function removeLast( str ) { - var options; - var nargs; - var opts; - var n; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - opts = { - 'mode': 'grapheme' - }; - nargs = arguments.length; - if ( nargs === 1 ) { - n = 1; - } else if ( nargs === 2 ) { - n = arguments[ 1 ]; - if ( isPlainObject( n ) ) { - options = n; - n = 1; - } else if ( !isNonNegativeInteger( n ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) ); - } - } else { // nargs > 2 - n = arguments[ 1 ]; - if ( !isNonNegativeInteger( n ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) ); - } - options = arguments[ 2 ]; - if ( !isPlainObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - } - if ( options ) { - if ( hasOwnProp( options, 'mode' ) ) { - opts.mode = options.mode; - if ( !isMode( opts.mode ) ) { - throw new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Value: `%s`.', 'mode', MODES.join( '", "' ), opts.mode ) ); - } - } - } - return FCNS[ opts.mode ]( str, n ); -} - - -// EXPORTS // - -module.exports = removeLast; diff --git a/remove-last/package.json b/remove-last/package.json deleted file mode 100644 index fb957911..00000000 --- a/remove-last/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@stdlib/string/remove-last", - "version": "0.0.0", - "description": "Remove the last character(s) of a string.", - "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" - } - ], - "bin": { - "remove-last": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "remove", - "last", - "character", - "char", - "trim", - "chop", - "shorten" - ] -} diff --git a/remove-last/test/fixtures/stdin_error.js.txt b/remove-last/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/remove-last/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/remove-last/test/test.cli.js b/remove-last/test/test.cli.js deleted file mode 100644 index f37d6523..00000000 --- a/remove-last/test/test.cli.js +++ /dev/null @@ -1,367 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface removes the last character of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'bee\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface removes the last `n` characters of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--n=2\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the type of characters to remove', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--mode=code_point\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'bee\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'if provided an invalid option, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--mode=foo\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString().length > 0, true, 'expected value' ); - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'bee\nboo\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream (remove `n` characters)', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop"', - '|', - EXEC_PATH, - fpath, - '--n=2' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be\nbo\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'fo\nba\nba\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the type of characters to remove when used as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf \'foo\nbar\nbaz\'', - '|', - EXEC_PATH, - fpath, - '--mode code_point' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'fo\nba\nba\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'fo\nba\nba\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/remove-last/test/test.js b/remove-last/test/test.js deleted file mode 100644 index b036830d..00000000 --- a/remove-last/test/test.js +++ /dev/null @@ -1,407 +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 removeLast = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof removeLast, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - removeLast( value ); - }; - } -}); - -tape( 'the function throws an error if not provided a string (options)', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - removeLast( value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided a second argument which is not a nonnegative integer', function test( t ) { - var values; - var i; - - values = [ - 3.12, - 'abc', - null, - true, - void 0, - NaN, - [], - 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() { - removeLast( 'beep', value ); - }; - } -}); - -tape( 'the function throws an error if provided a second argument which is not a nonnegative integer (options)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3.14, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - removeLast( 'beep', value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - removeLast( 'beep', 1, value ); - }; - } -}); - -tape( 'the function throws an error if provided a `mode` option which is not a supported mode (second argument)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - removeLast( 'beep', { - 'mode': value - }); - }; - } -}); - -tape( 'the function throws an error if provided a `mode` option which is not a supported mode (third argument)', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - removeLast( 'beep', 1, { - 'mode': value - }); - }; - } -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( removeLast( '' ), '', 'returns empty string' ); - t.strictEqual( removeLast( '', 1 ), '', 'returns expected value' ); - t.strictEqual( removeLast( '', {} ), '', 'returns expected value' ); - t.strictEqual( removeLast( '', 1, {} ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function removes the last character of a given string', function test( t ) { - var out; - - out = removeLast( 'hello world' ); - t.strictEqual( out, 'hello worl', 'removes character' ); - - out = removeLast( '!!!' ); - t.strictEqual( out, '!!', 'removes character' ); - - out = removeLast( 'Hello World' ); - t.strictEqual( out, 'Hello Worl', 'removes character' ); - - out = removeLast( 'अनुच्छेद' ); - t.strictEqual( out, 'अनुच्छे', 'returns expected value' ); - - out = removeLast( '六书/六書' ); - t.strictEqual( out, '六书/六', 'returns expected value' ); - - out = removeLast( '🌷' ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the original string if provided zero as the second argument', function test( t ) { - var out; - - out = removeLast( 'hello world', 0 ); - t.strictEqual( out, 'hello world', 'returns original string' ); - - out = removeLast( 'hello world', 0, {} ); - t.strictEqual( out, 'hello world', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function removes the last `n` characters of a given string (default)', function test( t ) { - var out; - - out = removeLast( 'hello world', 1 ); - t.strictEqual( out, 'hello worl', 'removes last character' ); - - out = removeLast( 'hello world', 6 ); - t.strictEqual( out, 'hello', 'returns expected value' ); - - out = removeLast( '!!!', 1 ); - t.strictEqual( out, '!!', 'removes character' ); - - out = removeLast( '!!!', 2 ); - t.strictEqual( out, '!', 'removes character' ); - - out = removeLast( 'अनुच्छेद', 1 ); - t.strictEqual( out, 'अनुच्छे', 'returns expected value' ); - - out = removeLast( '六书/六書', 1 ); - t.strictEqual( out, '六书/六', 'returns expected value' ); - - out = removeLast( '🌷', 1 ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports removing the last `n` characters of a provided string (mode=grapheme)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'grapheme' - }; - - out = removeLast( 'hello world', 1, opts ); - t.strictEqual( out, 'hello worl', 'returns expected value' ); - - out = removeLast( 'hello world', 7, opts ); - t.strictEqual( out, 'hell', 'returns expected value' ); - - out = removeLast( '!!!', 1, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeLast( '!!!', 2, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = removeLast( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'अनुच्छे', 'returns expected value' ); - - out = removeLast( '六书/六書', 1, opts ); - t.strictEqual( out, '六书/六', 'returns expected value' ); - - out = removeLast( '🌷', 1, opts ); - t.strictEqual( out, '', 'returns expected value' ); - - out = removeLast( '👉🏿', 1, opts ); - t.strictEqual( out, '', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports removing the last `n` characters of a provided string (mode=code_point)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'code_point' - }; - - out = removeLast( 'hello world', 1, opts ); - t.strictEqual( out, 'hello worl', 'returns expected value' ); - - out = removeLast( 'hello world', 7, opts ); - t.strictEqual( out, 'hell', 'returns expected value' ); - - out = removeLast( '!!!', 1, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeLast( '!!!', 2, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = removeLast( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'अनुच्छे', 'returns expected value' ); - - out = removeLast( '六书/六書', 1, opts ); - t.strictEqual( out, '六书/六', 'returns expected value' ); - - out = removeLast( '🌷', 1, opts ); - t.strictEqual( out, '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function supports removing the last `n` characters of a provided string (mode=code_unit)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'code_unit' - }; - - out = removeLast( 'hello world', 1, opts ); - t.strictEqual( out, 'hello worl', 'returns expected value' ); - - out = removeLast( 'hello world', 7, opts ); - t.strictEqual( out, 'hell', 'returns expected value' ); - - out = removeLast( '!!!', 1, opts ); - t.strictEqual( out, '!!', 'returns expected value' ); - - out = removeLast( '!!!', 2, opts ); - t.strictEqual( out, '!', 'returns expected value' ); - - out = removeLast( 'अनुच्छेद', 1, opts ); - t.strictEqual( out, 'अनुच्छे', 'returns expected value' ); - - out = removeLast( '六书/六書', 1, opts ); - t.strictEqual( out, '六书/六', 'returns expected value' ); - - out = removeLast( '🌷', 1, opts ); - t.strictEqual( out, '\ud83c', 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an empty string if `n` is greater than or equal to the length of the string', function test( t ) { - var out; - - out = removeLast( 'hello world', 12 ); - t.strictEqual( out, '', 'returns empty string' ); - - out = removeLast( '!!!', 3 ); - t.strictEqual( out, '', 'returns empty string' ); - - t.end(); -}); diff --git a/remove-punctuation/README.md b/remove-punctuation/README.md deleted file mode 100644 index 3621e4c2..00000000 --- a/remove-punctuation/README.md +++ /dev/null @@ -1,168 +0,0 @@ - - -# Remove Punctuation - -> Remove punctuation characters from a string. - -
- -
- - - -
- -## Usage - -```javascript -var removePunctuation = require( '@stdlib/string/remove-punctuation' ); -``` - -#### removePunctuation( str ) - -Removes punctuation characters from a `string`. - -```javascript -var str = removePunctuation( 'Sun Tzu said: "A leader leads by example not by force."' ); -// returns 'Sun Tzu said A leader leads by example not by force' -``` - -The function removes the following characters: - -| description | value | | -| :--------------: | :-----: | --- | -| Apostrophe | `` ` `` | | -| Braces | `{ }` | | -| Brackets | `[ ]` | | -| Colon | `:` | | -| Comma | `,` | | -| Exclamation Mark | `!` | | -| Fraction Slash | `/` | | -| Guillemets | `< >` | | -| Parentheses | `( )` | | -| Period | `.` | | -| Semicolon | `;` | | -| Tilde | `~` | | -| Vertical Bar | \` | \` | -| Question Mark | `?` | | -| Quotation Marks | `' "` | | - -
- - - -
- -## Examples - - - -```javascript -var removePunctuation = require( '@stdlib/string/remove-punctuation' ); - -var str; -var out; - -str = 'Double, double, toil and trouble; Fire burn, and cauldron bubble!'; -out = removePunctuation( str ); -// returns 'Double double toil and trouble Fire burn and cauldron bubble' - -str = 'This module removes these characters: `{}[]:,!/<>().;~|?\'"'; -out = removePunctuation( str ); -// returns 'This module removes these characters ' - -str = 'We have to hold the border – at all cost'; -out = removePunctuation( str ); -// returns 'We have to hold the border at all cost' - -str = 'This a sentence without punctuation'; -out = removePunctuation( str ); -// returns 'This a sentence without punctuation' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: remove-punctuation [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. -``` - -
- - - -
- -### Examples - -```bash -$ remove-punctuation 'beep! beep!!!' -beep beep -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep! beep!!!' | remove-punctuation -beep beep -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/remove-punctuation/benchmark/benchmark.js b/remove-punctuation/benchmark/benchmark.js deleted file mode 100644 index c9c98299..00000000 --- a/remove-punctuation/benchmark/benchmark.js +++ /dev/null @@ -1,51 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var pkg = require( './../package.json' ).name; -var removePunctuation = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var str; - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = fromCodePoint( i%126 ) + 'eep boop!"\'(),–.:;<>?`{}|~/\\[]'; - out = removePunctuation( str ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/remove-punctuation/bin/cli b/remove-punctuation/bin/cli deleted file mode 100755 index 49873549..00000000 --- a/remove-punctuation/bin/cli +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var removePunctuation = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - return stdin( onRead ); - } - console.log( removePunctuation( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - if ( error ) { - return cli.error( error ); - } - console.log( removePunctuation( data.toString() ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/remove-punctuation/docs/repl.txt b/remove-punctuation/docs/repl.txt deleted file mode 100644 index 47dd1067..00000000 --- a/remove-punctuation/docs/repl.txt +++ /dev/null @@ -1,45 +0,0 @@ - -{{alias}}( str ) - Removes punctuation characters from a `string`. - - The function removes the following characters: - - - Apostrophe: ` - - Braces : { } - - Brackets: [ ] - - Colon: : - - Comma: , - - Exclamation Mark: ! - - Fraction Slash: / - - Guillemets: < > - - Parentheses: ( ) - - Period: . - - Semicolon: ; - - Tilde: ~ - - Vertical Bar: | - - Question Mark: ? - - Quotation Marks: ' " - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - String with punctuation characters removed. - - Examples - -------- - > var str = 'Sun Tzu said: "A leader leads by example not by force."'; - > var out = {{alias}}( str ) - 'Sun Tzu said A leader leads by example not by force' - - > str = 'This function removes these characters: `{}[]:,!/<>().;~|?\'"'; - > out = {{alias}}( str ) - 'This function removes these characters ' - - See Also - -------- - diff --git a/remove-punctuation/docs/types/index.d.ts b/remove-punctuation/docs/types/index.d.ts deleted file mode 100644 index f35c6efe..00000000 --- a/remove-punctuation/docs/types/index.d.ts +++ /dev/null @@ -1,47 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Removes punctuation characters from a string. -* -* @param str - input string -* @returns output string -* -* @example -* var str = 'Sun Tzu said: "A leader leads by example not by force."'; -* var out = removePunctuation( str ); -* // returns 'Sun Tzu said A leader leads by example not by force' -* -* @example -* var str = 'Double, double, toil and trouble; Fire burn, and cauldron bubble!'; -* var out = removePunctuation( str ); -* // returns 'Double double toil and trouble Fire burn and cauldron bubble' -* -* @example -* var str = 'This module removes these characters: `{}[]:,!/<>().;~|?\'"'; -* var out = removePunctuation( str ); -* // returns 'This module removes these characters ' -*/ -declare function removePunctuation( str: string ): string; - - -// EXPORTS // - -export = removePunctuation; diff --git a/remove-punctuation/docs/types/test.ts b/remove-punctuation/docs/types/test.ts deleted file mode 100644 index dba7207a..00000000 --- a/remove-punctuation/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import removePunctuation = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - removePunctuation( 'Sun Tzu said: "A leader leads by example not by force."' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - removePunctuation( true ); // $ExpectError - removePunctuation( false ); // $ExpectError - removePunctuation( null ); // $ExpectError - removePunctuation( undefined ); // $ExpectError - removePunctuation( 5 ); // $ExpectError - removePunctuation( [] ); // $ExpectError - removePunctuation( {} ); // $ExpectError - removePunctuation( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - removePunctuation(); // $ExpectError -} diff --git a/remove-punctuation/docs/usage.txt b/remove-punctuation/docs/usage.txt deleted file mode 100644 index 9a19c289..00000000 --- a/remove-punctuation/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: remove-punctuation [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - diff --git a/remove-punctuation/etc/cli_opts.json b/remove-punctuation/etc/cli_opts.json deleted file mode 100644 index f245a17e..00000000 --- a/remove-punctuation/etc/cli_opts.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/remove-punctuation/examples/index.js b/remove-punctuation/examples/index.js deleted file mode 100644 index a7e32d3a..00000000 --- a/remove-punctuation/examples/index.js +++ /dev/null @@ -1,33 +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'; - -var removePunctuation = require( './../lib' ); - -console.log( removePunctuation( 'Double, double, toil and trouble; Fire burn, and cauldron bubble!' ) ); -// => 'Double double toil and trouble Fire burn and cauldron bubble' - -console.log( removePunctuation( 'This function removes these characters: `{}[]:,!/<>().;~|?\'"' ) ); -// => 'This function removes these characters ' - -console.log( removePunctuation( 'We have to hold the border – at all cost' ) ); -// => 'We have to hold the border at all cost' - -console.log( removePunctuation( 'This a sentence without punctuation' ) ); -// => 'This a sentence without punctuation' diff --git a/remove-punctuation/lib/index.js b/remove-punctuation/lib/index.js deleted file mode 100644 index c9c26911..00000000 --- a/remove-punctuation/lib/index.js +++ /dev/null @@ -1,43 +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'; - -/** -* Remove punctuation characters from a string. -* -* @module @stdlib/string/remove-punctuation -* -* @example -* var removePunctuation = require( '@stdlib/string/remove-punctuation' ); -* -* var out = removePunctuation( 'Sun Tzu said: "A leader leads by example not by force."' ); -* // returns 'Sun Tzu said A leader leads by example not by force' -* -* out = removePunctuation( 'Double, double, toil and trouble; Fire burn, and cauldron bubble!' ) ); -* // returns 'Double double toil and trouble Fire burn and cauldron bubble' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/remove-punctuation/lib/main.js b/remove-punctuation/lib/main.js deleted file mode 100644 index 9c3367c5..00000000 --- a/remove-punctuation/lib/main.js +++ /dev/null @@ -1,67 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var replace = require( './../../replace' ); -var format = require( './../../format' ); - - -// VARIABLES // - -var RE = /[!"'(),–.:;<>?`{}|~\/\\\[\]]/g; // eslint-disable-line no-useless-escape - - -// MAIN // - -/** -* Removes punctuation characters from a string. -* -* @param {string} str - input string -* @throws {TypeError} must provide a string primitive -* @returns {string} output string -* -* @example -* var str = 'Sun Tzu said: "A leader leads by example not by force."'; -* var out = removePunctuation( str ); -* // returns 'Sun Tzu said A leader leads by example not by force' -* -* @example -* var str = 'Double, double, toil and trouble; Fire burn, and cauldron bubble!'; -* var out = removePunctuation( str ); -* // returns 'Double double toil and trouble Fire burn and cauldron bubble' -* -* @example -* var str = 'This module removes these characters: `{}[]:,!/<>().;~|?\'"'; -* var out = removePunctuation( str ); -* // returns 'This module removes these characters ' -*/ -function removePunctuation( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - return replace( str, RE, '' ); -} - - -// EXPORTS // - -module.exports = removePunctuation; diff --git a/remove-punctuation/package.json b/remove-punctuation/package.json deleted file mode 100644 index 1b700a7f..00000000 --- a/remove-punctuation/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/remove-punctuation", - "version": "0.0.0", - "description": "Remove punctuation characters from a string.", - "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" - } - ], - "bin": { - "remove-punctuation": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "search", - "remove", - "punctuation", - "replace" - ] -} diff --git a/remove-punctuation/test/fixtures/stdin_error.js.txt b/remove-punctuation/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/remove-punctuation/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/remove-punctuation/test/test.cli.js b/remove-punctuation/test/test.cli.js deleted file mode 100644 index 2e5ed5ee..00000000 --- a/remove-punctuation/test/test.cli.js +++ /dev/null @@ -1,224 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface removes punctuation from a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'Sun Tzu said: A leader leads by example not by force.\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'Sun Tzu said A leader leads by example not by force\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var expected; - var cmd; - - cmd = [ - 'printf \'Hello, Sir!\n"Too little, too late", he said to me...\'', - '|', - EXEC_PATH, - fpath - ]; - - expected = 'Hello Sir\nToo little too late he said to me\n'; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), expected, 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/remove-punctuation/test/test.js b/remove-punctuation/test/test.js deleted file mode 100644 index fa052d49..00000000 --- a/remove-punctuation/test/test.js +++ /dev/null @@ -1,88 +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 removePunctuation = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof removePunctuation, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - removePunctuation( value ); - }; - } -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( removePunctuation( '' ), '', 'returns empty string' ); - t.end(); -}); - -tape( 'the function removes punctuation characters from a string', function test( t ) { - var expected; - var out; - - out = removePunctuation( 'Hello, Sir!' ); - expected = 'Hello Sir'; - t.strictEqual( out, expected, 'removes punctuation' ); - - out = removePunctuation( '"Too little, too late", he said to me...' ); - expected = 'Too little too late he said to me'; - t.strictEqual( out, expected, 'removes punctuation' ); - - out = removePunctuation( 'We don\'t need no education, we don\'t need no thought control' ); - expected = 'We dont need no education we dont need no thought control'; - t.strictEqual( out, expected, 'removes punctuation' ); - - out = removePunctuation( 'Sun Tzu said: "A leader leads by example not by force."' ); - expected = 'Sun Tzu said A leader leads by example not by force'; - t.strictEqual( out, expected, 'removes punctuation' ); - - t.end(); -}); diff --git a/remove-utf8-bom/README.md b/remove-utf8-bom/README.md deleted file mode 100644 index 2aceeb77..00000000 --- a/remove-utf8-bom/README.md +++ /dev/null @@ -1,145 +0,0 @@ - - -# Remove UTF-8 BOM - -> Remove a UTF-8 [byte order mark][bom] (BOM) from the beginning of a string. - -
- -
- - - -
- -## Usage - -```javascript -var removeUTF8BOM = require( '@stdlib/string/remove-utf8-bom' ); -``` - -#### removeUTF8BOM( str ) - -Removes a UTF-8 [byte order mark][bom] (BOM) from the beginning of a `string`. - -```javascript -var str = removeUTF8BOM( '\ufeffbeep' ); -// returns 'beep' -``` - -
- - - -
- -## Examples - - - -```javascript -var removeUTF8BOM = require( '@stdlib/string/remove-utf8-bom' ); - -var str = removeUTF8BOM( '\ufeffbeep' ); -// returns 'beep' - -str = removeUTF8BOM( 'boop\ufeff' ); -// returns 'boop\ufeff' - -str = removeUTF8BOM( 'be\ufeffbop' ); -// returns 'be\ufeffbop' - -str = removeUTF8BOM( 'foobar' ); -// returns 'foobar' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: remove-utf8-bom [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. -``` - -
- - - -
- -### Examples - -Assuming a shell which understands escape sequences, - -```bash -$ remove-utf8-bom "\xEF\xBB\xBFbeep boop" -beep boop -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n '\ufeffbeep' | remove-utf8-bom -beep -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/remove-utf8-bom/benchmark/benchmark.js b/remove-utf8-bom/benchmark/benchmark.js deleted file mode 100644 index 5bee3af0..00000000 --- a/remove-utf8-bom/benchmark/benchmark.js +++ /dev/null @@ -1,51 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var pkg = require( './../package.json' ).name; -var removeUTF8BOM = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var str; - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = '\ufeff' + fromCodePoint( i%126 ) + 'eep boop'; - out = removeUTF8BOM( str ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/remove-utf8-bom/bin/cli b/remove-utf8-bom/bin/cli deleted file mode 100755 index 7692ed86..00000000 --- a/remove-utf8-bom/bin/cli +++ /dev/null @@ -1,87 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var removeBOM = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - return stdin( onRead ); - } - console.log( removeBOM( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - if ( error ) { - return cli.error( error ); - } - data = data.toString(); - console.log( removeBOM( data ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/remove-utf8-bom/docs/repl.txt b/remove-utf8-bom/docs/repl.txt deleted file mode 100644 index 84338e64..00000000 --- a/remove-utf8-bom/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( str ) - Removes a UTF-8 byte order mark (BOM) from the beginning of a `string`. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - String with BOM removed. - - Examples - -------- - > var out = {{alias}}( '\ufeffbeep' ) - 'beep' - - See Also - -------- - diff --git a/remove-utf8-bom/docs/types/index.d.ts b/remove-utf8-bom/docs/types/index.d.ts deleted file mode 100644 index 73085e08..00000000 --- a/remove-utf8-bom/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Removes a UTF-8 byte order mark (BOM) from the beginning of a string. -* -* ## Notes -* -* - A UTF-8 byte order mark ([BOM][1]) is the byte sequence `0xEF,0xBB,0xBF`. -* - To convert a UTF-8 encoded `Buffer` to a `string`, the `Buffer` must be converted to [UTF-16][2]. The BOM thus gets converted to the single 16-bit code point `'\ufeff'` (UTF-16 BOM). -* -* [1]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8 -* [2]: http://es5.github.io/#x4.3.16 -* -* @param str - input string -* @returns string with BOM removed -* -* @example -* var str = removeUTF8BOM( '\ufeffbeep' ); -* // returns 'beep' -*/ -declare function removeUTF8BOM( str: string ): string; - - -// EXPORTS // - -export = removeUTF8BOM; diff --git a/remove-utf8-bom/docs/types/test.ts b/remove-utf8-bom/docs/types/test.ts deleted file mode 100644 index b8122e87..00000000 --- a/remove-utf8-bom/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import removeUTF8BOM = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - removeUTF8BOM( '\ufeffbeep' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - removeUTF8BOM( true ); // $ExpectError - removeUTF8BOM( false ); // $ExpectError - removeUTF8BOM( null ); // $ExpectError - removeUTF8BOM( undefined ); // $ExpectError - removeUTF8BOM( 5 ); // $ExpectError - removeUTF8BOM( [] ); // $ExpectError - removeUTF8BOM( {} ); // $ExpectError - removeUTF8BOM( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - removeUTF8BOM(); // $ExpectError -} diff --git a/remove-utf8-bom/docs/usage.txt b/remove-utf8-bom/docs/usage.txt deleted file mode 100644 index d9327889..00000000 --- a/remove-utf8-bom/docs/usage.txt +++ /dev/null @@ -1,7 +0,0 @@ - -Usage: remove-utf8-bom [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. diff --git a/remove-utf8-bom/etc/cli_opts.json b/remove-utf8-bom/etc/cli_opts.json deleted file mode 100644 index 92119c45..00000000 --- a/remove-utf8-bom/etc/cli_opts.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "string": [], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/remove-utf8-bom/examples/index.js b/remove-utf8-bom/examples/index.js deleted file mode 100644 index 63c6bc56..00000000 --- a/remove-utf8-bom/examples/index.js +++ /dev/null @@ -1,37 +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'; - -var removeUTF8BOM = require( './../lib' ); - -var str = removeUTF8BOM( '\ufeffbeep' ); -console.log( str ); -// => 'beep' - -str = removeUTF8BOM( 'boop\ufeff' ); -console.log( str ); -// => 'boop\ufeff' - -str = removeUTF8BOM( 'be\ufeffbop' ); -console.log( str ); -// => 'be\ufeffbop' - -str = removeUTF8BOM( 'foobar' ); -console.log( str ); -// => 'foobar' diff --git a/remove-utf8-bom/lib/index.js b/remove-utf8-bom/lib/index.js deleted file mode 100644 index 939a0077..00000000 --- a/remove-utf8-bom/lib/index.js +++ /dev/null @@ -1,40 +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'; - -/** -* Remove a UTF-8 byte order mark (BOM) from the beginning of a string. -* -* @module @stdlib/string/remove-utf8-bom -* -* @example -* var removeUTF8BOM = require( '@stdlib/string/remove-utf8-bom' ); -* -* var str = removeUTF8BOM( '\ufeffbeep' ); -* // returns 'beep' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/remove-utf8-bom/lib/main.js b/remove-utf8-bom/lib/main.js deleted file mode 100644 index 6770fbce..00000000 --- a/remove-utf8-bom/lib/main.js +++ /dev/null @@ -1,67 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); - - -// VARIABLES // - -// '\ufeff' => 1111111011111111 => 0xFEFF => 65279 -var BOM = 65279; - - -// MAIN // - -/** -* Removes a UTF-8 byte order mark (BOM) from the beginning of a string. -* -* ## Notes -* -* - A UTF-8 byte order mark ([BOM][1]) is the byte sequence `0xEF,0xBB,0xBF`. -* - To convert a UTF-8 encoded `Buffer` to a `string`, the `Buffer` must be converted to [UTF-16][2]. The BOM thus gets converted to the single 16-bit code point `'\ufeff'` (UTF-16 BOM). -* -* [1]: https://en.wikipedia.org/wiki/Byte_order_mark#UTF-8 -* [2]: http://es5.github.io/#x4.3.16 -* -* @param {string} str - input string -* @throws {TypeError} must provide a string primitive -* @returns {string} string with BOM removed -* -* @example -* var str = removeUTF8BOM( '\ufeffbeep' ); -* // returns 'beep' -*/ -function removeUTF8BOM( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - if ( str.charCodeAt( 0 ) === BOM ) { - return str.slice( 1 ); - } - return str; -} - - -// EXPORTS // - -module.exports = removeUTF8BOM; diff --git a/remove-utf8-bom/package.json b/remove-utf8-bom/package.json deleted file mode 100644 index b2ba8454..00000000 --- a/remove-utf8-bom/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "@stdlib/string/remove-utf8-bom", - "version": "0.0.0", - "description": "Remove a UTF-8 byte order mark (BOM) from the beginning of a string.", - "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" - } - ], - "bin": { - "remove-utf8-bom": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "byte order mark", - "bom", - "utf8", - "utf-8", - "encoding", - "remove", - "replace", - "strip", - "trim" - ] -} diff --git a/remove-utf8-bom/test/fixtures/stdin_error.js.txt b/remove-utf8-bom/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/remove-utf8-bom/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/remove-utf8-bom/test/test.cli.js b/remove-utf8-bom/test/test.cli.js deleted file mode 100644 index 71762b83..00000000 --- a/remove-utf8-bom/test/test.cli.js +++ /dev/null @@ -1,224 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface removes a UTF-8 byte order mark (BOM) from the beginning of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'\\\\ufeffbeep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var expected; - var cmd; - - cmd = [ - 'printf \'\ufeffbeep\'', - '|', - EXEC_PATH, - fpath - ]; - - expected = 'beep\n'; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), expected, 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/remove-utf8-bom/test/test.js b/remove-utf8-bom/test/test.js deleted file mode 100644 index f5cfbf14..00000000 --- a/remove-utf8-bom/test/test.js +++ /dev/null @@ -1,92 +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 string2buffer = require( '@stdlib/buffer/from-string' ); -var removeUTF8BOM = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof removeUTF8BOM, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string primitive', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - null, - void 0, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - removeUTF8BOM( value ); - }; - } -}); - -tape( 'the function removes a UTF-8 byte order mark (BOM) from the beginning of a string', function test( t ) { - var str; - - str = removeUTF8BOM( '\ufeffbeep' ); - t.strictEqual( str, 'beep', 'returns beep' ); - - str = string2buffer( '\ufeffboop' ).toString(); - str = removeUTF8BOM( str ); - t.strictEqual( str, 'boop', 'returns boop' ); - - t.end(); -}); - -tape( 'the function ignores zero-width non-breaking spaces (Unicode) occurring elsewhere in a string', function test( t ) { - var str; - - str = removeUTF8BOM( 'boop\ufeff' ); - t.strictEqual( str, 'boop\ufeff', 'returns boop\ufeff' ); - - str = removeUTF8BOM( 'be\ufeffbop' ); - t.strictEqual( str, 'be\ufeffbop', 'returns be\ufeffbop' ); - - t.end(); -}); - -tape( 'if a string does not begin with a BOM, the function returns the input string unchanged', function test( t ) { - var str = removeUTF8BOM( 'foobar' ); - t.strictEqual( str, 'foobar', 'returns foobar' ); - t.end(); -}); diff --git a/remove-words/README.md b/remove-words/README.md deleted file mode 100644 index 452ec521..00000000 --- a/remove-words/README.md +++ /dev/null @@ -1,154 +0,0 @@ - - -# Remove Words - -> Remove a list of words from a string. - -
- -
- - - -
- -## Usage - -```javascript -var removeWords = require( '@stdlib/string/remove-words' ); -``` - -#### removeWords( str, words\[, ignoreCase] ) - -Removes all occurrences of the given `words` from a `string`. - -```javascript -var str = 'beep boop Foo bar'; -var out = removeWords( str, [ 'boop', 'foo' ] ); -// returns 'beep Foo bar' -``` - -By default, words are removed from an input `string` in case of an exact match. To perform a case-insensitive replace operation, set `ignoreCase` to `true`. - -```javascript -var str = 'beep boop Foo bar'; -var out = removeWords( str, [ 'boop', 'foo' ], true ); -// returns 'beep bar' -``` - -
- - - -
- -## Examples - - - -```javascript -var removeWords = require( '@stdlib/string/remove-words' ); -var stopwords = require( '@stdlib/datasets/stopwords-en' ); -var inmap = require( '@stdlib/utils/inmap' ); -var spam = require( '@stdlib/datasets/spam-assassin' ); - -var corpus = spam(); -var words = stopwords(); - -function remove( mail, idx ) { - var newText = removeWords( mail.text, words ); - console.log( 'After removing stop words, email %d contains %d characters. Originally, it contained %d.', idx, newText.length, mail.text.length ); - mail.text = newText; -} - -inmap( corpus, remove ); -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: remove-words [options] [] --words= - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --words w1,w2,... Comma-separated list of words. - --ignore-case Perform case-insensitive replace operation. -``` - -
- - - -
- -### Examples - -```bash -$ remove-words 'beep! boop!!!' --words='beep,boop' -! !!! -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep! boop!!!' | remove-words --words='BEEP,BOOP' --ignore-case -! !!! -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/remove-words/benchmark/benchmark.js b/remove-words/benchmark/benchmark.js deleted file mode 100644 index 3e7300a7..00000000 --- a/remove-words/benchmark/benchmark.js +++ /dev/null @@ -1,122 +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' ); -var stopwords = require( '@stdlib/datasets/stopwords-en' ); -var uppercase = require( './../../uppercase' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var replace = require( './../../replace' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var removeWords = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var words; - var str; - var out; - var i; - - words = stopwords(); - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = 'The word '+words[ i % words.length ]+' should be removed from this string'; - out = removeWords( str, words ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::case_insensitive', pkg ), function benchmark( b ) { - var upper; - var words; - var str; - var out; - var i; - - words = stopwords(); - upper = []; - for ( i = 0; i < words.length; i++ ) { - upper.push( uppercase( words[ i ] ) ); - } - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = 'The word '+words[ i % words.length ]+' should be removed from this string'; - out = removeWords( str, upper, true ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::regexp', pkg ), function benchmark( b ) { - var words; - var str; - var out; - var i; - - words = stopwords(); - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = 'The word '+words[ i % words.length ]+' should be removed from this string'; - out = removeWordsRegexp( str, words ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function removeWordsRegexp( str, words ) { - var reString; - var wordRE; - var i; - reString = ''; - for ( i = 0; i < words.length; i++ ) { - reString += '\\b'+words[i]+'\\b'; - if ( i < words.length-1 ) { - reString += '|'; - } - } - wordRE = new RegExp( reString, 'g' ); - return replace( str, wordRE, '' ); - } -}); diff --git a/remove-words/bin/cli b/remove-words/bin/cli deleted file mode 100755 index 46821785..00000000 --- a/remove-words/bin/cli +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var removeWords = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var words; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Extract the words to remove: - words = flags.words.split( ',' ); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - return stdin( onRead ); - } - console.log( removeWords( args[ 0 ], words, flags[ 'ignore-case' ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - if ( error ) { - return cli.error( error ); - } - console.log( removeWords( data.toString(), words, flags[ 'ignore-case' ] ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/remove-words/docs/repl.txt b/remove-words/docs/repl.txt deleted file mode 100644 index 02f2d473..00000000 --- a/remove-words/docs/repl.txt +++ /dev/null @@ -1,33 +0,0 @@ - -{{alias}}( str, words[, ignoreCase] ) - Removes all occurrences of the given words from a `string`. - - Parameters - ---------- - str: string - Input string. - - words: Array - Array of words to be removed. - - ignoreCase: boolean (optional) - Boolean indicating whether to perform a case-insensitive operation. - Default: `false`. - - Returns - ------- - out: string - String with words removed. - - Examples - -------- - > var out = {{alias}}( 'beep boop Foo bar', [ 'boop', 'foo' ] ) - 'beep Foo bar' - - // Case-insensitive: - > out = {{alias}}( 'beep boop Foo bar', [ 'boop', 'foo' ], true ) - 'beep bar' - - See Also - -------- - diff --git a/remove-words/docs/types/index.d.ts b/remove-words/docs/types/index.d.ts deleted file mode 100644 index 1e0c16be..00000000 --- a/remove-words/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Removes a list of words from a string. -* -* @param str - input string -* @param words - array of words to be removed -* @param ignoreCase - boolean indicating whether to perform a case-insensitive operation (default: false) -* @returns output string -* -* @example -* var str = 'beep boop Foo bar'; -* var out = removeWords( str, [ 'boop', 'foo' ] ); -* // returns 'beep Foo bar' -* -* @example -* var str = 'beep boop Foo bar'; -* var out = removeWords( str, [ 'boop', 'foo' ], true ); -* // returns 'beep bar' -*/ -declare function removeWords( str: string, words: Array, ignoreCase?: boolean ): string; - - -// EXPORTS // - -export = removeWords; diff --git a/remove-words/docs/types/test.ts b/remove-words/docs/types/test.ts deleted file mode 100644 index 7a0cb6c6..00000000 --- a/remove-words/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import removeWords = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - removeWords( 'beep boop Foo bar', [ 'foo', 'bar' ] ); // $ExpectType string - removeWords( 'beep boop Foo bar', [ 'foo', 'bar' ], true ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string as its first argument... -{ - const words = [ 'foo', 'bar' ]; - removeWords( true, words ); // $ExpectError - removeWords( false, words ); // $ExpectError - removeWords( null, words ); // $ExpectError - removeWords( undefined, words ); // $ExpectError - removeWords( 5, words ); // $ExpectError - removeWords( [], words, false ); // $ExpectError - removeWords( {}, words, true ); // $ExpectError - removeWords( ( x: number ): number => x, words, false ); // $ExpectError -} - -// The compiler throws an error if the function is provided a value other than an array of strings as its second argument... -{ - removeWords( 'beep boop Foo bar', 'abc' ); // $ExpectError - removeWords( 'beep boop Foo bar', 123 ); // $ExpectError - removeWords( 'beep boop Foo bar', true ); // $ExpectError - removeWords( 'beep boop Foo bar', false, true ); // $ExpectError - removeWords( 'beep boop Foo bar', {}, false ); // $ExpectError - removeWords( 'beep boop Foo bar', ( x: number ): number => x, true ); // $ExpectError -} - -// The compiler throws an error if the function is provided a value other than a boolean as its third argument... -{ - const words = [ 'foo', 'bar' ]; - removeWords( 'beep boop Foo bar', words, 'abc' ); // $ExpectError - removeWords( 'beep boop Foo bar', words, 123 ); // $ExpectError - removeWords( 'beep boop Foo bar', words, [] ); // $ExpectError - removeWords( 'beep boop Foo bar', words, {} ); // $ExpectError - removeWords( 'beep boop Foo bar', words, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an insufficient number of arguments... -{ - removeWords(); // $ExpectError - removeWords( 'beep boop Foo bar' ); // $ExpectError -} diff --git a/remove-words/docs/usage.txt b/remove-words/docs/usage.txt deleted file mode 100644 index 2870ad8a..00000000 --- a/remove-words/docs/usage.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Usage: remove-words [options] [] --words= - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --words w1,w2,.. Comma-separated list of words. - --ignore-case Perform case-insensitive replace operation. diff --git a/remove-words/etc/cli_opts.json b/remove-words/etc/cli_opts.json deleted file mode 100644 index d72c9bcc..00000000 --- a/remove-words/etc/cli_opts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "boolean": [ - "help", - "version", - "ignore-case" - ], - "string": [ - "words" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/remove-words/examples/index.js b/remove-words/examples/index.js deleted file mode 100644 index 610dd074..00000000 --- a/remove-words/examples/index.js +++ /dev/null @@ -1,35 +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'; - -var stopwords = require( '@stdlib/datasets/stopwords-en' ); -var inmap = require( '@stdlib/utils/inmap' ); -var spam = require( '@stdlib/datasets/spam-assassin' ); -var removeWords = require( './../lib' ); - -var corpus = spam(); -var words = stopwords(); - -function remove( mail, idx ) { - var newText = removeWords( mail.text, words ); - console.log( 'After removing stop words, email %d contains %d characters. Originally, it contained %d.', idx, newText.length, mail.text.length ); - mail.text = newText; -} - -inmap( corpus, remove ); diff --git a/remove-words/lib/index.js b/remove-words/lib/index.js deleted file mode 100644 index 6919137d..00000000 --- a/remove-words/lib/index.js +++ /dev/null @@ -1,47 +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'; - -/** -* Remove a list of words from a string. -* -* @module @stdlib/string/remove-words -* -* @example -* var removeWords = require( '@stdlib/string/remove-words' ); -* -* var str = 'beep boop Foo bar'; -* var words = [ 'boop', 'foo' ]; -* -* var out = removeWords( str, words ); -* // returns 'beep Foo bar' -* -* // Case-insensitive: -* out = removeWords( str, words, true ) -* //returns 'beep bar' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/remove-words/lib/main.js b/remove-words/lib/main.js deleted file mode 100644 index 2458edd6..00000000 --- a/remove-words/lib/main.js +++ /dev/null @@ -1,118 +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 isStringArray = require( '@stdlib/assert/is-string-array' ); -var uppercase = require( './../../uppercase' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var tokenize = require( '@stdlib/nlp/tokenize' ); -var format = require( './../../format' ); - - -// MAIN // - -/** -* Removes a list of words from a string. -* -* @param {string} str - input string -* @param {StringArray} words - array of words to be removed -* @param {boolean} [ignoreCase=false] - boolean indicating whether to perform a case-insensitive operation -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be an array of strings -* @throws {TypeError} third argument must be a boolean -* @returns {string} output string -* -* @example -* var str = 'beep boop Foo bar'; -* var out = removeWords( str, [ 'boop', 'foo' ] ); -* // returns 'beep Foo bar' -* -* @example -* var str = 'beep boop Foo bar'; -* var out = removeWords( str, [ 'boop', 'foo' ], true ); -* // returns 'beep bar' -*/ -function removeWords( str, words, ignoreCase ) { - var tokens; - var token; - var list; - var flg; - var out; - var N; - var i; - var j; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isStringArray( words ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be an array of strings. Value: `%s`.', words ) ); - } - if ( arguments.length > 2 ) { - if ( !isBoolean( ignoreCase ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be a boolean. Value: `%s`.', ignoreCase ) ); - } - } - tokens = tokenize( str, true ); - N = words.length; - out = []; - if ( ignoreCase ) { - list = words.slice(); - for ( i = 0; i < N; i++ ) { - list[ i ] = uppercase( list[ i ] ); - } - for ( i = 0; i < tokens.length; i++ ) { - flg = true; - token = uppercase( tokens[ i ] ); - for ( j = 0; j < N; j++ ) { - if ( list[ j ] === token ) { - flg = false; - break; - } - } - if ( flg ) { - out.push( tokens[ i ] ); - } - } - return out.join( '' ); - } - // Case: case-sensitive - for ( i = 0; i < tokens.length; i++ ) { - token = tokens[ i ]; - flg = true; - for ( j = 0; j < N; j++ ) { - if ( words[ j ] === token ) { - flg = false; - break; - } - } - if ( flg ) { - out.push( token ); - } - } - return out.join( '' ); -} - - -// EXPORTS // - -module.exports = removeWords; diff --git a/remove-words/package.json b/remove-words/package.json deleted file mode 100644 index 2a07b5ab..00000000 --- a/remove-words/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/remove-words", - "version": "0.0.0", - "description": "Remove a list of words from a string.", - "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" - } - ], - "bin": { - "remove-words": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "search", - "remove", - "words", - "replace" - ] -} diff --git a/remove-words/test/fixtures/stdin_error.js.txt b/remove-words/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 6abc7481..00000000 --- a/remove-words/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,34 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; -proc.argv[ 2 ] = '--words=error'; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/remove-words/test/test.cli.js b/remove-words/test/test.cli.js deleted file mode 100644 index e5541b76..00000000 --- a/remove-words/test/test.cli.js +++ /dev/null @@ -1,273 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface removes a list of words from a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'Even though I walk through the valley of the shadow of death, I fear no evil\'; process.argv[ 3 ] = \'--words=death,i,of\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'Even though I walk through the valley the shadow , I fear no evil\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface removes a list of words from a string argument (ignore-case)', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'Even though I walk through the valley of the shadow of death, I fear no evil\'; process.argv[ 3 ] = \'--words=death,i,of\'; process.argv[ 4 ] = \'--ignore-case\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'Even though walk through the valley the shadow , fear no evil\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var expected; - var cmd; - - cmd = [ - 'printf \'Hello, Sir!\n"Too little, too late", he said to me...\'', - '|', - EXEC_PATH, - fpath, - '--words=little,too,late' - ]; - - expected = 'Hello, Sir!\n"Too , ", he said to me...\n'; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), expected, 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream (ignore-case)', opts, function test( t ) { - var expected; - var cmd; - - cmd = [ - 'printf \'Hello, Sir!\n"Too little, too late", he said to me...\'', - '|', - EXEC_PATH, - fpath, - '--words=little,too,late', - '--ignore-case' - ]; - - expected = 'Hello, Sir!\n" , ", he said to me...\n'; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), expected, 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/remove-words/test/test.js b/remove-words/test/test.js deleted file mode 100644 index 97015785..00000000 --- a/remove-words/test/test.js +++ /dev/null @@ -1,173 +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 removeWords = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof removeWords, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if the first argument is not a string primitive, the function throws an error', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - removeWords( value, [ 'abc' ] ); - }; - } -}); - -tape( 'if the second argument is not an array of strings, the function throws an error', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - removeWords( 'Beep boop', value ); - }; - } -}); - -tape( 'if provided a third argument that is not a boolean primitive, the function throws an error', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 5, - null, - void 0, - NaN, - [], - {}, - 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() { - removeWords( 'Beep boop', [ 'boop' ], value ); - }; - } -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( removeWords( '', [ 'beep' ] ), '', 'returns empty string' ); - t.end(); -}); - -tape( 'the function removes a list of words from a string (case-sensitive)', function test( t ) { - var expected; - var words; - var str; - var out; - - str = 'A noble craft, but somehow a most melancholy! All noble things are touched with that.'; - words = [ 'all', 'noble' ]; - out = removeWords( str, words ); - expected = 'A craft, but somehow a most melancholy! All things are touched with that.'; - t.strictEqual( out, expected, 'removes words' ); - - str = 'Even though I walk through the valley of the shadow of death, I fear no evil'; - words = [ 'death', 'i', 'of' ]; - out = removeWords( str, words ); - expected = 'Even though I walk through the valley the shadow , I fear no evil'; - t.strictEqual( out, expected, 'removes words' ); - - str = 'You, you will see no more the pain I suffered, all the pain I caused!'; - words = [ 'pain', 'you' ]; - out = removeWords( str, words ); - expected = 'You, will see no more the I suffered, all the I caused!'; - t.strictEqual( out, expected, 'removes words' ); - - t.end(); -}); - -tape( 'the function removes a list of words from a string (case-insensitive)', function test( t ) { - var expected; - var words; - var str; - var out; - - str = 'A noble craft, but somehow a most melancholy! All noble things are touched with that.'; - words = [ 'all', 'noble' ]; - out = removeWords( str, words, true ); - expected = 'A craft, but somehow a most melancholy! things are touched with that.'; - t.strictEqual( out, expected, 'removes words' ); - - str = 'Even though I walk through the valley of the shadow of death, I fear no evil'; - words = [ 'death', 'i', 'of' ]; - out = removeWords( str, words, true ); - expected = 'Even though walk through the valley the shadow , fear no evil'; - t.strictEqual( out, expected, 'removes words' ); - - str = 'You, you will see no more the pain I suffered, all the pain I caused!'; - words = [ 'pain', 'you' ]; - out = removeWords( str, words, true ); - expected = ', will see no more the I suffered, all the I caused!'; - t.strictEqual( out, expected, 'removes words' ); - t.end(); -}); diff --git a/repeat/README.md b/repeat/README.md deleted file mode 100644 index 0a6263c9..00000000 --- a/repeat/README.md +++ /dev/null @@ -1,180 +0,0 @@ - - -# repeat - -> Repeat a string a specified number of times and return the concatenated result. - -
- -## Usage - -```javascript -var repeat = require( '@stdlib/string/repeat' ); -``` - -#### repeat( str, n ) - -Repeats a string `n` times and returns the concatenated result. - -```javascript -var str = repeat( 'a', 5 ); -// returns 'aaaaa' - -str = repeat( '', 100 ); -// returns '' - -str = repeat( 'beep', 0 ); -// returns '' -``` - -
- - - -
- -## Examples - - - -```javascript -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var repeat = require( '@stdlib/string/repeat' ); - -var i; -for ( i = 0; i < 100; i++ ) { - console.log( repeat( 'beep', discreteUniform( 0, 3 ) ) ); -} -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: repstr [options] [] --n - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n repeats Number of repetitions. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nboop' | repstr --n 3 --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nboop' | repstr --n 3 --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ repstr beep --n 5 -beepbeepbeepbeepbeep -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n $'ab' | repstr --n 3 -ababab -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n $'beep\tboop' | repstr --n 3 --split '\t' -beepbeepbeep -boopboopboop -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/repeat/benchmark/benchmark.builtin.js b/repeat/benchmark/benchmark.builtin.js deleted file mode 100644 index b1c8154b..00000000 --- a/repeat/benchmark/benchmark.builtin.js +++ /dev/null @@ -1,108 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var repeat = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': typeof String.prototype.repeat !== 'function' -}; - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} n - number of repeats -* @returns {Function} benchmark function -*/ -function createBenchmark( n ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep', - 'boop', - 'baap', - 'biip' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = repeat( values[ i%values.length ], n ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var n; - var f; - var i; - - min = 1; // 10*min - max = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - n = 10 * i; - f = createBenchmark( n ); - bench( format( '%s::builtin:n=%d', pkg, n ), opts, f ); - } -} - -main(); diff --git a/repeat/benchmark/benchmark.js b/repeat/benchmark/benchmark.js deleted file mode 100644 index 66487f37..00000000 --- a/repeat/benchmark/benchmark.js +++ /dev/null @@ -1,101 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var repeat = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} n - number of repeats -* @returns {Function} benchmark function -*/ -function createBenchmark( n ) { - return benchmark; - - /** - * Benchmark function. - * - * @private - * @param {Benchmark} b - benchmark instance - */ - function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep', - 'boop', - 'baap', - 'biip' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = repeat( values[ i%values.length ], n ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var n; - var f; - var i; - - min = 1; // 10*min - max = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - n = 10 * i; - f = createBenchmark( n ); - bench( format( '%s:n=%d', pkg, n ), f ); - } -} - -main(); diff --git a/repeat/bin/cli b/repeat/bin/cli deleted file mode 100755 index 9ff28a8f..00000000 --- a/repeat/bin/cli +++ /dev/null @@ -1,112 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var repeat = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - var n; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Determine the number of times to repeat: - n = parseInt( flags.n, 10 ); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( repeat( args[ 0 ], n ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( repeat( lines[ i ], n ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/repeat/docs/repl.txt b/repeat/docs/repl.txt deleted file mode 100644 index 188080f1..00000000 --- a/repeat/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n ) - Repeats a string `n` times and returns the concatenated result. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of repetitions. - - Returns - ------- - out: string - Repeated string. - - Examples - -------- - > var out = {{alias}}( 'a', 5 ) - 'aaaaa' - > out = {{alias}}( '', 100 ) - '' - > out = {{alias}}( 'beep', 0 ) - '' - - See Also - -------- - diff --git a/repeat/docs/types/index.d.ts b/repeat/docs/types/index.d.ts deleted file mode 100644 index 15f033f7..00000000 --- a/repeat/docs/types/index.d.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Repeats a string `n` times and returns the concatenated result. -* -* @param str - string to repeat -* @param n - number of times to repeat the string -* @returns repeated string -* -* @example -* var str = repeat( 'a', 5 ); -* // returns 'aaaaa' -* -* @example -* var str = repeat( '', 100 ); -* // returns '' -* -* @example -* var str = repeat( 'beep', 0 ); -* // returns '' -*/ -declare function repeat( str: string, n: number ): string; - - -// EXPORTS // - -export = repeat; diff --git a/repeat/docs/types/test.ts b/repeat/docs/types/test.ts deleted file mode 100644 index b3bd0419..00000000 --- a/repeat/docs/types/test.ts +++ /dev/null @@ -1,57 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import repeat = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - repeat( 'a', 2 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided values other than a string and a number... -{ - repeat( true, 3 ); // $ExpectError - repeat( false, 2 ); // $ExpectError - repeat( 3, 1 ); // $ExpectError - repeat( [], 1 ); // $ExpectError - repeat( {}, 2 ); // $ExpectError - repeat( ( x: number ): number => x, 2 ); // $ExpectError - - repeat( 'a', true ); // $ExpectError - repeat( 'a', false ); // $ExpectError - repeat( 'a', '5' ); // $ExpectError - repeat( 'a', [] ); // $ExpectError - repeat( 'a', {} ); // $ExpectError - repeat( 'a', ( x: number ): number => x ); // $ExpectError - - repeat( [], true ); // $ExpectError - repeat( {}, false ); // $ExpectError - repeat( false, '5' ); // $ExpectError - repeat( {}, [] ); // $ExpectError - repeat( '5', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - repeat(); // $ExpectError - repeat( 3 ); // $ExpectError - repeat( 'abc' ); // $ExpectError -} diff --git a/repeat/docs/usage.txt b/repeat/docs/usage.txt deleted file mode 100644 index 411a8594..00000000 --- a/repeat/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: repstr [options] --n [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n repeats Number of repetitions. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - diff --git a/repeat/etc/cli_opts.json b/repeat/etc/cli_opts.json deleted file mode 100644 index 5d6ecc98..00000000 --- a/repeat/etc/cli_opts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "string": [ - "n", - "split" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/repeat/examples/index.js b/repeat/examples/index.js deleted file mode 100644 index 07c6bf4d..00000000 --- a/repeat/examples/index.js +++ /dev/null @@ -1,27 +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'; - -var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ); -var repeat = require( './../lib' ); - -var i; -for ( i = 0; i < 100; i++ ) { - console.log( repeat( 'beep', discreteUniform( 0, 3 ) ) ); -} diff --git a/repeat/lib/index.js b/repeat/lib/index.js deleted file mode 100644 index 598bfc2d..00000000 --- a/repeat/lib/index.js +++ /dev/null @@ -1,46 +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'; - -/** -* Repeat a string a specified number of times and return the concatenated result. -* -* @module @stdlib/string/repeat -* -* @example -* var repeat = require( '@stdlib/string/repeat' ); -* -* var str = repeat( 'a', 5 ); -* // returns 'aaaaa' -* -* str = repeat( '', 100 ); -* // returns '' -* -* str = repeat( 'beep', 0 ); -* // returns '' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/repeat/lib/main.js b/repeat/lib/main.js deleted file mode 100644 index 7b592280..00000000 --- a/repeat/lib/main.js +++ /dev/null @@ -1,66 +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 isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/repeat' ); - - -// MAIN // - -/** -* Repeats a string a specified number of times and returns the concatenated result. -* -* @param {string} str - string to repeat -* @param {NonNegativeInteger} n - number of times to repeat the string -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {RangeError} output string length must not exceed maximum allowed string length -* @returns {string} repeated string -* -* @example -* var str = repeat( 'a', 5 ); -* // returns 'aaaaa' -* -* @example -* var str = repeat( '', 100 ); -* // returns '' -* -* @example -* var str = repeat( 'beep', 0 ); -* // returns '' -*/ -function repeat( str, n ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isNonNegativeInteger( n ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', n ) ); - } - return base( str, n ); -} - - -// EXPORTS // - -module.exports = repeat; diff --git a/repeat/package.json b/repeat/package.json deleted file mode 100644 index 682b9421..00000000 --- a/repeat/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "@stdlib/string/repeat", - "version": "0.0.0", - "description": "Repeat a string a specified number of times and return the concatenated result.", - "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" - } - ], - "bin": { - "repstr": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "repeat", - "string", - "str", - "rep", - "tile", - "replicate", - "concatenate", - "concat", - "copy", - "repstr", - "cli" - ] -} diff --git a/repeat/test/fixtures/stdin_error.js.txt b/repeat/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/repeat/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/repeat/test/test.cli.js b/repeat/test/test.cli.js deleted file mode 100644 index b02d911f..00000000 --- a/repeat/test/test.cli.js +++ /dev/null @@ -1,268 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var replace = require( './../../replace' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints an input string repeated a specified number of times', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--n=4\'; process.argv[ 3 ] = \'world\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'worldworldworldworld\n', true, 'prints expected value to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop"', - '|', - EXEC_PATH, - fpath, - '--n=3' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beepbeepbeep\nboopboopboop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--n=3', - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beepbeepbeep\nboopboopboop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--n=3', - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beepbeepbeep\nboopboopboop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/repeat/test/test.js b/repeat/test/test.js deleted file mode 100644 index ffb3a097..00000000 --- a/repeat/test/test.js +++ /dev/null @@ -1,119 +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 repeat = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof repeat, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if the first argument is not a string, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - 5, - true, - false, - 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() { - repeat( value, 10 ); - }; - } -}); - -tape( 'if the second argument is not a nonnegative integer, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - '5', - 3.14, - -5, - true, - false, - 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() { - repeat( 'beep', value ); - }; - } -}); - -tape( 'if the output string will exceed the maximum allowed string length, the function will throw an error', function test( t ) { - t.throws( foo, RangeError, 'throws RangeError' ); - t.end(); - function foo() { - repeat( 'beep', 1e300 ); - } -}); - -tape( 'the function repeats an input string a specified number of times', function test( t ) { - var str; - - str = repeat( 'a', 5 ); - t.strictEqual( str, 'aaaaa', 'repeated 5 times' ); - - str = repeat( 'beep', 2 ); - t.strictEqual( str, 'beepbeep', 'repeated 2 times' ); - - t.end(); -}); - -tape( 'if provided an empty string, the function returns an empty string', function test( t ) { - t.strictEqual( repeat( '', 100 ), '', 'returns an empty string' ); - t.end(); -}); - -tape( 'if repeat number is 0, the function returns an empty string', function test( t ) { - t.strictEqual( repeat( 'a', 0 ), '', 'returns empty string' ); - t.end(); -}); diff --git a/replace-before/README.md b/replace-before/README.md deleted file mode 100644 index aaa8b395..00000000 --- a/replace-before/README.md +++ /dev/null @@ -1,213 +0,0 @@ - - -# replaceBefore - -> Replace the substring before the first occurrence of a specified search string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var replaceBefore = require( '@stdlib/string/replace-before' ); -``` - -#### replaceBefore( str, search, replacement ) - -Replaces the substring before the first occurrence of a specified search string. - -```javascript -var out = replaceBefore( 'beep boop', ' ', 'loop' ); -// returns 'loop boop' - -out = replaceBefore( 'beep boop', 'o', 'bar' ); -// returns 'baroop' -``` - -
- - - - - -
- -## Notes - -- If a search string is not present in a provided string, the function returns the provided string unchanged. -- If a search string is an empty string, the function returns the provided string unchanged. - -
- - - - - -
- -## Examples - - - -```javascript -var replaceBefore = require( '@stdlib/string/replace-before' ); - -var out = replaceBefore( 'beep boop', 'p', 'see' ); -// returns 'seep boop' - -out = replaceBefore( 'Hello World!', 'xyz', 'foo' ); -// returns 'Hello World!' - -out = replaceBefore( 'Hello World!', '', 'foo' ); -// returns 'Hello World!' - -out = replaceBefore( '', 'xyz', 'foo' ); -// returns '' -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: replace-before [options] --search= --replacement= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --replacement string Replacement string. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'foo\nbar\nbaz' | replace-before --search a --replacement b --split /\r?\n/ - - # Escaped... - $ echo -n $'foo\nbar\nbaz' | replace-before --search a --replacement b --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - - - -
- -### Examples - -```bash -$ replace-before abcdefg --search d --replacement pqr -pqrdefg -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n $'beep\nboop' | replace-before --search p --replacement see -seep -seep -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tboop' | replace-before --search p --replacement see --split '\t' -seep -seep -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/replace-before/benchmark/benchmark.js b/replace-before/benchmark/benchmark.js deleted file mode 100644 index 8076db07..00000000 --- a/replace-before/benchmark/benchmark.js +++ /dev/null @@ -1,58 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var replaceBefore = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'foo', - 'bar', - 'beep', - 'boop' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = replaceBefore( str, '.', values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/replace-before/bin/cli b/replace-before/bin/cli deleted file mode 100755 index fa280268..00000000 --- a/replace-before/bin/cli +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var replaceBefore = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var replacement; - var search; - var split; - var flags; - var args; - var cli; - var str; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - if ( flags.search ) { - search = flags.search; - } else { - search = ''; - } - if ( flags.replacement ) { - replacement = flags.replacement; - } else { - replacement = ''; - } - // Get any provided command-line arguments: - args = cli.args(); - if ( args.length ) { - str = args[ 0 ]; - } else { - // Treat an empty value as an empty string: - str = ''; - } - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( replaceBefore( str, search, replacement ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( replaceBefore( lines[ i ], search, replacement ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/replace-before/docs/repl.txt b/replace-before/docs/repl.txt deleted file mode 100644 index ad2c55e5..00000000 --- a/replace-before/docs/repl.txt +++ /dev/null @@ -1,32 +0,0 @@ - -{{alias}}( str, search, replacement ) - Replaces the substring before the first occurrence of a specified search - string. - - Parameters - ---------- - str: string - Input string. - - search: string - Search string. - - replacement: string - Replacement string. - - Returns - ------- - out: string - Output string. - - Examples - -------- - > var str = 'beep boop'; - > var out = {{alias}}( str, ' ', 'foo' ) - 'foo boop' - > out = {{alias}}( str, 'o', 'foo' ) - 'foooop' - - See Also - -------- - diff --git a/replace-before/docs/types/index.d.ts b/replace-before/docs/types/index.d.ts deleted file mode 100644 index 56f05acd..00000000 --- a/replace-before/docs/types/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Replaces the substring before the first occurrence of a specified search string. -* -* @param str - input string -* @param search - search string -* @param replacement - replacement string -* @returns output string -* -* @example -* var out = replaceBefore( 'beep boop', ' ', 'foo' ); -* // returns 'foo boop' -* -* @example -* var out = replaceBefore( 'beep boop', 'p', 'foo' ); -* // returns 'foop boop' -* -* @example -* var out = replaceBefore( 'Hello World!', '', 'foo' ); -* // returns 'Hello World!' -* -* @example -* var out = replaceBefore( 'Hello World!', 'xyz', 'foo' ); -* // returns 'Hello World!' -*/ -declare function replaceBefore( str: string, search: string, replacement: string ): string; - - -// EXPORTS // - -export = replaceBefore; diff --git a/replace-before/docs/types/test.ts b/replace-before/docs/types/test.ts deleted file mode 100644 index f935b62d..00000000 --- a/replace-before/docs/types/test.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import replaceBefore = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - replaceBefore( 'beep boop', ' ', 'foo' ); // $ExpectType string - replaceBefore( 'beep boop', 'xyz', 'foo' ); // $ExpectType string - replaceBefore( 'beep boop', '', 'foo' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - replaceBefore( true, 'd', 'foo' ); // $ExpectError - replaceBefore( false, 'd' , 'foo' ); // $ExpectError - replaceBefore( 3, 'd' , 'foo' ); // $ExpectError - replaceBefore( [], 'd' , 'foo' ); // $ExpectError - replaceBefore( {}, 'd' , 'foo' ); // $ExpectError - replaceBefore( ( x: number ): number => x, 'd', 'foo' ); // $ExpectError - - replaceBefore( 'abc', true, 'foo' ); // $ExpectError - replaceBefore( 'abc', false, 'foo' ); // $ExpectError - replaceBefore( 'abc', 5 , 'foo' ); // $ExpectError - replaceBefore( 'abc', [], 'foo' ); // $ExpectError - replaceBefore( 'abc', {} , 'foo' ); // $ExpectError - replaceBefore( 'abc', ( x: number ): number => x , 'foo' ); // $ExpectError - - replaceBefore( 'abc', 'd', true ); // $ExpectError - replaceBefore( 'abc', 'd', false ); // $ExpectError - replaceBefore( 'abc', 'd', 5 ); // $ExpectError - replaceBefore( 'abc', 'd', [] ); // $ExpectError - replaceBefore( 'abc', 'd', {} ); // $ExpectError - replaceBefore( 'abc', 'd', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - replaceBefore(); // $ExpectError - replaceBefore( 'abc' ); // $ExpectError - replaceBefore( 'abc', 'd' ); // $ExpectError -} diff --git a/replace-before/docs/usage.txt b/replace-before/docs/usage.txt deleted file mode 100644 index 80402f35..00000000 --- a/replace-before/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: replace-before [options] --search= --replacement= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --replacement string Replacement string. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/replace-before/etc/cli_opts.json b/replace-before/etc/cli_opts.json deleted file mode 100644 index 79ed61f6..00000000 --- a/replace-before/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "string": [ - "replacement", - "search", - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/replace-before/examples/index.js b/replace-before/examples/index.js deleted file mode 100644 index dad2af84..00000000 --- a/replace-before/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 replaceBefore = require( './../lib' ); - -var out = replaceBefore( 'beep boop', 'p', 'see' ); -console.log( out ); -// => 'seep boop' - -out = replaceBefore( 'Hello World!', 'xyz', 'foo' ); -console.log( out ); -// => 'Hello World!' - -out = replaceBefore( 'Hello World!', '', 'foo' ); -console.log( out ); -// => 'Hello World!' - -out = replaceBefore( '', 'xyz', 'foo' ); -console.log( out ); -// => '' diff --git a/replace-before/lib/index.js b/replace-before/lib/index.js deleted file mode 100644 index f6a1c6cb..00000000 --- a/replace-before/lib/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Replace the substring before the first occurrence of a specified search string. -* -* @module @stdlib/string/replace-before -* -* @example -* var replaceBefore = require( '@stdlib/string/replace-before' ); -* -* var str = 'beep boop'; -* -* var out = replaceBefore( str, ' ', 'foo' ); -* // returns 'foo boop' -* -* out = replaceBefore( str, 'o', 'bar' ); -* // returns 'baroop' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/replace-before/lib/main.js b/replace-before/lib/main.js deleted file mode 100644 index 44a38e1c..00000000 --- a/replace-before/lib/main.js +++ /dev/null @@ -1,73 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/replace-before' ); - - -// MAIN // - -/** -* Replaces the substring before the first occurrence of a specified search string. -* -* @param {string} str - input string -* @param {string} search - search string -* @param {string} replacement - replacement string -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a string -* @throws {TypeError} third argument must be a string -* @returns {string} output string -* -* @example -* var out = replaceBefore( 'beep boop', ' ', 'foo' ); -* // returns 'foo boop' -* -* @example -* var out = replaceBefore( 'beep boop', 'p', 'foo' ); -* // returns 'foop boop' -* -* @example -* var out = replaceBefore( 'Hello World!', '', 'foo' ); -* // returns 'Hello World!' -* -* @example -* var out = replaceBefore( 'Hello World!', 'xyz', 'foo' ); -* // returns 'Hello World!' -*/ -function replaceBefore( str, search, replacement ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isString( search ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) ); - } - if ( !isString( replacement ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', replacement ) ); - } - return base( str, search, replacement, 0 ); -} - - -// EXPORTS // - -module.exports = replaceBefore; diff --git a/replace-before/package.json b/replace-before/package.json deleted file mode 100644 index a84dc558..00000000 --- a/replace-before/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/replace-before", - "version": "0.0.0", - "description": "Replace the substring before the first occurrence of a specified search string.", - "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" - } - ], - "bin": { - "replace-before": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "replace", - "search", - "substring", - "substr", - "before", - "match" - ] -} diff --git a/replace-before/test/fixtures/stdin_error.js.txt b/replace-before/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 3fc7f8c1..00000000 --- a/replace-before/test/fixtures/stdin_error.js.txt +++ /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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} \ No newline at end of file diff --git a/replace-before/test/test.cli.js b/replace-before/test/test.cli.js deleted file mode 100644 index 8338a5c0..00000000 --- a/replace-before/test/test.cli.js +++ /dev/null @@ -1,271 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var EXEC_PATH = require( '@stdlib/process/exec-path' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface replaces the substring before the first occurrence of a specified search string', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=p\'; process.argv[ 3 ] = \'boopbeep\'; process.argv[ 4 ] = \'--replacement=foo\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'foopbeep\n', true, 'prints expected value to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nboop beep"', - '|', - EXEC_PATH, - fpath, - '--search="e"', - '--replacement="foo"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'fooeep boop\nfooeep\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tboop beep\'', - '|', - EXEC_PATH, - fpath, - '--search="e"', - '--replacement="foo"', - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'fooeep boop\nfooeep\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tboop beep\'', - '|', - EXEC_PATH, - fpath, - '--search="e"', - '--replacement="foo"', - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'fooeep boop\nfooeep\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/replace-before/test/test.js b/replace-before/test/test.js deleted file mode 100644 index bc46f535..00000000 --- a/replace-before/test/test.js +++ /dev/null @@ -1,178 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2023 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 replaceBefore = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof replaceBefore, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string as its first argument', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - replaceBefore( value, 'beep', 'foo' ); - }; - } -}); - -tape( 'the function throws an error if not provided a string as its second argument', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - replaceBefore( 'beep boop', value, 'foo' ); - }; - } -}); - -tape( 'the function throws an error if not provided a string as its third argument', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - replaceBefore( 'beep boop', 'beep', value ); - }; - } -}); - -tape( 'the function replaces the substring before the first occurrence of a specified search string', function test( t ) { - var expected; - var actual; - - actual = replaceBefore( 'beep boop', ' ', 'foo' ); - expected = 'foo boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceBefore( 'beep boop', 'p', 'foo' ); - expected = 'foop boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceBefore( 'Hello, World!', 'o', 'foo' ); - expected = 'fooo, World!'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function replaces the substring before the first occurrence of a specified search string (Unicode characters)', function test( t ) { - var expected; - var actual; - - actual = replaceBefore( 'beep 😀 boop 😀 baz', '😀', 'foo' ); - expected = 'foo😀 boop 😀 baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceBefore( '🤖 Robot army 🤖!', '🤖', 'foo' ); - expected = 'foo🤖 Robot army 🤖!'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceBefore( '🐺 Wolf brothers 🐺', 'o', 'foo' ); - expected = 'fooolf brothers 🐺'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is not found', function test( t ) { - var expected; - var actual; - - actual = replaceBefore( 'beep boop', 'z', 'foo' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = replaceBefore( 'beep boop', 'baz', 'foo' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is the empty string', function test( t ) { - var expected; - var actual; - - actual = replaceBefore( 'beep boop', '', 'foo' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/replace/README.md b/replace/README.md deleted file mode 100644 index 19da4909..00000000 --- a/replace/README.md +++ /dev/null @@ -1,200 +0,0 @@ - - -# replace - -> Replace search occurrences with a replacement string. - -
- -## Usage - -```javascript -var replace = require( '@stdlib/string/replace' ); -``` - -#### replace( str, search, newval ) - -Replaces search occurrences with a replacement string. - -```javascript -var out = replace( 'beep', 'e', 'o' ); -// returns 'boop' -``` - -If provided a function as the [third argument][mdn-string-replace], the function is invoked for each match, and the function's return value is used as the replacement string. - -```javascript -function replacer( match, p1 ) { - return '/' + p1 + '/'; -} -var str = 'Oranges and lemons'; -var out = replace( str, /([^\s]+)/gi, replacer ); -// returns '/Oranges/ /and/ /lemons/' -``` - -
- - - -
- -## Notes - -- The function has one notable difference from [`String.prototype.replace`][mdn-string-replace]. When provided a string as the `search` value, the function replaces **all** occurrences. To remove only the first match, use a regular expression. - - ```javascript - var out = replace( 'beep', /e/, 'o' ); - // returns 'boep' - ``` - -
- - - -
- -## Examples - - - -```javascript -var capitalize = require( '@stdlib/string/capitalize' ); -var replace = require( '@stdlib/string/replace' ); - -var out = replace( 'beep', 'e', 'o' ); -// returns 'boop' - -out = replace( 'Hello World', /world/i, 'Mr. President' ); -// returns 'Hello Mr. President' - -function replacer( match, p1 ) { - return capitalize( p1 ); -} -var str = 'Oranges and lemons say the bells of St. Clement\'s'; -out = replace( str, /([^\s]*)/gi, replacer ); -// returns 'Oranges And Lemons Say The Bells Of St. Clement\'s' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: replace [options] [] --search= --newval= - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --newval string Replacement string. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'foo\nbar' | replace --search='o' --newval='e' --split /\r?\n/ - - # Escaped... - $ echo -n $'foo\nbar' | replace --search='o' --newval='e' --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ replace --search='/[eo]/' --newval=a beep -baap -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'boop' | replace --search='o' --newval='e' -beep -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'boop\tfoo' | replace --search='o' --newval='e' --split '\t' -beep -fee -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/replace/benchmark/benchmark.js b/replace/benchmark/benchmark.js deleted file mode 100644 index ac55a9a6..00000000 --- a/replace/benchmark/benchmark.js +++ /dev/null @@ -1,198 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var replace = require( './../lib' ); - - -// MAIN // - -bench( format( '%s::string', pkg ), function benchmark( b ) { - var values; - var out; - var str; - var i; - - values = [ - 'abc', - 'def', - 'hig' - ]; - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = replace( str, 'be', values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::regexp', pkg ), function benchmark( b ) { - var values; - var out; - var str; - var re; - var i; - - values = [ - 'abc', - 'def', - 'hig' - ]; - str = 'To be, or not to be, that is the question.'; - re = /be/g; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = replace( str, re, values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::replacer', pkg ), function benchmark( b ) { - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = replace( str, 'be', replacer ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function replacer( match, p1 ) { - return '/' + p1 + '/'; - } -}); - -bench( format( '%s::builtin,string', pkg ), function benchmark( b ) { - var values; - var out; - var str; - var i; - - values = [ - 'abc', - 'def', - 'hig' - ]; - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = str.replace( 'be', values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::builtin,regexp', pkg ), function benchmark( b ) { - var values; - var out; - var str; - var re; - var i; - - values = [ - 'abc', - 'def', - 'hig' - ]; - str = 'To be, or not to be, that is the question.'; - re = /be/g; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = str.replace( re, values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::builtin,replacer', pkg ), function benchmark( b ) { - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = str.replace( 'be', replacer ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function replacer( match, p1 ) { - return '/' + p1 + '/'; - } -}); diff --git a/replace/bin/cli b/replace/bin/cli deleted file mode 100755 index 8683f705..00000000 --- a/replace/bin/cli +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var replace = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var search; - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - search = flags.search; - if ( isRegExpString( search ) ) { - search = reFromString( search ); - } - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( replace( args[ 0 ], search, flags.newval ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( replace( lines[ i ], search, flags.newval ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/replace/docs/repl.txt b/replace/docs/repl.txt deleted file mode 100644 index d34f97d2..00000000 --- a/replace/docs/repl.txt +++ /dev/null @@ -1,42 +0,0 @@ - -{{alias}}( str, search, newval ) - Replaces search occurrences with a replacement string. - - When provided a string as the search value, the function replaces *all* - occurrences. To remove only the first match, use a regular expression. - - Parameters - ---------- - str: string - Input string. - - search: string|RegExp - Search expression. - - newval: string|Function - Replacement value or function. - - Returns - ------- - out: string - String containing replacement(s). - - Examples - -------- - // Standard usage: - > var out = {{alias}}( 'beep', 'e', 'o' ) - 'boop' - - // Replacer function: - > function replacer( match, p1 ) { return '/'+p1+'/'; }; - > var str = 'Oranges and lemons'; - > out = {{alias}}( str, /([^\s]+)/gi, replacer ) - '/Oranges/ /and/ /lemons/' - - // Replace only first match: - > out = {{alias}}( 'beep', /e/, 'o' ) - 'boep' - - See Also - -------- - diff --git a/replace/docs/types/index.d.ts b/replace/docs/types/index.d.ts deleted file mode 100644 index 761f4351..00000000 --- a/replace/docs/types/index.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Replaces search occurrences with a replacement string. -* -* ## Notes -* -* - When provided a `string` as the `search` value, the function replaces **all** occurrences. To remove only the first match, use a regular expression. -* -* @param str - input string -* @param search - search expression -* @param newval - replacement value or function -* @returns new string containing replacement(s) -* -* @example -* var str = 'beep'; -* var out = replace( str, 'e', 'o' ); -* // returns 'boop' -* -* @example -* var str = 'Hello World'; -* var out = replace( str, /world/i, 'Mr. President' ); -* // returns 'Hello Mr. President' -* -* @example -* var capitalize = require( '@stdlib/string/capitalize' ); -* -* var str = 'Oranges and lemons say the bells of St. Clement\'s'; -* -* function replacer( match, p1 ) { -* return capitalize( p1 ); -* } -* -* var out = replace( str, /([^\s]*)/gi, replacer); -* // returns 'Oranges And Lemons Say The Bells Of St. Clement\'s' -*/ -declare function replace( str: string, search: string | RegExp, newval: string | Function ): string; - - -// EXPORTS // - -export = replace; diff --git a/replace/docs/types/test.ts b/replace/docs/types/test.ts deleted file mode 100644 index a9c53244..00000000 --- a/replace/docs/types/test.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import replace = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - replace( 'abd', 'd', 'c' ); // $ExpectType string - replace( 'abd', /[a-z]/, '1' ); // $ExpectType string - replace( 'abd', /[a-z]/, (): string => 'z' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - replace( true, 'd', 'a' ); // $ExpectError - replace( false, 'd', 'a' ); // $ExpectError - replace( 3, 'd', 'a' ); // $ExpectError - replace( [], 'd', 'a' ); // $ExpectError - replace( {}, 'd', 'a' ); // $ExpectError - replace( ( x: number ): number => x, 'd', 'a' ); // $ExpectError - - replace( 'abd', true, 'c' ); // $ExpectError - replace( 'abd', false, 'c' ); // $ExpectError - replace( 'abd', 5, 'c' ); // $ExpectError - replace( 'abd', [], 'c' ); // $ExpectError - replace( 'abd', {}, 'c' ); // $ExpectError - replace( 'abd', ( x: number ): number => x, 'c' ); // $ExpectError - - replace( 'abd', 'd', true ); // $ExpectError - replace( 'abd', 'd', false ); // $ExpectError - replace( 'abd', 'd', 5 ); // $ExpectError - replace( 'abd', 'd', [] ); // $ExpectError - replace( 'abd', 'd', {} ); // $ExpectError - replace( 'abd', 'd', /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - replace(); // $ExpectError - replace( 'abc' ); // $ExpectError - replace( 'abc', 'a' ); // $ExpectError -} diff --git a/replace/docs/usage.txt b/replace/docs/usage.txt deleted file mode 100644 index 9e7e21b9..00000000 --- a/replace/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: replace [options] [] --search= --newval= - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --newval string Replacement string. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/replace/etc/cli_opts.json b/replace/etc/cli_opts.json deleted file mode 100644 index 00a4539b..00000000 --- a/replace/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "string": [ - "search", - "newval", - "split" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/replace/examples/index.js b/replace/examples/index.js deleted file mode 100644 index bcdc5bb7..00000000 --- a/replace/examples/index.js +++ /dev/null @@ -1,38 +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'; - -var capitalize = require( './../../capitalize' ); -var replace = require( './../lib' ); - -var out = replace( 'beep', 'e', 'o' ); -console.log( out ); -// => 'boop' - -out = replace( 'Hello World', /world/i, 'Mr. President' ); -console.log( out ); -// => 'Hello Mr. President' - -function replacer( match, p1 ) { - return capitalize( p1 ); -} -var str = 'Oranges and lemons say the bells of St. Clement\'s'; -out = replace( str, /([^\s]*)/gi, replacer ); -console.log( out ); -// => 'Oranges And Lemons Say The Bells Of St. Clement\'s' diff --git a/replace/lib/index.js b/replace/lib/index.js deleted file mode 100644 index 4ff275d5..00000000 --- a/replace/lib/index.js +++ /dev/null @@ -1,45 +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'; - -/** -* Replace search occurrences with a replacement string. -* -* @module @stdlib/string/replace -* -* @example -* var replace = require( '@stdlib/string/replace' ); -* -* var str = 'beep'; -* var out = replace( str, 'e', 'o' ); -* // returns 'boop' -* -* str = 'Hello World'; -* out = replace( str, /world/i, 'Mr. President' ); -* // returns 'Hello Mr. President' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/replace/lib/main.js b/replace/lib/main.js deleted file mode 100644 index 4aee1273..00000000 --- a/replace/lib/main.js +++ /dev/null @@ -1,84 +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 rescape = require( '@stdlib/utils/escape-regexp-string' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isRegExp = require( '@stdlib/assert/is-regexp' ); -var format = require( './../../format' ); -var base = require( './../../base/replace' ); - - -// MAIN // - -/** -* Replaces search occurrences with a replacement string. -* -* @param {string} str - input string -* @param {(string|RegExp)} search - search expression -* @param {(string|Function)} newval - replacement value or function -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a string or regular expression -* @throws {TypeError} third argument must be a string or function -* @returns {string} new string containing replacement(s) -* -* @example -* var str = 'beep'; -* var out = replace( str, 'e', 'o' ); -* // returns 'boop' -* -* @example -* var str = 'Hello World'; -* var out = replace( str, /world/i, 'Mr. President' ); -* // returns 'Hello Mr. President' -* -* @example -* var capitalize = require( '@stdlib/string/capitalize' ); -* -* var str = 'Oranges and lemons say the bells of St. Clement\'s'; -* -* function replacer( match, p1 ) { -* return capitalize( p1 ); -* } -* -* var out = replace( str, /([^\s]*)/gi, replacer ); -* // returns 'Oranges And Lemons Say The Bells Of St. Clement\'s' -*/ -function replace( str, search, newval ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( isString( search ) ) { - search = new RegExp( rescape( search ), 'g' ); - } else if ( !isRegExp( search ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a string or regular expression. Value: `%s`.', search ) ); - } - if ( !isString( newval ) && !isFunction( newval ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be a string or replacement function. Value: `%s`.', newval ) ); - } - return base( str, search, newval ); -} - - -// EXPORTS // - -module.exports = replace; diff --git a/replace/package.json b/replace/package.json deleted file mode 100644 index dcc53dc9..00000000 --- a/replace/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@stdlib/string/replace", - "version": "0.0.0", - "description": "Replace search occurrences with a replacement string.", - "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" - } - ], - "bin": { - "replace": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "search", - "replace", - "regex", - "regular expression", - "regexp", - "regular", - "expression" - ] -} diff --git a/replace/test/fixtures/stdin_error.js.txt b/replace/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/replace/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/replace/test/test.cli.js b/replace/test/test.cli.js deleted file mode 100644 index d73df89f..00000000 --- a/replace/test/test.cli.js +++ /dev/null @@ -1,293 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var replace = require( './../../replace' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints a string where all occurrences of a string search value are replaced', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=e\'; process.argv[ 3 ] = \'--newval=o\'; process.argv[ 4 ] = \'beep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'boop\n', true, 'prints expected value to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints a string where all matches of a regular expression are replaced', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--newval=x\'; process.argv[ 3 ] = \'--search="/[eaoui]/g"\'; process.argv[ 4 ] = \'Hello World!\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'Hxllx Wxrld!\n', true, 'prints expected value to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "b123p\nb234"', - '|', - EXEC_PATH, - fpath, - '--search=/[0-9]/g', - '--newval=""' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'bp\nb\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'a11y\ti18n\ta16z\'', - '|', - EXEC_PATH, - fpath, - '--search=/[0-9]/g', - '--newval=""', - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'ay\nin\naz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'a11y\ti18n\ta16z\'', - '|', - EXEC_PATH, - fpath, - '--search=/[0-9]/g', - '--newval=""', - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'ay\nin\naz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/replace/test/test.js b/replace/test/test.js deleted file mode 100644 index b3f2a954..00000000 --- a/replace/test/test.js +++ /dev/null @@ -1,165 +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 replace = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof replace, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if the first argument is not a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - false, - void 0, - NaN, - [], - {}, - function noop() {}, - / /g - ]; - - 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() { - replace( value, '', '' ); - }; - } -}); - -tape( 'the function throws an error if the second argument is not a string or regular expression', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - false, - void 0, - NaN, - [], - {}, - 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() { - replace( 'string', value, '' ); - }; - } -}); - -tape( 'the function throws an error if the third argument is not a function or string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - false, - void 0, - NaN, - [], - {} - ]; - - 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() { - replace( 'string', 'str', value ); - }; - } -}); - -tape( 'the function replaces all occurrences of a string search value', function test( t ) { - var out; - - out = replace( 'abc abc abc', 'b', '' ); - t.strictEqual( out, 'ac ac ac', 'returns expected value' ); - - out = replace( 'abc abc abc', 'b', 'cd' ); - t.strictEqual( out, 'acdc acdc acdc', 'returns expected value' ); - - out = replace( 'Et tu, Brute?', 'Brute?', 'Caesar?' ); - t.strictEqual( out, 'Et tu, Caesar?', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function replaces matches of a regular expression', function test( t ) { - var expected; - var out; - - out = replace( 'aBcDeFgHiJkLmNoPqRsTuVwXYZ', /[A-Z]+/, '' ); - expected = 'acDeFgHiJkLmNoPqRsTuVwXYZ'; - t.strictEqual( out, expected, 'replaces letters matching the regular expression (first occurrence)' ); - - out = replace( 'aBcDeFgHiJkLmNoPqRsTuVwXYZ', /[A-Z]+/g, '' ); - expected = 'acegikmoqsuw'; - t.strictEqual( out, expected, 'replaces letters matching the regular expression (global)' ); - - t.end(); -}); - -tape( 'the function replaces matches with values returned by a replacer function', function test( t ) { - var expected; - var out; - var str; - - str = 'Oranges and lemons say the bells of St. Clement\'s'; - out = replace( str, /([^\s]+)/gi, replacer ); - - expected = '/Oranges/ /and/ /lemons/ /say/ /the/ /bells/ /of/ /St./ /Clement\'s/'; - t.strictEqual( out, expected, 'replaces matches using replacer function' ); - - t.end(); - - function replacer( match, p1 ) { - return '/' + p1 + '/'; - } -}); diff --git a/reverse/README.md b/reverse/README.md deleted file mode 100644 index a95a9fae..00000000 --- a/reverse/README.md +++ /dev/null @@ -1,197 +0,0 @@ - - -# reverseString - -> Reverse a string. - -
- -## Usage - -```javascript -var reverseString = require( '@stdlib/string/reverse' ); -``` - -#### reverseString( str\[, options] ) - -Reverses a `string`. - -```javascript -var out = reverseString( 'last man standing' ); -// returns 'gnidnats nam tsal' - -out = reverseString( 'Hidden Treasures' ); -// returns 'serusaerT neddiH' - -out = reverseString( 'Lorem ipsum 𝌆 dolor sit ameͨ͆t.' ); -// returns '.teͨ͆ma tis rolod 𝌆 muspi meroL' -``` - -The function supports the following options: - -- **mode**: type of characters to reverse. Must be one of the following: - - - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - - Default: `'grapheme'`. - -
- - - - - -
- -## Notes - -- By default, the function assumes the general case in which an input string may contain an arbitrary number of grapheme clusters. This assumption comes with a performance cost. Accordingly, if an input string is known to only contain visual characters of a particular type (e.g., only alphanumeric), one can achieve better performance by specifying the appropriate `mode` option. - -
- - - -
- -## Examples - - - -```javascript -var reverseString = require( '@stdlib/string/reverse' ); - -var str = reverseString( 'last man standing' ); -// returns 'gnidnats nam tsal' - -str = reverseString( 'presidential election' ); -// returns 'noitcele laitnediserp' - -str = reverseString( 'javaScript' ); -// returns 'tpircSavaj' - -str = reverseString( 'Hidden Treasures' ); -// returns 'serusaerT neddiH' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: reverse [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --mode mode Type of character to return. Default: 'grapheme'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nboop' | reverse --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nboop' | reverse --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ reverse foobar -raboof -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'foobar' | reverse -raboof -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'foobar\tbaz' | reverse --split '\t' -raboof -zab -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/reverse/benchmark/benchmark.js b/reverse/benchmark/benchmark.js deleted file mode 100644 index 44095c1a..00000000 --- a/reverse/benchmark/benchmark.js +++ /dev/null @@ -1,142 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var reverseString = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var str; - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = fromCodePoint( i%126 ) + 'eep boop foo bar hip hop tip top'; - out = reverseString( str ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=grapheme', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'grapheme' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = reverseString( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=code_point', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'code_point' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = reverseString( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s:mode=code_unit', pkg ), function benchmark( b ) { - var values; - var opts; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - opts = { - 'mode': 'code_unit' - }; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = reverseString( values[ i%values.length ], opts ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/reverse/bin/cli b/reverse/bin/cli deleted file mode 100755 index c96be860..00000000 --- a/reverse/bin/cli +++ /dev/null @@ -1,124 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var reverse = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var opts; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - opts = {}; - if ( flags.mode ) { - opts.mode = flags.mode; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - try { - console.log( reverse( args[ 0 ], opts ) ); // eslint-disable-line no-console - } catch ( error ) { - return cli.error( error ); - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - if ( lines.length ) { - try { - console.log( reverse( lines[ 0 ], opts ) ); // eslint-disable-line no-console - } catch ( error ) { - return cli.error( error ); - } - for ( i = 1; i < lines.length; i++ ) { - console.log( reverse( lines[ i ], opts ) ); // eslint-disable-line no-console - } - } - } -} - -main(); diff --git a/reverse/docs/repl.txt b/reverse/docs/repl.txt deleted file mode 100644 index 06ec7095..00000000 --- a/reverse/docs/repl.txt +++ /dev/null @@ -1,43 +0,0 @@ - -{{alias}}( str[, options] ) - Reverses a string. - - Parameters - ---------- - str: string - Input string. - - options: Object (optional) - Options. - - options.mode: string (optional) - Type of characters to reverse. The following modes are supported: - - - grapheme: grapheme clusters. Appropriate for strings containing visual - characters which can span multiple Unicode code points (e.g., emoji). - - code_point: Unicode code points. Appropriate for strings containing - visual characters which are comprised of more than one Unicode code - unit (e.g., ideographic symbols and punctuation and mathematical - alphanumerics). - - code_unit': UTF-16 code units. Appropriate for strings containing - visual characters drawn from the basic multilingual plane (BMP) (e.g., - common characters, such as those from the Latin, Greek, and Cyrillic - alphabets). - - Default: 'grapheme'. - - Returns - ------- - out: string - Reversed string. - - Examples - -------- - > var out = {{alias}}( 'foo' ) - 'oof' - > out = {{alias}}( 'abcdef' ) - 'fedcba' - - See Also - -------- - diff --git a/reverse/docs/types/index.d.ts b/reverse/docs/types/index.d.ts deleted file mode 100644 index 51cf5186..00000000 --- a/reverse/docs/types/index.d.ts +++ /dev/null @@ -1,63 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Interface describing function options. -*/ -interface Options { - /** - * Specifies the type of characters to reverse (default: 'grapheme'). - * - * ## Notes - * - * - The following modes are supported: - * - * - `'grapheme'`: grapheme clusters. Appropriate for strings containing visual characters which can span multiple Unicode code points (e.g., emoji). - * - `'code_point'`: Unicode code points. Appropriate for strings containing visual characters which are comprised of more than one Unicode code unit (e.g., ideographic symbols and punctuation and mathematical alphanumerics). - * - `'code_unit'`: UTF-16 code units. Appropriate for strings containing visual characters drawn from the basic multilingual plane (BMP) (e.g., common characters, such as those from the Latin, Greek, and Cyrillic alphabets). - */ - mode?: 'grapheme' | 'code_point' | 'code_unit'; -} - -/** -* Reverses a string. -* -* @param str - input string -* @param options - options -* @returns reversed string -* -* @example -* var out = reverseString( 'last man standing', { -* 'mode': 'code_unit' -* }); -* // returns 'gnidnats nam tsal' -* -* @example -* var out = reverseString( '🐶🐮🐷🐰🐸', { -* 'mode': 'grapheme' -* }); -* // returns '🐸🐰🐷🐮🐶' -*/ -declare function reverseString( str: string, options?: Options ): string; - - -// EXPORTS // - -export = reverseString; diff --git a/reverse/docs/types/test.ts b/reverse/docs/types/test.ts deleted file mode 100644 index 888c2d13..00000000 --- a/reverse/docs/types/test.ts +++ /dev/null @@ -1,75 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import reverseString = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - reverseString( 'last man standing' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - reverseString( true ); // $ExpectError - reverseString( false ); // $ExpectError - reverseString( null ); // $ExpectError - reverseString( undefined ); // $ExpectError - reverseString( 5 ); // $ExpectError - reverseString( [] ); // $ExpectError - reverseString( {} ); // $ExpectError - reverseString( ( x: number ): number => x ); // $ExpectError - - reverseString( true, {} ); // $ExpectError - reverseString( false, {} ); // $ExpectError - reverseString( null, {} ); // $ExpectError - reverseString( undefined, {} ); // $ExpectError - reverseString( 5, {} ); // $ExpectError - reverseString( [], {} ); // $ExpectError - reverseString( {}, {} ); // $ExpectError - reverseString( ( x: number ): number => x, {} ); // $ExpectError -} - -// The compiler throws an error if the function is provided a value other than an object as second argument... -{ - reverseString( 'abc', '1' ); // $ExpectError - reverseString( 'abc', 1 ); // $ExpectError - reverseString( 'abc', true ); // $ExpectError - reverseString( 'abc', false ); // $ExpectError - reverseString( 'abc', null ); // $ExpectError - reverseString( 'abc', '' ); // $ExpectError - reverseString( 'abc', [] ); // $ExpectError - reverseString( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an invalid `mode` option... -{ - reverseString( 'abc', { 'mode': true } ); // $ExpectError - reverseString( 'abc', { 'mode': false } ); // $ExpectError - reverseString( 'abc', { 'mode': null } ); // $ExpectError - reverseString( 'abc', { 'mode': '' } ); // $ExpectError - reverseString( 'abc', { 'mode': [] } ); // $ExpectError - reverseString( 'abc', { 'mode': ( x: number ): number => x } ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - reverseString(); // $ExpectError -} diff --git a/reverse/docs/usage.txt b/reverse/docs/usage.txt deleted file mode 100644 index b0a67623..00000000 --- a/reverse/docs/usage.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Usage: reverse [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. - --mode mode Type of character to reverse. Default: 'grapheme'. diff --git a/reverse/etc/cli_opts.json b/reverse/etc/cli_opts.json deleted file mode 100644 index b0907616..00000000 --- a/reverse/etc/cli_opts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "string": [ - "split", - "mode" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/reverse/examples/index.js b/reverse/examples/index.js deleted file mode 100644 index b8621dee..00000000 --- a/reverse/examples/index.js +++ /dev/null @@ -1,33 +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'; - -var reverseString = require( './../lib' ); - -console.log( reverseString( 'last man standing' ) ); -// => 'gnidnats nam tsal' - -console.log( reverseString( 'presidential election' ) ); -// => 'noitcele laitnediserp' - -console.log( reverseString( 'javaScript' ) ); -// => 'tpircSavaj' - -console.log( reverseString( 'Hidden Treasures' ) ); -// => 'serusaerT neddiH' diff --git a/reverse/lib/index.js b/reverse/lib/index.js deleted file mode 100644 index 2c7173e4..00000000 --- a/reverse/lib/index.js +++ /dev/null @@ -1,43 +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'; - -/** -* Reverse a string. -* -* @module @stdlib/string/reverse -* -* @example -* var reverseString = require( '@stdlib/string/reverse' ); -* -* var out = reverseString( 'last man standing' ); -* // returns 'gnidnats nam tsal' -* -* out = reverseString( 'Hidden Treasures' ); -* // returns 'serusaerT neddiH' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/reverse/lib/main.js b/reverse/lib/main.js deleted file mode 100644 index be32ddb3..00000000 --- a/reverse/lib/main.js +++ /dev/null @@ -1,105 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isPlainObject = require( '@stdlib/assert/is-plain-object' ); -var hasOwnProp = require( '@stdlib/assert/has-own-property' ); -var contains = require( '@stdlib/array/base/assert/contains' ).factory; -var reverseCodeUnit = require( './../../base/reverse' ); -var reverseCodePoints = require( './../../base/reverse-code-points' ); -var reverseGraphemeClusters = require( './../../base/reverse-grapheme-clusters' ); -var format = require( './../../format' ); - - -// VARIABLES // - -var MODES = [ 'grapheme', 'code_point', 'code_unit' ]; -var FCNS = { - 'grapheme': reverseGraphemeClusters, - 'code_point': reverseCodePoints, - 'code_unit': reverseCodeUnit -}; -var isMode = contains( MODES ); - - -// MAIN // - -/** -* Reverses a string. -* -* @param {string} str - input string -* @param {Options} [options] - options -* @param {string} [options.mode="grapheme"] - type of "character" to return (must be either `grapheme`, `code_point`, or `code_unit`) -* @throws {TypeError} must provide a string primitive -* @throws {TypeError} options argument must be an object -* @throws {TypeError} must provide valid options -* @returns {string} reversed string -* -* @example -* var out = reverse( 'last man standing' ); -* // returns 'gnidnats nam tsal' -* -* @example -* var out = reverse( 'presidential election' ); -* // returns 'noitcele laitnediserp' -* -* @example -* var out = reverse( 'javaScript' ); -* // returns 'tpircSavaj' -* -* @example -* var out = reverse( 'Hidden Treasures' ); -* // returns 'serusaerT neddiH' -*/ -function reverse( str ) { - var options; - var nargs; - var opts; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - opts = { - 'mode': 'grapheme' - }; - nargs = arguments.length; - if ( nargs > 1 ) { - options = arguments[ 1 ]; - if ( !isPlainObject( options ) ) { - throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) ); - } - } - if ( options ) { - if ( hasOwnProp( options, 'mode' ) ) { - opts.mode = options.mode; - if ( !isMode( opts.mode ) ) { - throw new TypeError( format( 'invalid option. `%s` option must be one of the following: "%s". Value: `%s`.', 'mode', MODES.join( '", "' ), opts.mode ) ); - } - } - } - return FCNS[ opts.mode ]( str ); -} - - -// EXPORTS // - -module.exports = reverse; diff --git a/reverse/package.json b/reverse/package.json deleted file mode 100644 index 06d9d211..00000000 --- a/reverse/package.json +++ /dev/null @@ -1,66 +0,0 @@ -{ - "name": "@stdlib/string/reverse", - "version": "0.0.0", - "description": "Reverse a string.", - "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" - } - ], - "bin": { - "reverse": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "reverse", - "flip" - ] -} diff --git a/reverse/test/fixtures/stdin_error.js.txt b/reverse/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 452e3afe..00000000 --- a/reverse/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'BEEP' ) ); -} diff --git a/reverse/test/test.cli.js b/reverse/test/test.cli.js deleted file mode 100644 index 9b5e5805..00000000 --- a/reverse/test/test.cli.js +++ /dev/null @@ -1,303 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface reverses a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'foobar\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'raboof\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying the type of characters to reverse', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--mode=code_point\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'peeb\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'if provided an invalid option, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep\'; process.argv[ 3 ] = \'--mode=foo\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString().length > 0, true, 'expected value' ); - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "foobar\nlast man standing"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'raboof\ngnidnats nam tsal\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'oof\nrab\nzab\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'foo\tbar\tbaz\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'oof\nrab\nzab\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: BEEP\n', 'expected value' ); - t.end(); - } -}); diff --git a/reverse/test/test.js b/reverse/test/test.js deleted file mode 100644 index 7ed549af..00000000 --- a/reverse/test/test.js +++ /dev/null @@ -1,281 +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 reverseString = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof reverseString, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - reverseString( value ); - }; - } -}); - -tape( 'the function throws an error if not provided a string (options)', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - void 0, - NaN, - [], - {}, - 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() { - reverseString( value, {} ); - }; - } -}); - -tape( 'the function throws an error if provided an options argument which is not an object', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - reverseString( 'beep', value ); - }; - } -}); - -tape( 'the function throws an error if provided a `mode` option which is not a supported mode', function test( t ) { - var values; - var i; - - values = [ - 'abc', - 3, - null, - true, - void 0, - NaN, - [], - 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() { - reverseString( 'beep', { - 'mode': value - }); - }; - } -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( reverseString( '' ), '', 'returns expected value' ); - t.strictEqual( reverseString( '', {} ), '', 'returns expected value' ); - t.end(); -}); - -tape( 'the function reverses a string', function test( t ) { - var expected; - var actual; - var values; - var i; - - values = [ - 'hello world', - '!!!', - 'Hello World', - '𝑨𝑩𝑪', - 'ma\xF1ana', - 'man\u0303ana', // combining mark - 'foo\u0303\u035C\u035D\u035Ebar', // multiple combining marks - 'foo\uD834\uDF06bar', // astral symbol (surrogate pair) - 'foo\uD834bar\uDF06baz', // unpaired surrogates - 'foo\uD834\uDF06\u0303bar', // astral symbol (surrogate pair) followed by a single combining mark - 'foo\uD834\uDF06\u0303\u035C\u035D\u035Ebar', // astral symbol (surrogate pair) followed by multiple combining marks - 'H\u0339\u0319\u0326\u032E\u0349\u0329\u0317\u0317\u0367\u0307\u030F\u030A\u033EE\u0368\u0346\u0352\u0306\u036E\u0303\u034F\u0337\u032E\u0323\u032B\u0324\u0323 \u0335\u031E\u0339\u033B\u0300\u0309\u0313\u036C\u0351\u0361\u0345C\u036F\u0302\u0350\u034F\u0328\u031B\u0354\u0326\u031F\u0348\u033BO\u031C\u034E\u034D\u0359\u035A\u032C\u031D\u0323\u033D\u036E\u0350\u0357\u0300\u0364\u030D\u0300\u0362M\u0334\u0321\u0332\u032D\u034D\u0347\u033C\u031F\u032F\u0326\u0309\u0312\u0360\u1E1A\u031B\u0319\u031E\u032A\u0317\u0365\u0364\u0369\u033E\u0351\u0314\u0350\u0345\u1E6E\u0334\u0337\u0337\u0317\u033C\u034D\u033F\u033F\u0313\u033D\u0350H\u0319\u0319\u0314\u0304\u035C', - '六书/六書', - 'กิิก้้ก็็ก็็กิิก้้ก็็กิิก้้กิิก้้ก็็ก็็กิิก้้ก็็กิิก้้', - '\u{1112}\u{1161}\u{11AB}', // eslint-disable-line n/no-unsupported-features/es-syntax - '\u{D55C}', // eslint-disable-line n/no-unsupported-features/es-syntax - 'เ❄︎நி' - ]; - - expected = [ - 'dlrow olleh', - '!!!', - 'dlroW olleH', - '𝑪𝑩𝑨', - 'ana\xF1am', - 'anan\u0303am', - 'rabo\u0303\u035C\u035D\u035Eof', - 'rab\uD834\uDF06oof', - 'zab\uDF06rab\uD834oof', - 'rab\uD834\uDF06\u0303oof', - 'rab\uD834\uDF06\u0303\u035C\u035D\u035Eoof', - 'H\u0319\u0319\u0314\u0304\u035C\u1E6E\u0334\u0337\u0337\u0317\u033C\u034D\u033F\u033F\u0313\u033D\u0350\u1E1A\u031B\u0319\u031E\u032A\u0317\u0365\u0364\u0369\u033E\u0351\u0314\u0350\u0345M\u0334\u0321\u0332\u032D\u034D\u0347\u033C\u031F\u032F\u0326\u0309\u0312\u0360O\u031C\u034E\u034D\u0359\u035A\u032C\u031D\u0323\u033D\u036E\u0350\u0357\u0300\u0364\u030D\u0300\u0362C\u036F\u0302\u0350\u034F\u0328\u031B\u0354\u0326\u031F\u0348\u033B \u0335\u031E\u0339\u033B\u0300\u0309\u0313\u036C\u0351\u0361\u0345E\u0368\u0346\u0352\u0306\u036E\u0303\u034F\u0337\u032E\u0323\u032B\u0324\u0323H\u0339\u0319\u0326\u032E\u0349\u0329\u0317\u0317\u0367\u0307\u030F\u030A\u033E', - '書六/书六', - 'ก้้กิิก็็ก้้กิิก็็ก็็ก้้กิิก้้กิิก็็ก้้กิิก็็ก็็ก้้กิิ', - '\u{1112}\u{1161}\u{11AB}', // eslint-disable-line n/no-unsupported-features/es-syntax - '\u{D55C}', // eslint-disable-line n/no-unsupported-features/es-syntax - 'நி❄︎เ' - - ]; - for ( i = 0; i < values.length; i++ ) { - actual = reverseString( values[ i ] ); - t.strictEqual( actual, expected[ i ], 'returns expected value when provided ' + values[ i ] ); - } - t.end(); -}); - -tape( 'the function reverses the first string (mode=grapheme)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'grapheme' - }; - - out = reverseString( 'hello world', opts ); - t.strictEqual( out, 'dlrow olleh', 'returns expected value' ); - - out = reverseString( '*!!!', opts ); - t.strictEqual( out, '!!!*', 'returns expected value' ); - - out = reverseString( 'अनुच्छेद', opts ); - t.strictEqual( out, 'दछेच्नुअ', 'returns expected value' ); - - out = reverseString( '六书/六書', opts ); - t.strictEqual( out, '書六/书六', 'returns expected value' ); - - out = reverseString( '🌷', opts ); - t.strictEqual( out, '🌷', 'returns expected value' ); - - out = reverseString( '👉🏿🌷', opts ); - t.strictEqual( out, '🌷👉🏿', 'returns expected value' ); - - t.end(); -}); - -tape( 'the function reverses the first string (mode=code_point)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'code_point' - }; - - out = reverseString( 'hello world', opts ); - t.strictEqual( out, 'dlrow olleh', 'returns expected value' ); - - out = reverseString( '*!!!', opts ); - t.strictEqual( out, '!!!*', 'returns expected value' ); - - out = reverseString( 'अनुच्छेद', opts ); - t.strictEqual( out, 'देछ्चुनअ', 'returns expected value' ); - - out = reverseString( '六书/六書', opts ); - t.strictEqual( out, '書六/书六', 'returns expected value' ); - - out = reverseString( '🌷', opts ); - t.strictEqual( out, '🌷', 'returns expected value' ); - t.end(); -}); - -tape( 'the function reverses the first string (mode=code_unit)', function test( t ) { - var opts; - var out; - - opts = { - 'mode': 'code_unit' - }; - - out = reverseString( 'hello world', opts ); - t.strictEqual( out, 'dlrow olleh', 'returns expected value' ); - - out = reverseString( '*!!!', opts ); - t.strictEqual( out, '!!!*', 'returns expected value' ); - - out = reverseString( 'अनुच्छेद', opts ); - t.strictEqual( out, 'देछ्चुनअ', 'returns expected value' ); - - out = reverseString( '六书/六書', opts ); - t.strictEqual( out, '書六/书六', 'returns expected value' ); - - out = reverseString( '🌷', opts ); - t.strictEqual( out, '\udf37\ud83c', 'returns expected value' ); - t.end(); -}); diff --git a/right-pad/README.md b/right-pad/README.md deleted file mode 100644 index 675efd43..00000000 --- a/right-pad/README.md +++ /dev/null @@ -1,212 +0,0 @@ - - -# Right Pad - -> Right pad a string. - -
- -## Usage - -```javascript -var rpad = require( '@stdlib/string/right-pad' ); -``` - -#### rpad( str, len\[, pad] ) - -Right pads a `string` such that the padded `string` has a `length` of **at least** `len`. - -```javascript -var str = rpad( 'a', 5 ); -// returns 'a ' -``` - -By default, an input `string` is padded with `spaces`. To pad with a different character or sequence of characters, provide a `pad` string. - -```javascript -var str = rpad( 'beep', 10, 'p' ); -// returns 'beeppppppp' - -str = rpad( 'beep', 12, 'boop' ); -// returns 'beepboopboop' -``` - -
- - - -
- -## Notes - -- An output `string` is **not** guaranteed to have a length of **exactly** `len`, but to have a `length` of **at least** `len`. To generate a padded `string` having a `length` equal to `len` - - ```javascript - var str = rpad( 'beep', 10, 'boop' ); - // returns 'beepboopboop' => length 12 - - str = str.substring( 0, 10 ); - // returns 'beepboopbo' => length 10 - ``` - -
- - - -
- -## Examples - - - -```javascript -var round = require( '@stdlib/math/base/special/round' ); -var randu = require( '@stdlib/random/base/randu' ); -var rpad = require( '@stdlib/string/right-pad' ); - -var str = 'beep'; -var n; -var i; - -for ( i = 0; i < 100; i++ ) { - n = round( randu()*10.0 ) + str.length; - console.log( rpad( str, n, 'p' ) ); -} -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: rpad [options] [] --len= - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --len length Minimum string length. - --pad str String used to pad. Default: ' '. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beep\nboop' | rpad --len 8 --pad % --split /\r?\n/ - - # Escaped... - $ echo -n $'beep\nboop' | rpad --len 8 --pad % --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ rpad beep --len 10 --pad p -beeppppppp -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'boop' | rpad --len 8 --pad % -boop%%%% -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'boop\tbeep' | rpad --len 8 --pad % --split '\t' -boop%%%% -beep%%%% -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/right-pad/benchmark/benchmark.js b/right-pad/benchmark/benchmark.js deleted file mode 100644 index 8a0b4b00..00000000 --- a/right-pad/benchmark/benchmark.js +++ /dev/null @@ -1,94 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var rpad = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - string length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - 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 = rpad( 'beep', len, fromCodePoint( i%126 ) ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - 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 = 10; // 10*max - - for ( i = min; i <= max; i++ ) { - len = 10 * i; - f = createBenchmark( len ); - bench( format( '%s:len=%d', pkg, len ), f ); - } -} - -main(); diff --git a/right-pad/bin/cli b/right-pad/bin/cli deleted file mode 100755 index a3d70a38..00000000 --- a/right-pad/bin/cli +++ /dev/null @@ -1,120 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var rpad = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - var len; - var pad; - var str; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - if ( args.length ) { - str = args[ 0 ]; - } else { - // Treat an empty value as an empty string: - str = ''; - } - len = parseInt( flags.len, 10 ); - pad = flags.pad || ' '; - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( rpad( str, len, pad ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( rpad( lines[ i ], len, pad ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/right-pad/docs/repl.txt b/right-pad/docs/repl.txt deleted file mode 100644 index 9b36705f..00000000 --- a/right-pad/docs/repl.txt +++ /dev/null @@ -1,38 +0,0 @@ - -{{alias}}( str, len[, pad] ) - Right pads a `string` such that the padded `string` has a length of at least - `len`. - - An output string is not guaranteed to have a length of exactly `len`, but to - have a length of at least `len`. To generate a padded string having a length - equal to `len`, post-process a padded string by trimming off excess - characters. - - Parameters - ---------- - str: string - Input string. - - len: integer - Minimum string length. - - pad: string (optional) - String used to pad. Default: ' '. - - Returns - ------- - out: string - Padded string. - - Examples - -------- - > var out = {{alias}}( 'a', 5 ) - 'a ' - > out = {{alias}}( 'beep', 10, 'p' ) - 'beeppppppp' - > out = {{alias}}( 'beep', 12, 'boop' ) - 'beepboopboop' - - See Also - -------- - diff --git a/right-pad/docs/types/index.d.ts b/right-pad/docs/types/index.d.ts deleted file mode 100644 index a403342c..00000000 --- a/right-pad/docs/types/index.d.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Right pads a string such that the padded string has a length of at least `len`. -* -* ## Notes -* -* - An output string is not guaranteed to have a length of exactly `len`, but to have a length of at least `len`. To generate a padded string having a length equal to `len`, post-process a padded string by trimming off excess characters. -* -* @param str - string to pad -* @param len - minimum string length -* @param pad - string used to pad (default: ' ') -* @throws second argument must be a nonnegative integer -* @throws padding must have a length greater than `0` -* @returns padded string -* -* @example -* var str = rpad( 'a', 5 ); -* // returns 'a ' -* -* @example -* var str = rpad( 'beep', 10, 'p' ); -* // returns 'beeppppppp' -* -* @example -* var str = rpad( 'beep', 12, 'boop' ); -* // returns 'beepboopboop' -*/ -declare function rpad( str: string, len: number, pad?: string ): string; - - -// EXPORTS // - -export = rpad; diff --git a/right-pad/docs/types/test.ts b/right-pad/docs/types/test.ts deleted file mode 100644 index bfd22b98..00000000 --- a/right-pad/docs/types/test.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import rpad = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - rpad( 'abd', 5, ' ' ); // $ExpectType string - rpad( 'abd', 4, 'x' ); // $ExpectType string - rpad( 'abd', 10 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - rpad( true, 6 ); // $ExpectError - rpad( false, 6 ); // $ExpectError - rpad( 3, 6 ); // $ExpectError - rpad( [], 6 ); // $ExpectError - rpad( {}, 6 ); // $ExpectError - rpad( ( x: number ): number => x, 6 ); // $ExpectError - - rpad( 'abd', true ); // $ExpectError - rpad( 'abd', false ); // $ExpectError - rpad( 'abd', 'abc' ); // $ExpectError - rpad( 'abd', [], 0 ); // $ExpectError - rpad( 'abd', {}, 0 ); // $ExpectError - rpad( 'abd', ( x: number ): number => x, 0 ); // $ExpectError - - rpad( 'abd', 6, true ); // $ExpectError - rpad( 'abd', 6, false ); // $ExpectError - rpad( 'abd', 6, 123 ); // $ExpectError - rpad( 'abd', 6, [] ); // $ExpectError - rpad( 'abd', 6, {} ); // $ExpectError - rpad( 'abd', 6, /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - rpad(); // $ExpectError - rpad( 'abc' ); // $ExpectError -} diff --git a/right-pad/docs/usage.txt b/right-pad/docs/usage.txt deleted file mode 100644 index c79ef203..00000000 --- a/right-pad/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: rpad [options] [] --len= - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --len length Minimum string length. - --pad str String used to pad. Default: ' '. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/right-pad/etc/cli_opts.json b/right-pad/etc/cli_opts.json deleted file mode 100644 index 702361cc..00000000 --- a/right-pad/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "string": [ - "len", - "pad", - "split" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/right-pad/examples/index.js b/right-pad/examples/index.js deleted file mode 100644 index e449f2f6..00000000 --- a/right-pad/examples/index.js +++ /dev/null @@ -1,32 +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'; - -var round = require( '@stdlib/math/base/special/round' ); -var randu = require( '@stdlib/random/base/randu' ); -var rpad = require( './../lib' ); - -var str = 'beep'; -var n; -var i; - -for ( i = 0; i < 100; i++ ) { - n = round( randu()*10.0 ) + str.length; - console.log( rpad( str, n, 'p' ) ); -} diff --git a/right-pad/lib/index.js b/right-pad/lib/index.js deleted file mode 100644 index 358721d6..00000000 --- a/right-pad/lib/index.js +++ /dev/null @@ -1,46 +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'; - -/** -* Right pad a string such that the padded string has a length of at least `len`. -* -* @module @stdlib/string/right-pad -* -* @example -* var rpad = require( '@stdlib/string/right-pad' ); -* -* var str = rpad( 'a', 5 ); -* // returns 'a ' -* -* str = rpad( 'beep', 10, 'p' ); -* // returns 'beeppppppp' -* -* str = rpad( 'beep', 12, 'boop' ); -* // returns 'beepboopboop' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/right-pad/lib/main.js b/right-pad/lib/main.js deleted file mode 100644 index 3c941f0e..00000000 --- a/right-pad/lib/main.js +++ /dev/null @@ -1,84 +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 isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var FLOAT64_MAX_SAFE_INTEGER = require( '@stdlib/constants/float64/max-safe-integer' ); -var base = require( './../../base/right-pad' ); - - -// MAIN // - -/** -* Right pads a string such that the padded string has a length of at least `len`. -* -* @param {string} str - string to pad -* @param {NonNegativeInteger} len - minimum string length -* @param {string} [pad=' '] - string used to pad -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {TypeError} third argument must be a string -* @throws {RangeError} padding must have a length greater than `0` -* @returns {string} padded string -* -* @example -* var str = rpad( 'a', 5 ); -* // returns 'a ' -* -* @example -* var str = rpad( 'beep', 10, 'p' ); -* // returns 'beeppppppp' -* -* @example -* var str = rpad( 'beep', 12, 'boop' ); -* // returns 'beepboopboop' -*/ -function rpad( str, len, pad ) { - var p; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isNonNegativeInteger( len ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) ); - } - if ( arguments.length > 2 ) { - p = pad; - if ( !isString( p ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', p ) ); - } - if ( p.length === 0 ) { - throw new RangeError( 'invalid argument. Pad string must not be an empty string.' ); - } - } else { - p = ' '; - } - if ( len > FLOAT64_MAX_SAFE_INTEGER ) { - throw new RangeError( format( 'invalid argument. Output string length exceeds maximum allowed string length. Value: `%u`.', len ) ); - } - return base( str, len, p ); -} - - -// EXPORTS // - -module.exports = rpad; diff --git a/right-pad/package.json b/right-pad/package.json deleted file mode 100644 index 43d53b44..00000000 --- a/right-pad/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/right-pad", - "version": "0.0.0", - "description": "Right pad a string.", - "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" - } - ], - "bin": { - "rpad": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "pad", - "string", - "str", - "padding", - "rpad", - "right", - "cli" - ] -} diff --git a/right-pad/test/fixtures/stdin_error.js.txt b/right-pad/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/right-pad/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/right-pad/test/test.cli.js b/right-pad/test/test.cli.js deleted file mode 100644 index 041b119e..00000000 --- a/right-pad/test/test.cli.js +++ /dev/null @@ -1,293 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var replace = require( './../../replace' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints a string right-padded with spaces', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--len=8\'; process.argv[ 3 ] = \'beep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'beep \n', true, 'prints expected value to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints a string right-padded with a custom pad string', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--len=9\'; process.argv[ 3 ] = \'--pad=!#\'; process.argv[ 4 ] = \'world\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'world!#!#\n', true, 'prints expected value to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop"', - '|', - EXEC_PATH, - fpath, - '--len=6', - '--pad=!' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep!!\nboop!!\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'', - '--len=6', - '--pad=!' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep!!\nboop!!\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/', - '--len=6', - '--pad=!' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep!!\nboop!!\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/right-pad/test/test.js b/right-pad/test/test.js deleted file mode 100644 index cd4ef1ad..00000000 --- a/right-pad/test/test.js +++ /dev/null @@ -1,153 +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 rpad = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof rpad, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if the first argument is not a string primitive, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - 5, - true, - 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() { - rpad( value, 10 ); - }; - } -}); - -tape( 'if the second argument is not a nonnegative integer, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - '5', - 3.14, - -5, - true, - 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() { - rpad( 'beep', value ); - }; - } -}); - -tape( 'if the third argument is not a string primitive, the function will throw an error', function test( t ) { - var values; - var i; - - values = [ - 5, - true, - 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() { - rpad( 'beep', 10, value ); - }; - } -}); - -tape( 'if the output string will exceed the maximum allowed string length, the function will throw an error', function test( t ) { - t.throws( foo, RangeError, 'throws RangeError' ); - t.end(); - function foo() { - rpad( 'beep', 1e300 ); - } -}); - -tape( 'if provided an empty pad string, the function throws an error', function test( t ) { - t.throws( foo, RangeError, 'throws RangeError' ); - t.end(); - function foo() { - rpad( 'beep', 10, '' ); - } -}); - -tape( 'by default, the function right pads a string with spaces', function test( t ) { - var str = rpad( 'a', 5 ); - t.strictEqual( str, 'a ', 'right padded with spaces' ); - t.end(); -}); - -tape( 'the function supports right padding a string with a custom pad string', function test( t ) { - var str = rpad( 'beep', 10, 'p' ); - t.strictEqual( str, 'beeppppppp', 'right padded to desired length' ); - t.end(); -}); - -tape( 'the function right pads a string such that an output string may exceed the specified length (minimum bound)', function test( t ) { - var str = rpad( 'a', 5, 'beepboop' ); - t.strictEqual( str, 'abeepboop', 'right padded and length exceeds minimum length' ); - t.end(); -}); - -tape( 'if the specified string length is less than or equal to the input string length, the function returns the input string', function test( t ) { - t.strictEqual( rpad( 'beep', 2, 'boop' ), 'beep', 'returns input string (<)' ); - t.strictEqual( rpad( 'beep', 4, 'boop' ), 'beep', 'returns input string (=)' ); - t.end(); -}); diff --git a/right-trim-n/README.md b/right-trim-n/README.md deleted file mode 100644 index b78700ae..00000000 --- a/right-trim-n/README.md +++ /dev/null @@ -1,232 +0,0 @@ - - -# rtrimN - -> Trim `n` characters from the end of a string. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var rtrimN = require( '@stdlib/string/right-trim-n' ); -``` - -#### rtrimN( str, n\[, chars] ) - -Trims `n` characters from the end of a string. - -```javascript -var str = ' foo '; -var out = rtrimN( str, str.length ); -// returns ' foo' - -out = rtrimN( str, 1 ); -// returns ' foo ' -``` - -By default, the function trims whitespace characters. To trim a different set of characters instead, provide a string or an array of characters to trim: - -```javascript -var str = '🐶🐶🐶 Animals 🐶🐶🐶'; -var out = rtrimN( str, str.length, [ '🐶', ' ' ] ); -// returns '🐶🐶🐶 Animals' - -out = rtrimN( str, str.length, '🐶 ' ); -// returns '🐶🐶🐶 Animals' -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var rtrimN = require( '@stdlib/string/right-trim-n' ); - -var out = rtrimN( ' Whitespace ', 3 ); -// returns ' Whitespace' - -out = rtrimN( '\t\t\tTabs\t\t\t', 2 ); -// returns '\t\t\tTabs\t' - -out = rtrimN( '~~~CUSTOM~~~', 3, '~' ); -// returns '~~~CUSTOM' -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: rtrimn [options] --n= - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n number Number of characters to trim. - --chars str Characters to trim. Default: whitespace. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $' foo \n bar ' | rtrimn --n=3 --split /\r?\n/ - - # Escaped... - $ echo -n $' foo \n bar ' | rtrimn --n=3 --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - - - -
- -### Examples - -```bash -$ rtrimn ' Whitespace ' --n=3 - Whitespace -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n '~beep~boop~~~' | rtrimn --n=2 --chars '~' -~beep~boop~ -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n '~~~foo~~~\t~~~bar~~~\t~~~baz~~~' | rtrimn --split '\t' --chars '~' --n=3 -~~~foo -~~~bar -~~~baz -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/right-trim-n/benchmark/benchmark.js b/right-trim-n/benchmark/benchmark.js deleted file mode 100644 index 301da846..00000000 --- a/right-trim-n/benchmark/benchmark.js +++ /dev/null @@ -1,111 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var rtrimN = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var whitespace; - var str; - var out; - var i; - - whitespace = '\\f\\n\\r\\t\\v\\u0020\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = fromCodePoint( i%126 ) + 'eep boop' + whitespace; - - out = rtrimN( str, i % 10 ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::chars_array', pkg ), function benchmark( b ) { - var whitespace; - var str; - var out; - var i; - - whitespace = [ - '\f', - '\n', - '\r', - '\t', - '\v', - ' ' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = fromCodePoint( i%126 ) + 'eep boop' + whitespace.join( '' ); - out = rtrimN( str, i % 10, whitespace ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::chars_string', pkg ), function benchmark( b ) { - var whitespace; - var str; - var out; - var i; - - whitespace = '\\f\\n\\r\\t\\v'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = fromCodePoint( i%126 ) + 'eep boop' + whitespace; - out = rtrimN( str, i % 10, whitespace ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/right-trim-n/bin/cli b/right-trim-n/bin/cli deleted file mode 100755 index fbe3c18b..00000000 --- a/right-trim-n/bin/cli +++ /dev/null @@ -1,125 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var rtrimN = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var chars; - var flags; - var args; - var opts; - var cli; - var n; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - n = parseInt( flags.n, 10 ); - if ( flags.chars ) { - chars = flags.chars; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - opts = {}; - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - opts.split = reFromString( flags.split ); - } else { - opts.split = RE_EOL; - } - return stdin( onRead ); - } - if ( chars ) { - console.log( rtrimN( args[ 0 ], n, chars ) ); // eslint-disable-line no-console - } else { - console.log( rtrimN( args[ 0 ], n ) ); // eslint-disable-line no-console - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( opts.split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - if ( chars ) { - for ( i = 0; i < lines.length; i++ ) { - console.log( rtrimN( lines[ i ], n, chars ) ); // eslint-disable-line no-console - } - } else { - for ( i = 0; i < lines.length; i++ ) { - console.log( rtrimN( lines[ i ], n ) ); // eslint-disable-line no-console - } - } - } -} - -main(); diff --git a/right-trim-n/docs/repl.txt b/right-trim-n/docs/repl.txt deleted file mode 100644 index e9a85490..00000000 --- a/right-trim-n/docs/repl.txt +++ /dev/null @@ -1,29 +0,0 @@ - -{{alias}}( str, n[, chars] ) - Trims `n` characters from the end of a string. - - Parameters - ---------- - str: string - Input string. - - n: integer - Number of characters to trim. - - chars: Array|string (optional) - Characters to trim. Default: whitespace characters. - - Returns - ------- - out: string - Trimmed string. - - Examples - -------- - > var out = {{alias}}( ' abc ', 2 ) - ' abc' - > var out = {{alias}}( '!!!abc!!!', 2, '!' ) - '!!!abc!' - - See Also - -------- diff --git a/right-trim-n/docs/types/index.d.ts b/right-trim-n/docs/types/index.d.ts deleted file mode 100644 index 6d1eed16..00000000 --- a/right-trim-n/docs/types/index.d.ts +++ /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. -*/ - -// TypeScript Version: 4.1 - -/** -* Trims `n` characters from the end of a string. -* -* @param str - input string -* @param n - number of characters to trim -* @param chars - characters to trim (default: whitespace characters) -* @returns trimmed string -* -* @example -* var str = ' abc '; -* var out = rtrimN( str, 2 ); -* // returns ' abc ' -* -* @example -* var str = ' abc '; -* var out = rtrimN( str, str.length ); -* // returns ' abc' -* -* @example -* var str = '~~abc!~~'; -* var out = rtrimN( str, str.length, [ '~', '!' ] ); -* // returns '~~abc' -* -* @example -* var str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨'; -* var out = rtrimN( str, str.length, '👨🏼‍🎨🤖' ); -* // returns '' -*/ -declare function rtrimN( str: string, n: number, chars?: string | Array ): string; - - -// EXPORTS // - -export = rtrimN; diff --git a/right-trim-n/docs/types/test.ts b/right-trim-n/docs/types/test.ts deleted file mode 100644 index 350a827a..00000000 --- a/right-trim-n/docs/types/test.ts +++ /dev/null @@ -1,67 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import rtrimN = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - rtrimN( ' abc ', 3 ); // $ExpectType string - rtrimN( '~~~abc~~~', 3, '~' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - rtrimN( true, 6 ); // $ExpectError - rtrimN( false, 6 ); // $ExpectError - rtrimN( 3, 6 ); // $ExpectError - rtrimN( [], 6 ); // $ExpectError - rtrimN( {}, 6 ); // $ExpectError - rtrimN( ( x: number ): number => x, 6 ); // $ExpectError - - rtrimN( 'abd', true ); // $ExpectError - rtrimN( 'abd', false ); // $ExpectError - rtrimN( 'abd', 'abc' ); // $ExpectError - rtrimN( 'abd', [], 0 ); // $ExpectError - rtrimN( 'abd', {}, 0 ); // $ExpectError - rtrimN( 'abd', ( x: number ): number => x, 0 ); // $ExpectError - - rtrimN( 'abd', 6, true ); // $ExpectError - rtrimN( 'abd', 6, false ); // $ExpectError - rtrimN( 'abd', 6, 123 ); // $ExpectError - rtrimN( 'abd', 6, {} ); // $ExpectError - rtrimN( 'abd', 6, /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided an a third argument which is not a string or an array of strings... -{ - rtrimN( 'abc', 3, true ); // $ExpectError - rtrimN( 'abc', 3, false ); // $ExpectError - rtrimN( 'abc', 3, 123 ); // $ExpectError - rtrimN( 'abc', 3, {} ); // $ExpectError - rtrimN( 'abc', 3, [ true ] ); // $ExpectError - rtrimN( 'abc', 3, ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - rtrimN(); // $ExpectError - rtrimN( 'abc' ); // $ExpectError -} diff --git a/right-trim-n/docs/usage.txt b/right-trim-n/docs/usage.txt deleted file mode 100644 index 1acaf7f5..00000000 --- a/right-trim-n/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: rtrimn [options] --n= - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --n number Number of characters to trim. - --chars str Characters to trim. Default: whitespace. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/right-trim-n/etc/cli_opts.json b/right-trim-n/etc/cli_opts.json deleted file mode 100644 index 8c4a5b6b..00000000 --- a/right-trim-n/etc/cli_opts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "string": [ - "n", - "chars" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/right-trim-n/examples/index.js b/right-trim-n/examples/index.js deleted file mode 100644 index caf769f7..00000000 --- a/right-trim-n/examples/index.js +++ /dev/null @@ -1,30 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 rtrimN = require( './../lib' ); - -console.log( rtrimN( ' Whitespace ', 3 ) ); -// => ' Whitespace' - -console.log( rtrimN( '\t\t\tTabs\t\t\t', 2 ) ); -// => '\t\t\tTabs\t' - -console.log( rtrimN( '~~~CUSTOM~~~', 3, '~' ) ); -// => '~~~CUSTOM' diff --git a/right-trim-n/lib/index.js b/right-trim-n/lib/index.js deleted file mode 100644 index e9b40a82..00000000 --- a/right-trim-n/lib/index.js +++ /dev/null @@ -1,45 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Trim `n` characters from the end of a string. -* -* @module @stdlib/string/right-trim-n -* -* @example -* var rtrimN = require( '@stdlib/string/right-trim-n' ); -* -* var str = ' foo '; -* var out = rtrimN( str, str.length ); -* // returns ' foo' -* -* str = '🐶🐶🐶 Animals 🐶🐶🐶'; -* out = rtrimN( str, 4, [ '🐶', ' ' ] ); -* // returns '🐶🐶🐶 Animals' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/right-trim-n/lib/main.js b/right-trim-n/lib/main.js deleted file mode 100644 index c1a5e5a6..00000000 --- a/right-trim-n/lib/main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var splitGraphemeClusters = require( './../../split-grapheme-clusters' ); -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var isStringArray = require( '@stdlib/assert/is-string-array' ).primitives; -var replace = require( './../../replace' ); -var rescape = require( '@stdlib/utils/escape-regexp-string' ); -var format = require( './../../format' ); - - -// VARIABLES // - -var WHITESPACE_CHARS = '\u0020\f\n\r\t\v\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff'; - - -// MAIN // - -/** -* Trims `n` characters from the end of a string. -* -* @param {string} str - input string -* @param {NonNegativeInteger} n - number of characters to trim -* @param {(string|StringArray)} [chars] - characters to trim (defaults to whitespace characters) -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {TypeError} third argument must be a string or an array of strings -* @returns {string} trimmed string -* -* @example -* var str = ' abc '; -* var out = rtrimN( str, 2 ); -* // returns ' abc ' -* -* @example -* var str = ' abc '; -* var out = rtrimN( str, str.length ); -* // returns ' abc' -* -* @example -* var str = '~~abc!~~'; -* var out = rtrimN( str, str.length, [ '~', '!' ] ); -* // returns '~~abc' -* -* @example -* var str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨'; -* var out = rtrimN( str, str.length, '👨🏼‍🎨🤖' ); -* // returns '' -*/ -function rtrimN( str, n, chars ) { - var nElems; - var reStr; - var isStr; - var RE; - var i; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - if ( !isNonNegativeInteger( n ) ) { - throw new TypeError( format( 'invalid argument. Must provide a nonnegative integer. Value: `%s`.', n ) ); - } - if ( arguments.length > 2 ) { - isStr = isString( chars ); - if ( !isStr && !isStringArray( chars ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string or an array of strings. Value: `%s`.', chars ) ); - } - if ( isStr ) { - chars = splitGraphemeClusters( chars ); - } - nElems = chars.length - 1; - reStr = ''; - for ( i = 0; i < nElems; i++ ) { - reStr += rescape( chars[ i ] ); - reStr += '|'; - } - reStr += rescape( chars[ nElems ] ); - - // Case: Trim a specific set of characters from the end of a string.. - RE = new RegExp( '(?:' + reStr + '){0,'+n+'}$' ); - } else { - // Case: Trim `n` whitespace characters from the end of a string... - RE = new RegExp( '[' + WHITESPACE_CHARS + ']{0,'+n+'}$' ); - } - return replace( str, RE, '' ); -} - - -// EXPORTS // - -module.exports = rtrimN; diff --git a/right-trim-n/package.json b/right-trim-n/package.json deleted file mode 100644 index e6c43334..00000000 --- a/right-trim-n/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@stdlib/string/right-trim-n", - "version": "0.0.0", - "description": "Trim `n` characters from the end of a string.", - "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" - } - ], - "bin": { - "rtrimn": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "number", - "custom", - "characters", - "whitespace", - "remove", - "trim", - "trimming", - "replace" - ] -} diff --git a/right-trim-n/test/fixtures/stdin_error.js.txt b/right-trim-n/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/right-trim-n/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/right-trim-n/test/test.cli.js b/right-trim-n/test/test.cli.js deleted file mode 100644 index d625c81a..00000000 --- a/right-trim-n/test/test.cli.js +++ /dev/null @@ -1,266 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var EXEC_PATH = require( '@stdlib/process/exec-path' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface trims whitespace from the end of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep boop \'; process.argv[ 3 ] = \'--n=2\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep boop \n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop \n hello world"', - '|', - EXEC_PATH, - fpath, - '--n=3' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep boop\n hello world\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \' foo \t bar \t baz \'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'', - '--n=3' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), ' foo\n bar\n baz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \' foo \t bar \t baz \'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/', - '--n=3' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), ' foo\n bar\n baz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/right-trim-n/test/test.js b/right-trim-n/test/test.js deleted file mode 100644 index bec6b4eb..00000000 --- a/right-trim-n/test/test.js +++ /dev/null @@ -1,241 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 rtrimN = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof rtrimN, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'if the first argument is not a string primitive, the function throws an error', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - rtrimN( value, 2 ); - }; - } -}); - -tape( 'if the second argument is not a nonnegative integer, the function throws an error', function test( t ) { - var values; - var i; - - values = [ - '5', - -1, - -3.14, - null, - void 0, - true, - [], - {}, - 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() { - rtrimN( 'beep', value ); - }; - } -}); - -tape( 'if provided a third argument which is not a string or string array, the function throws an error', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - rtrimN( 'beep', 2, value ); - }; - } -}); - -tape( 'the function trims `n` right-most whitespace characters from a string', function test( t ) { - var expected; - var actual; - var str; - - str = '\t\tbeep\t\t'; - expected = '\t\tbeep'; - actual = rtrimN( str, 4 ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t\tbeep\t\t'; - expected = '\t\tbeep\t'; - actual = rtrimN( str, 1 ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t \nbeep\t \n'; - expected = '\t \nbeep'; - actual = rtrimN( str, str.length ); - - t.end(); -}); - -tape( 'the function trims `n` right-most whitespace characters from a string (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = '\u00A0\u00A0beep\u00A0\u00A0'; - expected = '\u00A0\u00A0beep'; - actual = rtrimN( str, 4 ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\u00A0\u00A0beep\u00A0\u00A0'; - expected = '\u00A0\u00A0beep\u00A0'; - actual = rtrimN( str, 1 ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\u00A0 \nbeep\u00A0 \n'; - expected = '\u00A0 \nbeep'; - actual = rtrimN( str, str.length ); - - t.end(); -}); - -tape( 'the function trims `n` right-most custom characters from a string when provided a string array as the third argument', function test( t ) { - var expected; - var actual; - var str; - - str = '\t\tbeep\t\t'; - expected = '\t\tbeep'; - actual = rtrimN( str, 4, [ '\t' ] ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t\tbeep\t\t'; - expected = '\t\tbeep\t\t'; - actual = rtrimN( str, 1, [ '\n' ] ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t \nbeep\t \n'; - expected = '\t \nbeep\t '; - actual = rtrimN( str, str.length, [ '\t', '\n' ] ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function trims `n` right-most custom characters from a string when provided a string array as the third argument (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = '\u00A0\u00A0beep\u00A0\u00A0'; - expected = '\u00A0\u00A0beep'; - actual = rtrimN( str, 4, [ '\u00A0' ] ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨'; - expected = ''; - actual = rtrimN( str, str.length, [ '🤖', '👨🏼‍🎨' ] ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function trims `n` right-most custom characters from a string when provided a string as the third argument', function test( t ) { - var expected; - var actual; - var str; - - str = '\t\tbeep\t\t'; - expected = '\t\tbeep'; - actual = rtrimN( str, 4, '\t' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t\tbeep\t\t'; - expected = '\t\tbeep\t\t'; - actual = rtrimN( str, 1, '\n' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '\t \nbeep\t \n'; - expected = '\t \nbeep\t '; - actual = rtrimN( str, str.length, '\t\n' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function trims `n` right-most custom characters from a string when provided a string as the third argument (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = '\u00A0\u00A0beep\u00A0\u00A0'; - expected = '\u00A0\u00A0beep'; - actual = rtrimN( str, 4, '\u00A0' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🤖👨🏼‍🎨🤖👨🏼‍🎨🤖👨🏼‍🎨'; - expected = ''; - actual = rtrimN( str, str.length, '👨🏼‍🎨🤖' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/right-trim/README.md b/right-trim/README.md deleted file mode 100644 index f7a379f3..00000000 --- a/right-trim/README.md +++ /dev/null @@ -1,209 +0,0 @@ - - -# rtrim - -> Trim whitespace characters from the end of a string. - -
- -## Usage - -```javascript -var rtrim = require( '@stdlib/string/right-trim' ); -``` - -#### rtrim( str ) - -Trims whitespace from the end of a string. - -```javascript -var out = rtrim( ' \t\t\n Beep \r\n\t ' ); -// returns ' \t\t\n Beep' -``` - -
- - - -
- -## Notes - -- Following [Unicode 6.3.0][unicode] and later, "whitespace" is defined as the following characters: - - - `\f` - - `\n` - - `\r` - - `\t` - - `\v` - - `\u0020` - - `\u00a0` - - `\u1680` - - `\u2000-\u200a` - - `\u2028` - - `\u2029` - - `\u202f` - - `\u205f` - - `\u3000` - - `\ufeff` - -
- - - -
- -## Examples - - - -```javascript -var rtrim = require( '@stdlib/string/right-trim' ); - -var out = rtrim( ' Whitespace ' ); -// returns ' Whitespace' - -out = rtrim( '\t\t\tTabs\t\t\t' ); -// returns '\t\t\tTabs' - -out = rtrim( '\n\n\nNew Lines\n\n\n' ); -// returns '\n\n\nNew Lines' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: rtrim [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $' foo \n bar ' | rtrim --split /\r?\n/ - - # Escaped... - $ echo -n $' foo \n bar ' | rtrim --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ rtrim 'beep boop ' -beep boop -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep boop ' | rtrim -beep boop -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n ' foo \t bar \t baz ' | rtrim --split '\t' - foo - bar - baz -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/right-trim/benchmark/benchmark.js b/right-trim/benchmark/benchmark.js deleted file mode 100644 index 51a241e1..00000000 --- a/right-trim/benchmark/benchmark.js +++ /dev/null @@ -1,90 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var rtrim = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( typeof String.prototype.trimRight !== 'function' ) -}; -var whitespace = '\\f\\n\\r\\t\\v\\u0020\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff'; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop' + whitespace, - 'foo bar' + whitespace, - 'abc xyz' + whitespace - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = rtrim( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::built-in', pkg ), opts, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop' + whitespace, - 'foo bar' + whitespace, - 'abc xyz' + whitespace - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = values[ i%values.length ].trimRight(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/right-trim/bin/cli b/right-trim/bin/cli deleted file mode 100755 index beb969ce..00000000 --- a/right-trim/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var rtrim = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( rtrim( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( rtrim( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/right-trim/docs/repl.txt b/right-trim/docs/repl.txt deleted file mode 100644 index b3e12745..00000000 --- a/right-trim/docs/repl.txt +++ /dev/null @@ -1,40 +0,0 @@ - -{{alias}}( str ) - Trims whitespace from the end of a string. - - "Whitespace" is defined as the following characters: - - - \f - - \n - - \r - - \t - - \v - - \u0020 - - \u00a0 - - \u1680 - - \u2000-\u200a - - \u2028 - - \u2029 - - \u202f - - \u205f - - \u3000 - - \ufeff - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Trimmed string. - - Examples - -------- - > var out = {{alias}}( ' \t\t\n Beep \r\n\t ' ) - ' \t\t\n Beep' - - See Also - -------- - diff --git a/right-trim/docs/types/index.d.ts b/right-trim/docs/types/index.d.ts deleted file mode 100644 index 0867bfd6..00000000 --- a/right-trim/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Trims whitespace characters from the end of a string. -* -* @param str - input string -* @returns trimmed string -* -* @example -* var out = rtrim( ' Whitespace ' ); -* // returns ' Whitespace' -* -* @example -* var out = rtrim( '\t\t\tTabs\t\t\t' ); -* // returns '\t\t\tTabs' -* -* @example -* var out = rtrim( '\n\n\nNew Lines\n\n\n' ); -* // returns '\n\n\nNew Lines' -*/ -declare function rtrim( str: string ): string; - - -// EXPORTS // - -export = rtrim; diff --git a/right-trim/docs/types/test.ts b/right-trim/docs/types/test.ts deleted file mode 100644 index 57a668cd..00000000 --- a/right-trim/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import rtrim = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - rtrim( ' Whitespace ' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - rtrim( true ); // $ExpectError - rtrim( false ); // $ExpectError - rtrim( null ); // $ExpectError - rtrim( undefined ); // $ExpectError - rtrim( 5 ); // $ExpectError - rtrim( [] ); // $ExpectError - rtrim( {} ); // $ExpectError - rtrim( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - rtrim(); // $ExpectError -} diff --git a/right-trim/docs/usage.txt b/right-trim/docs/usage.txt deleted file mode 100644 index af5113ef..00000000 --- a/right-trim/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: rtrim [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/right-trim/etc/cli_opts.json b/right-trim/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/right-trim/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/right-trim/examples/index.js b/right-trim/examples/index.js deleted file mode 100644 index cc93d444..00000000 --- a/right-trim/examples/index.js +++ /dev/null @@ -1,30 +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'; - -var rtrim = require( './../lib' ); - -console.log( rtrim( ' Whitespace ' ) ); -// => ' Whitespace' - -console.log( rtrim( '\t\t\tTabs\t\t\t' ) ); -// => '\t\t\tTabs' - -console.log( rtrim( '\n\n\nNew Lines\n\n\n' ) ); -// => '\n\n\nNew Lines' diff --git a/right-trim/lib/index.js b/right-trim/lib/index.js deleted file mode 100644 index a4060f0e..00000000 --- a/right-trim/lib/index.js +++ /dev/null @@ -1,46 +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'; - -/** -* Trim whitespace characters from the end of a string. -* -* @module @stdlib/string/right-trim -* -* @example -* var rtrim = require( '@stdlib/string/right-trim' ); -* -* var out = rtrim( ' Whitespace ' ); -* // returns ' Whitespace' -* -* out = rtrim( '\t\t\tTabs\t\t\t' ); -* // returns '\t\t\tTabs' -* -* out = rtrim( '\n\n\nNew Lines\n\n\n' ); -* // returns '\n\n\nNew Lines' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/right-trim/lib/main.js b/right-trim/lib/main.js deleted file mode 100644 index bb4cf810..00000000 --- a/right-trim/lib/main.js +++ /dev/null @@ -1,59 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/right-trim' ); - - -// MAIN // - -/** -* Trims whitespace from the end of a string. -* -* @param {string} str - input string -* @throws {TypeError} must provide a string -* @returns {string} trimmed string -* -* @example -* var out = rtrim( ' Whitespace ' ); -* // returns ' Whitespace' -* -* @example -* var out = rtrim( '\t\t\tTabs\t\t\t' ); -* // returns '\t\t\tTabs' -* -* @example -* var out = rtrim( '\n\n\nNew Lines\n\n\n' ); -* // returns '\n\n\nNew Lines' -*/ -function rtrim( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = rtrim; diff --git a/right-trim/package.json b/right-trim/package.json deleted file mode 100644 index ce74ed3d..00000000 --- a/right-trim/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/right-trim", - "version": "0.0.0", - "description": "Trim whitespace characters from the end of a string.", - "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" - } - ], - "bin": { - "rtrim": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "whitespace", - "remove", - "trim", - "trimming", - "replace" - ] -} diff --git a/right-trim/test/fixtures/stdin_error.js.txt b/right-trim/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/right-trim/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/right-trim/test/test.cli.js b/right-trim/test/test.cli.js deleted file mode 100644 index c158fbd7..00000000 --- a/right-trim/test/test.cli.js +++ /dev/null @@ -1,263 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface trims whitespace from the end of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep boop \'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep boop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop \n hello world"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep boop\n hello world\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \' foo \t bar \t baz \'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), ' foo\n bar\n baz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \' foo \t bar \t baz \'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), ' foo\n bar\n baz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/right-trim/test/test.js b/right-trim/test/test.js deleted file mode 100644 index 679b5146..00000000 --- a/right-trim/test/test.js +++ /dev/null @@ -1,183 +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 rtrim = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof rtrim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - false, - void 0, - NaN, - [], - {}, - 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() { - rtrim( value ); - }; - } -}); - -tape( 'the function removes all whitespace characters at the end of a string', function test( t ) { - var expected; - var actual; - - expected = ' Whitespace'; - actual = rtrim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '\t\t\tTabs'; - actual = rtrim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = '\n\n\nNew Lines'; - actual = rtrim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = ' \r\n \tBeep'; - actual = rtrim( ' \r\n \tBeep \r\n\t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = rtrim( 'beep\f' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = rtrim( 'beep\n' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = rtrim( 'beep\t' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = rtrim( 'beep\v' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = rtrim( 'beep\u1680' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2000' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2001' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2002' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2003' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2004' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2005' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2006' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2007' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2008' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2009' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = rtrim( 'beep\u200a' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2028' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = rtrim( 'beep\u2029' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = rtrim( 'beep\u202f' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = rtrim( 'beep\u205f' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = rtrim( 'beep\u3000' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = rtrim( 'beep\ufeff' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); - -tape( 'the function does not trim the Mongolian space separator in accordance with Unicode 6.3.0 and later', function test( t ) { - var expected; - var actual; - - expected = 'beep\u180e'; - actual = rtrim( 'beep\u180e' ); - t.strictEqual( actual, expected, 'does not remove \\u180e' ); - - t.end(); -}); diff --git a/snakecase/README.md b/snakecase/README.md deleted file mode 100644 index 09506de6..00000000 --- a/snakecase/README.md +++ /dev/null @@ -1,209 +0,0 @@ - - -# snakecase - -> Convert a string to snake case. - - - -
- -## Usage - -```javascript -var snakecase = require( '@stdlib/string/snakecase' ); -``` - -#### snakecase( str ) - -Converts a string to snake case. - -```javascript -var str = snakecase( 'Foo Bar' ); -// returns 'foo_bar' - -str = snakecase( 'I am a tiny little house' ); -// returns 'i_am_a_tiny_little_house' - -str = snakecase( 'Hello World!' ); -// returns 'hello_world' -``` - -
- - - - - -
- -## Examples - -```javascript -var snakecase = require( '@stdlib/string/snakecase' ); - -var str = 'foo bar baz'; -var out = snakecase( str ); -// returns 'foo_bar_baz' - -str = 'foo_baz'; -out = snakecase( str ); -// returns 'foo_baz' - -str = 'foo_bar_baz!'; -out = snakecase( str ); -// returns 'foo_bar_baz' - -str = 'beep boop!'; -out = snakecase( str ); -// returns 'beep_boop' - -str = 'foo-baz'; -out = snakecase( str ); -// returns 'foo_baz' - -str = 'Welcome! 😀'; -out = snakecase( str ); -// returns 'welcome_😀' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: snakecase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'beEp booP\nfooBar' | snakecase --split /\r?\n/ - - # Escaped... - $ echo -n $'beEp booP\nfooBar' | snakecase --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ snakecase 'hello world!' -hello_world -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beEp booP' | snakecase -beep_boop -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beEp booP\tfooBar' | snakecase --split '\t' -beep_boop -foo_bar -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/snakecase/benchmark/benchmark.js b/snakecase/benchmark/benchmark.js deleted file mode 100644 index 42fdcdf1..00000000 --- a/snakecase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var snakecase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = snakecase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/snakecase/bin/cli b/snakecase/bin/cli deleted file mode 100755 index 0b55e9f4..00000000 --- a/snakecase/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var snakecase = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( snakecase( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( snakecase( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/snakecase/docs/repl.txt b/snakecase/docs/repl.txt deleted file mode 100644 index 39cc133c..00000000 --- a/snakecase/docs/repl.txt +++ /dev/null @@ -1,23 +0,0 @@ - -{{alias}}( str ) - Converts a string to snake case. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Snake-cased string. - - Examples - -------- - > var out = {{alias}}( 'Hello World!' ) - 'hello_world' - > out = {{alias}}( 'I am a tiny little teapot' ) - 'i_am_a_tiny_little_teapot' - - See Also - -------- diff --git a/snakecase/docs/types/index.d.ts b/snakecase/docs/types/index.d.ts deleted file mode 100644 index 789e18d1..00000000 --- a/snakecase/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/** -* Converts a string to snake case. -* -* @param str - string to convert -* @returns snake-cased string -* -* @example -* var str = snakecase( 'fooBar' ); -* // returns 'foo_bar' -* -* @example -* var str = snakecase( 'foo-bar' ); -* // returns 'foo_bar' -* -* @example -* var str = snakecase( 'foo_bar' ); -* // returns 'foo_bar' -*/ -declare function snakecase( str: string ): string; - - -// EXPORTS // - -export = snakecase; diff --git a/snakecase/docs/types/test.ts b/snakecase/docs/types/test.ts deleted file mode 100644 index 2e6baad8..00000000 --- a/snakecase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import snakecase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - snakecase( 'Hello World!' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - snakecase( true ); // $ExpectError - snakecase( false ); // $ExpectError - snakecase( null ); // $ExpectError - snakecase( undefined ); // $ExpectError - snakecase( 5 ); // $ExpectError - snakecase( [] ); // $ExpectError - snakecase( {} ); // $ExpectError - snakecase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - snakecase(); // $ExpectError -} diff --git a/snakecase/docs/usage.txt b/snakecase/docs/usage.txt deleted file mode 100644 index 1c8ce254..00000000 --- a/snakecase/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: snakecase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/snakecase/etc/cli_opts.json b/snakecase/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/snakecase/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/snakecase/examples/index.js b/snakecase/examples/index.js deleted file mode 100644 index 838eb595..00000000 --- a/snakecase/examples/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 snakecase = require( './../lib' ); - -var str = 'foo bar baz'; -var out = snakecase( str ); -console.log( out ); -// => 'foo_bar_baz' - -str = 'foo_baz'; -out = snakecase( str ); -console.log( out ); -// => 'foo_baz' - -str = 'foo_bar_baz!'; -out = snakecase( str ); -console.log( out ); -// => 'foo_bar_baz' - -str = 'beep boop!'; -out = snakecase( str ); -console.log( out ); -// => 'beep_boop' - -str = 'foo_baz'; -out = snakecase( str ); -console.log( out ); -// => 'foo_baz' - -str = 'Welcome! 😀'; -out = snakecase( str ); -console.log( out ); -// => 'welcome_😀' diff --git a/snakecase/lib/index.js b/snakecase/lib/index.js deleted file mode 100644 index 36507651..00000000 --- a/snakecase/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to snake case. -* -* @module @stdlib/string/snakecase -* -* @example -* var snakecase = require( '@stdlib/string/snakecase' ); -* -* var str = snakecase( 'Foo Bar' ); -* // returns 'foo_bar' -* -* str = snakecase( 'I am a tiny little house' ); -* // returns 'i_am_a_tiny_little_house' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/snakecase/lib/main.js b/snakecase/lib/main.js deleted file mode 100644 index 08d43b3f..00000000 --- a/snakecase/lib/main.js +++ /dev/null @@ -1,67 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/snakecase' ); - - -// MAIN // - -/** -* Converts a string to snake case. -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {string} snake-cased string -* -* @example -* var str = snakecase( 'Hello World!' ); -* // returns 'hello_world' -* -* @example -* var str = snakecase( 'foo bar' ); -* // returns 'foo_bar' -* -* @example -* var str = snakecase( 'I am a tiny little teapot' ); -* // returns 'i_am_a_tiny_little_teapot' -* -* @example -* var str = snakecase( 'BEEP boop' ); -* // returns 'beep_boop' -* -* @example -* var str = snakecase( 'isMobile' ); -* // returns 'is_mobile' -*/ -function snakecase( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = snakecase; diff --git a/snakecase/package.json b/snakecase/package.json deleted file mode 100644 index 84e9a527..00000000 --- a/snakecase/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/snakecase", - "version": "0.0.0", - "description": "Convert a string to snake case.", - "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" - } - ], - "bin": { - "snakecase": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "case", - "convert", - "snake" - ], - "__stdlib__": {} -} diff --git a/snakecase/test/fixtures/stdin_error.js.txt b/snakecase/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/snakecase/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/snakecase/test/test.cli.js b/snakecase/test/test.cli.js deleted file mode 100644 index faf5fa70..00000000 --- a/snakecase/test/test.cli.js +++ /dev/null @@ -1,263 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a string argument to snake case', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'Hello World!\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'hello_world\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nisMobile"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep_boop\nis_mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep_boop\nis_mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep_boop\nis_mobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/snakecase/test/test.js b/snakecase/test/test.js deleted file mode 100644 index 0b900973..00000000 --- a/snakecase/test/test.js +++ /dev/null @@ -1,224 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 snakecase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof snakecase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - true, - false, - null, - void 0, - [], - {}, - function noop() {} - ]; - - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - snakecase( value ); - }; - } -}); - -tape( 'the function converts a string to snake case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo', - 'foo-bar', - 'fooBar', - 'foo_bar', - 'foo-bar-baz', - 'foo_bar_baz', - 'foo bar baz', - 'foo bar baz qux', - 'foo_bar_baz_qux', - 'foo_bar baz qux' - ]; - - expected = [ - 'foo', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar_baz', - 'foo_bar_baz', - 'foo_bar_baz', - 'foo_bar_baz_qux', - 'foo_bar_baz_qux', - 'foo_bar_baz_qux' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( snakecase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function converts a camel case string to snake case', function test( t ) { - var expected; - var actual; - var str; - - str = 'helloWorld'; - expected = 'hello_world'; - actual = snakecase( str ); - - str = 'isMobile'; - expected = 'is_mobile'; - actual = snakecase( str ); - - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); - -tape( 'the function converts a string with Unicode characters to snake case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'fóoBár', - 'ру́сский язык', - '😀😀 😀', - 'ру́сский язы́к', - 'Привет мир', - '안녕하세요', - '你好世界', - '신규 서비스' - ]; - expected = [ - 'fóo_bár', - 'ру́сский_язык', - '😀😀_😀', - 'ру́сский_язы́к', - 'привет_мир', - '안녕하세요', - '你好世界', - '신규_서비스' - ]; - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( snakecase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function converts a string with special characters to snake case', function test( t ) { - var expected; - var values; - var i; - - values = [ - 'foo!bar', - 'foo@bar', - 'foo#bar', - 'foo$bar', - 'foo%bar', - 'foo^bar', - 'foo&bar', - 'foo*bar', - 'foo(bar', - 'foo)bar', - 'foo[bar', - 'foo]bar', - 'foo{bar', - 'foo}bar', - 'foo|bar', - 'foo~bar', - 'foo:"bar', - 'foo\'bar', - 'foobar', - 'foo?bar', - 'foo/bar' - ]; - - expected = [ - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar', - 'foo_bar' - ]; - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( snakecase( values[i] ), expected[i], 'returns '+expected[i] ); - } - t.end(); -}); - -tape( 'the function returns a string unchanged if already in snake case', function test( t ) { - var expected; - var actual; - - expected = 'foo_bar'; - actual = snakecase( expected ); - t.strictEqual( actual, expected, 'returns expected value' ); - - expected = 'client_side_rendering'; - actual = snakecase( expected ); - t.strictEqual( actual, expected, 'returns expected value' ); - t.end(); -}); diff --git a/split-grapheme-clusters/README.md b/split-grapheme-clusters/README.md deleted file mode 100644 index 68fb2cba..00000000 --- a/split-grapheme-clusters/README.md +++ /dev/null @@ -1,122 +0,0 @@ - - -# splitGraphemeClusters - -> Split a string by its [grapheme cluster][unicode-text-segmentation] breaks. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var splitGraphemeClusters = require( '@stdlib/string/split-grapheme-clusters' ); -``` - -#### splitGraphemeClusters( str ) - -Splits a string by its [grapheme cluster][unicode-text-segmentation] breaks. - -```javascript -var out = splitGraphemeClusters( 'café' ); -// returns [ 'c', 'a', 'f', 'é' ] - -out = splitGraphemeClusters( '🍕🍕🍕' ); -// returns [ '🍕', '🍕', '🍕' ] -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var splitGraphemeClusters = require( '@stdlib/string/split-grapheme-clusters' ); - -var out = splitGraphemeClusters( 'abc' ); -// returns [ 'a', 'b', 'c' ] - -out = splitGraphemeClusters( 'Iñtërnâtiônàlizætiøn' ); -// returns [ 'I', 'ñ', 't', 'ë', 'r', 'n', 'â', 't', 'i', 'ô', 'n', 'à', 'l', 'i', 'z', 'æ', 't', 'i', 'ø', 'n' ] - -out = splitGraphemeClusters( '\uD834\uDD1E' ); -// returns [ '𝄞' ] - -out = splitGraphemeClusters( '! !' ); -// returns [ '!', ' ', '!' ] - -out = splitGraphemeClusters( '' ); -// returns [] -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/split-grapheme-clusters/benchmark/benchmark.js b/split-grapheme-clusters/benchmark/benchmark.js deleted file mode 100644 index ed1f21ce..00000000 --- a/split-grapheme-clusters/benchmark/benchmark.js +++ /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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var fromCodePoint = require( './../../from-code-point' ); -var UNICODE_MAX = require( '@stdlib/constants/unicode/max' ); -var randu = require( '@stdlib/random/base/randu' ); -var floor = require( '@stdlib/math/base/special/floor' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var splitGraphemeClusters = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var str; - var out; - var i; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - str = fromCodePoint( floor( randu() * UNICODE_MAX ) ) + 'eep boop'; - out = splitGraphemeClusters( str ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an array' ); - } - } - b.toc(); - if ( !isArray( out ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/split-grapheme-clusters/docs/repl.txt b/split-grapheme-clusters/docs/repl.txt deleted file mode 100644 index 35774260..00000000 --- a/split-grapheme-clusters/docs/repl.txt +++ /dev/null @@ -1,25 +0,0 @@ - -{{alias}}( str ) - Splits a string by its grapheme cluster breaks. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: Array - Array of grapheme clusters. - - Examples - -------- - > var out = {{alias}}( 'Hello!' ) - [ 'H', 'e', 'l', 'l', 'o', '!' ] - > out = {{alias}}( '𠮷' ) - [ '𠮷' ] - > out = {{alias}}( '' ) - [] - - See Also - -------- diff --git a/split-grapheme-clusters/docs/types/index.d.ts b/split-grapheme-clusters/docs/types/index.d.ts deleted file mode 100644 index 297bc776..00000000 --- a/split-grapheme-clusters/docs/types/index.d.ts +++ /dev/null @@ -1,40 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Splits a string by its grapheme cluster breaks. -* -* @param str - input string -* @returns array of grapheme clusters -* -* @example -* var out = splitGraphemeClusters( 'café' ); -* // returns [ 'c', 'a', 'f', 'é' ] -* -* @example -* var out = splitGraphemeClusters( '🍕🍕🍕' ); -* // returns [ '🍕', '🍕', '🍕' ] -*/ -declare function splitGraphemeClusters( str: string ): Array; - - -// EXPORTS // - -export = splitGraphemeClusters; diff --git a/split-grapheme-clusters/docs/types/test.ts b/split-grapheme-clusters/docs/types/test.ts deleted file mode 100644 index 494b77fa..00000000 --- a/split-grapheme-clusters/docs/types/test.ts +++ /dev/null @@ -1,45 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import splitGraphemeClusters = require( './index' ); - - -// TESTS // - -// The function returns an array of strings... -{ - splitGraphemeClusters( 'abc' ); // $ExpectType string[] - splitGraphemeClusters( '' ); // $ExpectType string[] -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - splitGraphemeClusters( true ); // $ExpectError - splitGraphemeClusters( false ); // $ExpectError - splitGraphemeClusters( null ); // $ExpectError - splitGraphemeClusters( undefined ); // $ExpectError - splitGraphemeClusters( 5 ); // $ExpectError - splitGraphemeClusters( [] ); // $ExpectError - splitGraphemeClusters( {} ); // $ExpectError - splitGraphemeClusters( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - splitGraphemeClusters(); // $ExpectError -} diff --git a/split-grapheme-clusters/examples/index.js b/split-grapheme-clusters/examples/index.js deleted file mode 100644 index cd73bb82..00000000 --- a/split-grapheme-clusters/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 splitGraphemeClusters = require( './../lib' ); - -var out = splitGraphemeClusters( 'abc' ); -console.log( out ); -// => [ 'a', 'b', 'c' ] - -out = splitGraphemeClusters( 'Iñtërnâtiônàlizætiøn' ); -console.log( out ); -// => [ 'I', 'ñ', 't', 'ë', 'r', 'n', 'â', 't', 'i', 'ô', 'n', 'à', 'l', 'i', 'z', 'æ', 't', 'i', 'ø', 'n' ] - -out = splitGraphemeClusters( '\uD834\uDD1E' ); -console.log( out ); -// => [ '𝄞' ] - -out = splitGraphemeClusters( '! !' ); -console.log( out ); -// => [ '!', ' ', '!' ] - -out = splitGraphemeClusters( '' ); -console.log( out ); -// => [] diff --git a/split-grapheme-clusters/lib/index.js b/split-grapheme-clusters/lib/index.js deleted file mode 100644 index e1f3061c..00000000 --- a/split-grapheme-clusters/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Split a string by its grapheme cluster breaks. -* -* @module @stdlib/string/split-grapheme-clusters -* -* @example -* var splitGraphemeClusters = require( '@stdlib/string/split-grapheme-clusters' ); -* -* var out = splitGraphemeClusters( 'café' ); -* // returns [ 'c', 'a', 'f', 'é' ] -* -* out = splitGraphemeClusters( '🍕🍕🍕' ); -* // returns [ '🍕', '🍕', '🍕' ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/split-grapheme-clusters/lib/main.js b/split-grapheme-clusters/lib/main.js deleted file mode 100644 index 9c702253..00000000 --- a/split-grapheme-clusters/lib/main.js +++ /dev/null @@ -1,71 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var nextGraphemeClusterBreak = require( './../../next-grapheme-cluster-break' ); -var format = require( './../../format' ); - - -// MAIN // - -/** -* Splits a string by its grapheme cluster breaks. -* -* @param {string} str - input string -* @throws {TypeError} must provide a string primitive -* @returns {StringArray} array of grapheme clusters -* -* @example -* var out = splitGraphemeClusters( 'café' ); -* // returns [ 'c', 'a', 'f', 'é' ] -* -* @example -* var out = splitGraphemeClusters( '🍕🍕🍕' ); -* // returns [ '🍕', '🍕', '🍕' ] -*/ -function splitGraphemeClusters( str ) { - var idx; - var brk; - var out; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - idx = 0; - out = []; - if ( str.length === 0 ) { - return out; - } - brk = nextGraphemeClusterBreak( str, idx ); - while ( brk !== -1 ) { - out.push( str.substring( idx, brk ) ); - idx = brk; - brk = nextGraphemeClusterBreak( str, idx ); - } - out.push( str.substring( idx ) ); - return out; -} - - -// EXPORTS // - -module.exports = splitGraphemeClusters; diff --git a/split-grapheme-clusters/package.json b/split-grapheme-clusters/package.json deleted file mode 100644 index ef7e7628..00000000 --- a/split-grapheme-clusters/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/split-grapheme-clusters", - "version": "0.0.0", - "description": "Split a string by its grapheme cluster breaks.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "unicode", - "grapheme", - "segmentation", - "surrogate", - "astral", - "emojis" - ] -} diff --git a/split-grapheme-clusters/test/test.js b/split-grapheme-clusters/test/test.js deleted file mode 100644 index 28910b57..00000000 --- a/split-grapheme-clusters/test/test.js +++ /dev/null @@ -1,117 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 splitGraphemeClusters = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof splitGraphemeClusters, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - 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() { - splitGraphemeClusters( value ); - }; - } -}); - -tape( 'the function returns an empty array if provided an empty string', function test( t ) { - t.deepEqual( splitGraphemeClusters( '' ), [], 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns an array of grapheme clusters', function test( t ) { - var expected; - var actual; - var str; - var i; - - str = 'abc'; - expected = [ 'a', 'b', 'c' ]; - actual = splitGraphemeClusters( str ); - - t.strictEqual( actual.length, expected.length, 'expected length' ); - for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( actual[ i ], expected[ i ], 'expected value' ); - } - t.end(); -}); - -tape( 'the function returns an array of grapheme clusters when provided a string with combining marks', function test( t ) { - var expected; - var actual; - var str; - var i; - - str = 'a\u0300b\u0301c\u0302'; - expected = [ 'à', 'b́', 'ĉ' ]; - actual = splitGraphemeClusters( str ); - - t.strictEqual( actual.length, expected.length, 'expected length' ); - for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( actual[ i ], expected[ i ], 'expected value' ); - } - t.end(); -}); - -tape( 'the function returns an array of grapheme clusters when provided a string with combining marks and a surrogate pair', function test( t ) { - var expected; - var actual; - var str; - var i; - - str = 'a\u0300b\u0301c\u0302\uD834\uDD1E!'; - expected = [ 'à', 'b́', 'ĉ', '𝄞', '!' ]; - actual = splitGraphemeClusters( str ); - - t.strictEqual( actual.length, expected.length, 'expected length' ); - for ( i = 0; i < actual.length; i++ ) { - t.strictEqual( actual[ i ], expected[ i ], 'expected value' ); - } - t.end(); -}); diff --git a/startcase/README.md b/startcase/README.md deleted file mode 100644 index 7c0f5f1f..00000000 --- a/startcase/README.md +++ /dev/null @@ -1,167 +0,0 @@ - - -# startcase - -> Capitalize the first letter of each word in a string. - -
- -
- - - -
- -## Usage - -```javascript -var startcase = require( '@stdlib/string/startcase' ); -``` - -#### startcase( str ) - -Capitalizes the first letter of each word in a string. - -```javascript -var str = startcase( 'beep boop a foo bar' ); -// returns 'Beep Boop A Foo Bar' -``` - -
- - - -
- -## Examples - - - -```javascript -var startcase = require( '@stdlib/string/startcase' ); - -var str = startcase( 'beep boop foo bar' ); -// returns 'Beep Boop Foo Bar' - -str = startcase( 'Beep' ); -// returns 'Beep' - -str = startcase( 'BeEp' ); -// returns 'BeEp' - -str = startcase( '$**_beep_BoOp_**$' ); -// returns '$**_beep_BoOp_**$' - -str = startcase( '' ); -// returns '' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: startcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. -``` - -
- - - - - -
- -
- - - -
- -### Examples - -```bash -$ startcase 'beep boop foo bar' -Beep Boop Foo Bar -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'beep boop foo bar' | startcase -Beep Boop Foo Bar -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/startcase/benchmark/benchmark.js b/startcase/benchmark/benchmark.js deleted file mode 100644 index 2b1d8b98..00000000 --- a/startcase/benchmark/benchmark.js +++ /dev/null @@ -1,55 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var startcase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = startcase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/startcase/bin/cli b/startcase/bin/cli deleted file mode 100755 index 3e6434be..00000000 --- a/startcase/bin/cli +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var startcase = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - return stdin( onRead ); - } - console.log( startcase( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - if ( error ) { - return cli.error( error ); - } - console.log( startcase( data.toString() ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/startcase/docs/repl.txt b/startcase/docs/repl.txt deleted file mode 100644 index 666e4151..00000000 --- a/startcase/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( str ) - Capitalizes the first letter of each word in an input string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - String containing words where each first letter is capitalized. - - Examples - -------- - > var out = {{alias}}( 'beep boop' ) - 'Beep Boop' - - See Also - -------- - diff --git a/startcase/docs/types/index.d.ts b/startcase/docs/types/index.d.ts deleted file mode 100644 index 0866446f..00000000 --- a/startcase/docs/types/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Capitalizes the first letter of each word in an input string. -* -* @param str - string to convert -* @returns start-cased string -* -* @example -* var str = startcase( 'beep boop foo bar' ); -* // returns 'Beep Boop Foo Bar' -*/ -declare function startcase( str: string ): string; - - -// EXPORTS // - -export = startcase; diff --git a/startcase/docs/types/test.ts b/startcase/docs/types/test.ts deleted file mode 100644 index 6f63595f..00000000 --- a/startcase/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import startcase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - startcase( 'Last man standing' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - startcase( true ); // $ExpectError - startcase( false ); // $ExpectError - startcase( null ); // $ExpectError - startcase( undefined ); // $ExpectError - startcase( 5 ); // $ExpectError - startcase( [] ); // $ExpectError - startcase( {} ); // $ExpectError - startcase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - startcase(); // $ExpectError -} diff --git a/startcase/docs/usage.txt b/startcase/docs/usage.txt deleted file mode 100644 index fa2bfe2d..00000000 --- a/startcase/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: startcase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - diff --git a/startcase/etc/cli_opts.json b/startcase/etc/cli_opts.json deleted file mode 100644 index f245a17e..00000000 --- a/startcase/etc/cli_opts.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/startcase/examples/index.js b/startcase/examples/index.js deleted file mode 100644 index 3e30086d..00000000 --- a/startcase/examples/index.js +++ /dev/null @@ -1,41 +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'; - -var startcase = require( './../lib' ); - -var str = startcase( 'beep boop foo bar' ); -console.log( str ); -// => 'Beep Boop Foo Bar' - -str = startcase( 'Beep' ); -console.log( str ); -// => 'Beep' - -str = startcase( 'BeEp' ); -console.log( str ); -// => 'BeEp' - -str = startcase( '$**_beep_BoOp_**$' ); -console.log( str ); -// => '$**_beep_BoOp_**$' - -str = startcase( '' ); -console.log( str ); -// => '' diff --git a/startcase/lib/index.js b/startcase/lib/index.js deleted file mode 100644 index 65c4b20d..00000000 --- a/startcase/lib/index.js +++ /dev/null @@ -1,40 +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'; - -/** -* Capitalize the first letter of each word in an input string. -* -* @module @stdlib/string/startcase -* -* @example -* var startcase = require( '@stdlib/string/startcase' ); -* -* var str = startcase( 'beep boop foo bar' ); -* // returns 'Beep Boop Foo Bar' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/startcase/lib/main.js b/startcase/lib/main.js deleted file mode 100644 index 091d9e3e..00000000 --- a/startcase/lib/main.js +++ /dev/null @@ -1,51 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/startcase' ); - - -// MAIN // - -/** -* Capitalizes the first letter of each word in an input string. -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {string} start case string -* -* @example -* var str = startcase( 'beep boop foo bar' ); -* // returns 'Beep Boop Foo Bar' -*/ -function startcase( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = startcase; diff --git a/startcase/package.json b/startcase/package.json deleted file mode 100644 index 0b88acb5..00000000 --- a/startcase/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@stdlib/string/startcase", - "version": "0.0.0", - "description": "Capitalize the first letter of each word in a string.", - "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" - } - ], - "bin": { - "startcase": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "upper", - "case", - "start", - "title", - "startcase", - "uppercase", - "capitalize", - "convert", - "string", - "str" - ] -} diff --git a/startcase/test/fixtures/stdin_error.js.txt b/startcase/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 452e3afe..00000000 --- a/startcase/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'BEEP' ) ); -} diff --git a/startcase/test/test.cli.js b/startcase/test/test.cli.js deleted file mode 100644 index e70ee9dc..00000000 --- a/startcase/test/test.cli.js +++ /dev/null @@ -1,219 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a string argument to startcase', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep boop foo bar\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'Beep Boop Foo Bar\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\'', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'Beep Boop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: BEEP\n', 'expected value' ); - t.end(); - } -}); diff --git a/startcase/test/test.js b/startcase/test/test.js deleted file mode 100644 index 4bf87c1a..00000000 --- a/startcase/test/test.js +++ /dev/null @@ -1,93 +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 startcase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof startcase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - startcase( value ); - }; - } -}); - -tape( 'the function converts a string to start case', function test( t ) { - var expected; - var values; - var actual; - var i; - - values = [ - 'beep boop a foo bar', - 'beep\nboop', - 'beep', - 'Beep', - 'BeEp', - 'Beep BOOP', - '$**_Beep_BoOp_**$', - '' - ]; - expected = [ - 'Beep Boop A Foo Bar', - 'Beep\nBoop', - 'Beep', - 'Beep', - 'BeEp', - 'Beep BOOP', - '$**_Beep_BoOp_**$', - '' - ]; - for ( i = 0; i < values.length; i++ ) { - actual = startcase( values[i] ); - t.strictEqual( actual, expected[i], 'converts string to '+expected[i] ); - } - t.end(); -}); diff --git a/starts-with/README.md b/starts-with/README.md deleted file mode 100644 index 48cfb4cd..00000000 --- a/starts-with/README.md +++ /dev/null @@ -1,235 +0,0 @@ - - -# startsWith - -> Test if a string starts with the characters of another string. - -
- -
- - - -
- -## Usage - -```javascript -var startsWith = require( '@stdlib/string/starts-with' ); -``` - -#### startsWith( str, search\[, position] ) - -Tests if a string starts with the characters of another string. - -```javascript -var str = 'To be, or not to be, that is the question.'; - -var bool = startsWith( str, 'To be' ); -// returns true - -bool = startsWith( str, 'to be' ); -// returns false -``` - -By default, the function searches from the beginning of the input string. To search from a different character index, provide a `position` value (zero-based). If provided a negative `position`, the start index is determined relative to the string end (i.e., `pos = str.length + position`). - -```javascript -var str = 'Remember the story I used to tell you when you were a boy?'; - -var bool = startsWith( str, 'the story' ); -// returns false - -bool = startsWith( str, 'the story', 9 ); -// returns true - -bool = startsWith( str, 'you', -15 ); -// returns true -``` - -If provided an empty `search` string, the function **always** returns `true`. - -```javascript -var str = 'beep boop'; - -var bool = startsWith( str, '' ); -// returns true -``` - -
- - - -
- -## Notes - -- This function differs from [`String.prototype.startsWith`][mdn-string-startswith] in the following ways: - - - The function requires string values for the first and second arguments and requires that the `position` argument be an integer value. - - The function does **not** clamp negative `position` values. Instead, when provided a negative `position`, the function resolves the starting search position relative to the end of the string. - - Except when provided an empty `search` string, the function **always** returns `false` if a `position` resolves to a starting search position which exceeds the bounds of the input string. - -
- - - -
- -## Examples - - - -```javascript -var startsWith = require( '@stdlib/string/starts-with' ); - -var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; - -var bool = startsWith( str, 'Fair' ); -// returns true - -bool = startsWith( str, 'fair' ); -// returns false - -bool = startsWith( str, 'foul', 8 ); -// returns true - -bool = startsWith( str, 'filthy', -10 ); -// returns true -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: starts-with [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --pos int Search position. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'Hello, World!\nBeep Boop Baz' | starts-with --search=Beep --split /\r?\n/ - - # Escaped... - $ echo -n $'Hello, World!\nBeep Boop Baz' | starts-with --search=Beep --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ starts-with --search=be beep -true -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'boop' | starts-with --search=bo -true -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'Hello, World!\tBeep Boop' | starts-with --search=Beep --split '\t' -false -true -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/starts-with/benchmark/benchmark.js b/starts-with/benchmark/benchmark.js deleted file mode 100644 index 0b4eb14e..00000000 --- a/starts-with/benchmark/benchmark.js +++ /dev/null @@ -1,149 +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' ); -var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var startsWith = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': typeof String.prototype.startsWith !== 'function' -}; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'To be', - 'To ba', - 'To bi' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = startsWith( str, values[ i%values.length ] ); - 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(); -}); - -bench( format( '%s::substring', pkg ), function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'to be', - 'to ba', - 'to bi' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = startsWith( str, values[ i%values.length ], 14 ); - 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(); -}); - -bench( format( '%s::builtin', pkg ), opts, function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'To be', - 'To ba', - 'To bi' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = str.startsWith( values[ i%values.length ] ); - 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(); -}); - -bench( format( '%s::builtin,substring', pkg ), opts, function benchmark( b ) { - var values; - var bool; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - values = [ - 'to be', - 'to ba', - 'to bi' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - bool = str.startsWith( values[ i%values.length ], 14 ); - 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/starts-with/bin/cli b/starts-with/bin/cli deleted file mode 100755 index b9659954..00000000 --- a/starts-with/bin/cli +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var startsWith = require( '@stdlib/string/base/starts-with' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - var pos; - var str; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - if ( args.length ) { - str = args[ 0 ]; - } else { - // Treat an empty value as an empty string: - str = ''; - } - if ( flags.pos ) { - pos = parseInt( flags.pos, 10 ); - } else { - pos = 0; - } - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( startsWith( str, flags.search, pos ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( startsWith( lines[ i ], flags.search, pos ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/starts-with/docs/repl.txt b/starts-with/docs/repl.txt deleted file mode 100644 index 14605829..00000000 --- a/starts-with/docs/repl.txt +++ /dev/null @@ -1,41 +0,0 @@ - -{{alias}}( str, search[, position] ) - Tests if a string starts with the characters of another string. - - If provided an empty search string, the function always returns `true`. - - Parameters - ---------- - str: string - Input string. - - search: string - Search string. - - position: integer (optional) - Position at which to start searching for `search`. If less than `0`, the - start position is determined relative to the end of the input string. - Default: 0. - - Returns - ------- - bool: boolean - Boolean indicating whether a string starts with the characters of - another string. - - Examples - -------- - > var bool = {{alias}}( 'Beep', 'Be' ) - true - > bool = {{alias}}( 'Beep', 'ep' ) - false - > bool = {{alias}}( 'Beep', 'ee', 1 ) - true - > bool = {{alias}}( 'Beep', 'ee', -3 ) - true - > bool = {{alias}}( 'Beep', '' ) - true - - See Also - -------- - diff --git a/starts-with/docs/types/index.d.ts b/starts-with/docs/types/index.d.ts deleted file mode 100644 index 3a0b3704..00000000 --- a/starts-with/docs/types/index.d.ts +++ /dev/null @@ -1,62 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Tests if a string starts with the characters of another string. -* -* ## Notes -* -* - If provided a negative `position`, the search starting position is resolved relative to the end of the string. For example, if provided the input string `'beep boop'` and a `position` equal to `-2`, the starting position resolves to `7`. -* -* @param str - input string -* @param search - search string -* @param position - position at which to start searching (default: 0) -* @returns boolean indicating if the input string starts with the search string -* -* @example -* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember' ); -* // returns true -* -* @example -* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember' ); -* // returns false -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be' ); -* // returns true -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be' ); -* // returns false -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 ); -* // returns true -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 ); -* // returns true -*/ -declare function startsWith( str: string, search: string, position?: number ): boolean; - - -// EXPORTS // - -export = startsWith; diff --git a/starts-with/docs/types/test.ts b/starts-with/docs/types/test.ts deleted file mode 100644 index 33ab42f2..00000000 --- a/starts-with/docs/types/test.ts +++ /dev/null @@ -1,59 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import startsWith = require( './index' ); - - -// TESTS // - -// The function returns a boolean... -{ - startsWith( 'abd', 'd' ); // $ExpectType boolean - startsWith( 'abd', 'b', 1 ); // $ExpectType boolean - startsWith( 'abd', 'ab', 1 ); // $ExpectType boolean -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - startsWith( true, 'd' ); // $ExpectError - startsWith( false, 'd' ); // $ExpectError - startsWith( 3, 'd', 0 ); // $ExpectError - startsWith( [], 'd', 0 ); // $ExpectError - startsWith( {}, 'd', 0 ); // $ExpectError - startsWith( ( x: number ): number => x, 'd', 0 ); // $ExpectError - - startsWith( 'abd', true ); // $ExpectError - startsWith( 'abd', false ); // $ExpectError - startsWith( 'abd', 5 ); // $ExpectError - startsWith( 'abd', [], 0 ); // $ExpectError - startsWith( 'abd', {}, 0 ); // $ExpectError - startsWith( 'abd', ( x: number ): number => x, 0 ); // $ExpectError - - startsWith( 'abd', 'a', true ); // $ExpectError - startsWith( 'abd', 'a', false ); // $ExpectError - startsWith( 'abd', 'a', '5' ); // $ExpectError - startsWith( 'abd', 'b', [] ); // $ExpectError - startsWith( 'abd', 'b', {} ); // $ExpectError - startsWith( 'abd', 'b', /[a-z]/ ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - startsWith(); // $ExpectError - startsWith( 'abc' ); // $ExpectError -} diff --git a/starts-with/docs/usage.txt b/starts-with/docs/usage.txt deleted file mode 100644 index 2fe4cc29..00000000 --- a/starts-with/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: starts-with [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --pos int Search position. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/starts-with/etc/cli_opts.json b/starts-with/etc/cli_opts.json deleted file mode 100644 index 0b562c89..00000000 --- a/starts-with/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "string": [ - "search", - "pos", - "split" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/starts-with/examples/index.js b/starts-with/examples/index.js deleted file mode 100644 index 9764da01..00000000 --- a/starts-with/examples/index.js +++ /dev/null @@ -1,35 +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'; - -var startsWith = require( './../lib' ); - -var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; - -console.log( startsWith( str, 'Fair' ) ); -// => true - -console.log( startsWith( str, 'fair' ) ); -// => false - -console.log( startsWith( str, 'foul', 8 ) ); -// => true - -console.log( startsWith( str, 'filthy', -10 ) ); -// => true diff --git a/starts-with/lib/index.js b/starts-with/lib/index.js deleted file mode 100644 index 1a5c1a04..00000000 --- a/starts-with/lib/index.js +++ /dev/null @@ -1,50 +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'; - -/** -* Test if a string starts with the characters of another string. -* -* @module @stdlib/string/starts-with -* -* @example -* var startsWith = require( '@stdlib/string/starts-with' ); -* -* var str = 'Fair is foul, and foul is fair, hover through fog and filthy air'; -* var bool = startsWith( str, 'Fair' ); -* // returns true -* -* bool = startsWith( str, 'fair' ); -* // returns false -* -* bool = startsWith( str, 'foul', 8 ); -* // returns true -* -* bool = startsWith( str, 'filthy', -10 ); -* // returns true -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/starts-with/lib/main.js b/starts-with/lib/main.js deleted file mode 100644 index 1cc9e393..00000000 --- a/starts-with/lib/main.js +++ /dev/null @@ -1,88 +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 isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/starts-with' ); - - -// MAIN // - -/** -* Tests if a string starts with the characters of another string. -* -* @param {string} str - input string -* @param {string} search - search string -* @param {integer} [position=0] - position at which to start searching -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a string -* @throws {TypeError} third argument must be an integer -* @returns {boolean} boolean indicating if the input string starts with the search string -* -* @example -* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember' ); -* // returns true -* -* @example -* var bool = startsWith( 'Remember the story I used to tell you when you were a boy?', 'Remember, remember' ); -* // returns false -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'To be' ); -* // returns true -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be' ); -* // returns false -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'to be', 14 ); -* // returns true -* -* @example -* var bool = startsWith( 'To be, or not to be, that is the question.', 'quest', -9 ); -* // returns true -*/ -function startsWith( str, search, position ) { - var pos; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isString( search ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) ); - } - if ( arguments.length > 2 ) { - if ( !isInteger( position ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', position ) ); - } - pos = position; - } else { - pos = 0; - } - return base( str, search, pos ); -} - - -// EXPORTS // - -module.exports = startsWith; diff --git a/starts-with/package.json b/starts-with/package.json deleted file mode 100644 index fe9fa319..00000000 --- a/starts-with/package.json +++ /dev/null @@ -1,72 +0,0 @@ -{ - "name": "@stdlib/string/starts-with", - "version": "0.0.0", - "description": "Test if a string starts with the characters of another string.", - "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" - } - ], - "bin": { - "starts-with": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "check", - "begins", - "begin", - "starts", - "start", - "test", - "search", - "match" - ] -} diff --git a/starts-with/test/fixtures/stdin_error.js.txt b/starts-with/test/fixtures/stdin_error.js.txt deleted file mode 100644 index d2894155..00000000 --- a/starts-with/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,34 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; -proc.stdin.write = '--search=beep'; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/starts-with/test/test.cli.js b/starts-with/test/test.cli.js deleted file mode 100644 index 6413fbaa..00000000 --- a/starts-with/test/test.cli.js +++ /dev/null @@ -1,290 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var replace = require( './../../replace' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints either `true` or `false` to `stdout` indicating whether a string starts with the characters of another string', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=beep\'; process.argv[ 3 ] = \'beepboop\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'true\n', true, 'prints `true` to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints either `true` or `false` to `stdout` indicating whether a string starts with the characters of another string (options: pos)', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=foul\'; process.argv[ 3 ] = \'--pos=8\'; process.argv[ 4 ] = \'Fair is foul, and foul is fair\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'true\n', true, 'prints `true` to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep\nboop"', - '|', - EXEC_PATH, - fpath, - '--search=be' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'true\nfalse\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'', - '--search=beep' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'true\nfalse\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep\tboop\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/', - '--search=beep' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'true\nfalse\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/starts-with/test/test.js b/starts-with/test/test.js deleted file mode 100644 index 86d7f9e0..00000000 --- a/starts-with/test/test.js +++ /dev/null @@ -1,241 +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 startsWith = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof startsWith, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if the first argument is not a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - false, - void 0, - NaN, - [], - {}, - 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() { - startsWith( value, 'abc' ); - }; - } -}); - -tape( 'the function throws an error if the second argument is not a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - false, - void 0, - NaN, - [], - {}, - 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() { - startsWith( 'abc', value ); - }; - } -}); - -tape( 'the function throws an error if the third argument is not an integer', function test( t ) { - var values; - var i; - - values = [ - '5', - 5.5, - null, - true, - false, - void 0, - NaN, - [], - {}, - 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() { - startsWith( 'abc', 'a', value ); - }; - } -}); - -tape( 'the function returns `true` if the input string starts with the search value', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'Too' ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Not too late, I\'m afraid', 'Not' ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome home' ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome home!' ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if the input string does not start with the search value', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'too' ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Not too late, I\'m afraid', 'Never' ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Welcome home!', 'Welcome at home' ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing a starting search position relative to the beginning of an input string (positive)', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'late', 3 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'late', 4 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'late', 5 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afraid', 14 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function supports providing a starting search position relative to the end of an input string (negative)', function test( t ) { - var bool; - - bool = startsWith( 'Too late, I\'m afraid', 'i', -2 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -7 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -6 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afr', -5 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'Too late, I\'m afraid', 'afraid', -6 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input string length', function test( t ) { - var bool = startsWith( 'abc', 'abcde' ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a search string which exceeds the input (sub)string length', function test( t ) { - var bool; - - bool = startsWith( 'abc', 'bcd', 1 ); - t.strictEqual( bool, false, 'returns expected value' ); - - bool = startsWith( 'abc', 'bcd', -2 ); - t.strictEqual( bool, false, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `true` if provided an empty search string', function test( t ) { - var bool; - - bool = startsWith( '', '' ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '' ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', 10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', -10 ); - t.strictEqual( bool, true, 'returns expected value' ); - - bool = startsWith( 'abc', '', 0 ); - t.strictEqual( bool, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns `false` if provided a position exceeding the input string length (positive)', function test( t ) { - var bool = startsWith( 'abc', 'c', 99999 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); - -tape( 'the function returns `false` if provided a position exceeding the input string length (negative)', function test( t ) { - var bool = startsWith( 'abc', 'a', -5 ); - t.strictEqual( bool, false, 'returns expected value' ); - t.end(); -}); diff --git a/stats_browser.html b/stats_browser.html new file mode 100644 index 00000000..06387eb6 --- /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 00000000..4f065ab0 --- /dev/null +++ b/stats_node.html @@ -0,0 +1,4842 @@ + + + + + + + + Rollup Visualizer + + + +
+ + + + + diff --git a/substring-after-last/README.md b/substring-after-last/README.md deleted file mode 100644 index 6a040d1d..00000000 --- a/substring-after-last/README.md +++ /dev/null @@ -1,244 +0,0 @@ - - -# substringAfterLast - -> Return the part of a string after the last occurrence of a specified substring. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var substringAfterLast = require( '@stdlib/string/substring-after-last' ); -``` - -#### substringAfterLast( str, search\[, fromIndex] ) - -Returns the part of a string after the last occurrence of a specified substring. - -```javascript -var str = 'beep boop'; -var out = substringAfterLast( str, 'b' ); -// returns 'oop' - -out = substringAfterLast( str, 'o' ); -// returns 'p' -``` - -By default, the search starts at the end of the string and proceeds backwards to the beginning. To start the search at a specified index, specify an integer for the `fromIndex` argument. - -```javascript -var str = 'beep boop'; -var out = substringAfterLast( str, 'b', 3 ); -// returns 'eep boop' -``` - -
- - - - - -
- -## Notes - -- If a substring is not present in a provided string, the function returns an empty string. -- If provided an empty substring, the function returns an empty string. - -
- - - - - -
- -## Examples - - - -```javascript -var substringAfterLast = require( '@stdlib/string/substring-after-last' ); - -var str = 'To be, or not to be, that is the question.'; -var out = substringAfterLast( str, ', ' ); -// returns 'that is the question.' - -out = substringAfterLast( str, 'to be' ); -// returns ', that is the question.' - -out = substringAfterLast( str, 'question.' ); -// returns '' - -out = substringAfterLast( str, 'xyz' ); -// returns '' - -out = substringAfterLast( str, '' ); -// returns '' -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: substring-after-last [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --from-index int Index at which to start the search. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'foo\nbar\nbaz' | substring-after-last --search a --split /\r?\n/ - - # Escaped... - $ echo -n $'foo\nbar\nbaz' | substring-after-last --search a --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - - - -
- -### Examples - -```bash -$ substring-after-last abcdefg --search d -efg -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n $'bar\nbaz' | substring-after-last --search b -ar -az -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'bar\tbaz' | substring-after-last --search b --split '\t' -ar -az -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/substring-after-last/benchmark/benchmark.js b/substring-after-last/benchmark/benchmark.js deleted file mode 100644 index 7db05402..00000000 --- a/substring-after-last/benchmark/benchmark.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var pkg = require( './../package.json' ).name; -var substringAfterLast = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = substringAfterLast( str, fromCodePoint( i%126 ) ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/substring-after-last/bin/cli b/substring-after-last/bin/cli deleted file mode 100755 index b1a5ad5b..00000000 --- a/substring-after-last/bin/cli +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var substringAfterLast = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - var str; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - if ( args.length ) { - str = args[ 0 ]; - } else { - // Treat an empty value as an empty string: - str = ''; - } - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - if ( flags[ 'from-index' ] ) { - console.log( substringAfterLast( str, flags.search, parseInt( flags[ 'from-index' ], 10 ) ) ); // eslint-disable-line no-console - } else { - console.log( substringAfterLast( str, flags.search ) ); // eslint-disable-line no-console - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var fromIndex; - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - if ( flags[ 'from-index' ] ) { - fromIndex = parseInt( flags[ 'from-index' ], 10 ); - for ( i = 0; i < lines.length; i++ ) { - console.log( substringAfterLast( lines[ i ], flags.search, fromIndex ) ); // eslint-disable-line no-console, max-len - } - } else { - for ( i = 0; i < lines.length; i++ ) { - console.log( substringAfterLast( lines[ i ], flags.search ) ); // eslint-disable-line no-console - } - } - } -} - -main(); diff --git a/substring-after-last/docs/repl.txt b/substring-after-last/docs/repl.txt deleted file mode 100644 index 667ba7a1..00000000 --- a/substring-after-last/docs/repl.txt +++ /dev/null @@ -1,33 +0,0 @@ - -{{alias}}( str, search[, fromIndex] ) - Returns the part of a string after the last occurrence of a specified - substring. - - Parameters - ---------- - str: string - Input string. - - search: string - Search value. - - fromIndex: integer (optional) - Index of last character to be considered beginning of a match. - Default: `str.length`. - - Returns - ------- - out: string - Substring. - - Examples - -------- - > var out = {{alias}}( 'beep boop beep baz', 'beep' ) - ' baz' - > out = {{alias}}( 'Hello World!', 'Hello ' ) - 'World!' - > out = {{alias}}( 'Hello World!', 'o', 5 ) - ' World!' - - See Also - -------- diff --git a/substring-after-last/docs/types/index.d.ts b/substring-after-last/docs/types/index.d.ts deleted file mode 100644 index 281b87dc..00000000 --- a/substring-after-last/docs/types/index.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/// - -/** -* Returns the part of a string after the last occurrence of a specified substring. -* -* @param str - input string -* @param search - search string -* @param fromIndex - index of last character to be considered beginning of a match (default: `str.length`) -* @returns substring -* -* @example -* var out = substringAfterLast( 'beep boop', 'b' ); -* // returns 'oop' -* -* @example -* var out = substringAfterLast( 'beep boop', 'o' ); -* // returns 'p' -* -* @example -* var out = substringAfterLast( 'Hello World', 'o' ); -* // returns 'rld' -* -* @example -* var out = substringAfterLast( 'Hello World', '!' ); -* // returns '' -* -* @example -* var out = substringAfterLast( 'Hello World', '' ); -* // returns '' -* -* @example -* var out = substringAfterLast( 'beep boop baz', 'p b', 6 ); -* // returns 'oop baz' -*/ -declare function substringAfterLast( str: string, search: string, fromIndex?: number ): string; - - -// EXPORTS // - -export = substringAfterLast; diff --git a/substring-after-last/docs/types/test.ts b/substring-after-last/docs/types/test.ts deleted file mode 100644 index 33ab495d..00000000 --- a/substring-after-last/docs/types/test.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import substringAfterLast = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - substringAfterLast( 'beep boop', ' ' ); // $ExpectType string - substringAfterLast( 'beep boop', 'xyz' ); // $ExpectType string - substringAfterLast( 'beep boop', '' ); // $ExpectType string - substringAfterLast( 'beep boop baz', ' ', 6 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - substringAfterLast( true, 'd', 999 ); // $ExpectError - substringAfterLast( false, 'd', 999 ); // $ExpectError - substringAfterLast( 3, 'd', 999 ); // $ExpectError - substringAfterLast( [], 'd', 999 ); // $ExpectError - substringAfterLast( {}, 'd', 999 ); // $ExpectError - substringAfterLast( ( x: number ): number => x, 'd', 999 ); // $ExpectError - - substringAfterLast( 'abc', true, 999 ); // $ExpectError - substringAfterLast( 'abc', false, 999 ); // $ExpectError - substringAfterLast( 'abc', 5, 999 ); // $ExpectError - substringAfterLast( 'abc', [], 999 ); // $ExpectError - substringAfterLast( 'abc', {}, 999 ); // $ExpectError - substringAfterLast( 'abc', ( x: number ): number => x, 999 ); // $ExpectError - - substringAfterLast( 'abc', 'd', true ); // $ExpectError - substringAfterLast( 'abc', 'd', false ); // $ExpectError - substringAfterLast( 'abc', 'd', 'abc' ); // $ExpectError - substringAfterLast( 'abc', 'd', [] ); // $ExpectError - substringAfterLast( 'abc', 'd', {} ); // $ExpectError - substringAfterLast( 'abc', 'd', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - substringAfterLast(); // $ExpectError - substringAfterLast( 'abc' ); // $ExpectError - substringAfterLast( 'abc', 'd', 3, 'f' ); // $ExpectError -} diff --git a/substring-after-last/docs/usage.txt b/substring-after-last/docs/usage.txt deleted file mode 100644 index 2e1c5f91..00000000 --- a/substring-after-last/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: substring-after-last [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --from-index int Index at which to start the search. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/substring-after-last/etc/cli_opts.json b/substring-after-last/etc/cli_opts.json deleted file mode 100644 index c3257d57..00000000 --- a/substring-after-last/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "string": [ - "search", - "from-index", - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/substring-after-last/examples/index.js b/substring-after-last/examples/index.js deleted file mode 100644 index ee59acd2..00000000 --- a/substring-after-last/examples/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 substringAfterLast = require( './../lib' ); - -var str = 'To be, or not to be, that is the question.'; -var out = substringAfterLast( str, ', ' ); -console.log( out ); -// => 'that is the question.' - -out = substringAfterLast( str, 'to be' ); -console.log( out ); -// => ', that is the question.' - -out = substringAfterLast( str, 'question.' ); -console.log( out ); -// => '' - -out = substringAfterLast( str, 'xyz' ); -console.log( out ); -// => '' - -out = substringAfterLast( str, '' ); -console.log( out ); -// => '' diff --git a/substring-after-last/lib/index.js b/substring-after-last/lib/index.js deleted file mode 100644 index 541379fc..00000000 --- a/substring-after-last/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the part of a string after the last occurrence of a specified substring. -* -* @module @stdlib/string/substring-after-last -* -* @example -* var substringAfterLast = require( '@stdlib/string/substring-after-last' ); -* -* var str = 'beep boop'; -* var out = substringAfterLast( str, 'b' ): -* // returns 'oop' -* -* out = substringAfterLast( str, 'o' ): -* // returns 'p' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/substring-after-last/lib/main.js b/substring-after-last/lib/main.js deleted file mode 100644 index eb20333a..00000000 --- a/substring-after-last/lib/main.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); - - -// MAIN // - -/** -* Returns the part of a string after the last occurrence of a specified substring. -* -* @param {string} str - input string -* @param {string} search - search value -* @param {integer} [fromIndex=str.length] - index of last character to be considered beginning of a match -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a string -* @throws {TypeError} third argument must be an integer -* @returns {string} substring -* -* @example -* var out = substringAfterLast( 'beep boop', 'b' ); -* // returns 'oop' -* -* @example -* var out = substringAfterLast( 'beep boop', 'o' ); -* // returns 'p' -* -* @example -* var out = substringAfterLast( 'Hello World', 'o' ); -* // returns 'rld' -* -* @example -* var out = substringAfterLast( 'Hello World', '!' ); -* // returns '' -* -* @example -* var out = substringAfterLast( 'Hello World', '' ); -* // returns '' -* -* @example -* var out = substringAfterLast( 'beep boop baz', 'p b', 6 ); -* // returns 'oop baz' -*/ -function substringAfterLast( str, search, fromIndex ) { - var idx; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isString( search ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) ); - } - if ( arguments.length > 2 ) { - if ( !isInteger( fromIndex ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be a nonnegative integer. Value: `%s`.', fromIndex ) ); - } - idx = str.lastIndexOf( search, fromIndex ); - } else { - idx = str.lastIndexOf( search ); - } - if ( idx === -1 ) { - return ''; - } - return str.substring( idx+search.length ); -} - - -// EXPORTS // - -module.exports = substringAfterLast; diff --git a/substring-after-last/package.json b/substring-after-last/package.json deleted file mode 100644 index be6dd451..00000000 --- a/substring-after-last/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@stdlib/string/substring-after-last", - "version": "0.0.0", - "description": "Return the part of a string after the last occurrence of a specified substring.", - "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" - } - ], - "bin": { - "substring-after-last": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "check", - "search", - "substring", - "substr", - "after", - "last", - "match" - ] -} diff --git a/substring-after-last/test/fixtures/stdin_error.js.txt b/substring-after-last/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/substring-after-last/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/substring-after-last/test/test.cli.js b/substring-after-last/test/test.cli.js deleted file mode 100644 index 5b952486..00000000 --- a/substring-after-last/test/test.cli.js +++ /dev/null @@ -1,315 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var EXEC_PATH = require( '@stdlib/process/exec-path' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints the part of a string after last occurrence of a specified substring.', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=b\'; process.argv[ 3 ] = \'boopbeep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'eep\n', true, 'prints `beep` to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints the part of a string after last ocurrence of a specified substring (custom start index).', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=b\'; process.argv[ 3 ] = \'--from-index=3\'; process.argv[ 4 ] = \'boopbeep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'oopbeep\n', true, 'prints `oopbeep` string to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nboop beep"', - '|', - EXEC_PATH, - fpath, - '--search="e"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'p boop\np\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream (custom start index)', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nboop beep"', - '|', - EXEC_PATH, - fpath, - '--search="e"', - '--from-index=3' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'p boop\n\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tboop beep\'', - '|', - EXEC_PATH, - fpath, - '--search="e"', - '--from-index=3', - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'p boop\n\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tboop beep\'', - '|', - EXEC_PATH, - fpath, - '--search="e"', - '--from-index=3', - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'p boop\n\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/substring-after-last/test/test.js b/substring-after-last/test/test.js deleted file mode 100644 index a14b0658..00000000 --- a/substring-after-last/test/test.js +++ /dev/null @@ -1,190 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 substringAfterLast = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof substringAfterLast, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string as its first argument', function test( t ) { - var values; - var i; - - 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() { - substringAfterLast( value, 'beep' ); - }; - } -}); - -tape( 'the function throws an error if not provided a string as its second argument', function test( t ) { - var values; - var i; - - 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() { - substringAfterLast( 'beep', value ); - }; - } -}); - -tape( 'the function returns the substring after the last occurrence of a provided search string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringAfterLast( str, ' ' ); - expected = 'boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = substringAfterLast( str, 'p' ); - expected = ''; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'Hello, World!'; - actual = substringAfterLast( str, 'o' ); - expected = 'rld!'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the substring after the last occurrence of a provided search string (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep 😀 boop 😀 baz'; - actual = substringAfterLast( str, '😀' ); - expected = ' baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🤖 Robot army 🤖!'; - actual = substringAfterLast( str, '🤖' ); - expected = '!'; - - str = '🐺 Wolf brothers 🐺'; - actual = substringAfterLast( str, 'o' ); - expected = 'thers 🐺'; - - t.end(); -}); - -tape( 'the function returns the substring after the last occurrence of a provided search string (custom start index)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop baz'; - actual = substringAfterLast( str, ' ', 5 ); - expected = 'boop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = substringAfterLast( str, 'b', 8 ); - expected = 'oop baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = substringAfterLast( str, 'p', 0 ); - expected = ''; - t.strictEqual( actual, expected, 'returns expected value' ); - - actual = substringAfterLast( str, 'p', -20 ); - expected = ''; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the empty string if the search string is not found', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringAfterLast( str, 'z' ); - expected = ''; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = substringAfterLast( str, 'baz' ); - expected = ''; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the empty string if the search string is the empty string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringAfterLast( str, '' ); - expected = ''; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/substring-after/README.md b/substring-after/README.md deleted file mode 100644 index 289cf2b7..00000000 --- a/substring-after/README.md +++ /dev/null @@ -1,245 +0,0 @@ - - -# substringAfter - -> Return the part of a string after a specified substring. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var substringAfter = require( '@stdlib/string/substring-after' ); -``` - -#### substringAfter( str, search\[, fromIndex] ) - -Returns the part of a string after a specified substring. - -```javascript -var str = 'beep boop'; -var out = substringAfter( str, 'o' ); -// returns 'op' - -out = substringAfter( str, ' ' ); -// returns 'boop' -``` - -By default, the search starts at the beginning of the string. To start searching from a different index, provide a `fromIndex` argument: - -```javascript -var str = 'boop baz boop'; -var out = substringAfter( str, 'o', 3 ); -// returns 'op' -``` - -
- - - - - -
- -## Notes - -- If a substring is not present in a provided string, the function returns an empty string. -- If provided an empty substring, the function returns the input string. -- If `fromIndex` is less than `0` or greater than `str.length`, the search starts at index `0` and `str.length`, respectively. - -
- - - - - -
- -## Examples - - - -```javascript -var substringAfter = require( '@stdlib/string/substring-after' ); - -var str = 'To be, or not to be, that is the question.'; -var out = substringAfter( str, ', ' ); -// returns 'or not to be, that is the question.' - -out = substringAfter( str, 'to be' ); -// returns ', that is the question.' - -out = substringAfter( str, 'question.' ); -// returns '' - -out = substringAfter( str, 'xyz' ); -// returns '' - -out = substringAfter( str, '' ); -// returns 'To be, or not to be, that is the question.' -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: substring-after [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --from-index int Start index. Default: 0. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'foo\nbar\nbaz' | substring-after --search a --split /\r?\n/ - - # Escaped... - $ echo -n $'foo\nbar\nbaz' | substring-after --search a --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - - - -
- -### Examples - -```bash -$ substring-after abcdefg --search d -efg -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n $'bar\nbaz' | substring-after --search b -ar -az -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'bar\tbaz' | substring-after --search b --split '\t' -ar -az -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/substring-after/benchmark/benchmark.js b/substring-after/benchmark/benchmark.js deleted file mode 100644 index 464af62c..00000000 --- a/substring-after/benchmark/benchmark.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var pkg = require( './../package.json' ).name; -var substringAfter = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = substringAfter( str, fromCodePoint( i%126 ) ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/substring-after/bin/cli b/substring-after/bin/cli deleted file mode 100755 index 723edc00..00000000 --- a/substring-after/bin/cli +++ /dev/null @@ -1,127 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var substringAfter = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - var str; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - if ( args.length ) { - str = args[ 0 ]; - } else { - // Treat an empty value as an empty string: - str = ''; - } - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - if ( flags[ 'from-index' ] ) { - console.log( substringAfter( str, flags.search, parseInt( flags[ 'from-index' ], 10 ) ) ); // eslint-disable-line no-console - } else { - console.log( substringAfter( str, flags.search ) ); // eslint-disable-line no-console - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var fromIndex; - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - if ( flags[ 'from-index' ] ) { - fromIndex = parseInt( flags[ 'from-index' ], 10 ); - for ( i = 0; i < lines.length; i++ ) { - console.log( substringAfter( lines[ i ], flags.search, fromIndex ) ); // eslint-disable-line no-console, max-len - } - } else { - for ( i = 0; i < lines.length; i++ ) { - console.log( substringAfter( lines[ i ], flags.search ) ); // eslint-disable-line no-console - } - } - } -} - -main(); diff --git a/substring-after/docs/repl.txt b/substring-after/docs/repl.txt deleted file mode 100644 index 1325c721..00000000 --- a/substring-after/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( str, search[, fromIndex] ) - Returns the part of a string after a specified substring. - - Parameters - ---------- - str: string - Input string. - - search: string - Search string. - - fromIndex: integer (optional) - Index from which to start the search. Default: `0`. - - Returns - ------- - out: string - Substring. - - Examples - -------- - > var out = {{alias}}( 'Hello World!', 'World' ) - '!' - > out = {{alias}}( 'Hello World!', 'Hello ' ) - 'World!' - > out = {{alias}}( 'Hello World!', 'l', 5 ) - 'd!' - - See Also - -------- diff --git a/substring-after/docs/types/index.d.ts b/substring-after/docs/types/index.d.ts deleted file mode 100644 index 516cc694..00000000 --- a/substring-after/docs/types/index.d.ts +++ /dev/null @@ -1,60 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/// - -/** -* Returns the part of a string after a specified substring. -* -* @param str - input string -* @param search - search string -* @param fromIndex - index at which to start the search (default: 0) -* @returns substring -* -* @example -* var out = substringAfter( 'Hello, world!', ', ' ); -* // returns 'world!' -* -* @example -* var out = substringAfter( 'beep boop', 'beep' ); -* // returns ' boop' -* -* @example -* var out = substringAfter( 'beep boop', 'boop' ); -* // returns '' -* -* @example -* var out = substringAfter( 'beep boop', 'xyz' ); -* // returns '' -* -* @example -* var out = substringAfter( 'beep boop', 'beep', 5 ); -* // returns '' -* -* @example -* var out = substringAfter( 'beep boop beep baz', 'beep', 5 ); -* // returns ' baz' -*/ -declare function substringAfter( str: string, search: string, fromIndex?: number ): string; - - -// EXPORTS // - -export = substringAfter; diff --git a/substring-after/docs/types/test.ts b/substring-after/docs/types/test.ts deleted file mode 100644 index b83c6a76..00000000 --- a/substring-after/docs/types/test.ts +++ /dev/null @@ -1,61 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import substringAfter = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - substringAfter( 'beep boop', ' ' ); // $ExpectType string - substringAfter( 'beep boop', 'xyz' ); // $ExpectType string - substringAfter( 'beep boop', '' ); // $ExpectType string - substringAfter( 'beep boop', 'b', 5 ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - substringAfter( true, 'd', 0 ); // $ExpectError - substringAfter( false, 'd', 0 ); // $ExpectError - substringAfter( 3, 'd', 0 ); // $ExpectError - substringAfter( [], 'd', 0 ); // $ExpectError - substringAfter( {}, 'd', 0 ); // $ExpectError - substringAfter( ( x: number ): number => x, 'd', 0 ); // $ExpectError - - substringAfter( 'abc', true, 0 ); // $ExpectError - substringAfter( 'abc', false, 0 ); // $ExpectError - substringAfter( 'abc', 5, 0 ); // $ExpectError - substringAfter( 'abc', [], 0 ); // $ExpectError - substringAfter( 'abc', {}, 0 ); // $ExpectError - substringAfter( 'abc', ( x: number ): number => x, 0 ); // $ExpectError - - substringAfter( 'abc', 'd', true ); // $ExpectError - substringAfter( 'abc', 'd', false ); // $ExpectError - substringAfter( 'abc', 'd', '5' ); // $ExpectError - substringAfter( 'abc', 'd', [] ); // $ExpectError - substringAfter( 'abc', 'd', {} ); // $ExpectError - substringAfter( 'abc', 'd', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - substringAfter(); // $ExpectError - substringAfter( 'abc' ); // $ExpectError - substringAfter( 'abc', 'd', 1, 1 ); // $ExpectError -} diff --git a/substring-after/docs/usage.txt b/substring-after/docs/usage.txt deleted file mode 100644 index c103799b..00000000 --- a/substring-after/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: substring-after [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --from-index int Start index. Default: 0. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/substring-after/etc/cli_opts.json b/substring-after/etc/cli_opts.json deleted file mode 100644 index c3257d57..00000000 --- a/substring-after/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "string": [ - "search", - "from-index", - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/substring-after/examples/index.js b/substring-after/examples/index.js deleted file mode 100644 index cd83b5fc..00000000 --- a/substring-after/examples/index.js +++ /dev/null @@ -1,42 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 substringAfter = require( './../lib' ); - -var str = 'To be, or not to be, that is the question.'; -var out = substringAfter( str, ', ' ); -console.log( out ); -// => 'or not to be, that is the question.' - -out = substringAfter( str, 'to be' ); -console.log( out ); -// => ', that is the question.' - -out = substringAfter( str, 'question.' ); -console.log( out ); -// => '' - -out = substringAfter( str, 'xyz' ); -console.log( out ); -// => '' - -out = substringAfter( str, '' ); -console.log( out ); -// => 'To be, or not to be, that is the question.' diff --git a/substring-after/lib/index.js b/substring-after/lib/index.js deleted file mode 100644 index 3a3011bf..00000000 --- a/substring-after/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the part of a string after a specified substring. -* -* @module @stdlib/string/substring-after -* -* @example -* var substringAfter = require( '@stdlib/string/substring-after' ); -* -* var str = 'beep boop'; -* var out = substringAfter( str, 'o' ); -* // returns 'op' -* -* out = substringAfter( str, ' ' ); -* // returns 'boop' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/substring-after/lib/main.js b/substring-after/lib/main.js deleted file mode 100644 index bf23f19f..00000000 --- a/substring-after/lib/main.js +++ /dev/null @@ -1,90 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isInteger = require( '@stdlib/assert/is-integer' ).isPrimitive; -var format = require( './../../format' ); - - -// MAIN // - -/** -* Returns the part of a string after a specified substring. -* -* @param {string} str - input string -* @param {string} search - search string -* @param {integer} [fromIndex=0] - index at which to start the search -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a string -* @throws {TypeError} third argument must be an integer -* @returns {string} substring -* -* @example -* var out = substringAfter( 'Hello, world!', ', ' ); -* // returns 'world!' -* -* @example -* var out = substringAfter( 'beep boop', 'beep' ); -* // returns ' boop' -* -* @example -* var out = substringAfter( 'beep boop', 'boop' ); -* // returns '' -* -* @example -* var out = substringAfter( 'beep boop', 'xyz' ); -* // returns '' -* -* @example -* var out = substringAfter( 'beep boop', 'beep', 5 ); -* // returns '' -* -* @example -* var out = substringAfter( 'beep boop beep baz', 'beep', 5 ); -* // returns ' baz' -*/ -function substringAfter( str, search, fromIndex ) { - var idx; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isString( search ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) ); - } - if ( arguments.length > 2 ) { - if ( !isInteger( fromIndex ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be an integer. Value: `%s`.', fromIndex ) ); - } - idx = str.indexOf( search, fromIndex ); - } else { - idx = str.indexOf( search ); - } - if ( idx === -1 ) { - return ''; - } - return str.substring( idx+search.length ); -} - - -// EXPORTS // - -module.exports = substringAfter; diff --git a/substring-after/package.json b/substring-after/package.json deleted file mode 100644 index 7b21e1ff..00000000 --- a/substring-after/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/substring-after", - "version": "0.0.0", - "description": "Return the part of a string after a specified substring.", - "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" - } - ], - "bin": { - "substring-after": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "check", - "search", - "substring", - "substr", - "after", - "match" - ] -} diff --git a/substring-after/test/fixtures/stdin_error.js.txt b/substring-after/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/substring-after/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/substring-after/test/test.cli.js b/substring-after/test/test.cli.js deleted file mode 100644 index b4e4340b..00000000 --- a/substring-after/test/test.cli.js +++ /dev/null @@ -1,315 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var EXEC_PATH = require( '@stdlib/process/exec-path' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints the part of a string after a specified substring.', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=boop\'; process.argv[ 3 ] = \'boopbeep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'beep\n', true, 'prints `beep` to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints the part of a string after a specified substring (custom start index).', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=boop\'; process.argv[ 3 ] = \'--from-index=4\'; process.argv[ 4 ] = \'boopbeep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === '\n', true, 'prints empty string to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nboop beep"', - '|', - EXEC_PATH, - fpath, - '--search=" "' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'boop\nbeep\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream (custom start index).', opts, function test( t ) { - var cmd = [ - 'printf "beep boop foo\nboop beep bar"', - '|', - EXEC_PATH, - fpath, - '--search=" "', - '--from-index=6' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'foo\nbar\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop foo\tboop beep bar\'', - '|', - EXEC_PATH, - fpath, - '--search=" "', - '--from-index=6', - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'foo\nbar\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop foo\tboop beep bar\'', - '|', - EXEC_PATH, - fpath, - '--search=" "', - '--from-index=6', - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'foo\nbar\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/substring-after/test/test.js b/substring-after/test/test.js deleted file mode 100644 index 8a6f7a8e..00000000 --- a/substring-after/test/test.js +++ /dev/null @@ -1,218 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 substringAfter = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof substringAfter, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string as its first argument', function test( t ) { - var values; - var i; - - 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() { - substringAfter( value, 'beep' ); - }; - } -}); - -tape( 'the function throws an error if not provided a string as its second argument', function test( t ) { - var values; - var i; - - 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() { - substringAfter( 'beep', value ); - }; - } -}); - -tape( 'the function throws an error if provided a non-integer value as its third argument', function test( t ) { - var values; - var i; - - 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() { - substringAfter( 'beep', 'e', value ); - }; - } -}); - -tape( 'the function returns the substring after a provided search string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringAfter( str, ' ' ); - expected = 'boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = substringAfter( str, 'p' ); - expected = ' boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'Hello, World!'; - actual = substringAfter( str, 'o' ); - expected = ', World!'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the substring after a provided search string (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep 😀 boop 😀 baz'; - actual = substringAfter( str, '😀' ); - expected = ' boop 😀 baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🤖 Robot army 🤖!'; - actual = substringAfter( str, '🤖' ); - expected = ' Robot army 🤖!'; - - str = '🐺 Wolf brothers 🐺'; - actual = substringAfter( str, 'o' ); - expected = 'lf brothers 🐺'; - - t.end(); -}); - -tape( 'the function returns the substring after a provided search string (custom start index)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop baz'; - actual = substringAfter( str, ' ', 6 ); - expected = 'baz'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop baz'; - actual = substringAfter( str, 'p', 6 ); - expected = ' baz'; - - str = 'beep boop baz'; - actual = substringAfter( str, 'beep', -2 ); - expected = ' boop baz'; - - str = 'beep boop baz'; - actual = substringAfter( str, 'beep', 20 ); - expected = ''; - - t.end(); -}); - -tape( 'the function returns the empty string if the search string is not found', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringAfter( str, 'z' ); - expected = ''; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = substringAfter( str, 'baz' ); - expected = ''; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the original string if the search string is the empty string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringAfter( str, '' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/substring-before-last/README.md b/substring-before-last/README.md deleted file mode 100644 index 615d7ccb..00000000 --- a/substring-before-last/README.md +++ /dev/null @@ -1,232 +0,0 @@ - - -# substringBeforeLast - -> Return the part of a string before the last occurrence of a specified substring. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var substringBeforeLast = require( '@stdlib/string/substring-before-last' ); -``` - -#### substringBeforeLast( str, search ) - -Returns the part of a string before the last occurrence of a specified substring. - -```javascript -var str = 'Beep Boop Beep'; -var out = substringBeforeLast( str, 'Beep' ); -// returns 'Beep Boop ' - -out = substringBeforeLast( str, 'Boop' ); -// returns 'Beep ' -``` - -
- - - - - -
- -## Notes - -- If a substring is not present in a provided string, the function returns the input string. -- If provided an empty substring, the function returns the input string. - -
- - - - - -
- -## Examples - - - -```javascript -var substringBeforeLast = require( '@stdlib/string/substring-before-last' ); - -var str = 'beep boop'; -var out = substringBeforeLast( str, ' ' ); -// returns 'beep' - -out = substringBeforeLast( str, 'e' ); -// returns 'be' - -out = substringBeforeLast( str, 'x' ); -// returns 'beep boop' - -out = substringBeforeLast( str, '' ); -// returns 'beep boop' -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: substring-before-last [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'foo\nbar\nbaz' | substring-before-last --search a --split /\r?\n/ - - # Escaped... - $ echo -n $'foo\nbar\nbaz' | substring-before-last --search a --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - - - -
- -### Examples - -```bash -$ substring-before-last abcdefg --search d -abc -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n $'beep\nboop' | substring-before-last --search p -bee -boo -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tboop' | substring-before-last --search p --split '\t' -bee -boo -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/substring-before-last/benchmark/benchmark.js b/substring-before-last/benchmark/benchmark.js deleted file mode 100644 index 3eacb486..00000000 --- a/substring-before-last/benchmark/benchmark.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var pkg = require( './../package.json' ).name; -var substringBeforeLast = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = substringBeforeLast( str, fromCodePoint( i%126 ) ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/substring-before-last/bin/cli b/substring-before-last/bin/cli deleted file mode 100755 index 9c222aa9..00000000 --- a/substring-before-last/bin/cli +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var substringBeforeLast = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - var str; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - if ( args.length ) { - str = args[ 0 ]; - } else { - // Treat an empty value as an empty string: - str = ''; - } - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( substringBeforeLast( str, flags.search ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( substringBeforeLast( lines[ i ], flags.search ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/substring-before-last/docs/repl.txt b/substring-before-last/docs/repl.txt deleted file mode 100644 index c183736d..00000000 --- a/substring-before-last/docs/repl.txt +++ /dev/null @@ -1,28 +0,0 @@ - -{{alias}}( str, search ) - Returns the part of a string before the last occurrence of a specified - substring. - - Parameters - ---------- - str: string - Input string. - - search: string - Search value. - - Returns - ------- - out: string - Substring. - - Examples - -------- - > var str = 'Beep Boop Beep'; - > var out = {{alias}}( str, 'Beep' ) - 'Beep Boop ' - > out = {{alias}}( str, 'Boop' ) - 'Beep ' - - See Also - -------- diff --git a/substring-before-last/docs/types/index.d.ts b/substring-before-last/docs/types/index.d.ts deleted file mode 100644 index d5ff417b..00000000 --- a/substring-before-last/docs/types/index.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/// - -/** -* Returns the part of a string before the last occurrence of a specified substring. -* -* @param str - input string -* @param search - search string -* @returns substring -* -* @example -* var out = substringBeforeLast( 'abcba', 'b' ); -* // returns 'abc' -* -* @example -* var out = substringBeforeLast( 'Hello World, my friend!', ' ' ); -* // returns 'Hello World, my' -* -* @example -* var out = substringBeforeLast( 'abcba', ' ' ); -* // returns 'abcba' -* -* @example -* var out = substringBeforeLast( 'abcba', '' ); -* // returns 'abcba' -*/ -declare function substringBeforeLast( str: string, search: string ): string; - - -// EXPORTS // - -export = substringBeforeLast; diff --git a/substring-before-last/docs/types/test.ts b/substring-before-last/docs/types/test.ts deleted file mode 100644 index 4bedc937..00000000 --- a/substring-before-last/docs/types/test.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import substringBeforeLast = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - substringBeforeLast( 'beep boop', ' ' ); // $ExpectType string - substringBeforeLast( 'beep boop', 'xyz' ); // $ExpectType string - substringBeforeLast( 'beep boop', '' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - substringBeforeLast( true, 'd' ); // $ExpectError - substringBeforeLast( false, 'd' ); // $ExpectError - substringBeforeLast( 3, 'd' ); // $ExpectError - substringBeforeLast( [], 'd' ); // $ExpectError - substringBeforeLast( {}, 'd' ); // $ExpectError - substringBeforeLast( ( x: number ): number => x, 'd' ); // $ExpectError - - substringBeforeLast( 'abc', true ); // $ExpectError - substringBeforeLast( 'abc', false ); // $ExpectError - substringBeforeLast( 'abc', 5 ); // $ExpectError - substringBeforeLast( 'abc', [] ); // $ExpectError - substringBeforeLast( 'abc', {} ); // $ExpectError - substringBeforeLast( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - substringBeforeLast(); // $ExpectError - substringBeforeLast( 'abc' ); // $ExpectError -} diff --git a/substring-before-last/docs/usage.txt b/substring-before-last/docs/usage.txt deleted file mode 100644 index 9098f530..00000000 --- a/substring-before-last/docs/usage.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Usage: substring-before-last [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/substring-before-last/etc/cli_opts.json b/substring-before-last/etc/cli_opts.json deleted file mode 100644 index 7b49c967..00000000 --- a/substring-before-last/etc/cli_opts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "string": [ - "search", - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/substring-before-last/examples/index.js b/substring-before-last/examples/index.js deleted file mode 100644 index 272e9316..00000000 --- a/substring-before-last/examples/index.js +++ /dev/null @@ -1,38 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 substringBeforeLast = require( './../lib' ); - -var str = 'beep boop'; -var out = substringBeforeLast( str, ' ' ); -console.log( out ); -// => 'beep' - -out = substringBeforeLast( str, 'e' ); -console.log( out ); -// => 'be' - -out = substringBeforeLast( str, 'x' ); -console.log( out ); -// => 'beep boop' - -out = substringBeforeLast( str, '' ); -console.log( out ); -// => 'beep boop' diff --git a/substring-before-last/lib/index.js b/substring-before-last/lib/index.js deleted file mode 100644 index b28aea49..00000000 --- a/substring-before-last/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the part of a string before the last occurrence of a specified substring. -* -* @module @stdlib/string/substring-before-last -* -* @example -* var substringBeforeLast = require( '@stdlib/string/substring-before-last' ); -* -* var str = 'Beep Boop Beep'; -* var out = substringBeforeLast( str, 'Beep' ); -* // returns 'Beep Boop ' -* -* out = substringBeforeLast( str, 'Boop' ); -* // returns 'Beep ' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/substring-before-last/lib/main.js b/substring-before-last/lib/main.js deleted file mode 100644 index bf2c2232..00000000 --- a/substring-before-last/lib/main.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); - - -// MAIN // - -/** -* Returns the part of a string before the last occurrence of a specified substring. -* -* @param {string} str - input string -* @param {string} search - search value -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a string -* @returns {string} substring -* -* @example -* var out = substringBeforeLast( 'abcba', 'b' ); -* // returns 'abc' -* -* @example -* var out = substringBeforeLast( 'Hello World, my friend!', ' ' ); -* // returns 'Hello World, my' -* -* @example -* var out = substringBeforeLast( 'abcba', ' ' ); -* // returns 'abcba' -* -* @example -* var out = substringBeforeLast( 'abcba', '' ); -* // returns 'abcba' -*/ -function substringBeforeLast( str, search ) { - var idx; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isString( search ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) ); - } - idx = str.lastIndexOf( search ); - if ( idx === -1 ) { - return str; - } - return str.substring( 0, idx ); -} - - -// EXPORTS // - -module.exports = substringBeforeLast; diff --git a/substring-before-last/package.json b/substring-before-last/package.json deleted file mode 100644 index 7573945e..00000000 --- a/substring-before-last/package.json +++ /dev/null @@ -1,71 +0,0 @@ -{ - "name": "@stdlib/string/substring-before-last", - "version": "0.0.0", - "description": "Return the part of a string before the last occurrence of a specified substring.", - "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" - } - ], - "bin": { - "substring-before-last": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "check", - "search", - "substring", - "substr", - "before", - "last", - "match" - ] -} diff --git a/substring-before-last/test/fixtures/stdin_error.js.txt b/substring-before-last/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/substring-before-last/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/substring-before-last/test/test.cli.js b/substring-before-last/test/test.cli.js deleted file mode 100644 index ac667231..00000000 --- a/substring-before-last/test/test.cli.js +++ /dev/null @@ -1,268 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var EXEC_PATH = require( '@stdlib/process/exec-path' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints the part of a string before the last occurrence of a specified substring.', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=p\'; process.argv[ 3 ] = \'boopbeep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'boopbee\n', true, 'prints `beep` to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nboop beep"', - '|', - EXEC_PATH, - fpath, - '--search="e"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be\nboop be\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tboop beep\'', - '|', - EXEC_PATH, - fpath, - '--search="e"', - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be\nboop be\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tboop beep\'', - '|', - EXEC_PATH, - fpath, - '--search="e"', - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be\nboop be\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/substring-before-last/test/test.js b/substring-before-last/test/test.js deleted file mode 100644 index ce86875e..00000000 --- a/substring-before-last/test/test.js +++ /dev/null @@ -1,164 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 substringBeforeLast = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof substringBeforeLast, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string as its first argument', function test( t ) { - var values; - var i; - - 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() { - substringBeforeLast( value, 'beep' ); - }; - } -}); - -tape( 'the function throws an error if not provided a string as its second argument', function test( t ) { - var values; - var i; - - 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() { - substringBeforeLast( 'beep', value ); - }; - } -}); - -tape( 'the function returns the substring before the last occurrence of the provided search string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringBeforeLast( str, ' ' ); - expected = 'beep'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = substringBeforeLast( str, 'p' ); - expected = 'beep boo'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'Hello, World!'; - actual = substringBeforeLast( str, 'o' ); - expected = 'Hello, W'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the substring before a provided search string (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep 😀 boop 😀 baz'; - actual = substringBeforeLast( str, '😀' ); - expected = 'beep 😀 boop '; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🤖 Robot army 🤖!'; - actual = substringBeforeLast( str, '🤖' ); - expected = '🤖 Robot army '; - - str = '🐺 Wolf brothers 🐺'; - actual = substringBeforeLast( str, 'o' ); - expected = '🐺 Wolf brothers '; - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is not found', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringBeforeLast( str, 'z' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = substringBeforeLast( str, 'baz' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is the empty string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringBeforeLast( str, '' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/substring-before/README.md b/substring-before/README.md deleted file mode 100644 index 5cdb953a..00000000 --- a/substring-before/README.md +++ /dev/null @@ -1,231 +0,0 @@ - - -# substringBefore - -> Return the part of a string before a specified substring. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var substringBefore = require( '@stdlib/string/substring-before' ); -``` - -#### substringBefore( str, search ) - -Returns the part of a string before a specified substring. - -```javascript -var str = 'beep boop'; -var out = substringBefore( str, ' ' ); -// returns 'beep' - -out = substringBefore( str, 'o' ); -// returns 'beep b' -``` - -
- - - - - -
- -## Notes - -- If a substring is not present in a provided string, the function returns the input string. -- If provided an empty substring, the function returns an empty string. - -
- - - - - -
- -## Examples - - - -```javascript -var substringBefore = require( '@stdlib/string/substring-before' ); - -var out = substringBefore( 'beep boop', 'p' ); -// returns 'bee' - -out = substringBefore( 'Hello World!', 'xyz' ); -// returns 'Hello World!' - -out = substringBefore( 'Hello World!', '' ); -// returns '' - -out = substringBefore( '', 'xyz' ); -// returns '' -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: substring-before [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'foo\nbar\nbaz' | substring-before --search a --split /\r?\n/ - - # Escaped... - $ echo -n $'foo\nbar\nbaz' | substring-before --search a --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - - - -
- -### Examples - -```bash -$ substring-before abcdefg --search d -abc -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n $'beep\nboop' | substring-before --search p -bee -boo -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'beep\tboop' | substring-before --search p --split '\t' -bee -boo -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/substring-before/benchmark/benchmark.js b/substring-before/benchmark/benchmark.js deleted file mode 100644 index 57e8e18e..00000000 --- a/substring-before/benchmark/benchmark.js +++ /dev/null @@ -1,52 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var pkg = require( './../package.json' ).name; -var substringBefore = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var out; - var str; - var i; - - str = 'To be, or not to be, that is the question.'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = substringBefore( str, fromCodePoint( i%126 ) ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/substring-before/bin/cli b/substring-before/bin/cli deleted file mode 100755 index ff16f88b..00000000 --- a/substring-before/bin/cli +++ /dev/null @@ -1,115 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var substringBefore = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - var str; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - if ( args.length ) { - str = args[ 0 ]; - } else { - // Treat an empty value as an empty string: - str = ''; - } - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( substringBefore( str, flags.search ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( substringBefore( lines[ i ], flags.search ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/substring-before/docs/repl.txt b/substring-before/docs/repl.txt deleted file mode 100644 index 448750da..00000000 --- a/substring-before/docs/repl.txt +++ /dev/null @@ -1,27 +0,0 @@ - -{{alias}}( str, search ) - Returns the part of a string before a specified substring. - - Parameters - ---------- - str: string - Input string. - - search: string - Search string. - - Returns - ------- - out: string - Substring. - - Examples - -------- - > var str = 'beep boop'; - > var out = {{alias}}( str, ' ' ) - 'beep' - > out = {{alias}}( str, 'o' ) - 'beep b' - - See Also - -------- diff --git a/substring-before/docs/types/index.d.ts b/substring-before/docs/types/index.d.ts deleted file mode 100644 index c1691d22..00000000 --- a/substring-before/docs/types/index.d.ts +++ /dev/null @@ -1,51 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/// - -/** -* Returns the part of a string before a specified substring. -* -* @param str - input string -* @param search - search string -* @returns substring -* -* @example -* var out = substringBefore( 'beep boop', ' ' ); -* // returns 'beep' -* -* @example -* var out = substringBefore( 'beep boop', 'p' ); -* // returns 'bee' -* -* @example -* var out = substringBefore( 'Hello World!', '' ); -* // returns '' -* -* @example -* var out = substringBefore( 'Hello World!', 'XYZ' ); -* // returns 'Hello World!' -*/ -declare function substringBefore( str: string, search: string ): string; - - -// EXPORTS // - -export = substringBefore; diff --git a/substring-before/docs/types/test.ts b/substring-before/docs/types/test.ts deleted file mode 100644 index 58434f83..00000000 --- a/substring-before/docs/types/test.ts +++ /dev/null @@ -1,52 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import substringBefore = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - substringBefore( 'beep boop', ' ' ); // $ExpectType string - substringBefore( 'beep boop', 'xyz' ); // $ExpectType string - substringBefore( 'beep boop', '' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided arguments having invalid types... -{ - substringBefore( true, 'd' ); // $ExpectError - substringBefore( false, 'd' ); // $ExpectError - substringBefore( 3, 'd' ); // $ExpectError - substringBefore( [], 'd' ); // $ExpectError - substringBefore( {}, 'd' ); // $ExpectError - substringBefore( ( x: number ): number => x, 'd' ); // $ExpectError - - substringBefore( 'abc', true ); // $ExpectError - substringBefore( 'abc', false ); // $ExpectError - substringBefore( 'abc', 5 ); // $ExpectError - substringBefore( 'abc', [] ); // $ExpectError - substringBefore( 'abc', {} ); // $ExpectError - substringBefore( 'abc', ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - substringBefore(); // $ExpectError - substringBefore( 'abc' ); // $ExpectError -} diff --git a/substring-before/docs/usage.txt b/substring-before/docs/usage.txt deleted file mode 100644 index b784fb68..00000000 --- a/substring-before/docs/usage.txt +++ /dev/null @@ -1,9 +0,0 @@ - -Usage: substring-before [options] --search= [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --search string Search string. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/substring-before/etc/cli_opts.json b/substring-before/etc/cli_opts.json deleted file mode 100644 index 7b49c967..00000000 --- a/substring-before/etc/cli_opts.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "string": [ - "search", - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/substring-before/examples/index.js b/substring-before/examples/index.js deleted file mode 100644 index d2f5118d..00000000 --- a/substring-before/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 substringBefore = require( './../lib' ); - -var out = substringBefore( 'beep boop', 'p' ); -console.log( out ); -// => 'bee' - -out = substringBefore( 'Hello World!', 'xyz' ); -console.log( out ); -// => 'Hello World!' - -out = substringBefore( 'Hello World!', '' ); -console.log( out ); -// => '' - -out = substringBefore( '', 'xyz' ); -console.log( out ); -// => '' diff --git a/substring-before/lib/index.js b/substring-before/lib/index.js deleted file mode 100644 index 16a1be8e..00000000 --- a/substring-before/lib/index.js +++ /dev/null @@ -1,44 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Return the part of a string before a specified substring. -* -* @module @stdlib/string/substring-before -* -* @example -* var substringBefore = require( '@stdlib/string/substring-before' ); -* -* var str = 'beep boop'; -* var out = substringBefore( str, ' ' ); -* // returns 'beep' -* -* out = substringBefore( str, 'o' ); -* // returns 'beep b' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/substring-before/lib/main.js b/substring-before/lib/main.js deleted file mode 100644 index 8ef72a60..00000000 --- a/substring-before/lib/main.js +++ /dev/null @@ -1,72 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); - - -// MAIN // - -/** -* Returns the part of a string before a specified substring. -* -* @param {string} str - input string -* @param {string} search - search string -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a string -* @returns {string} substring -* -* @example -* var out = substringBefore( 'beep boop', ' ' ); -* // returns 'beep' -* -* @example -* var out = substringBefore( 'beep boop', 'p' ); -* // returns 'bee' -* -* @example -* var out = substringBefore( 'Hello World!', '' ); -* // returns '' -* -* @example -* var out = substringBefore( 'Hello World!', 'XYZ' ); -* // returns 'Hello World!' -*/ -function substringBefore( str, search ) { - var idx; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isString( search ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a string. Value: `%s`.', search ) ); - } - idx = str.indexOf( search ); - if ( idx === -1 ) { - return str; - } - return str.substring( 0, idx ); -} - - -// EXPORTS // - -module.exports = substringBefore; diff --git a/substring-before/package.json b/substring-before/package.json deleted file mode 100644 index 6af62900..00000000 --- a/substring-before/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/substring-before", - "version": "0.0.0", - "description": "Return the part of a string before a specified substring.", - "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" - } - ], - "bin": { - "substring-before": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "check", - "search", - "substring", - "substr", - "before", - "match" - ] -} diff --git a/substring-before/test/fixtures/stdin_error.js.txt b/substring-before/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/substring-before/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/substring-before/test/test.cli.js b/substring-before/test/test.cli.js deleted file mode 100644 index 83fa258a..00000000 --- a/substring-before/test/test.cli.js +++ /dev/null @@ -1,268 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var EXEC_PATH = require( '@stdlib/process/exec-path' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface prints the part of a string before a specified substring.', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'--search=p\'; process.argv[ 3 ] = \'boopbeep\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - var str; - if ( error ) { - t.fail( error.message ); - } else { - str = stdout.toString(); - t.strictEqual( str === 'boo\n', true, 'prints `beep` to `stdout`' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nboop beep"', - '|', - EXEC_PATH, - fpath, - '--search="e"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'b\nboop b\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tboop beep\'', - '|', - EXEC_PATH, - fpath, - '--search="e"', - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'b\nboop b\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tboop beep\'', - '|', - EXEC_PATH, - fpath, - '--search="e"', - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'b\nboop b\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/substring-before/test/test.js b/substring-before/test/test.js deleted file mode 100644 index bb08ff5c..00000000 --- a/substring-before/test/test.js +++ /dev/null @@ -1,162 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 substringBefore = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof substringBefore, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string primitive as its first argument', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - substringBefore( value, 'beep' ); - }; - } -}); - -tape( 'the function throws an error if not provided a string primitive as its second argument', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - substringBefore( 'beep boop', value ); - }; - } -}); - -tape( 'the function returns the substring before a provided search string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringBefore( str, ' ' ); - expected = 'beep'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = substringBefore( str, 'p' ); - expected = 'bee'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'Hello, World!'; - actual = substringBefore( str, 'o' ); - expected = 'Hell'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the substring before a provided search string (Unicode characters)', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep 😀 boop 😀 baz'; - actual = substringBefore( str, '😀' ); - expected = 'beep '; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🤖 Robot army 🤖!'; - actual = substringBefore( str, '🤖' ); - expected = ''; - - str = '🐺 Wolf brothers 🐺'; - actual = substringBefore( str, 'o' ); - expected = '🐺 W'; - - t.end(); -}); - -tape( 'the function returns the entire string if the search string is not found', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringBefore( str, 'z' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - actual = substringBefore( str, 'baz' ); - expected = 'beep boop'; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function returns the empty string if the search string is the empty string', function test( t ) { - var expected; - var actual; - var str; - - str = 'beep boop'; - actual = substringBefore( str, '' ); - expected = ''; - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/test/test.js b/test/test.js deleted file mode 100644 index 31b69b18..00000000 --- a/test/test.js +++ /dev/null @@ -1,40 +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 objectKeys = require( '@stdlib/utils/keys' ); -var string = require( './../lib' ); - - -// TESTS // - -tape( 'main export is an object', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof string, 'object', 'main export is an object' ); - t.end(); -}); - -tape( 'the exported object contains string manipulation functionality', function test( t ) { - var keys = objectKeys( string ); - t.strictEqual( keys.length > 0, true, 'has keys' ); - t.end(); -}); diff --git a/to-grapheme-cluster-iterator-right/README.md b/to-grapheme-cluster-iterator-right/README.md deleted file mode 100644 index a65a1164..00000000 --- a/to-grapheme-cluster-iterator-right/README.md +++ /dev/null @@ -1,239 +0,0 @@ - - -# graphemeClusters2iteratorRight - -> Create an iterator which iterates from right to left over [grapheme clusters][unicode-text-segmentation]. - - - -
- -
- - - - - -
- -## Usage - - - -```javascript -var graphemeClusters2iteratorRight = require( '@stdlib/string/to-grapheme-cluster-iterator-right' ); -``` - -#### graphemeClusters2iteratorRight( src\[, mapFcn\[, thisArg]] ) - -Returns an iterator which iterates from right to left over each [grapheme cluster][unicode-text-segmentation] in a `string`. - - - -```javascript -var iter = graphemeClusters2iteratorRight( '🌷🍕' ); - -var v = iter.next().value; -// returns '🍕' - -v = iter.next().value; -// returns '🌷' - -var bool = iter.next().done; -// returns true -``` - -The returned iterator protocol-compliant object has the following properties: - -- **next**: function which returns an iterator protocol-compliant object containing the next iterated value (if one exists) assigned to a `value` property and a `done` property having a `boolean` value indicating whether the iterator is finished. -- **return**: function which closes an iterator and returns a single (optional) argument in an iterator protocol-compliant object. - -To invoke a function for each `src` value, provide a callback function. - - - -```javascript -function fcn( v ) { - return v + v; -} - -var it = graphemeClusters2iteratorRight( 'beep', fcn ); -// returns - -var v = it.next().value; -// returns 'pp' - -v = it.next().value; -// returns 'ee' - -v = it.next().value; -// returns 'ee' - -// ... -``` - -The invoked function is provided three arguments: - -- **value**: [grapheme cluster][unicode-text-segmentation]. -- **index**: iterated value index. -- **src**: source string. - - - -```javascript -function fcn( v, i ) { - return v + i; -} - -var it = graphemeClusters2iteratorRight( 'bar', fcn ); -// returns - -var v = it.next().value; -// returns 'r2' - -v = it.next().value; -// returns 'a1' - -v = it.next().value; -// returns 'b0' - -// ... -``` - -To set the callback function execution context, provide a `thisArg`. - - - -```javascript -function fcn( v ) { - this.count += 1; - return v; -} - -var ctx = { - 'count': 0 -}; - -var it = graphemeClusters2iteratorRight( '🌷🍕', fcn, ctx ); -// returns - -var v = it.next().value; -// returns '🍕' - -v = it.next().value; -// returns '🌷' - -var count = ctx.count; -// returns 2 -``` - - - - - - - -
- -## Notes - -- If an environment supports `Symbol.iterator`, the returned iterator is iterable. -- In environments supporting `Symbol.iterator`, the function **explicitly** does **not** invoke a string's `@@iterator` method, regardless of whether this method is defined. To convert a string to an implementation defined iterator, invoke this method directly. - -
- - - - - -
- -## Examples - - - - - -```javascript -var graphemeClusters2iteratorRight = require( '@stdlib/string/to-grapheme-cluster-iterator-right' ); - -function repeat( str ) { - return str + str; -} - -// Create an iterator which iterates over grapheme clusters: -var it = graphemeClusters2iteratorRight( 'Iñtërnâtiônàlizætiøn', repeat ); - -// Perform manual iteration... -var v; -while ( true ) { - v = it.next(); - if ( v.done ) { - break; - } - console.log( v.value ); -} -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/to-grapheme-cluster-iterator-right/benchmark/benchmark.js b/to-grapheme-cluster-iterator-right/benchmark/benchmark.js deleted file mode 100644 index 16775f46..00000000 --- a/to-grapheme-cluster-iterator-right/benchmark/benchmark.js +++ /dev/null @@ -1,116 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isIteratorLike = require( '@stdlib/assert/is-iterator-like' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var graphemeClusters2iteratorRight = require( './../lib' ); // eslint-disable-line id-length - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var iter; - var i; - - values = 'Iñtërnâtiônàlizætiøn'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = graphemeClusters2iteratorRight( 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(); -}); - -bench( format( '%s::iteration', pkg ), function benchmark( b ) { - var values; - var iter; - var str; - var z; - var i; - - str = [ 'I', 'ñ', 't', 'ë', 'r', 'n', 'â', 't', 'i', 'ô', 'n', 'à', 'l', 'i', 'z', 'æ', 't', 'i', 'ø', 'n' ]; - values = []; - for ( i = 0; i < b.iterations; i++ ) { - values.push( str[ i%str.length ] ); - } - - iter = graphemeClusters2iteratorRight( values.join( '' ) ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = iter.next().value; - if ( typeof z !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof z !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::iteration,map', pkg ), function benchmark( b ) { - var values; - var iter; - var str; - var z; - var i; - - str = [ 'I', 'ñ', 't', 'ë', 'r', 'n', 'â', 't', 'i', 'ô', 'n', 'à', 'l', 'i', 'z', 'æ', 't', 'i', 'ø', 'n' ]; - values = []; - for ( i = 0; i < b.iterations; i++ ) { - values.push( str[ i%str.length ] ); - } - - iter = graphemeClusters2iteratorRight( values.join( '' ), transform ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = iter.next().value; - if ( typeof z !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof z !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function transform( v ) { - return v + v; - } -}); diff --git a/to-grapheme-cluster-iterator-right/docs/repl.txt b/to-grapheme-cluster-iterator-right/docs/repl.txt deleted file mode 100644 index d153d030..00000000 --- a/to-grapheme-cluster-iterator-right/docs/repl.txt +++ /dev/null @@ -1,56 +0,0 @@ - -{{alias}}( src[, mapFcn[, thisArg]] ) - Returns an iterator which iterates from right to left over each grapheme - cluster in a string. - - When invoked, an input function is provided three arguments: - - - value: grapheme cluster. - - index: iterated value index. - - src: source string. - - If an environment supports Symbol.iterator, the returned iterator is - iterable. - - If an environment supports Symbol.iterator, the function explicitly does not - invoke a string's `@@iterator` method, regardless of whether this method is - defined. To convert a string to an implementation defined iterator, invoke - this method directly. - - Parameters - ---------- - src: string - String from which to create the iterator. - - mapFcn: Function (optional) - Function to invoke for each iterated value. - - thisArg: any (optional) - Execution context. - - Returns - ------- - iterator: Object - Iterator. - - iterator.next(): Function - Returns an iterator protocol-compliant object containing the next - iterated value (if one exists) and a boolean flag indicating whether the - iterator is finished. - - iterator.return( [value] ): Function - Finishes an iterator and returns a provided value. - - Examples - -------- - > var it = {{alias}}( '🌷🍕' ); - > var v = it.next().value - '🍕' - > v = it.next().value - '🌷' - > var bool = it.next().done - true - - See Also - -------- - diff --git a/to-grapheme-cluster-iterator-right/docs/types/index.d.ts b/to-grapheme-cluster-iterator-right/docs/types/index.d.ts deleted file mode 100644 index 8708a95d..00000000 --- a/to-grapheme-cluster-iterator-right/docs/types/index.d.ts +++ /dev/null @@ -1,97 +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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Iterator as Iter, IterableIterator } from '@stdlib/types/iter'; - -// Define a union type representing both iterable and non-iterable iterators: -type Iterator = Iter | IterableIterator; - -/** -* Map function invoked for each iterated value. -* -* @returns iterator value -*/ -type Nullary = () => any; - -/** -* Map function invoked for each iterated value. -* -* @param value - iterated value -* @returns iterator value -*/ -type Unary = ( value: string ) => any; - -/** -* Map function invoked for each iterated value. -* -* @param value - iterated value -* @param index - iterated value index -* @returns iterator value -*/ -type Binary = ( value: string, index: number ) => any; - -/** -* Map function invoked for each iterated value. -* -* @param value - iterated value -* @param index - iterated value index -* @param src - source string -* @returns iterator value -*/ -type Ternary = ( value: string, index: number, src: string ) => any; - -/** -* Map function invoked for each iterated value. -* -* @param value - iterated value -* @param index - iterated value index -* @param src - source string -* @returns iterator value -*/ -type MapFunction = Nullary | Unary | Binary | Ternary; - -/** -* Returns an iterator which iterates from right to left over each grapheme cluster in a string. -* -* @param src - input value -* @param mapFcn - function to invoke for each iterated value -* @param thisArg - execution context -* @returns iterator -* -* @example -* var iter = graphemeClusters2iteratorRight( '🌷🍕' ); -* -* var v = iter.next().value; -* // returns '🍕' -* -* v = iter.next().value; -* // returns '🌷' -* -* var bool = iter.next().done; -* // returns true -*/ -declare function graphemeClusters2iteratorRight( src: string, mapFcn?: MapFunction, thisArg?: any ): Iterator; - - -// EXPORTS // - -export = graphemeClusters2iteratorRight; diff --git a/to-grapheme-cluster-iterator-right/docs/types/test.ts b/to-grapheme-cluster-iterator-right/docs/types/test.ts deleted file mode 100644 index f7402be1..00000000 --- a/to-grapheme-cluster-iterator-right/docs/types/test.ts +++ /dev/null @@ -1,66 +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. -*/ - -import graphemeClusters2iteratorRight = require( './index' ); - -/** -* Transforms a string. -* -* @param v - iterated value -* @returns new value -*/ -function transform( v: string ): string { - return v + v; -} - - -// TESTS // - -// The function returns an iterator... -{ - graphemeClusters2iteratorRight( 'beep' ); // $ExpectType Iterator - graphemeClusters2iteratorRight( 'beep', transform ); // $ExpectType Iterator - graphemeClusters2iteratorRight( 'beep', transform, {} ); // $ExpectType Iterator -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - graphemeClusters2iteratorRight( 123 ); // $ExpectError - graphemeClusters2iteratorRight( true ); // $ExpectError - graphemeClusters2iteratorRight( false ); // $ExpectError - graphemeClusters2iteratorRight( {} ); // $ExpectError - graphemeClusters2iteratorRight( null ); // $ExpectError - graphemeClusters2iteratorRight( undefined ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a map function... -{ - graphemeClusters2iteratorRight( 'beep', 'abc' ); // $ExpectError - graphemeClusters2iteratorRight( 'beep', 123 ); // $ExpectError - graphemeClusters2iteratorRight( 'beep', [] ); // $ExpectError - graphemeClusters2iteratorRight( 'beep', {} ); // $ExpectError - graphemeClusters2iteratorRight( 'beep', true ); // $ExpectError - graphemeClusters2iteratorRight( 'beep', false ); // $ExpectError - graphemeClusters2iteratorRight( 'beep', null ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - graphemeClusters2iteratorRight(); // $ExpectError - graphemeClusters2iteratorRight( 'beep', transform, {}, 123 ); // $ExpectError -} diff --git a/to-grapheme-cluster-iterator-right/examples/index.js b/to-grapheme-cluster-iterator-right/examples/index.js deleted file mode 100644 index 5837d160..00000000 --- a/to-grapheme-cluster-iterator-right/examples/index.js +++ /dev/null @@ -1,38 +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. -*/ - -'use strict'; - -var graphemeClusters2iteratorRight = require( './../lib' ); // eslint-disable-line id-length - -function repeat( str ) { - return str + str; -} - -// Create an iterator which iterates over grapheme clusters: -var it = graphemeClusters2iteratorRight( 'Iñtërnâtiônàlizætiøn', repeat ); - -// Perform manual iteration... -var v; -while ( true ) { - v = it.next(); - if ( v.done ) { - break; - } - console.log( v.value ); -} diff --git a/to-grapheme-cluster-iterator-right/lib/index.js b/to-grapheme-cluster-iterator-right/lib/index.js deleted file mode 100644 index cc550d02..00000000 --- a/to-grapheme-cluster-iterator-right/lib/index.js +++ /dev/null @@ -1,48 +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. -*/ - -'use strict'; - -/** -* Create an iterator which iterates from right to left over grapheme clusters. -* -* @module @stdlib/string/to-grapheme-cluster-iterator-right -* -* @example -* var graphemeClusters2iteratorRight = require( '@stdlib/string/to-grapheme-cluster-iterator-right' ); -* -* var iter = graphemeClusters2iteratorRight( '🌷🍕' ); -* -* var v = iter.next().value; -* // returns '🍕' -* -* v = iter.next().value; -* // returns '🌷' -* -* var bool = iter.next().done; -* // returns true -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/to-grapheme-cluster-iterator-right/lib/main.js b/to-grapheme-cluster-iterator-right/lib/main.js deleted file mode 100644 index 8bda67c0..00000000 --- a/to-grapheme-cluster-iterator-right/lib/main.js +++ /dev/null @@ -1,195 +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. -*/ - -'use strict'; - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var iteratorSymbol = require( '@stdlib/symbol/iterator' ); -var prevGraphemeClusterBreak = require( './../../prev-grapheme-cluster-break' ); -var format = require( './../../format' ); - - -// MAIN // - -/** -* Returns an iterator which iterates from right to left over each grapheme cluster in a string. -* -* @param {string} src - input value -* @param {Function} [mapFcn] - function to invoke for each iterated value -* @param {*} [thisArg] - execution context -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a function -* @returns {Iterator} iterator -* -* @example -* var iter = graphemeClusters2iteratorRight( '🌷🍕' ); -* -* var v = iter.next().value; -* // returns '🍕' -* -* v = iter.next().value; -* // returns '🌷' -* -* var bool = iter.next().done; -* // returns true -*/ -function graphemeClusters2iteratorRight( src ) { // eslint-disable-line id-length - var thisArg; - var iter; - var FLG; - var fcn; - var i; - if ( !isString( src ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', src ) ); - } - if ( arguments.length > 1 ) { - fcn = arguments[ 1 ]; - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) ); - } - thisArg = arguments[ 2 ]; - } - i = src.length - 1; - - // Create an iterator protocol-compliant object: - iter = {}; - if ( fcn ) { - setReadOnly( iter, 'next', next1 ); - } else { - setReadOnly( iter, 'next', next2 ); - } - setReadOnly( iter, 'return', end ); - - // If an environment supports `Symbol.iterator`, make the iterator iterable: - if ( iteratorSymbol ) { - setReadOnly( iter, iteratorSymbol, factory ); - } - return iter; - - /** - * Returns an iterator protocol-compliant object containing the next iterated value. - * - * @private - * @returns {Object} iterator protocol-compliant object - */ - function next1() { - var v; - var j; - if ( FLG ) { - return { - 'done': true - }; - } - j = prevGraphemeClusterBreak( src, i ); - if ( j === -1 ) { - FLG = true; - if ( src.length ) { - return { - 'value': fcn.call( thisArg, src.substring( j+1, i+1 ), j+1, src ), - 'done': false - }; - } - return { - 'done': true - }; - } - v = fcn.call( thisArg, src.substring( j+1, i+1 ), j+1, src ); - i = j; - return { - 'value': v, - 'done': false - }; - } - - /** - * Returns an iterator protocol-compliant object containing the next iterated value. - * - * @private - * @returns {Object} iterator protocol-compliant object - */ - function next2() { - var v; - var j; - if ( FLG ) { - return { - 'done': true - }; - } - j = prevGraphemeClusterBreak( src, i ); - if ( j === -1 ) { - FLG = true; - if ( src.length ) { - return { - 'value': src.substring( j+1, i+1 ), - 'done': false - }; - } - return { - 'done': true - }; - } - v = src.substring( j+1, i+1 ); - i = j; - return { - 'value': v, - '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() { - if ( fcn ) { - return graphemeClusters2iteratorRight( src, fcn, thisArg ); - } - return graphemeClusters2iteratorRight( src ); - } -} - - -// EXPORTS // - -module.exports = graphemeClusters2iteratorRight; diff --git a/to-grapheme-cluster-iterator-right/package.json b/to-grapheme-cluster-iterator-right/package.json deleted file mode 100644 index 01274a38..00000000 --- a/to-grapheme-cluster-iterator-right/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "@stdlib/string/to-grapheme-cluster-iterator-right", - "version": "0.0.0", - "description": "Create an iterator which iterates from right to left over grapheme clusters.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "unicode", - "grapheme", - "segmentation", - "surrogate", - "astral", - "emojis", - "iterator", - "iterate", - "iteration", - "iter", - "to", - "convert" - ] -} diff --git a/to-grapheme-cluster-iterator-right/test/test.js b/to-grapheme-cluster-iterator-right/test/test.js deleted file mode 100644 index eaf66e0e..00000000 --- a/to-grapheme-cluster-iterator-right/test/test.js +++ /dev/null @@ -1,563 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var iteratorSymbol = require( '@stdlib/symbol/iterator' ); -var noop = require( '@stdlib/utils/noop' ); -var grev = require( '@stdlib/blas/ext/base/grev' ); -var numGraphemeClusters = require( './../../num-grapheme-clusters' ); -var graphemeClusters2iteratorRight = require( './../lib' ); // eslint-disable-line id-length - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof graphemeClusters2iteratorRight, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided a first argument which is not a string', function test( t ) { - var values; - var i; - - 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() { - graphemeClusters2iteratorRight( value ); - }; - } -}); - -tape( 'the function throws an error if provided a first argument which is not a string (callback)', function test( t ) { - var values; - var i; - - 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() { - graphemeClusters2iteratorRight( value, noop ); - }; - } -}); - -tape( 'the function 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() { - graphemeClusters2iteratorRight( 'beep', value ); - }; - } -}); - -tape( 'the function returns an iterator protocol-compliant object', function test( t ) { - var expected; - var actual; - var values; - var it; - var r; - var i; - - values = '🌷Iñtërnâtiô🌷na\u0300lizætiøn🌷c\u0302🍕\uD834\uDD1E🍕🍕'; - expected = [ - { - 'value': '🌷', - 'done': false - }, - { - 'value': 'I', - 'done': false - }, - { - 'value': 'ñ', - 'done': false - }, - { - 'value': 't', - 'done': false - }, - { - 'value': 'ë', - 'done': false - }, - { - 'value': 'r', - 'done': false - }, - { - 'value': 'n', - 'done': false - }, - { - 'value': 'â', - 'done': false - }, - { - 'value': 't', - 'done': false - }, - { - 'value': 'i', - 'done': false - }, - { - 'value': 'ô', - 'done': false - }, - { - 'value': '🌷', - 'done': false - }, - { - 'value': 'n', - 'done': false - }, - { - 'value': 'à', - 'done': false - }, - { - 'value': 'l', - 'done': false - }, - { - 'value': 'i', - 'done': false - }, - { - 'value': 'z', - 'done': false - }, - { - 'value': 'æ', - 'done': false - }, - { - 'value': 't', - 'done': false - }, - { - 'value': 'i', - 'done': false - }, - { - 'value': 'ø', - 'done': false - }, - { - 'value': 'n', - 'done': false - }, - { - 'value': '🌷', - 'done': false - }, - { - 'value': 'ĉ', - 'done': false - }, - { - 'value': '🍕', - 'done': false - }, - { - 'value': '𝄞', - 'done': false - }, - { - 'value': '🍕', - 'done': false - }, - { - 'value': '🍕', - 'done': false - }, - { - 'done': true - } - ]; - expected = grev( expected.length-1, expected, 1 ); - - it = graphemeClusters2iteratorRight( values ); - t.strictEqual( it.next.length, 0, 'has zero arity' ); - - actual = []; - for ( i = 0; i < numGraphemeClusters( values ); i++ ) { - r = it.next(); - actual.push( r ); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( typeof r.done, 'boolean', 'returns expected value' ); - } - actual.push( it.next() ); - - t.deepEqual( actual, expected, 'returns expected values' ); - t.end(); -}); - -tape( 'the function returns an iterator protocol-compliant object (empty string)', function test( t ) { - var expected; - var actual; - var values; - var it; - var r; - var i; - - values = ''; - expected = [ - { - 'done': true - } - ]; - - it = graphemeClusters2iteratorRight( values ); - t.strictEqual( it.next.length, 0, 'has zero arity' ); - - actual = []; - for ( i = 0; i < numGraphemeClusters( values ); i++ ) { - r = it.next(); - actual.push( r ); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( typeof r.done, 'boolean', 'returns expected value' ); - } - actual.push( it.next() ); - - t.deepEqual( actual, expected, 'returns expected values' ); - t.end(); -}); - -tape( 'the function returns an iterator protocol-compliant object which supports invoking a provided function for each iterated value', function test( t ) { - var expected; - var values; - var it; - var r; - var i; - - values = 'beep'; - - it = graphemeClusters2iteratorRight( values, transform ); - t.strictEqual( it.next.length, 0, 'has zero arity' ); - - expected = []; - for ( i = 0; i < numGraphemeClusters( values ); i++ ) { - r = it.next(); - t.strictEqual( r.value, expected[ i ], 'returns expected value' ); - t.strictEqual( typeof r.done, 'boolean', 'returns expected value' ); - } - t.strictEqual( expected.length, values.length, 'has expected length' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); - - function transform( v, i ) { - v += i; - expected.push( v ); - return v; - } -}); - -tape( 'the function returns an iterator protocol-compliant object which supports invoking a provided function for each iterated value (empty string)', function test( t ) { - var expected; - var values; - var it; - var r; - var i; - - values = ''; - - it = graphemeClusters2iteratorRight( values, transform ); - t.strictEqual( it.next.length, 0, 'has zero arity' ); - - expected = []; - for ( i = 0; i < numGraphemeClusters( values ); i++ ) { - r = it.next(); - t.strictEqual( r.value, expected[ i ], 'returns expected value' ); - t.strictEqual( typeof r.done, 'boolean', 'returns expected value' ); - } - t.strictEqual( expected.length, values.length, 'has expected length' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); - - function transform( v, i ) { - v += i; - expected.push( v ); - return v; - } -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (no argument)', function test( t ) { - var it; - var r; - - it = graphemeClusters2iteratorRight( 'beep' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.return(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (no argument; callback)', function test( t ) { - var it; - var r; - - it = graphemeClusters2iteratorRight( 'beep', transform ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.return(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); - - function transform( v, i ) { - return v + i; - } -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (argument)', function test( t ) { - var it; - var r; - - it = graphemeClusters2iteratorRight( 'beep' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.return( 'finished' ); - t.strictEqual( r.value, 'finished', 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (argument; callback)', function test( t ) { - var it; - var r; - - it = graphemeClusters2iteratorRight( 'beep', transform ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.return( 'finished' ); - t.strictEqual( r.value, 'finished', 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); - - function transform( v, i ) { - return v + i; - } -}); - -tape( 'if an environment supports `Symbol.iterator`, the returned iterator is iterable', function test( t ) { - var graphemeClusters2iteratorRight; // eslint-disable-line id-length - var values; - var it1; - var it2; - var i; - - graphemeClusters2iteratorRight = proxyquire( './../lib/main.js', { - '@stdlib/symbol/iterator': '__ITERATOR_SYMBOL__' - }); - - values = 'beep'; - - it1 = graphemeClusters2iteratorRight( 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 method' ); - t.strictEqual( typeof it2.return, 'function', 'has method' ); - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( it2.next().value, it1.next().value, 'returns expected value' ); - } - t.end(); -}); - -tape( 'if an environment supports `Symbol.iterator`, the returned iterator is iterable (callback)', function test( t ) { - var graphemeClusters2iteratorRight; // eslint-disable-line id-length - var values; - var it1; - var it2; - var i; - - graphemeClusters2iteratorRight = proxyquire( './../lib/main.js', { - '@stdlib/symbol/iterator': '__ITERATOR_SYMBOL__' - }); - - values = 'beep'; - - it1 = graphemeClusters2iteratorRight( values, transform ); - 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 method' ); - t.strictEqual( typeof it2.return, 'function', 'has method' ); - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( it2.next().value, it1.next().value, 'returns expected value' ); - } - t.end(); - - function transform( v ) { - return v + v; - } -}); - -tape( 'if an environment does not support `Symbol.iterator`, the returned iterator is not "iterable"', function test( t ) { - var graphemeClusters2iteratorRight; // eslint-disable-line id-length - var it; - - graphemeClusters2iteratorRight = proxyquire( './../lib/main.js', { - '@stdlib/symbol/iterator': false - }); - - it = graphemeClusters2iteratorRight( 'beep' ); - t.strictEqual( it[ iteratorSymbol ], void 0, 'does not have property' ); - - t.end(); -}); - -tape( 'if an environment does not support `Symbol.iterator`, the returned iterator is not "iterable" (callback)', function test( t ) { - var graphemeClusters2iteratorRight; // eslint-disable-line id-length - var it; - - graphemeClusters2iteratorRight = proxyquire( './../lib/main.js', { - '@stdlib/symbol/iterator': false - }); - - it = graphemeClusters2iteratorRight( 'beep', transform ); - t.strictEqual( it[ iteratorSymbol ], void 0, 'does not have property' ); - - t.end(); - - function transform( v, i ) { - return v + i; - } -}); diff --git a/to-grapheme-cluster-iterator/README.md b/to-grapheme-cluster-iterator/README.md deleted file mode 100644 index 52004db4..00000000 --- a/to-grapheme-cluster-iterator/README.md +++ /dev/null @@ -1,227 +0,0 @@ - - -# graphemeClusters2iterator - -> Create an iterator which iterates over [grapheme clusters][unicode-text-segmentation]. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var graphemeClusters2iterator = require( '@stdlib/string/to-grapheme-cluster-iterator' ); -``` - -#### graphemeClusters2iterator( src\[, mapFcn\[, thisArg]] ) - -Returns an iterator which iterates over each [grapheme cluster][unicode-text-segmentation] in a `string`. - -```javascript -var iter = graphemeClusters2iterator( '🌷🍕' ); - -var v = iter.next().value; -// returns '🌷' - -v = iter.next().value; -// returns '🍕' - -var bool = iter.next().done; -// returns true -``` - -The returned iterator protocol-compliant object has the following properties: - -- **next**: function which returns an iterator protocol-compliant object containing the next iterated value (if one exists) assigned to a `value` property and a `done` property having a `boolean` value indicating whether the iterator is finished. -- **return**: function which closes an iterator and returns a single (optional) argument in an iterator protocol-compliant object. - -To invoke a function for each `src` value, provide a callback function. - -```javascript -function fcn( v ) { - return v + v; -} - -var it = graphemeClusters2iterator( 'beep', fcn ); -// returns - -var v = it.next().value; -// returns 'bb' - -v = it.next().value; -// returns 'ee' - -v = it.next().value; -// returns 'ee' - -// ... -``` - -The invoked function is provided three arguments: - -- **value**: [grapheme cluster][unicode-text-segmentation]. -- **index**: iterated value index. -- **src**: source string. - -```javascript -function fcn( v, i ) { - return v + i; -} - -var it = graphemeClusters2iterator( 'bar', fcn ); -// returns - -var v = it.next().value; -// returns 'b0' - -v = it.next().value; -// returns 'a1' - -v = it.next().value; -// returns 'r2' - -// ... -``` - -To set the callback function execution context, provide a `thisArg`. - -```javascript -function fcn( v ) { - this.count += 1; - return v; -} - -var ctx = { - 'count': 0 -}; - -var it = graphemeClusters2iterator( '🌷🍕', fcn, ctx ); -// returns - -var v = it.next().value; -// returns '🌷' - -v = it.next().value; -// returns '🍕' - -var count = ctx.count; -// returns 2 -``` - - - - - - - -
- -## Notes - -- If an environment supports `Symbol.iterator`, the returned iterator is iterable. -- In environments supporting `Symbol.iterator`, the function **explicitly** does **not** invoke a string's `@@iterator` method, regardless of whether this method is defined. To convert a string to an implementation defined iterator, invoke this method directly. - -
- - - - - -
- -## Examples - - - -```javascript -var graphemeClusters2iterator = require( '@stdlib/string/to-grapheme-cluster-iterator' ); - -function repeat( str ) { - return str + str; -} - -// Create an iterator which iterates over grapheme clusters: -var it = graphemeClusters2iterator( 'Iñtërnâtiônàlizætiøn', repeat ); - -// Perform manual iteration... -var v; -while ( true ) { - v = it.next(); - if ( v.done ) { - break; - } - console.log( v.value ); -} -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/to-grapheme-cluster-iterator/benchmark/benchmark.js b/to-grapheme-cluster-iterator/benchmark/benchmark.js deleted file mode 100644 index ebb44144..00000000 --- a/to-grapheme-cluster-iterator/benchmark/benchmark.js +++ /dev/null @@ -1,116 +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. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isIteratorLike = require( '@stdlib/assert/is-iterator-like' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var graphemeClusters2iterator = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var iter; - var i; - - values = 'Iñtërnâtiônàlizætiøn'; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - iter = graphemeClusters2iterator( 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(); -}); - -bench( format( '%s::iteration', pkg ), function benchmark( b ) { - var values; - var iter; - var str; - var z; - var i; - - str = [ 'I', 'ñ', 't', 'ë', 'r', 'n', 'â', 't', 'i', 'ô', 'n', 'à', 'l', 'i', 'z', 'æ', 't', 'i', 'ø', 'n' ]; - values = []; - for ( i = 0; i < b.iterations; i++ ) { - values.push( str[ i%str.length ] ); - } - - iter = graphemeClusters2iterator( values.join( '' ) ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = iter.next().value; - if ( typeof z !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof z !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::iteration,map', pkg ), function benchmark( b ) { - var values; - var iter; - var str; - var z; - var i; - - str = [ 'I', 'ñ', 't', 'ë', 'r', 'n', 'â', 't', 'i', 'ô', 'n', 'à', 'l', 'i', 'z', 'æ', 't', 'i', 'ø', 'n' ]; - values = []; - for ( i = 0; i < b.iterations; i++ ) { - values.push( str[ i%str.length ] ); - } - - iter = graphemeClusters2iterator( values.join( '' ), transform ); - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - z = iter.next().value; - if ( typeof z !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( typeof z !== 'string' ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - - function transform( v ) { - return v + v; - } -}); diff --git a/to-grapheme-cluster-iterator/docs/repl.txt b/to-grapheme-cluster-iterator/docs/repl.txt deleted file mode 100644 index 8f8ed500..00000000 --- a/to-grapheme-cluster-iterator/docs/repl.txt +++ /dev/null @@ -1,55 +0,0 @@ - -{{alias}}( src[, mapFcn[, thisArg]] ) - Returns an iterator which iterates over each grapheme cluster in a string. - - When invoked, an input function is provided three arguments: - - - value: grapheme cluster. - - index: iterated value index. - - src: source string. - - If an environment supports Symbol.iterator, the returned iterator is - iterable. - - If an environment supports Symbol.iterator, the function explicitly does not - invoke a string's `@@iterator` method, regardless of whether this method is - defined. To convert a string to an implementation defined iterator, invoke - this method directly. - - Parameters - ---------- - src: string - String from which to create the iterator. - - mapFcn: Function (optional) - Function to invoke for each iterated value. - - thisArg: any (optional) - Execution context. - - Returns - ------- - iterator: Object - Iterator. - - iterator.next(): Function - Returns an iterator protocol-compliant object containing the next - iterated value (if one exists) and a boolean flag indicating whether the - iterator is finished. - - iterator.return( [value] ): Function - Finishes an iterator and returns a provided value. - - Examples - -------- - > var it = {{alias}}( '🌷🍕' ); - > var v = it.next().value - '🌷' - > v = it.next().value - '🍕' - > var bool = it.next().done - true - - See Also - -------- - diff --git a/to-grapheme-cluster-iterator/docs/types/index.d.ts b/to-grapheme-cluster-iterator/docs/types/index.d.ts deleted file mode 100644 index b18fa63c..00000000 --- a/to-grapheme-cluster-iterator/docs/types/index.d.ts +++ /dev/null @@ -1,97 +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. -*/ - -// TypeScript Version: 4.1 - -/// - -import { Iterator as Iter, IterableIterator } from '@stdlib/types/iter'; - -// Define a union type representing both iterable and non-iterable iterators: -type Iterator = Iter | IterableIterator; - -/** -* Map function invoked for each iterated value. -* -* @returns iterator value -*/ -type Nullary = () => any; - -/** -* Map function invoked for each iterated value. -* -* @param value - iterated value -* @returns iterator value -*/ -type Unary = ( value: string ) => any; - -/** -* Map function invoked for each iterated value. -* -* @param value - iterated value -* @param index - iterated value index -* @returns iterator value -*/ -type Binary = ( value: string, index: number ) => any; - -/** -* Map function invoked for each iterated value. -* -* @param value - iterated value -* @param index - iterated value index -* @param src - source string -* @returns iterator value -*/ -type Ternary = ( value: string, index: number, src: string ) => any; - -/** -* Map function invoked for each iterated value. -* -* @param value - iterated value -* @param index - iterated value index -* @param src - source string -* @returns iterator value -*/ -type MapFunction = Nullary | Unary | Binary | Ternary; - -/** -* Returns an iterator which iterates over each grapheme cluster in a string. -* -* @param src - input value -* @param mapFcn - function to invoke for each iterated value -* @param thisArg - execution context -* @returns iterator -* -* @example -* var iter = graphemeClusters2iterator( '🌷🍕' ); -* -* var v = iter.next().value; -* // returns '🌷' -* -* v = iter.next().value; -* // returns '🍕' -* -* var bool = iter.next().done; -* // returns true -*/ -declare function graphemeClusters2iterator( src: string, mapFcn?: MapFunction, thisArg?: any ): Iterator; - - -// EXPORTS // - -export = graphemeClusters2iterator; diff --git a/to-grapheme-cluster-iterator/docs/types/test.ts b/to-grapheme-cluster-iterator/docs/types/test.ts deleted file mode 100644 index 3554030a..00000000 --- a/to-grapheme-cluster-iterator/docs/types/test.ts +++ /dev/null @@ -1,66 +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. -*/ - -import graphemeClusters2iterator = require( './index' ); - -/** -* Transforms a string. -* -* @param v - iterated value -* @returns new value -*/ -function transform( v: string ): string { - return v + v; -} - - -// TESTS // - -// The function returns an iterator... -{ - graphemeClusters2iterator( 'beep' ); // $ExpectType Iterator - graphemeClusters2iterator( 'beep', transform ); // $ExpectType Iterator - graphemeClusters2iterator( 'beep', transform, {} ); // $ExpectType Iterator -} - -// The compiler throws an error if the function is provided a first argument which is not a string... -{ - graphemeClusters2iterator( 123 ); // $ExpectError - graphemeClusters2iterator( true ); // $ExpectError - graphemeClusters2iterator( false ); // $ExpectError - graphemeClusters2iterator( {} ); // $ExpectError - graphemeClusters2iterator( null ); // $ExpectError - graphemeClusters2iterator( undefined ); // $ExpectError -} - -// The compiler throws an error if the function is provided a second argument which is not a map function... -{ - graphemeClusters2iterator( 'beep', 'abc' ); // $ExpectError - graphemeClusters2iterator( 'beep', 123 ); // $ExpectError - graphemeClusters2iterator( 'beep', [] ); // $ExpectError - graphemeClusters2iterator( 'beep', {} ); // $ExpectError - graphemeClusters2iterator( 'beep', true ); // $ExpectError - graphemeClusters2iterator( 'beep', false ); // $ExpectError - graphemeClusters2iterator( 'beep', null ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - graphemeClusters2iterator(); // $ExpectError - graphemeClusters2iterator( 'beep', transform, {}, 123 ); // $ExpectError -} diff --git a/to-grapheme-cluster-iterator/examples/index.js b/to-grapheme-cluster-iterator/examples/index.js deleted file mode 100644 index bee1bc87..00000000 --- a/to-grapheme-cluster-iterator/examples/index.js +++ /dev/null @@ -1,38 +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. -*/ - -'use strict'; - -var graphemeClusters2iterator = require( './../lib' ); - -function repeat( str ) { - return str + str; -} - -// Create an iterator which iterates over grapheme clusters: -var it = graphemeClusters2iterator( 'Iñtërnâtiônàlizætiøn', repeat ); - -// Perform manual iteration... -var v; -while ( true ) { - v = it.next(); - if ( v.done ) { - break; - } - console.log( v.value ); -} diff --git a/to-grapheme-cluster-iterator/lib/index.js b/to-grapheme-cluster-iterator/lib/index.js deleted file mode 100644 index 69f101ab..00000000 --- a/to-grapheme-cluster-iterator/lib/index.js +++ /dev/null @@ -1,48 +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. -*/ - -'use strict'; - -/** -* Create an iterator which iterates over grapheme clusters. -* -* @module @stdlib/string/to-grapheme-cluster-iterator -* -* @example -* var graphemeClusters2iterator = require( '@stdlib/string/to-grapheme-cluster-iterator' ); -* -* var iter = graphemeClusters2iterator( '🌷🍕' ); -* -* var v = iter.next().value; -* // returns '🌷' -* -* v = iter.next().value; -* // returns '🍕' -* -* var bool = iter.next().done; -* // returns true -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/to-grapheme-cluster-iterator/lib/main.js b/to-grapheme-cluster-iterator/lib/main.js deleted file mode 100644 index 0c88d98b..00000000 --- a/to-grapheme-cluster-iterator/lib/main.js +++ /dev/null @@ -1,195 +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. -*/ - -'use strict'; - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var isFunction = require( '@stdlib/assert/is-function' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var iteratorSymbol = require( '@stdlib/symbol/iterator' ); -var nextGraphemeClusterBreak = require( './../../next-grapheme-cluster-break' ); -var format = require( './../../format' ); - - -// MAIN // - -/** -* Returns an iterator which iterates over each grapheme cluster in a string. -* -* @param {string} src - input value -* @param {Function} [mapFcn] - function to invoke for each iterated value -* @param {*} [thisArg] - execution context -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a function -* @returns {Iterator} iterator -* -* @example -* var iter = graphemeClusters2iterator( '🌷🍕' ); -* -* var v = iter.next().value; -* // returns '🌷' -* -* v = iter.next().value; -* // returns '🍕' -* -* var bool = iter.next().done; -* // returns true -*/ -function graphemeClusters2iterator( src ) { - var thisArg; - var iter; - var FLG; - var fcn; - var i; - if ( !isString( src ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', src ) ); - } - if ( arguments.length > 1 ) { - fcn = arguments[ 1 ]; - if ( !isFunction( fcn ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a function. Value: `%s`.', fcn ) ); - } - thisArg = arguments[ 2 ]; - } - i = 0; - - // Create an iterator protocol-compliant object: - iter = {}; - if ( fcn ) { - setReadOnly( iter, 'next', next1 ); - } else { - setReadOnly( iter, 'next', next2 ); - } - setReadOnly( iter, 'return', end ); - - // If an environment supports `Symbol.iterator`, make the iterator iterable: - if ( iteratorSymbol ) { - setReadOnly( iter, iteratorSymbol, factory ); - } - return iter; - - /** - * Returns an iterator protocol-compliant object containing the next iterated value. - * - * @private - * @returns {Object} iterator protocol-compliant object - */ - function next1() { - var v; - var j; - if ( FLG ) { - return { - 'done': true - }; - } - j = nextGraphemeClusterBreak( src, i ); - if ( j === -1 ) { - FLG = true; - if ( src.length ) { - return { - 'value': fcn.call( thisArg, src.substring( i ), i, src ), - 'done': false - }; - } - return { - 'done': true - }; - } - v = fcn.call( thisArg, src.substring( i, j ), i, src ); - i = j; - return { - 'value': v, - 'done': false - }; - } - - /** - * Returns an iterator protocol-compliant object containing the next iterated value. - * - * @private - * @returns {Object} iterator protocol-compliant object - */ - function next2() { - var v; - var j; - if ( FLG ) { - return { - 'done': true - }; - } - j = nextGraphemeClusterBreak( src, i ); - if ( j === -1 ) { - FLG = true; - if ( src.length ) { - return { - 'value': src.substring( i ), - 'done': false - }; - } - return { - 'done': true - }; - } - v = src.substring( i, j ); - i = j; - return { - 'value': v, - '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() { - if ( fcn ) { - return graphemeClusters2iterator( src, fcn, thisArg ); - } - return graphemeClusters2iterator( src ); - } -} - - -// EXPORTS // - -module.exports = graphemeClusters2iterator; diff --git a/to-grapheme-cluster-iterator/package.json b/to-grapheme-cluster-iterator/package.json deleted file mode 100644 index 3fe506c3..00000000 --- a/to-grapheme-cluster-iterator/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "@stdlib/string/to-grapheme-cluster-iterator", - "version": "0.0.0", - "description": "Create an iterator which iterates over grapheme clusters.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "unicode", - "grapheme", - "segmentation", - "surrogate", - "astral", - "emojis", - "iterator", - "iterate", - "iteration", - "iter", - "to", - "convert" - ] -} diff --git a/to-grapheme-cluster-iterator/test/test.js b/to-grapheme-cluster-iterator/test/test.js deleted file mode 100644 index c8c2fe92..00000000 --- a/to-grapheme-cluster-iterator/test/test.js +++ /dev/null @@ -1,561 +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. -*/ - -'use strict'; - -// MODULES // - -var tape = require( 'tape' ); -var proxyquire = require( 'proxyquire' ); -var iteratorSymbol = require( '@stdlib/symbol/iterator' ); -var noop = require( '@stdlib/utils/noop' ); -var numGraphemeClusters = require( './../../num-grapheme-clusters' ); -var graphemeClusters2iterator = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof graphemeClusters2iterator, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if provided a first argument which is not a string', function test( t ) { - var values; - var i; - - 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() { - graphemeClusters2iterator( value ); - }; - } -}); - -tape( 'the function throws an error if provided a first argument which is not a string (callback)', function test( t ) { - var values; - var i; - - 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() { - graphemeClusters2iterator( value, noop ); - }; - } -}); - -tape( 'the function 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() { - graphemeClusters2iterator( 'beep', value ); - }; - } -}); - -tape( 'the function returns an iterator protocol-compliant object', function test( t ) { - var expected; - var actual; - var values; - var it; - var r; - var i; - - values = '🌷Iñtërnâtiô🌷na\u0300lizætiøn🌷c\u0302🍕\uD834\uDD1E🍕🍕'; - expected = [ - { - 'value': '🌷', - 'done': false - }, - { - 'value': 'I', - 'done': false - }, - { - 'value': 'ñ', - 'done': false - }, - { - 'value': 't', - 'done': false - }, - { - 'value': 'ë', - 'done': false - }, - { - 'value': 'r', - 'done': false - }, - { - 'value': 'n', - 'done': false - }, - { - 'value': 'â', - 'done': false - }, - { - 'value': 't', - 'done': false - }, - { - 'value': 'i', - 'done': false - }, - { - 'value': 'ô', - 'done': false - }, - { - 'value': '🌷', - 'done': false - }, - { - 'value': 'n', - 'done': false - }, - { - 'value': 'à', - 'done': false - }, - { - 'value': 'l', - 'done': false - }, - { - 'value': 'i', - 'done': false - }, - { - 'value': 'z', - 'done': false - }, - { - 'value': 'æ', - 'done': false - }, - { - 'value': 't', - 'done': false - }, - { - 'value': 'i', - 'done': false - }, - { - 'value': 'ø', - 'done': false - }, - { - 'value': 'n', - 'done': false - }, - { - 'value': '🌷', - 'done': false - }, - { - 'value': 'ĉ', - 'done': false - }, - { - 'value': '🍕', - 'done': false - }, - { - 'value': '𝄞', - 'done': false - }, - { - 'value': '🍕', - 'done': false - }, - { - 'value': '🍕', - 'done': false - }, - { - 'done': true - } - ]; - - it = graphemeClusters2iterator( values ); - t.strictEqual( it.next.length, 0, 'has zero arity' ); - - actual = []; - for ( i = 0; i < numGraphemeClusters( values ); i++ ) { - r = it.next(); - actual.push( r ); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( typeof r.done, 'boolean', 'returns expected value' ); - } - actual.push( it.next() ); - - t.deepEqual( actual, expected, 'returns expected values' ); - t.end(); -}); - -tape( 'the function returns an iterator protocol-compliant object (empty string)', function test( t ) { - var expected; - var actual; - var values; - var it; - var r; - var i; - - values = ''; - expected = [ - { - 'done': true - } - ]; - - it = graphemeClusters2iterator( values ); - t.strictEqual( it.next.length, 0, 'has zero arity' ); - - actual = []; - for ( i = 0; i < numGraphemeClusters( values ); i++ ) { - r = it.next(); - actual.push( r ); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( typeof r.done, 'boolean', 'returns expected value' ); - } - actual.push( it.next() ); - - t.deepEqual( actual, expected, 'returns expected values' ); - t.end(); -}); - -tape( 'the function returns an iterator protocol-compliant object which supports invoking a provided function for each iterated value', function test( t ) { - var expected; - var values; - var it; - var r; - var i; - - values = 'beep'; - - it = graphemeClusters2iterator( values, transform ); - t.strictEqual( it.next.length, 0, 'has zero arity' ); - - expected = []; - for ( i = 0; i < numGraphemeClusters( values ); i++ ) { - r = it.next(); - t.strictEqual( r.value, expected[ i ], 'returns expected value' ); - t.strictEqual( typeof r.done, 'boolean', 'returns expected value' ); - } - t.strictEqual( expected.length, values.length, 'has expected length' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); - - function transform( v, i ) { - v += i; - expected.push( v ); - return v; - } -}); - -tape( 'the function returns an iterator protocol-compliant object which supports invoking a provided function for each iterated value (empty string)', function test( t ) { - var expected; - var values; - var it; - var r; - var i; - - values = ''; - - it = graphemeClusters2iterator( values, transform ); - t.strictEqual( it.next.length, 0, 'has zero arity' ); - - expected = []; - for ( i = 0; i < numGraphemeClusters( values ); i++ ) { - r = it.next(); - t.strictEqual( r.value, expected[ i ], 'returns expected value' ); - t.strictEqual( typeof r.done, 'boolean', 'returns expected value' ); - } - t.strictEqual( expected.length, values.length, 'has expected length' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); - - function transform( v, i ) { - v += i; - expected.push( v ); - return v; - } -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (no argument)', function test( t ) { - var it; - var r; - - it = graphemeClusters2iterator( 'beep' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.return(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (no argument; callback)', function test( t ) { - var it; - var r; - - it = graphemeClusters2iterator( 'beep', transform ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.return(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); - - function transform( v, i ) { - return v + i; - } -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (argument)', function test( t ) { - var it; - var r; - - it = graphemeClusters2iterator( 'beep' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.return( 'finished' ); - t.strictEqual( r.value, 'finished', 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); -}); - -tape( 'the returned iterator has a `return` method for closing an iterator (argument; callback)', function test( t ) { - var it; - var r; - - it = graphemeClusters2iterator( 'beep', transform ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.next(); - t.strictEqual( typeof r.value, 'string', 'returns expected value' ); - t.strictEqual( r.done, false, 'returns expected value' ); - - r = it.return( 'finished' ); - t.strictEqual( r.value, 'finished', 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - r = it.next(); - t.strictEqual( r.value, void 0, 'returns expected value' ); - t.strictEqual( r.done, true, 'returns expected value' ); - - t.end(); - - function transform( v, i ) { - return v + i; - } -}); - -tape( 'if an environment supports `Symbol.iterator`, the returned iterator is iterable', function test( t ) { - var graphemeClusters2iterator; - var values; - var it1; - var it2; - var i; - - graphemeClusters2iterator = proxyquire( './../lib/main.js', { - '@stdlib/symbol/iterator': '__ITERATOR_SYMBOL__' - }); - - values = 'beep'; - - it1 = graphemeClusters2iterator( 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 method' ); - t.strictEqual( typeof it2.return, 'function', 'has method' ); - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( it2.next().value, it1.next().value, 'returns expected value' ); - } - t.end(); -}); - -tape( 'if an environment supports `Symbol.iterator`, the returned iterator is iterable (callback)', function test( t ) { - var graphemeClusters2iterator; - var values; - var it1; - var it2; - var i; - - graphemeClusters2iterator = proxyquire( './../lib/main.js', { - '@stdlib/symbol/iterator': '__ITERATOR_SYMBOL__' - }); - - values = 'beep'; - - it1 = graphemeClusters2iterator( values, transform ); - 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 method' ); - t.strictEqual( typeof it2.return, 'function', 'has method' ); - - for ( i = 0; i < values.length; i++ ) { - t.strictEqual( it2.next().value, it1.next().value, 'returns expected value' ); - } - t.end(); - - function transform( v ) { - return v + v; - } -}); - -tape( 'if an environment does not support `Symbol.iterator`, the returned iterator is not "iterable"', function test( t ) { - var graphemeClusters2iterator; - var it; - - graphemeClusters2iterator = proxyquire( './../lib/main.js', { - '@stdlib/symbol/iterator': false - }); - - it = graphemeClusters2iterator( 'beep' ); - t.strictEqual( it[ iteratorSymbol ], void 0, 'does not have property' ); - - t.end(); -}); - -tape( 'if an environment does not support `Symbol.iterator`, the returned iterator is not "iterable" (callback)', function test( t ) { - var graphemeClusters2iterator; - var it; - - graphemeClusters2iterator = proxyquire( './../lib/main.js', { - '@stdlib/symbol/iterator': false - }); - - it = graphemeClusters2iterator( 'beep', transform ); - t.strictEqual( it[ iteratorSymbol ], void 0, 'does not have property' ); - - t.end(); - - function transform( v, i ) { - return v + i; - } -}); diff --git a/to-well-formed/README.md b/to-well-formed/README.md deleted file mode 100644 index 9bbc402e..00000000 --- a/to-well-formed/README.md +++ /dev/null @@ -1,106 +0,0 @@ - - -# str2wellformed - -> Create a new well-formed string. - -
- -## Usage - -```javascript -var str2wellformed = require( '@stdlib/string/to-well-formed' ); -``` - -#### str2wellformed( str ) - -Creates a new well-formed string by replacing all lone surrogates with the replacement character `\uFFFD`. - - - -```javascript -var result = str2wellformed( '' ); -// returns '' - -result = str2wellformed( '\uDBFF' ); -// returns '�' - -result = str2wellformed( '\uDBFFFF\uDBFF' ); -// returns '�FF�' - -result = str2wellformed( '-5' ); -// returns '-5' -``` - -
- - - -
- -## Examples - - - - - -```javascript -var str2wellformed = require( '@stdlib/string/to-well-formed' ); - -var result = str2wellformed( '' ); -// returns '' - -result = str2wellformed( '\uDBFF' ); -// returns '�' - -result = str2wellformed( '\uDBFF\uDBFF' ); -// returns '��' - -result = str2wellformed( '5\uDBFF' ); -// returns '5�' - -result = str2wellformed( '-5' ); -// returns '-5' -``` - -
- - - - - - - - - - - - - - diff --git a/to-well-formed/benchmark/benchmark.js b/to-well-formed/benchmark/benchmark.js deleted file mode 100644 index 9dfeec91..00000000 --- a/to-well-formed/benchmark/benchmark.js +++ /dev/null @@ -1,59 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var str2wellformed = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var result; - var strs; - var i; - - strs = [ - '', - '\uDBFF', - 'Hello World', - '3.14', - '\uDBFF\uDBFF', - 'foo\uD800bar', - 'hello123' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - result = str2wellformed( strs[ i % strs.length ] ); - if ( typeof result !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( result ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/to-well-formed/docs/repl.txt b/to-well-formed/docs/repl.txt deleted file mode 100644 index 026fbb43..00000000 --- a/to-well-formed/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( str ) - Returns a well formed string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - result: string - Well formed string. - - Examples - -------- - > result = {{alias}}( '\uDBFF' ) - '�' - - > result = {{alias}}( '\uDBFFFF\uDBFF' ) - '�FF�' - - > result = {{alias}}( '-5' ) - '-5' - - > result = {{alias}}( '\uDBFFFF\uDBFF' ) - '�FF�' - - See Also - -------- - diff --git a/to-well-formed/docs/types/index.d.ts b/to-well-formed/docs/types/index.d.ts deleted file mode 100644 index 88d0d039..00000000 --- a/to-well-formed/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Replaces all lone surrogates in order to create a new string which is well formed. -* -* @param str - string to test -* @returns new string which does not contain any lone surrogates -* -* @example -* var result = str2wellformed( '\uDBFF' ); -* // returns '�' -* -* @example -* var result = str2wellformed( '\uDBFFFF\uDBFF' ); -* // returns '�FF�' -* -* @example -* var result = str2wellformed( '-5' ); -* // returns '-5' -*/ -declare function str2wellformed( str: string ): string; - - -// EXPORTS // - -export = str2wellformed; diff --git a/to-well-formed/docs/types/test.ts b/to-well-formed/docs/types/test.ts deleted file mode 100644 index ffe9f74f..00000000 --- a/to-well-formed/docs/types/test.ts +++ /dev/null @@ -1,35 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import str2wellformed = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - str2wellformed( '' ); // $ExpectType string - str2wellformed( 'Hello' ); // $ExpectType string - str2wellformed( '\uDBFFFF\uDBFF' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - str2wellformed(); // $ExpectError - str2wellformed( '', '\uDBFF' ); // $ExpectError -} diff --git a/to-well-formed/examples/index.js b/to-well-formed/examples/index.js deleted file mode 100644 index 1a7a7852..00000000 --- a/to-well-formed/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -/* eslint-disable no-new-wrappers */ - -'use strict'; - -var str2wellformed = require( './../lib' ); - -console.log( str2wellformed( '' ) ); -// => '' - -console.log( str2wellformed( new String( '' ) ) ); -// => '' - -console.log( str2wellformed( '\uDFFFab' ) ); -// => '�ab' - -console.log( str2wellformed( '\uDBFFFF\uDBFF' ) ); -// => '�FF�' - -console.log( str2wellformed( 'ab\uD800' ) ); -// => 'ab�' - -console.log( str2wellformed( 'ab\uD83D\uDE04c' ) ); -// => 'ab😄c' diff --git a/to-well-formed/lib/index.js b/to-well-formed/lib/index.js deleted file mode 100644 index dad981ce..00000000 --- a/to-well-formed/lib/index.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Convert a string to a well formed string. -* -* @module @stdlib/string/to-well-formed -* -* @example -* var str2wellformed = require( '@stdlib/string/to-well-formed' ); -* -* var str = "ab\uD800"; -* var newStr = str2wellformed( str ); -* // returns 'ab�' -* -* str = "ab\uD83D\uDE04c"; -* newStr = str2wellformed( str ); -* // returns 'ab😄c' -* -* str = "abc"; -* bool = str2wellformed( str ); -* // returns 'abc' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/to-well-formed/lib/main.js b/to-well-formed/lib/main.js deleted file mode 100644 index 9618d933..00000000 --- a/to-well-formed/lib/main.js +++ /dev/null @@ -1,75 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ); -var format = require( './../../format' ); -var isWellFormed = require( '@stdlib/assert/is-well-formed-string' ); - - -// VARIABLES // - -var RE_UTF16_LOW_SURROGATE = /[\uDC00-\uDFFF]/; -var RE_UTF16_HIGH_SURROGATE = /[\uD800-\uDBFF]/; - - -// MAIN // - -/** -* Replaces all lone surrogates in order to create a new string which is well formed. -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {string} new string which does not contain any lone surrogates -* -* @example -* var str = str2wellformed( 'ab\uD800' ); -* // returns 'ab�' -*/ -function str2wellformed( str ) { - var modifiedString; - var i; - modifiedString = ''; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - if ( isWellFormed( str ) ) { - for ( i = 0; i < str.length; i++ ) { - modifiedString += str[i]; - } - return modifiedString; - } - for ( i = 0; i < str.length; i++ ) { - if ( RE_UTF16_LOW_SURROGATE.test( str[ i ] ) || RE_UTF16_HIGH_SURROGATE.test( str[ i ] ) ) { - modifiedString += '\uFFFD'; - } - else { - modifiedString += str[ i ]; - } - } - return modifiedString; -} - - -// EXPORTS // - -module.exports = str2wellformed; diff --git a/to-well-formed/package.json b/to-well-formed/package.json deleted file mode 100644 index 6d6c10d7..00000000 --- a/to-well-formed/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/to-well-formed", - "version": "0.0.0", - "description": "Convert a string to a well formed string.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "string", - "well-formed", - "surrogate", - "lone-surrogate", - "utf-16", - "unicode", - "replacement", - "character", - "validation", - "sanitization", - "conversion", - "transform", - "utility", - "utils" - ] -} diff --git a/to-well-formed/test/test.js b/to-well-formed/test/test.js deleted file mode 100644 index 57aecc80..00000000 --- a/to-well-formed/test/test.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2024 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 str2wellformed = require( './../lib/main.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof str2wellformed, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a well-formed string by replacing lone surrogates with Unicode replacement character', function test( t ) { - t.strictEqual( str2wellformed(''), '', 'returns an empty string for an empty input' ); - t.strictEqual( str2wellformed('\uDBFF'), '�', 'replaces lone high surrogate with Unicode replacement character' ); - t.strictEqual( str2wellformed('\uDBFFFF\uDBFF'), '�FF�', 'replaces multiple lone surrogates with Unicode replacement characters' ); - t.strictEqual( str2wellformed('Hello \uDBFFWorld'), 'Hello �World', 'replaces lone high surrogate in a string with Unicode replacement character' ); - t.strictEqual( str2wellformed('\uDBFF'), '�', 'replaces lone high surrogate with Unicode replacement character' ); - t.strictEqual( str2wellformed('\uDBFFFFF'), '�FFF', 'replaces lone high surrogate with Unicode replacement character' ); - t.strictEqual( str2wellformed('\uDC00\uDC00'), '��', 'replaces lone low surrogate with Unicode replacement character' ); - t.strictEqual( str2wellformed('5\uDBFF'), '5�', 'replaces lone high surrogate with Unicode replacement character' ); - - t.end(); -}); diff --git a/tools/README.md b/tools/README.md deleted file mode 100644 index 510c5d36..00000000 --- a/tools/README.md +++ /dev/null @@ -1,97 +0,0 @@ - - -# Tools - -> String tools. - -
- -## Usage - -```javascript -var tools = require( '@stdlib/string/tools' ); -``` - -#### tools - -Namespace containing string tools. - -```javascript -var o = tools; -// returns {...} -``` - -The namespace contains the following: - - - -
- -- [`grapheme( code )`][@stdlib/string/tools/grapheme-cluster-break]: grapheme cluster break tooling. - -
- - - -
- - - -
- -## Examples - - - - - -```javascript -var objectKeys = require( '@stdlib/utils/keys' ); -var tools = require( '@stdlib/string/tools' ); - -console.log( objectKeys( tools ) ); -``` - -
- - - - - - - - - - - - - - diff --git a/tools/docs/types/index.d.ts b/tools/docs/types/index.d.ts deleted file mode 100644 index 60e8e9b8..00000000 --- a/tools/docs/types/index.d.ts +++ /dev/null @@ -1,43 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/* eslint-disable max-lines */ - -import grapheme = require( './../../../tools/grapheme-cluster-break' ); - -/** -* Interface describing the `tools` namespace. -*/ -interface Namespace { - /** - * Grapheme cluster break tooling. - */ - grapheme: typeof grapheme; -} - -/** -* String tools. -*/ -declare var ns: Namespace; - - -// EXPORTS // - -export = ns; diff --git a/tools/docs/types/test.ts b/tools/docs/types/test.ts deleted file mode 100644 index c2dd14ec..00000000 --- a/tools/docs/types/test.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 ns = require( './index' ); - - -// TESTS // - -// The exported value is the expected interface... -{ - ns; // $ExpectType Namespace -} diff --git a/tools/examples/index.js b/tools/examples/index.js deleted file mode 100644 index 6c26d3be..00000000 --- a/tools/examples/index.js +++ /dev/null @@ -1,24 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 objectKeys = require( '@stdlib/utils/keys' ); -var ns = require( './../lib' ); - -console.log( objectKeys( ns ) ); diff --git a/tools/grapheme-cluster-break/README.md b/tools/grapheme-cluster-break/README.md deleted file mode 100644 index 4176bd20..00000000 --- a/tools/grapheme-cluster-break/README.md +++ /dev/null @@ -1,170 +0,0 @@ - - -# grapheme - -> Grapheme cluster break tooling. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var grapheme = require( '@stdlib/string/tools/grapheme-cluster-break' ); -``` - -#### grapheme - -A collection of functions for performing grapheme cluster break operations. - -* * * - -### Methods - -#### grapheme.breakProperty( code ) - -Returns the grapheme break property from the [Unicode Standard][unicode-grapheme-break-property]. - -```javascript -var out = grapheme.breakProperty( 0x008f ); -// returns 2 - -out = grapheme.breakProperty( 0x111C2 ); -// returns 12 - -out = grapheme.breakProperty( 0x1F3FC ); -// returns 3 -``` - -#### grapheme.emojiProperty( code ) - -Returns the emoji property from the [Unicode Standard][unicode-emoji-property]. - -```javascript -var out = grapheme.emojiProperty( 0x23EC ); -// returns 101 - -out = grapheme.emojiProperty( 0x1FFFE ); -// returns 11 -``` - -#### grapheme.breakType( breaks, emoji ) - -Returns the break type between grapheme breaking classes according to _UAX #29 3.1.1 Grapheme Cluster Boundary Rules_ on extended grapheme clusters. - -```javascript -var out = grapheme.breakType( [ 11, 3, 11 ], [ 11, 11, 11 ] ); -// returns 1 -``` - -* * * - -### Properties - -#### grapheme.constants - -An object mapping break type names to integer values. - -```javascript -var out = grapheme.constants; -// returns {...} -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var grapheme = require( '@stdlib/string/tools/grapheme-cluster-break' ); - -var out = grapheme.breakProperty( 0x008f ); -// returns 2 - -out = grapheme.emojiProperty( 0x23EC ); -// returns 101 - -out = grapheme.breakType( [ 11, 3, 11 ], [ 11, 11, 11 ] ); -// returns 1 - -out = grapheme.constants; -// returns {...} -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/tools/grapheme-cluster-break/docs/types/index.d.ts b/tools/grapheme-cluster-break/docs/types/index.d.ts deleted file mode 100644 index 211465b0..00000000 --- a/tools/grapheme-cluster-break/docs/types/index.d.ts +++ /dev/null @@ -1,99 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* An object mapping break type names to integer values. -*/ -interface Constants { - [key: string]: number; -} - -/** -* Interface describing grapheme cluster break tooling. -*/ -interface Grapheme { - /** - * Returns the grapheme break property from the [Unicode Standard][1]. - * - * [1]: https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt - * - * @param code - Unicode code point - * @returns grapheme break property - * - * @example - * var out = grapheme.breakProperty( 0x008f ); - * // returns 2 - * - * @example - * var out = grapheme.breakProperty( 0x111C2 ); - * // returns 12 - * - * @example - * var out = grapheme.breakProperty( 0x1F3FC ); - * // returns 3 - */ - breakProperty( code: number ): number; - - /** - * Returns the break type between grapheme breaking classes according to _UAX #29 3.1.1 Grapheme Cluster Boundary Rules_ on extended grapheme clusters. - * - * @param breaks - list of grapheme break properties - * @param emoji - list of emoji properties - * @returns break type - * - * @example - * var out = grapheme.breakType( [ 11, 3, 11 ], [ 11, 11, 11 ] ); - * // returns 1 - */ - breakType( breaks: Array, emoji: Array ): number; - - /** - * Returns the emoji property from the [Unicode Standard][1]. - * - * [1]: https://www.unicode.org/Public/13.0.0/ucd/emoji/emoji-data.txt - * - * @param code - Unicode code point - * @returns emoji property - * - * @example - * var out = grapheme.emojiProperty( 0x23EC ); - * // returns 101 - * - * @example - * var out = grapheme.emojiProperty( 0x1FFFE ); - * // returns 11 - */ - emojiProperty( code: number ): number; - - /** - * An object mapping break type names to integer values. - */ - constants: Constants; -} - -/** -* Grapheme cluster break tooling. -*/ -declare var grapheme: Grapheme; - - -// EXPORTS // - -export = grapheme; diff --git a/tools/grapheme-cluster-break/docs/types/test.ts b/tools/grapheme-cluster-break/docs/types/test.ts deleted file mode 100644 index 19b6db27..00000000 --- a/tools/grapheme-cluster-break/docs/types/test.ts +++ /dev/null @@ -1,29 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 grapheme = require( './index' ); - - -// TESTS // - -// The exported value is the expected interface... -{ - grapheme; // $ExpectType Grapheme -} diff --git a/tools/grapheme-cluster-break/examples/index.js b/tools/grapheme-cluster-break/examples/index.js deleted file mode 100644 index 68a5b163..00000000 --- a/tools/grapheme-cluster-break/examples/index.js +++ /dev/null @@ -1,37 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 grapheme = require( './../lib' ); - -var out = grapheme.breakProperty( 0x008f ); -console.log( out ); -// => 2 - -out = grapheme.emojiProperty( 0x23EC ); -console.log( out ); -// => 101 - -out = grapheme.breakType( [ 11, 3, 11 ], [ 11, 11, 11 ] ); -console.log( out ); -// => 1 - -out = grapheme.constants; -console.log( out ); -// => {...} diff --git a/tools/grapheme-cluster-break/lib/break_property.js b/tools/grapheme-cluster-break/lib/break_property.js deleted file mode 100644 index e605c7d4..00000000 --- a/tools/grapheme-cluster-break/lib/break_property.js +++ /dev/null @@ -1,1475 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 max-lines-per-function, max-lines */ - -'use strict'; - -// MODULES // - -var constants = require( './constants.js' ); - - -// MAIN // - -/** -* Returns the grapheme break property from the [Unicode Standard][1]. -* -* [1]: https://www.unicode.org/Public/13.0.0/ucd/auxiliary/GraphemeBreakProperty.txt -* -* @private -* @param {NonNegativeInteger} code - Unicode code point -* @returns {NonNegativeInteger} grapheme break property -* -* @example -* var out = graphemeBreakProperty( 0x008f ); -* // returns 2 -* -* @example -* var out = graphemeBreakProperty( 0x111C2 ); -* // returns 12 -* -* @example -* var out = graphemeBreakProperty( 0x1F3FC ); -* // returns 3 -*/ -function graphemeBreakProperty( code ) { - if ( - ( 0x0600 <= code && code <= 0x0605 ) || // Cf [6] ARABIC NUMBER SIGN..ARABIC NUMBER MARK ABOVE - code === 0x06DD || // Cf ARABIC END OF AYAH - code === 0x070F || // Cf SYRIAC ABBREVIATION MARK - code === 0x08E2 || // Cf ARABIC DISPUTED END OF AYAH - code === 0x0D4E || // Lo MALAYALAM LETTER DOT REPH - code === 0x110BD || // Cf KAITHI NUMBER SIGN - code === 0x110CD || // Cf KAITHI NUMBER SIGN ABOVE - ( 0x111C2 <= code && code <= 0x111C3 ) || // Lo [2] SHARADA SIGN JIHVAMULIYA..SHARADA SIGN UPADHMANIYA - code === 0x1193F || // Lo DIVES AKURU PREFIXED NASAL SIGN - code === 0x11941 || // Lo DIVES AKURU INITIAL RA - code === 0x11A3A || // Lo ZANABAZAR SQUARE CLUSTER-INITIAL LETTER RA - ( 0x11A84 <= code && code <= 0x11A89 ) || // Lo [6] SOYOMBO SIGN JIHVAMULIYA..SOYOMBO CLUSTER-INITIAL LETTER SA - code === 0x11D46 // Lo MASARAM GONDI REPHA - ) { - return constants.Prepend; - } - if ( - code === 0x000D // Cc - ) { - return constants.CR; - } - if ( - code === 0x000A // Cc - ) { - return constants.LF; - } - if ( - ( 0x0000 <= code && code <= 0x0009 ) || // Cc [10] .. - ( 0x000B <= code && code <= 0x000C ) || // Cc [2] .. - ( 0x000E <= code && code <= 0x001F ) || // Cc [18] .. - ( 0x007F <= code && code <= 0x009F ) || // Cc [33] .. - code === 0x00AD || // Cf SOFT HYPHEN - code === 0x061C || // Cf ARABIC LETTER MARK - code === 0x180E || // Cf MONGOLIAN VOWEL SEPARATOR - code === 0x200B || // Cf ZERO WIDTH SPACE - ( 0x200E <= code && code <= 0x200F ) || // Cf [2] LEFT-TO-RIGHT MARK..RIGHT-TO-LEFT MARK - code === 0x2028 || // Zl LINE SEPARATOR - code === 0x2029 || // Zp PARAGRAPH SEPARATOR - ( 0x202A <= code && code <= 0x202E ) || // Cf [5] LEFT-TO-RIGHT EMBEDDING..RIGHT-TO-LEFT OVERRIDE - ( 0x2060 <= code && code <= 0x2064 ) || // Cf [5] WORD JOINER..INVISIBLE PLUS - code === 0x2065 || // Cn - ( 0x2066 <= code && code <= 0x206F ) || // Cf [10] LEFT-TO-RIGHT ISOLATE..NOMINAL DIGIT SHAPES - code === 0xFEFF || // Cf ZERO WIDTH NO-BREAK SPACE - ( 0xFFF0 <= code && code <= 0xFFF8 ) || // Cn [9] .. - ( 0xFFF9 <= code && code <= 0xFFFB ) || // Cf [3] INTERLINEAR ANNOTATION ANCHOR..INTERLINEAR ANNOTATION TERMINATOR - ( 0x13430 <= code && code <= 0x13438 ) || // Cf [9] EGYPTIAN HIEROGLYPH VERTICAL JOINER..EGYPTIAN HIEROGLYPH END SEGMENT - ( 0x1BCA0 <= code && code <= 0x1BCA3 ) || // Cf [4] SHORTHAND FORMAT LETTER OVERLAP..SHORTHAND FORMAT UP STEP - ( 0x1D173 <= code && code <= 0x1D17A ) || // Cf [8] MUSICAL SYMBOL BEGIN BEAM..MUSICAL SYMBOL END PHRASE - code === 0xE0000 || // Cn - code === 0xE0001 || // Cf LANGUAGE TAG - ( 0xE0002 <= code && code <= 0xE001F ) || // Cn [30] .. - ( 0xE0080 <= code && code <= 0xE00FF ) || // Cn [128] .. - ( 0xE01F0 <= code && code <= 0xE0FFF ) // Cn [3600] .. - ) { - return constants.Control; - } - if ( - ( 0x0300 <= code && code <= 0x036F ) || // Mn [112] COMBINING GRAVE ACCENT..COMBINING LATIN SMALL LETTER X - ( 0x0483 <= code && code <= 0x0487 ) || // Mn [5] COMBINING CYRILLIC TITLO..COMBINING CYRILLIC POKRYTIE - ( 0x0488 <= code && code <= 0x0489 ) || // Me [2] COMBINING CYRILLIC HUNDRED THOUSANDS SIGN..COMBINING CYRILLIC MILLIONS SIGN - ( 0x0591 <= code && code <= 0x05BD ) || // Mn [45] HEBREW ACCENT ETNAHTA..HEBREW POINT METEG - code === 0x05BF || // Mn HEBREW POINT RAFE - ( 0x05C1 <= code && code <= 0x05C2 ) || // Mn [2] HEBREW POINT SHIN DOT..HEBREW POINT SIN DOT - ( 0x05C4 <= code && code <= 0x05C5 ) || // Mn [2] HEBREW MARK UPPER DOT..HEBREW MARK LOWER DOT - code === 0x05C7 || // Mn HEBREW POINT QAMATS QATAN - ( 0x0610 <= code && code <= 0x061A ) || // Mn [11] ARABIC SIGN SALLALLAHOU ALAYHE WASSALLAM..ARABIC SMALL KASRA - ( 0x064B <= code && code <= 0x065F ) || // Mn [21] ARABIC FATHATAN..ARABIC WAVY HAMZA BELOW - code === 0x0670 || // Mn ARABIC LETTER SUPERSCRIPT ALEF - ( 0x06D6 <= code && code <= 0x06DC ) || // Mn [7] ARABIC SMALL HIGH LIGATURE SAD WITH LAM WITH ALEF MAKSURA..ARABIC SMALL HIGH SEEN - ( 0x06DF <= code && code <= 0x06E4 ) || // Mn [6] ARABIC SMALL HIGH ROUNDED ZERO..ARABIC SMALL HIGH MADDA - ( 0x06E7 <= code && code <= 0x06E8 ) || // Mn [2] ARABIC SMALL HIGH YEH..ARABIC SMALL HIGH NOON - ( 0x06EA <= code && code <= 0x06ED ) || // Mn [4] ARABIC EMPTY CENTRE LOW STOP..ARABIC SMALL LOW MEEM - code === 0x0711 || // Mn SYRIAC LETTER SUPERSCRIPT ALAPH - ( 0x0730 <= code && code <= 0x074A ) || // Mn [27] SYRIAC PTHAHA ABOVE..SYRIAC BARREKH - ( 0x07A6 <= code && code <= 0x07B0 ) || // Mn [11] THAANA ABAFILI..THAANA SUKUN - ( 0x07EB <= code && code <= 0x07F3 ) || // Mn [9] NKO COMBINING SHORT HIGH TONE..NKO COMBINING DOUBLE DOT ABOVE - code === 0x07FD || // Mn NKO DANTAYALAN - ( 0x0816 <= code && code <= 0x0819 ) || // Mn [4] SAMARITAN MARK IN..SAMARITAN MARK DAGESH - ( 0x081B <= code && code <= 0x0823 ) || // Mn [9] SAMARITAN MARK EPENTHETIC YUT..SAMARITAN VOWEL SIGN A - ( 0x0825 <= code && code <= 0x0827 ) || // Mn [3] SAMARITAN VOWEL SIGN SHORT A..SAMARITAN VOWEL SIGN U - ( 0x0829 <= code && code <= 0x082D ) || // Mn [5] SAMARITAN VOWEL SIGN LONG I..SAMARITAN MARK NEQUDAA - ( 0x0859 <= code && code <= 0x085B ) || // Mn [3] MANDAIC AFFRICATION MARK..MANDAIC GEMINATION MARK - ( 0x08D3 <= code && code <= 0x08E1 ) || // Mn [15] ARABIC SMALL LOW WAW..ARABIC SMALL HIGH SIGN SAFHA - ( 0x08E3 <= code && code <= 0x0902 ) || // Mn [32] ARABIC TURNED DAMMA BELOW..DEVANAGARI SIGN ANUSVARA - code === 0x093A || // Mn DEVANAGARI VOWEL SIGN OE - code === 0x093C || // Mn DEVANAGARI SIGN NUKTA - ( 0x0941 <= code && code <= 0x0948 ) || // Mn [8] DEVANAGARI VOWEL SIGN U..DEVANAGARI VOWEL SIGN AI - code === 0x094D || // Mn DEVANAGARI SIGN VIRAMA - ( 0x0951 <= code && code <= 0x0957 ) || // Mn [7] DEVANAGARI STRESS SIGN UDATTA..DEVANAGARI VOWEL SIGN UUE - ( 0x0962 <= code && code <= 0x0963 ) || // Mn [2] DEVANAGARI VOWEL SIGN VOCALIC L..DEVANAGARI VOWEL SIGN VOCALIC LL - code === 0x0981 || // Mn BENGALI SIGN CANDRABINDU - code === 0x09BC || // Mn BENGALI SIGN NUKTA - code === 0x09BE || // Mc BENGALI VOWEL SIGN AA - ( 0x09C1 <= code && code <= 0x09C4 ) || // Mn [4] BENGALI VOWEL SIGN U..BENGALI VOWEL SIGN VOCALIC RR - code === 0x09CD || // Mn BENGALI SIGN VIRAMA - code === 0x09D7 || // Mc BENGALI AU LENGTH MARK - ( 0x09E2 <= code && code <= 0x09E3 ) || // Mn [2] BENGALI VOWEL SIGN VOCALIC L..BENGALI VOWEL SIGN VOCALIC LL - code === 0x09FE || // Mn BENGALI SANDHI MARK - ( 0x0A01 <= code && code <= 0x0A02 ) || // Mn [2] GURMUKHI SIGN ADAK BINDI..GURMUKHI SIGN BINDI - code === 0x0A3C || // Mn GURMUKHI SIGN NUKTA - ( 0x0A41 <= code && code <= 0x0A42 ) || // Mn [2] GURMUKHI VOWEL SIGN U..GURMUKHI VOWEL SIGN UU - ( 0x0A47 <= code && code <= 0x0A48 ) || // Mn [2] GURMUKHI VOWEL SIGN EE..GURMUKHI VOWEL SIGN AI - ( 0x0A4B <= code && code <= 0x0A4D ) || // Mn [3] GURMUKHI VOWEL SIGN OO..GURMUKHI SIGN VIRAMA - code === 0x0A51 || // Mn GURMUKHI SIGN UDAAT - ( 0x0A70 <= code && code <= 0x0A71 ) || // Mn [2] GURMUKHI TIPPI..GURMUKHI ADDAK - code === 0x0A75 || // Mn GURMUKHI SIGN YAKASH - ( 0x0A81 <= code && code <= 0x0A82 ) || // Mn [2] GUJARATI SIGN CANDRABINDU..GUJARATI SIGN ANUSVARA - code === 0x0ABC || // Mn GUJARATI SIGN NUKTA - ( 0x0AC1 <= code && code <= 0x0AC5 ) || // Mn [5] GUJARATI VOWEL SIGN U..GUJARATI VOWEL SIGN CANDRA E - ( 0x0AC7 <= code && code <= 0x0AC8 ) || // Mn [2] GUJARATI VOWEL SIGN E..GUJARATI VOWEL SIGN AI - code === 0x0ACD || // Mn GUJARATI SIGN VIRAMA - ( 0x0AE2 <= code && code <= 0x0AE3 ) || // Mn [2] GUJARATI VOWEL SIGN VOCALIC L..GUJARATI VOWEL SIGN VOCALIC LL - ( 0x0AFA <= code && code <= 0x0AFF ) || // Mn [6] GUJARATI SIGN SUKUN..GUJARATI SIGN TWO-CIRCLE NUKTA ABOVE - code === 0x0B01 || // Mn ORIYA SIGN CANDRABINDU - code === 0x0B3C || // Mn ORIYA SIGN NUKTA - code === 0x0B3E || // Mc ORIYA VOWEL SIGN AA - code === 0x0B3F || // Mn ORIYA VOWEL SIGN I - ( 0x0B41 <= code && code <= 0x0B44 ) || // Mn [4] ORIYA VOWEL SIGN U..ORIYA VOWEL SIGN VOCALIC RR - code === 0x0B4D || // Mn ORIYA SIGN VIRAMA - ( 0x0B55 <= code && code <= 0x0B56 ) || // Mn [2] ORIYA SIGN OVERLINE..ORIYA AI LENGTH MARK - code === 0x0B57 || // Mc ORIYA AU LENGTH MARK - ( 0x0B62 <= code && code <= 0x0B63 ) || // Mn [2] ORIYA VOWEL SIGN VOCALIC L..ORIYA VOWEL SIGN VOCALIC LL - code === 0x0B82 || // Mn TAMIL SIGN ANUSVARA - code === 0x0BBE || // Mc TAMIL VOWEL SIGN AA - code === 0x0BC0 || // Mn TAMIL VOWEL SIGN II - code === 0x0BCD || // Mn TAMIL SIGN VIRAMA - code === 0x0BD7 || // Mc TAMIL AU LENGTH MARK - code === 0x0C00 || // Mn TELUGU SIGN COMBINING CANDRABINDU ABOVE - code === 0x0C04 || // Mn TELUGU SIGN COMBINING ANUSVARA ABOVE - ( 0x0C3E <= code && code <= 0x0C40 ) || // Mn [3] TELUGU VOWEL SIGN AA..TELUGU VOWEL SIGN II - ( 0x0C46 <= code && code <= 0x0C48 ) || // Mn [3] TELUGU VOWEL SIGN E..TELUGU VOWEL SIGN AI - ( 0x0C4A <= code && code <= 0x0C4D ) || // Mn [4] TELUGU VOWEL SIGN O..TELUGU SIGN VIRAMA - ( 0x0C55 <= code && code <= 0x0C56 ) || // Mn [2] TELUGU LENGTH MARK..TELUGU AI LENGTH MARK - ( 0x0C62 <= code && code <= 0x0C63 ) || // Mn [2] TELUGU VOWEL SIGN VOCALIC L..TELUGU VOWEL SIGN VOCALIC LL - code === 0x0C81 || // Mn KANNADA SIGN CANDRABINDU - code === 0x0CBC || // Mn KANNADA SIGN NUKTA - code === 0x0CBF || // Mn KANNADA VOWEL SIGN I - code === 0x0CC2 || // Mc KANNADA VOWEL SIGN UU - code === 0x0CC6 || // Mn KANNADA VOWEL SIGN E - ( 0x0CCC <= code && code <= 0x0CCD ) || // Mn [2] KANNADA VOWEL SIGN AU..KANNADA SIGN VIRAMA - ( 0x0CD5 <= code && code <= 0x0CD6 ) || // Mc [2] KANNADA LENGTH MARK..KANNADA AI LENGTH MARK - ( 0x0CE2 <= code && code <= 0x0CE3 ) || // Mn [2] KANNADA VOWEL SIGN VOCALIC L..KANNADA VOWEL SIGN VOCALIC LL - ( 0x0D00 <= code && code <= 0x0D01 ) || // Mn [2] MALAYALAM SIGN COMBINING ANUSVARA ABOVE..MALAYALAM SIGN CANDRABINDU - ( 0x0D3B <= code && code <= 0x0D3C ) || // Mn [2] MALAYALAM SIGN VERTICAL BAR VIRAMA..MALAYALAM SIGN CIRCULAR VIRAMA - code === 0x0D3E || // Mc MALAYALAM VOWEL SIGN AA - ( 0x0D41 <= code && code <= 0x0D44 ) || // Mn [4] MALAYALAM VOWEL SIGN U..MALAYALAM VOWEL SIGN VOCALIC RR - code === 0x0D4D || // Mn MALAYALAM SIGN VIRAMA - code === 0x0D57 || // Mc MALAYALAM AU LENGTH MARK - ( 0x0D62 <= code && code <= 0x0D63 ) || // Mn [2] MALAYALAM VOWEL SIGN VOCALIC L..MALAYALAM VOWEL SIGN VOCALIC LL - code === 0x0D81 || // Mn SINHALA SIGN CANDRABINDU - code === 0x0DCA || // Mn SINHALA SIGN AL-LAKUNA - code === 0x0DCF || // Mc SINHALA VOWEL SIGN AELA-PILLA - ( 0x0DD2 <= code && code <= 0x0DD4 ) || // Mn [3] SINHALA VOWEL SIGN KETTI IS-PILLA..SINHALA VOWEL SIGN KETTI PAA-PILLA - code === 0x0DD6 || // Mn SINHALA VOWEL SIGN DIGA PAA-PILLA - code === 0x0DDF || // Mc SINHALA VOWEL SIGN GAYANUKITTA - code === 0x0E31 || // Mn THAI CHARACTER MAI HAN-AKAT - ( 0x0E34 <= code && code <= 0x0E3A ) || // Mn [7] THAI CHARACTER SARA I..THAI CHARACTER PHINTHU - ( 0x0E47 <= code && code <= 0x0E4E ) || // Mn [8] THAI CHARACTER MAITAIKHU..THAI CHARACTER YAMAKKAN - code === 0x0EB1 || // Mn LAO VOWEL SIGN MAI KAN - ( 0x0EB4 <= code && code <= 0x0EBC ) || // Mn [9] LAO VOWEL SIGN I..LAO SEMIVOWEL SIGN LO - ( 0x0EC8 <= code && code <= 0x0ECD ) || // Mn [6] LAO TONE MAI EK..LAO NIGGAHITA - ( 0x0F18 <= code && code <= 0x0F19 ) || // Mn [2] TIBETAN ASTROLOGICAL SIGN -KHYUD PA..TIBETAN ASTROLOGICAL SIGN SDONG TSHUGS - code === 0x0F35 || // Mn TIBETAN MARK NGAS BZUNG NYI ZLA - code === 0x0F37 || // Mn TIBETAN MARK NGAS BZUNG SGOR RTAGS - code === 0x0F39 || // Mn TIBETAN MARK TSA -PHRU - ( 0x0F71 <= code && code <= 0x0F7E ) || // Mn [14] TIBETAN VOWEL SIGN AA..TIBETAN SIGN RJES SU NGA RO - ( 0x0F80 <= code && code <= 0x0F84 ) || // Mn [5] TIBETAN VOWEL SIGN REVERSED I..TIBETAN MARK HALANTA - ( 0x0F86 <= code && code <= 0x0F87 ) || // Mn [2] TIBETAN SIGN LCI RTAGS..TIBETAN SIGN YANG RTAGS - ( 0x0F8D <= code && code <= 0x0F97 ) || // Mn [11] TIBETAN SUBJOINED SIGN LCE TSA CAN..TIBETAN SUBJOINED LETTER JA - ( 0x0F99 <= code && code <= 0x0FBC ) || // Mn [36] TIBETAN SUBJOINED LETTER NYA..TIBETAN SUBJOINED LETTER FIXED-FORM RA - code === 0x0FC6 || // Mn TIBETAN SYMBOL PADMA GDAN - ( 0x102D <= code && code <= 0x1030 ) || // Mn [4] MYANMAR VOWEL SIGN I..MYANMAR VOWEL SIGN UU - ( 0x1032 <= code && code <= 0x1037 ) || // Mn [6] MYANMAR VOWEL SIGN AI..MYANMAR SIGN DOT BELOW - ( 0x1039 <= code && code <= 0x103A ) || // Mn [2] MYANMAR SIGN VIRAMA..MYANMAR SIGN ASAT - ( 0x103D <= code && code <= 0x103E ) || // Mn [2] MYANMAR CONSONANT SIGN MEDIAL WA..MYANMAR CONSONANT SIGN MEDIAL HA - ( 0x1058 <= code && code <= 0x1059 ) || // Mn [2] MYANMAR VOWEL SIGN VOCALIC L..MYANMAR VOWEL SIGN VOCALIC LL - ( 0x105E <= code && code <= 0x1060 ) || // Mn [3] MYANMAR CONSONANT SIGN MON MEDIAL NA..MYANMAR CONSONANT SIGN MON MEDIAL LA - ( 0x1071 <= code && code <= 0x1074 ) || // Mn [4] MYANMAR VOWEL SIGN GEBA KAREN I..MYANMAR VOWEL SIGN KAYAH EE - code === 0x1082 || // Mn MYANMAR CONSONANT SIGN SHAN MEDIAL WA - ( 0x1085 <= code && code <= 0x1086 ) || // Mn [2] MYANMAR VOWEL SIGN SHAN E ABOVE..MYANMAR VOWEL SIGN SHAN FINAL Y - code === 0x108D || // Mn MYANMAR SIGN SHAN COUNCIL EMPHATIC TONE - code === 0x109D || // Mn MYANMAR VOWEL SIGN AITON AI - ( 0x135D <= code && code <= 0x135F ) || // Mn [3] ETHIOPIC COMBINING GEMINATION AND VOWEL LENGTH MARK..ETHIOPIC COMBINING GEMINATION MARK - ( 0x1712 <= code && code <= 0x1714 ) || // Mn [3] TAGALOG VOWEL SIGN I..TAGALOG SIGN VIRAMA - ( 0x1732 <= code && code <= 0x1734 ) || // Mn [3] HANUNOO VOWEL SIGN I..HANUNOO SIGN PAMUDPOD - ( 0x1752 <= code && code <= 0x1753 ) || // Mn [2] BUHID VOWEL SIGN I..BUHID VOWEL SIGN U - ( 0x1772 <= code && code <= 0x1773 ) || // Mn [2] TAGBANWA VOWEL SIGN I..TAGBANWA VOWEL SIGN U - ( 0x17B4 <= code && code <= 0x17B5 ) || // Mn [2] KHMER VOWEL INHERENT AQ..KHMER VOWEL INHERENT AA - ( 0x17B7 <= code && code <= 0x17BD ) || // Mn [7] KHMER VOWEL SIGN I..KHMER VOWEL SIGN UA - code === 0x17C6 || // Mn KHMER SIGN NIKAHIT - ( 0x17C9 <= code && code <= 0x17D3 ) || // Mn [11] KHMER SIGN MUUSIKATOAN..KHMER SIGN BATHAMASAT - code === 0x17DD || // Mn KHMER SIGN ATTHACAN - ( 0x180B <= code && code <= 0x180D ) || // Mn [3] MONGOLIAN FREE VARIATION SELECTOR ONE..MONGOLIAN FREE VARIATION SELECTOR THREE - ( 0x1885 <= code && code <= 0x1886 ) || // Mn [2] MONGOLIAN LETTER ALI GALI BALUDA..MONGOLIAN LETTER ALI GALI THREE BALUDA - code === 0x18A9 || // Mn MONGOLIAN LETTER ALI GALI DAGALGA - ( 0x1920 <= code && code <= 0x1922 ) || // Mn [3] LIMBU VOWEL SIGN A..LIMBU VOWEL SIGN U - ( 0x1927 <= code && code <= 0x1928 ) || // Mn [2] LIMBU VOWEL SIGN E..LIMBU VOWEL SIGN O - code === 0x1932 || // Mn LIMBU SMALL LETTER ANUSVARA - ( 0x1939 <= code && code <= 0x193B ) || // Mn [3] LIMBU SIGN MUKPHRENG..LIMBU SIGN SA-I - ( 0x1A17 <= code && code <= 0x1A18 ) || // Mn [2] BUGINESE VOWEL SIGN I..BUGINESE VOWEL SIGN U - code === 0x1A1B || // Mn BUGINESE VOWEL SIGN AE - code === 0x1A56 || // Mn TAI THAM CONSONANT SIGN MEDIAL LA - ( 0x1A58 <= code && code <= 0x1A5E ) || // Mn [7] TAI THAM SIGN MAI KANG LAI..TAI THAM CONSONANT SIGN SA - code === 0x1A60 || // Mn TAI THAM SIGN SAKOT - code === 0x1A62 || // Mn TAI THAM VOWEL SIGN MAI SAT - ( 0x1A65 <= code && code <= 0x1A6C ) || // Mn [8] TAI THAM VOWEL SIGN I..TAI THAM VOWEL SIGN OA BELOW - ( 0x1A73 <= code && code <= 0x1A7C ) || // Mn [10] TAI THAM VOWEL SIGN OA ABOVE..TAI THAM SIGN KHUEN-LUE KARAN - code === 0x1A7F || // Mn TAI THAM COMBINING CRYPTOGRAMMIC DOT - ( 0x1AB0 <= code && code <= 0x1ABD ) || // Mn [14] COMBINING DOUBLED CIRCUMFLEX ACCENT..COMBINING PARENTHESES BELOW - code === 0x1ABE || // Me COMBINING PARENTHESES OVERLAY - ( 0x1ABF <= code && code <= 0x1AC0 ) || // Mn [2] COMBINING LATIN SMALL LETTER W BELOW..COMBINING LATIN SMALL LETTER TURNED W BELOW - ( 0x1B00 <= code && code <= 0x1B03 ) || // Mn [4] BALINESE SIGN ULU RICEM..BALINESE SIGN SURANG - code === 0x1B34 || // Mn BALINESE SIGN REREKAN - code === 0x1B35 || // Mc BALINESE VOWEL SIGN TEDUNG - ( 0x1B36 <= code && code <= 0x1B3A) || // Mn [5] BALINESE VOWEL SIGN ULU..BALINESE VOWEL SIGN RA REPA - code === 0x1B3C || // Mn BALINESE VOWEL SIGN LA LENGA - code === 0x1B42 || // Mn BALINESE VOWEL SIGN PEPET - ( 0x1B6B <= code && code <= 0x1B73 ) || // Mn [9] BALINESE MUSICAL SYMBOL COMBINING TEGEH..BALINESE MUSICAL SYMBOL COMBINING GONG - ( 0x1B80 <= code && code <= 0x1B81 ) || // Mn [2] SUNDANESE SIGN PANYECEK..SUNDANESE SIGN PANGLAYAR - ( 0x1BA2 <= code && code <= 0x1BA5 ) || // Mn [4] SUNDANESE CONSONANT SIGN PANYAKRA..SUNDANESE VOWEL SIGN PANYUKU - ( 0x1BA8 <= code && code <= 0x1BA9 ) || // Mn [2] SUNDANESE VOWEL SIGN PAMEPET..SUNDANESE VOWEL SIGN PANEULEUNG - ( 0x1BAB <= code && code <= 0x1BAD ) || // Mn [3] SUNDANESE SIGN VIRAMA..SUNDANESE CONSONANT SIGN PASANGAN WA - code === 0x1BE6 || // Mn BATAK SIGN TOMPI - ( 0x1BE8 <= code && code <= 0x1BE9) || // Mn [2] BATAK VOWEL SIGN PAKPAK E..BATAK VOWEL SIGN EE - code === 0x1BED || // Mn BATAK VOWEL SIGN KARO O - ( 0x1BEF <= code && code <= 0x1BF1 ) || // Mn [3] BATAK VOWEL SIGN U FOR SIMALUNGUN SA..BATAK CONSONANT SIGN H - ( 0x1C2C <= code && code <= 0x1C33 ) || // Mn [8] LEPCHA VOWEL SIGN E..LEPCHA CONSONANT SIGN T - ( 0x1C36 <= code && code <= 0x1C37 ) || // Mn [2] LEPCHA SIGN RAN..LEPCHA SIGN NUKTA - ( 0x1CD0 <= code && code <= 0x1CD2 ) || // Mn [3] VEDIC TONE KARSHANA..VEDIC TONE PRENKHA - ( 0x1CD4 <= code && code <= 0x1CE0 ) || // Mn [13] VEDIC SIGN YAJURVEDIC MIDLINE SVARITA..VEDIC TONE RIGVEDIC KASHMIRI INDEPENDENT SVARITA - ( 0x1CE2 <= code && code <= 0x1CE8 ) || // Mn [7] VEDIC SIGN VISARGA SVARITA..VEDIC SIGN VISARGA ANUDATTA WITH TAIL - code === 0x1CED || // Mn VEDIC SIGN TIRYAK - code === 0x1CF4 || // Mn VEDIC TONE CANDRA ABOVE - ( 0x1CF8 <= code && code <= 0x1CF9 ) || // Mn [2] VEDIC TONE RING ABOVE..VEDIC TONE DOUBLE RING ABOVE - ( 0x1DC0 <= code && code <= 0x1DF9 ) || // Mn [58] COMBINING DOTTED GRAVE ACCENT..COMBINING WIDE INVERTED BRIDGE BELOW - ( 0x1DFB <= code && code <= 0x1DFF ) || // Mn [5] COMBINING DELETION MARK..COMBINING RIGHT ARROWHEAD AND DOWN ARROWHEAD BELOW - code === 0x200C || // Cf ZERO WIDTH NON-JOINER - ( 0x20D0 <= code && code <= 0x20DC ) || // Mn [13] COMBINING LEFT HARPOON ABOVE..COMBINING FOUR DOTS ABOVE - ( 0x20DD <= code && code <= 0x20E0 ) || // Me [4] COMBINING ENCLOSING CIRCLE..COMBINING ENCLOSING CIRCLE BACKSLASH - code === 0x20E1 || // Mn COMBINING LEFT RIGHT ARROW ABOVE - ( 0x20E2 <= code && code <= 0x20E4 ) || // Me [3] COMBINING ENCLOSING SCREEN..COMBINING ENCLOSING UPWARD POINTING TRIANGLE - ( 0x20E5 <= code && code <= 0x20F0 ) || // Mn [12] COMBINING REVERSE SOLIDUS OVERLAY..COMBINING ASTERISK ABOVE - ( 0x2CEF <= code && code <= 0x2CF1 ) || // Mn [3] COPTIC COMBINING NI ABOVE..COPTIC COMBINING SPIRITUS LENIS - code === 0x2D7F || // Mn TIFINAGH CONSONANT JOINER - ( 0x2DE0 <= code && code <= 0x2DFF ) || // Mn [32] COMBINING CYRILLIC LETTER BE..COMBINING CYRILLIC LETTER IOTIFIED BIG YUS - ( 0x302A <= code && code <= 0x302D ) || // Mn [4] IDEOGRAPHIC LEVEL TONE MARK..IDEOGRAPHIC ENTERING TONE MARK - ( 0x302E <= code && code <= 0x302F ) || // Mc [2] HANGUL SINGLE DOT TONE MARK..HANGUL DOUBLE DOT TONE MARK - ( 0x3099 <= code && code <= 0x309A ) || // Mn [2] COMBINING KATAKANA-HIRAGANA VOICED SOUND MARK..COMBINING KATAKANA-HIRAGANA SEMI-VOICED SOUND MARK - code === 0xA66F || // Mn COMBINING CYRILLIC VZMET - ( 0xA670 <= code && code <= 0xA672 ) || // Me [3] COMBINING CYRILLIC TEN MILLIONS SIGN..COMBINING CYRILLIC THOUSAND MILLIONS SIGN - ( 0xA674 <= code && code <= 0xA67D ) || // Mn [10] COMBINING CYRILLIC LETTER UKRAINIAN IE..COMBINING CYRILLIC PAYEROK - ( 0xA69E <= code && code <= 0xA69F ) || // Mn [2] COMBINING CYRILLIC LETTER EF..COMBINING CYRILLIC LETTER IOTIFIED E - ( 0xA6F0 <= code && code <= 0xA6F1 ) || // Mn [2] BAMUM COMBINING MARK KOQNDON..BAMUM COMBINING MARK TUKWENTIS - code === 0xA802 || // Mn SYLOTI NAGRI SIGN DVISVARA - code === 0xA806 || // Mn SYLOTI NAGRI SIGN HASANTA - code === 0xA80B || // Mn SYLOTI NAGRI SIGN ANUSVARA - ( 0xA825 <= code && code <= 0xA826 ) || // Mn [2] SYLOTI NAGRI VOWEL SIGN U..SYLOTI NAGRI VOWEL SIGN E - code === 0xA82C || // Mn SYLOTI NAGRI SIGN ALTERNATE HASANTA - ( 0xA8C4 <= code && code <= 0xA8C5 ) || // Mn [2] SAURASHTRA SIGN VIRAMA..SAURASHTRA SIGN CANDRABINDU - ( 0xA8E0 <= code && code <= 0xA8F1 ) || // Mn [18] COMBINING DEVANAGARI DIGIT ZERO..COMBINING DEVANAGARI SIGN AVAGRAHA - code === 0xA8FF || // Mn DEVANAGARI VOWEL SIGN AY - ( 0xA926 <= code && code <= 0xA92D ) || // Mn [8] KAYAH LI VOWEL UE..KAYAH LI TONE CALYA PLOPHU - ( 0xA947 <= code && code <= 0xA951 ) || // Mn [11] REJANG VOWEL SIGN I..REJANG CONSONANT SIGN R - ( 0xA980 <= code && code <= 0xA982 ) || // Mn [3] JAVANESE SIGN PANYANGGA..JAVANESE SIGN LAYAR - code === 0xA9B3 || // Mn JAVANESE SIGN CECAK TELU - ( 0xA9B6 <= code && code <= 0xA9B9 ) || // Mn [4] JAVANESE VOWEL SIGN WULU..JAVANESE VOWEL SIGN SUKU MENDUT - ( 0xA9BC <= code && code <= 0xA9BD ) || // Mn [2] JAVANESE VOWEL SIGN PEPET..JAVANESE CONSONANT SIGN KERET - code === 0xA9E5 || // Mn MYANMAR SIGN SHAN SAW - ( 0xAA29 <= code && code <= 0xAA2E ) || // Mn [6] CHAM VOWEL SIGN AA..CHAM VOWEL SIGN OE - ( 0xAA31 <= code && code <= 0xAA32 ) || // Mn [2] CHAM VOWEL SIGN AU..CHAM VOWEL SIGN UE - ( 0xAA35 <= code && code <= 0xAA36 ) || // Mn [2] CHAM CONSONANT SIGN LA..CHAM CONSONANT SIGN WA - code === 0xAA43 || // Mn CHAM CONSONANT SIGN FINAL NG - code === 0xAA4C || // Mn CHAM CONSONANT SIGN FINAL M - code === 0xAA7C || // Mn MYANMAR SIGN TAI LAING TONE-2 - code === 0xAAB0 || // Mn TAI VIET MAI KANG - ( 0xAAB2 <= code && code <= 0xAAB4 ) || // Mn [3] TAI VIET VOWEL I..TAI VIET VOWEL U - ( 0xAAB7 <= code && code <= 0xAAB8 ) || // Mn [2] TAI VIET MAI KHIT..TAI VIET VOWEL IA - ( 0xAABE <= code && code <= 0xAABF ) || // Mn [2] TAI VIET VOWEL AM..TAI VIET TONE MAI EK - code === 0xAAC1 || // Mn TAI VIET TONE MAI THO - ( 0xAAEC <= code && code <= 0xAAED ) || // Mn [2] MEETEI MAYEK VOWEL SIGN UU..MEETEI MAYEK VOWEL SIGN AAI - code === 0xAAF6 || // Mn MEETEI MAYEK VIRAMA - code === 0xABE5 || // Mn MEETEI MAYEK VOWEL SIGN ANAP - code === 0xABE8 || // Mn MEETEI MAYEK VOWEL SIGN UNAP - code === 0xABED || // Mn MEETEI MAYEK APUN IYEK - code === 0xFB1E || // Mn HEBREW POINT JUDEO-SPANISH VARIKA - ( 0xFE00 <= code && code <= 0xFE0F ) || // Mn [16] VARIATION SELECTOR-1..VARIATION SELECTOR-16 - ( 0xFE20 <= code && code <= 0xFE2F ) || // Mn [16] COMBINING LIGATURE LEFT HALF..COMBINING CYRILLIC TITLO RIGHT HALF - ( 0xFF9E <= code && code <= 0xFF9F ) || // Lm [2] HALFWIDTH KATAKANA VOICED SOUND MARK..HALFWIDTH KATAKANA SEMI-VOICED SOUND MARK - code === 0x101FD || // Mn PHAISTOS DISC SIGN COMBINING OBLIQUE STROKE - code === 0x102E0 || // Mn COPTIC EPACT THOUSANDS MARK - ( 0x10376 <= code && code <= 0x1037A ) || // Mn [5] COMBINING OLD PERMIC LETTER AN..COMBINING OLD PERMIC LETTER SII - ( 0x10A01 <= code && code <= 0x10A03 ) || // Mn [3] KHAROSHTHI VOWEL SIGN I..KHAROSHTHI VOWEL SIGN VOCALIC R - ( 0x10A05 <= code && code <= 0x10A06 ) || // Mn [2] KHAROSHTHI VOWEL SIGN E..KHAROSHTHI VOWEL SIGN O - ( 0x10A0C <= code && code <= 0x10A0F ) || // Mn [4] KHAROSHTHI VOWEL LENGTH MARK..KHAROSHTHI SIGN VISARGA - ( 0x10A38 <= code && code <= 0x10A3A ) || // Mn [3] KHAROSHTHI SIGN BAR ABOVE..KHAROSHTHI SIGN DOT BELOW - code === 0x10A3F || // Mn KHAROSHTHI VIRAMA - ( 0x10AE5 <= code && code <= 0x10AE6 ) || // Mn [2] MANICHAEAN ABBREVIATION MARK ABOVE..MANICHAEAN ABBREVIATION MARK BELOW - ( 0x10D24 <= code && code <= 0x10D27 ) || // Mn [4] HANIFI ROHINGYA SIGN HARBAHAY..HANIFI ROHINGYA SIGN TASSI - ( 0x10EAB <= code && code <= 0x10EAC ) || // Mn [2] YEZIDI COMBINING HAMZA MARK..YEZIDI COMBINING MADDA MARK - ( 0x10F46 <= code && code <= 0x10F50 ) || // Mn [11] SOGDIAN COMBINING DOT BELOW..SOGDIAN COMBINING STROKE BELOW - code === 0x11001 || // Mn BRAHMI SIGN ANUSVARA - ( 0x11038 <= code && code <= 0x11046 ) || // Mn [15] BRAHMI VOWEL SIGN AA..BRAHMI VIRAMA - ( 0x1107F <= code && code <= 0x11081 ) || // Mn [3] BRAHMI NUMBER JOINER..KAITHI SIGN ANUSVARA - ( 0x110B3 <= code && code <= 0x110B6 ) || // Mn [4] KAITHI VOWEL SIGN U..KAITHI VOWEL SIGN AI - ( 0x110B9 <= code && code <= 0x110BA ) || // Mn [2] KAITHI SIGN VIRAMA..KAITHI SIGN NUKTA - ( 0x11100 <= code && code <= 0x11102 ) || // Mn [3] CHAKMA SIGN CANDRABINDU..CHAKMA SIGN VISARGA - ( 0x11127 <= code && code <= 0x1112B ) || // Mn [5] CHAKMA VOWEL SIGN A..CHAKMA VOWEL SIGN UU - ( 0x1112D <= code && code <= 0x11134 ) || // Mn [8] CHAKMA VOWEL SIGN AI..CHAKMA MAAYYAA - code === 0x11173 || // Mn MAHAJANI SIGN NUKTA - ( 0x11180 <= code && code <= 0x11181 ) || // Mn [2] SHARADA SIGN CANDRABINDU..SHARADA SIGN ANUSVARA - ( 0x111B6 <= code && code <= 0x111BE ) || // Mn [9] SHARADA VOWEL SIGN U..SHARADA VOWEL SIGN O - ( 0x111C9 <= code && code <= 0x111CC ) || // Mn [4] SHARADA SANDHI MARK..SHARADA EXTRA SHORT VOWEL MARK - code === 0x111CF || // Mn SHARADA SIGN INVERTED CANDRABINDU - ( 0x1122F <= code && code <= 0x11231 ) || // Mn [3] KHOJKI VOWEL SIGN U..KHOJKI VOWEL SIGN AI - code === 0x11234 || // Mn KHOJKI SIGN ANUSVARA - ( 0x11236 <= code && code <= 0x11237 ) || // Mn [2] KHOJKI SIGN NUKTA..KHOJKI SIGN SHADDA - code === 0x1123E || // Mn KHOJKI SIGN SUKUN - code === 0x112DF || // Mn KHUDAWADI SIGN ANUSVARA - ( 0x112E3 <= code && code <= 0x112EA ) || // Mn [8] KHUDAWADI VOWEL SIGN U..KHUDAWADI SIGN VIRAMA - ( 0x11300 <= code && code <= 0x11301 ) || // Mn [2] GRANTHA SIGN COMBINING ANUSVARA ABOVE..GRANTHA SIGN CANDRABINDU - ( 0x1133B <= code && code <= 0x1133C ) || // Mn [2] COMBINING BINDU BELOW..GRANTHA SIGN NUKTA - code === 0x1133E || // Mc GRANTHA VOWEL SIGN AA - code === 0x11340 || // Mn GRANTHA VOWEL SIGN II - code === 0x11357 || // Mc GRANTHA AU LENGTH MARK - ( 0x11366 <= code && code <= 0x1136C ) || // Mn [7] COMBINING GRANTHA DIGIT ZERO..COMBINING GRANTHA DIGIT SIX - ( 0x11370 <= code && code <= 0x11374 ) || // Mn [5] COMBINING GRANTHA LETTER A..COMBINING GRANTHA LETTER PA - ( 0x11438 <= code && code <= 0x1143F ) || // Mn [8] NEWA VOWEL SIGN U..NEWA VOWEL SIGN AI - ( 0x11442 <= code && code <= 0x11444 ) || // Mn [3] NEWA SIGN VIRAMA..NEWA SIGN ANUSVARA - code === 0x11446 || // Mn NEWA SIGN NUKTA - code === 0x1145E || // Mn NEWA SANDHI MARK - code === 0x114B0 || // Mc TIRHUTA VOWEL SIGN AA - ( 0x114B3 <= code && code <= 0x114B8 ) || // Mn [6] TIRHUTA VOWEL SIGN U..TIRHUTA VOWEL SIGN VOCALIC LL - code === 0x114BA || // Mn TIRHUTA VOWEL SIGN SHORT E - code === 0x114BD || // Mc TIRHUTA VOWEL SIGN SHORT O - ( 0x114BF <= code && code <= 0x114C0 ) || // Mn [2] TIRHUTA SIGN CANDRABINDU..TIRHUTA SIGN ANUSVARA - ( 0x114C2 <= code && code <= 0x114C3 ) || // Mn [2] TIRHUTA SIGN VIRAMA..TIRHUTA SIGN NUKTA - code === 0x115AF || // Mc SIDDHAM VOWEL SIGN AA - ( 0x115B2 <= code && code <= 0x115B5 ) || // Mn [4] SIDDHAM VOWEL SIGN U..SIDDHAM VOWEL SIGN VOCALIC RR - ( 0x115BC <= code && code <= 0x115BD ) || // Mn [2] SIDDHAM SIGN CANDRABINDU..SIDDHAM SIGN ANUSVARA - ( 0x115BF <= code && code <= 0x115C0 ) || // Mn [2] SIDDHAM SIGN VIRAMA..SIDDHAM SIGN NUKTA - ( 0x115DC <= code && code <= 0x115DD ) || // Mn [2] SIDDHAM VOWEL SIGN ALTERNATE U..SIDDHAM VOWEL SIGN ALTERNATE UU - ( 0x11633 <= code && code <= 0x1163A ) || // Mn [8] MODI VOWEL SIGN U..MODI VOWEL SIGN AI - code === 0x1163D || // Mn MODI SIGN ANUSVARA - ( 0x1163F <= code && code <= 0x11640 ) || // Mn [2] MODI SIGN VIRAMA..MODI SIGN ARDHACANDRA - code === 0x116AB || // Mn TAKRI SIGN ANUSVARA - code === 0x116AD || // Mn TAKRI VOWEL SIGN AA - ( 0x116B0 <= code && code <= 0x116B5 ) || // Mn [6] TAKRI VOWEL SIGN U..TAKRI VOWEL SIGN AU - code === 0x116B7 || // Mn TAKRI SIGN NUKTA - ( 0x1171D <= code && code <= 0x1171F ) || // Mn [3] AHOM CONSONANT SIGN MEDIAL LA..AHOM CONSONANT SIGN MEDIAL LIGATING RA - ( 0x11722 <= code && code <= 0x11725 ) || // Mn [4] AHOM VOWEL SIGN I..AHOM VOWEL SIGN UU - ( 0x11727 <= code && code <= 0x1172B ) || // Mn [5] AHOM VOWEL SIGN AW..AHOM SIGN KILLER - ( 0x1182F <= code && code <= 0x11837 ) || // Mn [9] DOGRA VOWEL SIGN U..DOGRA SIGN ANUSVARA - ( 0x11839 <= code && code <= 0x1183A ) || // Mn [2] DOGRA SIGN VIRAMA..DOGRA SIGN NUKTA - code === 0x11930 || // Mc DIVES AKURU VOWEL SIGN AA - ( 0x1193B <= code && code <= 0x1193C ) || // Mn [2] DIVES AKURU SIGN ANUSVARA..DIVES AKURU SIGN CANDRABINDU - code === 0x1193E || // Mn DIVES AKURU VIRAMA - code === 0x11943 || // Mn DIVES AKURU SIGN NUKTA - ( 0x119D4 <= code && code <= 0x119D7 ) || // Mn [4] NANDINAGARI VOWEL SIGN U..NANDINAGARI VOWEL SIGN VOCALIC RR - ( 0x119DA <= code && code <= 0x119DB ) || // Mn [2] NANDINAGARI VOWEL SIGN E..NANDINAGARI VOWEL SIGN AI - code === 0x119E0 || // Mn NANDINAGARI SIGN VIRAMA - ( 0x11A01 <= code && code <= 0x11A0A ) || // Mn [10] ZANABAZAR SQUARE VOWEL SIGN I..ZANABAZAR SQUARE VOWEL LENGTH MARK - ( 0x11A33 <= code && code <= 0x11A38 ) || // Mn [6] ZANABAZAR SQUARE FINAL CONSONANT MARK..ZANABAZAR SQUARE SIGN ANUSVARA - ( 0x11A3B <= code && code <= 0x11A3E ) || // Mn [4] ZANABAZAR SQUARE CLUSTER-FINAL LETTER YA..ZANABAZAR SQUARE CLUSTER-FINAL LETTER VA - code === 0x11A47 || // Mn ZANABAZAR SQUARE SUBJOINER - ( 0x11A51 <= code && code <= 0x11A56 ) || // Mn [6] SOYOMBO VOWEL SIGN I..SOYOMBO VOWEL SIGN OE - ( 0x11A59 <= code && code <= 0x11A5B ) || // Mn [3] SOYOMBO VOWEL SIGN VOCALIC R..SOYOMBO VOWEL LENGTH MARK - ( 0x11A8A <= code && code <= 0x11A96 ) || // Mn [13] SOYOMBO FINAL CONSONANT SIGN G..SOYOMBO SIGN ANUSVARA - ( 0x11A98 <= code && code <= 0x11A99 ) || // Mn [2] SOYOMBO GEMINATION MARK..SOYOMBO SUBJOINER - ( 0x11C30 <= code && code <= 0x11C36 ) || // Mn [7] BHAIKSUKI VOWEL SIGN I..BHAIKSUKI VOWEL SIGN VOCALIC L - ( 0x11C38 <= code && code <= 0x11C3D ) || // Mn [6] BHAIKSUKI VOWEL SIGN E..BHAIKSUKI SIGN ANUSVARA - code === 0x11C3F || // Mn BHAIKSUKI SIGN VIRAMA - ( 0x11C92 <= code && code <= 0x11CA7 ) || // Mn [22] MARCHEN SUBJOINED LETTER KA..MARCHEN SUBJOINED LETTER ZA - ( 0x11CAA <= code && code <= 0x11CB0 ) || // Mn [7] MARCHEN SUBJOINED LETTER RA..MARCHEN VOWEL SIGN AA - ( 0x11CB2 <= code && code <= 0x11CB3 ) || // Mn [2] MARCHEN VOWEL SIGN U..MARCHEN VOWEL SIGN E - ( 0x11CB5 <= code && code <= 0x11CB6 ) || // Mn [2] MARCHEN SIGN ANUSVARA..MARCHEN SIGN CANDRABINDU - ( 0x11D31 <= code && code <= 0x11D36 ) || // Mn [6] MASARAM GONDI VOWEL SIGN AA..MASARAM GONDI VOWEL SIGN VOCALIC R - code === 0x11D3A || // Mn MASARAM GONDI VOWEL SIGN E - ( 0x11D3C <= code && code <= 0x11D3D ) || // Mn [2] MASARAM GONDI VOWEL SIGN AI..MASARAM GONDI VOWEL SIGN O - ( 0x11D3F <= code && code <= 0x11D45 ) || // Mn [7] MASARAM GONDI VOWEL SIGN AU..MASARAM GONDI VIRAMA - code === 0x11D47 || // Mn MASARAM GONDI RA-KARA - ( 0x11D90 <= code && code <= 0x11D91 ) || // Mn [2] GUNJALA GONDI VOWEL SIGN EE..GUNJALA GONDI VOWEL SIGN AI - code === 0x11D95 || // Mn GUNJALA GONDI SIGN ANUSVARA - code === 0x11D97 || // Mn GUNJALA GONDI VIRAMA - ( 0x11EF3 <= code && code <= 0x11EF4 ) || // Mn [2] MAKASAR VOWEL SIGN I..MAKASAR VOWEL SIGN U - ( 0x16AF0 <= code && code <= 0x16AF4 ) || // Mn [5] BASSA VAH COMBINING HIGH TONE..BASSA VAH COMBINING HIGH-LOW TONE - ( 0x16B30 <= code && code <= 0x16B36 ) || // Mn [7] PAHAWH HMONG MARK CIM TUB..PAHAWH HMONG MARK CIM TAUM - code === 0x16F4F || // Mn MIAO SIGN CONSONANT MODIFIER BAR - ( 0x16F8F <= code && code <= 0x16F92 ) || // Mn [4] MIAO TONE RIGHT..MIAO TONE BELOW - code === 0x16FE4 || // Mn KHITAN SMALL SCRIPT FILLER - ( 0x1BC9D <= code && code <= 0x1BC9E ) || // Mn [2] DUPLOYAN THICK LETTER SELECTOR..DUPLOYAN DOUBLE MARK - code === 0x1D165 || // Mc MUSICAL SYMBOL COMBINING STEM - ( 0x1D167 <= code && code <= 0x1D169 ) || // Mn [3] MUSICAL SYMBOL COMBINING TREMOLO-1..MUSICAL SYMBOL COMBINING TREMOLO-3 - ( 0x1D16E <= code && code <= 0x1D172 ) || // Mc [5] MUSICAL SYMBOL COMBINING FLAG-1..MUSICAL SYMBOL COMBINING FLAG-5 - ( 0x1D17B <= code && code <= 0x1D182 ) || // Mn [8] MUSICAL SYMBOL COMBINING ACCENT..MUSICAL SYMBOL COMBINING LOURE - ( 0x1D185 <= code && code <= 0x1D18B ) || // Mn [7] MUSICAL SYMBOL COMBINING DOIT..MUSICAL SYMBOL COMBINING TRIPLE TONGUE - ( 0x1D1AA <= code && code <= 0x1D1AD ) || // Mn [4] MUSICAL SYMBOL COMBINING DOWN BOW..MUSICAL SYMBOL COMBINING SNAP PIZZICATO - ( 0x1D242 <= code && code <= 0x1D244 ) || // Mn [3] COMBINING GREEK MUSICAL TRISEME..COMBINING GREEK MUSICAL PENTASEME - ( 0x1DA00 <= code && code <= 0x1DA36 ) || // Mn [55] SIGNWRITING HEAD RIM..SIGNWRITING AIR SUCKING IN - ( 0x1DA3B <= code && code <= 0x1DA6C ) || // Mn [50] SIGNWRITING MOUTH CLOSED NEUTRAL..SIGNWRITING EXCITEMENT - code === 0x1DA75 || // Mn SIGNWRITING UPPER BODY TILTING FROM HIP JOINTS - code === 0x1DA84 || // Mn SIGNWRITING LOCATION HEAD NECK - ( 0x1DA9B <= code && code <= 0x1DA9F ) || // Mn [5] SIGNWRITING FILL MODIFIER-2..SIGNWRITING FILL MODIFIER-6 - ( 0x1DAA1 <= code && code <= 0x1DAAF ) || // Mn [15] SIGNWRITING ROTATION MODIFIER-2..SIGNWRITING ROTATION MODIFIER-16 - ( 0x1E000 <= code && code <= 0x1E006 ) || // Mn [7] COMBINING GLAGOLITIC LETTER AZU..COMBINING GLAGOLITIC LETTER ZHIVETE - ( 0x1E008 <= code && code <= 0x1E018 ) || // Mn [17] COMBINING GLAGOLITIC LETTER ZEMLJA..COMBINING GLAGOLITIC LETTER HERU - ( 0x1E01B <= code && code <= 0x1E021 ) || // Mn [7] COMBINING GLAGOLITIC LETTER SHTA..COMBINING GLAGOLITIC LETTER YATI - ( 0x1E023 <= code && code <= 0x1E024 ) || // Mn [2] COMBINING GLAGOLITIC LETTER YU..COMBINING GLAGOLITIC LETTER SMALL YUS - ( 0x1E026 <= code && code <= 0x1E02A ) || // Mn [5] COMBINING GLAGOLITIC LETTER YO..COMBINING GLAGOLITIC LETTER FITA - ( 0x1E130 <= code && code <= 0x1E136 ) || // Mn [7] NYIAKENG PUACHUE HMONG TONE-B..NYIAKENG PUACHUE HMONG TONE-D - ( 0x1E2EC <= code && code <= 0x1E2EF ) || // Mn [4] WANCHO TONE TUP..WANCHO TONE KOINI - ( 0x1E8D0 <= code && code <= 0x1E8D6 ) || // Mn [7] MENDE KIKAKUI COMBINING NUMBER TEENS..MENDE KIKAKUI COMBINING NUMBER MILLIONS - ( 0x1E944 <= code && code <= 0x1E94A ) || // Mn [7] ADLAM ALIF LENGTHENER..ADLAM NUKTA - ( 0x1F3FB <= code && code <= 0x1F3FF ) || // Sk [5] EMOJI MODIFIER FITZPATRICK TYPE-1-2..EMOJI MODIFIER FITZPATRICK TYPE-6 - ( 0xE0020 <= code && code <= 0xE007F ) || // Cf [96] TAG SPACE..CANCEL TAG - ( 0xE0100 <= code && code <= 0xE01EF ) // Mn [240] VARIATION SELECTOR-17..VARIATION SELECTOR-256 - ) { - return constants.Extend; - } - if ( - ( 0x1F1E6 <= code && code <= 0x1F1FF ) // So [26] REGIONAL INDICATOR SYMBOL LETTER A..REGIONAL INDICATOR SYMBOL LETTER Z - ) { - return constants.RegionalIndicator; - } - if ( - code === 0x0903 || // Mc DEVANAGARI SIGN VISARGA - code === 0x093B || // Mc DEVANAGARI VOWEL SIGN OOE - ( 0x093E <= code && code <= 0x0940 ) || // Mc [3] DEVANAGARI VOWEL SIGN AA..DEVANAGARI VOWEL SIGN II - ( 0x0949 <= code && code <= 0x094C ) || // Mc [4] DEVANAGARI VOWEL SIGN CANDRA O..DEVANAGARI VOWEL SIGN AU - ( 0x094E <= code && code <= 0x094F ) || // Mc [2] DEVANAGARI VOWEL SIGN PRISHTHAMATRA E..DEVANAGARI VOWEL SIGN AW - ( 0x0982 <= code && code <= 0x0983 ) || // Mc [2] BENGALI SIGN ANUSVARA..BENGALI SIGN VISARGA - ( 0x09BF <= code && code <= 0x09C0 ) || // Mc [2] BENGALI VOWEL SIGN I..BENGALI VOWEL SIGN II - ( 0x09C7 <= code && code <= 0x09C8 ) || // Mc [2] BENGALI VOWEL SIGN E..BENGALI VOWEL SIGN AI - ( 0x09CB <= code && code <= 0x09CC ) || // Mc [2] BENGALI VOWEL SIGN O..BENGALI VOWEL SIGN AU - code === 0x0A03 || // Mc GURMUKHI SIGN VISARGA - ( 0x0A3E <= code && code <= 0x0A40 ) || // Mc [3] GURMUKHI VOWEL SIGN AA..GURMUKHI VOWEL SIGN II - code === 0x0A83 || // Mc GUJARATI SIGN VISARGA - ( 0x0ABE <= code && code <= 0x0AC0 ) || // Mc [3] GUJARATI VOWEL SIGN AA..GUJARATI VOWEL SIGN II - code === 0x0AC9 || // Mc GUJARATI VOWEL SIGN CANDRA O - ( 0x0ACB <= code && code <= 0x0ACC ) || // Mc [2] GUJARATI VOWEL SIGN O..GUJARATI VOWEL SIGN AU - ( 0x0B02 <= code && code <= 0x0B03 ) || // Mc [2] ORIYA SIGN ANUSVARA..ORIYA SIGN VISARGA - code === 0x0B40 || // Mc ORIYA VOWEL SIGN II - ( 0x0B47 <= code && code <= 0x0B48 ) || // Mc [2] ORIYA VOWEL SIGN E..ORIYA VOWEL SIGN AI - ( 0x0B4B <= code && code <= 0x0B4C ) || // Mc [2] ORIYA VOWEL SIGN O..ORIYA VOWEL SIGN AU - code === 0x0BBF || // Mc TAMIL VOWEL SIGN I - ( 0x0BC1 <= code && code <= 0x0BC2 ) || // Mc [2] TAMIL VOWEL SIGN U..TAMIL VOWEL SIGN UU - ( 0x0BC6 <= code && code <= 0x0BC8 ) || // Mc [3] TAMIL VOWEL SIGN E..TAMIL VOWEL SIGN AI - ( 0x0BCA <= code && code <= 0x0BCC ) || // Mc [3] TAMIL VOWEL SIGN O..TAMIL VOWEL SIGN AU - ( 0x0C01 <= code && code <= 0x0C03 ) || // Mc [3] TELUGU SIGN CANDRABINDU..TELUGU SIGN VISARGA - ( 0x0C41 <= code && code <= 0x0C44 ) || // Mc [4] TELUGU VOWEL SIGN U..TELUGU VOWEL SIGN VOCALIC RR - ( 0x0C82 <= code && code <= 0x0C83 ) || // Mc [2] KANNADA SIGN ANUSVARA..KANNADA SIGN VISARGA - code === 0x0CBE || // Mc KANNADA VOWEL SIGN AA - ( 0x0CC0 <= code && code <= 0x0CC1 ) || // Mc [2] KANNADA VOWEL SIGN II..KANNADA VOWEL SIGN U - ( 0x0CC3 <= code && code <= 0x0CC4 ) || // Mc [2] KANNADA VOWEL SIGN VOCALIC R..KANNADA VOWEL SIGN VOCALIC RR - ( 0x0CC7 <= code && code <= 0x0CC8 ) || // Mc [2] KANNADA VOWEL SIGN EE..KANNADA VOWEL SIGN AI - ( 0x0CCA <= code && code <= 0x0CCB ) || // Mc [2] KANNADA VOWEL SIGN O..KANNADA VOWEL SIGN OO - ( 0x0D02 <= code && code <= 0x0D03 ) || // Mc [2] MALAYALAM SIGN ANUSVARA..MALAYALAM SIGN VISARGA - ( 0x0D3F <= code && code <= 0x0D40 ) || // Mc [2] MALAYALAM VOWEL SIGN I..MALAYALAM VOWEL SIGN II - ( 0x0D46 <= code && code <= 0x0D48 ) || // Mc [3] MALAYALAM VOWEL SIGN E..MALAYALAM VOWEL SIGN AI - ( 0x0D4A <= code && code <= 0x0D4C ) || // Mc [3] MALAYALAM VOWEL SIGN O..MALAYALAM VOWEL SIGN AU - ( 0x0D82 <= code && code <= 0x0D83 ) || // Mc [2] SINHALA SIGN ANUSVARAYA..SINHALA SIGN VISARGAYA - ( 0x0DD0 <= code && code <= 0x0DD1 ) || // Mc [2] SINHALA VOWEL SIGN KETTI AEDA-PILLA..SINHALA VOWEL SIGN DIGA AEDA-PILLA - ( 0x0DD8 <= code && code <= 0x0DDE ) || // Mc [7] SINHALA VOWEL SIGN GAETTA-PILLA..SINHALA VOWEL SIGN KOMBUVA HAA GAYANUKITTA - ( 0x0DF2 <= code && code <= 0x0DF3 ) || // Mc [2] SINHALA VOWEL SIGN DIGA GAETTA-PILLA..SINHALA VOWEL SIGN DIGA GAYANUKITTA - code === 0x0E33 || // Lo THAI CHARACTER SARA AM - code === 0x0EB3 || // Lo LAO VOWEL SIGN AM - ( 0x0F3E <= code && code <= 0x0F3F ) || // Mc [2] TIBETAN SIGN YAR TSHES..TIBETAN SIGN MAR TSHES - code === 0x0F7F || // Mc TIBETAN SIGN RNAM BCAD - code === 0x1031 || // Mc MYANMAR VOWEL SIGN E - ( 0x103B <= code && code <= 0x103C ) || // Mc [2] MYANMAR CONSONANT SIGN MEDIAL YA..MYANMAR CONSONANT SIGN MEDIAL RA - ( 0x1056 <= code && code <= 0x1057 ) || // Mc [2] MYANMAR VOWEL SIGN VOCALIC R..MYANMAR VOWEL SIGN VOCALIC RR - code === 0x1084 || // Mc MYANMAR VOWEL SIGN SHAN E - code === 0x17B6 || // Mc KHMER VOWEL SIGN AA - ( 0x17BE <= code && code <= 0x17C5 ) || // Mc [8] KHMER VOWEL SIGN OE..KHMER VOWEL SIGN AU - ( 0x17C7 <= code && code <= 0x17C8 ) || // Mc [2] KHMER SIGN REAHMUK..KHMER SIGN YUUKALEAPINTU - ( 0x1923 <= code && code <= 0x1926 ) || // Mc [4] LIMBU VOWEL SIGN EE..LIMBU VOWEL SIGN AU - ( 0x1929 <= code && code <= 0x192B ) || // Mc [3] LIMBU SUBJOINED LETTER YA..LIMBU SUBJOINED LETTER WA - ( 0x1930 <= code && code <= 0x1931 ) || // Mc [2] LIMBU SMALL LETTER KA..LIMBU SMALL LETTER NGA - ( 0x1933 <= code && code <= 0x1938 ) || // Mc [6] LIMBU SMALL LETTER TA..LIMBU SMALL LETTER LA - ( 0x1A19 <= code && code <= 0x1A1A ) || // Mc [2] BUGINESE VOWEL SIGN E..BUGINESE VOWEL SIGN O - code === 0x1A55 || // Mc TAI THAM CONSONANT SIGN MEDIAL RA - code === 0x1A57 || // Mc TAI THAM CONSONANT SIGN LA TANG LAI - ( 0x1A6D <= code && code <= 0x1A72 ) || // Mc [6] TAI THAM VOWEL SIGN OY..TAI THAM VOWEL SIGN THAM AI - code === 0x1B04 || // Mc BALINESE SIGN BISAH - code === 0x1B3B || // Mc BALINESE VOWEL SIGN RA REPA TEDUNG - ( 0x1B3D <= code && code <= 0x1B41 ) || // Mc [5] BALINESE VOWEL SIGN LA LENGA TEDUNG..BALINESE VOWEL SIGN TALING REPA TEDUNG - ( 0x1B43 <= code && code <= 0x1B44 ) || // Mc [2] BALINESE VOWEL SIGN PEPET TEDUNG..BALINESE ADEG ADEG - code === 0x1B82 || // Mc SUNDANESE SIGN PANGWISAD - code === 0x1BA1 || // Mc SUNDANESE CONSONANT SIGN PAMINGKAL - ( 0x1BA6 <= code && code <= 0x1BA7 ) || // Mc [2] SUNDANESE VOWEL SIGN PANAELAENG..SUNDANESE VOWEL SIGN PANOLONG - code === 0x1BAA || // Mc SUNDANESE SIGN PAMAAEH - code === 0x1BE7 || // Mc BATAK VOWEL SIGN E - ( 0x1BEA <= code && code <= 0x1BEC ) || // Mc [3] BATAK VOWEL SIGN I..BATAK VOWEL SIGN O - code === 0x1BEE || // Mc BATAK VOWEL SIGN U - ( 0x1BF2 <= code && code <= 0x1BF3 ) || // Mc [2] BATAK PANGOLAT..BATAK PANONGONAN - ( 0x1C24 <= code && code <= 0x1C2B ) || // Mc [8] LEPCHA SUBJOINED LETTER YA..LEPCHA VOWEL SIGN UU - ( 0x1C34 <= code && code <= 0x1C35 ) || // Mc [2] LEPCHA CONSONANT SIGN NYIN-DO..LEPCHA CONSONANT SIGN KANG - code === 0x1CE1 || // Mc VEDIC TONE ATHARVAVEDIC INDEPENDENT SVARITA - code === 0x1CF7 || // Mc VEDIC SIGN ATIKRAMA - ( 0xA823 <= code && code <= 0xA824 ) || // Mc [2] SYLOTI NAGRI VOWEL SIGN A..SYLOTI NAGRI VOWEL SIGN I - code === 0xA827 || // Mc SYLOTI NAGRI VOWEL SIGN OO - ( 0xA880 <= code && code <= 0xA881 ) || // Mc [2] SAURASHTRA SIGN ANUSVARA..SAURASHTRA SIGN VISARGA - ( 0xA8B4 <= code && code <= 0xA8C3 ) || // Mc [16] SAURASHTRA CONSONANT SIGN HAARU..SAURASHTRA VOWEL SIGN AU - ( 0xA952 <= code && code <= 0xA953 ) || // Mc [2] REJANG CONSONANT SIGN H..REJANG VIRAMA - code === 0xA983 || // Mc JAVANESE SIGN WIGNYAN - ( 0xA9B4 <= code && code <= 0xA9B5 ) || // Mc [2] JAVANESE VOWEL SIGN TARUNG..JAVANESE VOWEL SIGN TOLONG - ( 0xA9BA <= code && code <= 0xA9BB ) || // Mc [2] JAVANESE VOWEL SIGN TALING..JAVANESE VOWEL SIGN DIRGA MURE - ( 0xA9BE <= code && code <= 0xA9C0 ) || // Mc [3] JAVANESE CONSONANT SIGN PENGKAL..JAVANESE PANGKON - ( 0xAA2F <= code && code <= 0xAA30 ) || // Mc [2] CHAM VOWEL SIGN O..CHAM VOWEL SIGN AI - ( 0xAA33 <= code && code <= 0xAA34 ) || // Mc [2] CHAM CONSONANT SIGN YA..CHAM CONSONANT SIGN RA - code === 0xAA4D || // Mc CHAM CONSONANT SIGN FINAL H - code === 0xAAEB || // Mc MEETEI MAYEK VOWEL SIGN II - ( 0xAAEE <= code && code <= 0xAAEF ) || // Mc [2] MEETEI MAYEK VOWEL SIGN AU..MEETEI MAYEK VOWEL SIGN AAU - code === 0xAAF5 || // Mc MEETEI MAYEK VOWEL SIGN VISARGA - ( 0xABE3 <= code && code <= 0xABE4 ) || // Mc [2] MEETEI MAYEK VOWEL SIGN ONAP..MEETEI MAYEK VOWEL SIGN INAP - ( 0xABE6 <= code && code <= 0xABE7 ) || // Mc [2] MEETEI MAYEK VOWEL SIGN YENAP..MEETEI MAYEK VOWEL SIGN SOUNAP - ( 0xABE9 <= code && code <= 0xABEA ) || // Mc [2] MEETEI MAYEK VOWEL SIGN CHEINAP..MEETEI MAYEK VOWEL SIGN NUNG - code === 0xABEC || // Mc MEETEI MAYEK LUM IYEK - code === 0x11000 || // Mc BRAHMI SIGN CANDRABINDU - code === 0x11002 || // Mc BRAHMI SIGN VISARGA - code === 0x11082 || // Mc KAITHI SIGN VISARGA - ( 0x110B0 <= code && code <= 0x110B2 ) || // Mc [3] KAITHI VOWEL SIGN AA..KAITHI VOWEL SIGN II - ( 0x110B7 <= code && code <= 0x110B8 ) || // Mc [2] KAITHI VOWEL SIGN O..KAITHI VOWEL SIGN AU - code === 0x1112C || // Mc CHAKMA VOWEL SIGN E - ( 0x11145 <= code && code <= 0x11146 ) || // Mc [2] CHAKMA VOWEL SIGN AA..CHAKMA VOWEL SIGN EI - code === 0x11182 || // Mc SHARADA SIGN VISARGA - ( 0x111B3 <= code && code <= 0x111B5 ) || // Mc [3] SHARADA VOWEL SIGN AA..SHARADA VOWEL SIGN II - ( 0x111BF <= code && code <= 0x111C0 ) || // Mc [2] SHARADA VOWEL SIGN AU..SHARADA SIGN VIRAMA - code === 0x111CE || // Mc SHARADA VOWEL SIGN PRISHTHAMATRA E - ( 0x1122C <= code && code <= 0x1122E ) || // Mc [3] KHOJKI VOWEL SIGN AA..KHOJKI VOWEL SIGN II - ( 0x11232 <= code && code <= 0x11233 ) || // Mc [2] KHOJKI VOWEL SIGN O..KHOJKI VOWEL SIGN AU - code === 0x11235 || // Mc KHOJKI SIGN VIRAMA - ( 0x112E0 <= code && code <= 0x112E2 ) || // Mc [3] KHUDAWADI VOWEL SIGN AA..KHUDAWADI VOWEL SIGN II - ( 0x11302 <= code && code <= 0x11303 ) || // Mc [2] GRANTHA SIGN ANUSVARA..GRANTHA SIGN VISARGA - code === 0x1133F || // Mc GRANTHA VOWEL SIGN I - ( 0x11341 <= code && code <= 0x11344 ) || // Mc [4] GRANTHA VOWEL SIGN U..GRANTHA VOWEL SIGN VOCALIC RR - ( 0x11347 <= code && code <= 0x11348 ) || // Mc [2] GRANTHA VOWEL SIGN EE..GRANTHA VOWEL SIGN AI - ( 0x1134B <= code && code <= 0x1134D ) || // Mc [3] GRANTHA VOWEL SIGN OO..GRANTHA SIGN VIRAMA - ( 0x11362 <= code && code <= 0x11363 ) || // Mc [2] GRANTHA VOWEL SIGN VOCALIC L..GRANTHA VOWEL SIGN VOCALIC LL - ( 0x11435 <= code && code <= 0x11437 ) || // Mc [3] NEWA VOWEL SIGN AA..NEWA VOWEL SIGN II - ( 0x11440 <= code && code <= 0x11441 ) || // Mc [2] NEWA VOWEL SIGN O..NEWA VOWEL SIGN AU - code === 0x11445 || // Mc NEWA SIGN VISARGA - ( 0x114B1 <= code && code <= 0x114B2 ) || // Mc [2] TIRHUTA VOWEL SIGN I..TIRHUTA VOWEL SIGN II - code === 0x114B9 || // Mc TIRHUTA VOWEL SIGN E - ( 0x114BB <= code && code <= 0x114BC ) || // Mc [2] TIRHUTA VOWEL SIGN AI..TIRHUTA VOWEL SIGN O - code === 0x114BE || // Mc TIRHUTA VOWEL SIGN AU - code === 0x114C1 || // Mc TIRHUTA SIGN VISARGA - ( 0x115B0 <= code && code <= 0x115B1 ) || // Mc [2] SIDDHAM VOWEL SIGN I..SIDDHAM VOWEL SIGN II - ( 0x115B8 <= code && code <= 0x115BB ) || // Mc [4] SIDDHAM VOWEL SIGN E..SIDDHAM VOWEL SIGN AU - code === 0x115BE || // Mc SIDDHAM SIGN VISARGA - ( 0x11630 <= code && code <= 0x11632 ) || // Mc [3] MODI VOWEL SIGN AA..MODI VOWEL SIGN II - ( 0x1163B <= code && code <= 0x1163C ) || // Mc [2] MODI VOWEL SIGN O..MODI VOWEL SIGN AU - code === 0x1163E || // Mc MODI SIGN VISARGA - code === 0x116AC || // Mc TAKRI SIGN VISARGA - ( 0x116AE <= code && code <= 0x116AF ) || // Mc [2] TAKRI VOWEL SIGN I..TAKRI VOWEL SIGN II - code === 0x116B6 || // Mc TAKRI SIGN VIRAMA - ( 0x11720 <= code && code <= 0x11721 ) || // Mc [2] AHOM VOWEL SIGN A..AHOM VOWEL SIGN AA - code === 0x11726 || // Mc AHOM VOWEL SIGN E - ( 0x1182C <= code && code <= 0x1182E ) || // Mc [3] DOGRA VOWEL SIGN AA..DOGRA VOWEL SIGN II - code === 0x11838 || // Mc DOGRA SIGN VISARGA - ( 0x11931 <= code && code <= 0x11935 ) || // Mc [5] DIVES AKURU VOWEL SIGN I..DIVES AKURU VOWEL SIGN E - ( 0x11937 <= code && code <= 0x11938 ) || // Mc [2] DIVES AKURU VOWEL SIGN AI..DIVES AKURU VOWEL SIGN O - code === 0x1193D || // Mc DIVES AKURU SIGN HALANTA - code === 0x11940 || // Mc DIVES AKURU MEDIAL YA - code === 0x11942 || // Mc DIVES AKURU MEDIAL RA - ( 0x119D1 <= code && code <= 0x119D3 ) || // Mc [3] NANDINAGARI VOWEL SIGN AA..NANDINAGARI VOWEL SIGN II - ( 0x119DC <= code && code <= 0x119DF ) || // Mc [4] NANDINAGARI VOWEL SIGN O..NANDINAGARI SIGN VISARGA - code === 0x119E4 || // Mc NANDINAGARI VOWEL SIGN PRISHTHAMATRA E - code === 0x11A39 || // Mc ZANABAZAR SQUARE SIGN VISARGA - ( 0x11A57 <= code && code <= 0x11A58 ) || // Mc [2] SOYOMBO VOWEL SIGN AI..SOYOMBO VOWEL SIGN AU - code === 0x11A97 || // Mc SOYOMBO SIGN VISARGA - code === 0x11C2F || // Mc BHAIKSUKI VOWEL SIGN AA - code === 0x11C3E || // Mc BHAIKSUKI SIGN VISARGA - code === 0x11CA9 || // Mc MARCHEN SUBJOINED LETTER YA - code === 0x11CB1 || // Mc MARCHEN VOWEL SIGN I - code === 0x11CB4 || // Mc MARCHEN VOWEL SIGN O - ( 0x11D8A <= code && code <= 0x11D8E ) || // Mc [5] GUNJALA GONDI VOWEL SIGN AA..GUNJALA GONDI VOWEL SIGN UU - ( 0x11D93 <= code && code <= 0x11D94 ) || // Mc [2] GUNJALA GONDI VOWEL SIGN OO..GUNJALA GONDI VOWEL SIGN AU - code === 0x11D96 || // Mc GUNJALA GONDI SIGN VISARGA - ( 0x11EF5 <= code && code <= 0x11EF6 ) || // Mc [2] MAKASAR VOWEL SIGN E..MAKASAR VOWEL SIGN O - ( 0x16F51 <= code && code <= 0x16F87 ) || // Mc [55] MIAO SIGN ASPIRATION..MIAO VOWEL SIGN UI - ( 0x16FF0 <= code && code <= 0x16FF1 ) || // Mc [2] VIETNAMESE ALTERNATE READING MARK CA..VIETNAMESE ALTERNATE READING MARK NHAY - code === 0x1D166 || // Mc MUSICAL SYMBOL COMBINING SPRECHGESANG STEM - code === 0x1D16D // Mc MUSICAL SYMBOL COMBINING AUGMENTATION DOT - ) { - return constants.SpacingMark; - } - if ( - ( 0x1100 <= code && code <= 0x115F ) || // Lo [96] HANGUL CHOSEONG KIYEOK..HANGUL CHOSEONG FILLER - ( 0xA960 <= code && code <= 0xA97C ) // Lo [29] HANGUL CHOSEONG TIKEUT-MIEUM..HANGUL CHOSEONG SSANGYEORINHIEUH - ) { - return constants.L; - } - if ( - ( 0x1160 <= code && code <= 0x11A7 ) || // Lo [72] HANGUL JUNGSEONG FILLER..HANGUL JUNGSEONG O-YAE - ( 0xD7B0 <= code && code <= 0xD7C6 ) // Lo [23] HANGUL JUNGSEONG O-YEO..HANGUL JUNGSEONG ARAEA-E - ) { - return constants.V; - } - if ( - ( 0x11A8 <= code && code <= 0x11FF ) || // Lo [88] HANGUL JONGSEONG KIYEOK..HANGUL JONGSEONG SSANGNIEUN - ( 0xD7CB <= code && code <= 0xD7FB ) // Lo [49] HANGUL JONGSEONG NIEUN-RIEUL..HANGUL JONGSEONG PHIEUPH-THIEUTH - ) { - return constants.T; - } - if ( - code === 0xAC00 || // Lo HANGUL SYLLABLE GA - code === 0xAC1C || // Lo HANGUL SYLLABLE GAE - code === 0xAC38 || // Lo HANGUL SYLLABLE GYA - code === 0xAC54 || // Lo HANGUL SYLLABLE GYAE - code === 0xAC70 || // Lo HANGUL SYLLABLE GEO - code === 0xAC8C || // Lo HANGUL SYLLABLE GE - code === 0xACA8 || // Lo HANGUL SYLLABLE GYEO - code === 0xACC4 || // Lo HANGUL SYLLABLE GYE - code === 0xACE0 || // Lo HANGUL SYLLABLE GO - code === 0xACFC || // Lo HANGUL SYLLABLE GWA - code === 0xAD18 || // Lo HANGUL SYLLABLE GWAE - code === 0xAD34 || // Lo HANGUL SYLLABLE GOE - code === 0xAD50 || // Lo HANGUL SYLLABLE GYO - code === 0xAD6C || // Lo HANGUL SYLLABLE GU - code === 0xAD88 || // Lo HANGUL SYLLABLE GWEO - code === 0xADA4 || // Lo HANGUL SYLLABLE GWE - code === 0xADC0 || // Lo HANGUL SYLLABLE GWI - code === 0xADDC || // Lo HANGUL SYLLABLE GYU - code === 0xADF8 || // Lo HANGUL SYLLABLE GEU - code === 0xAE14 || // Lo HANGUL SYLLABLE GYI - code === 0xAE30 || // Lo HANGUL SYLLABLE GI - code === 0xAE4C || // Lo HANGUL SYLLABLE GGA - code === 0xAE68 || // Lo HANGUL SYLLABLE GGAE - code === 0xAE84 || // Lo HANGUL SYLLABLE GGYA - code === 0xAEA0 || // Lo HANGUL SYLLABLE GGYAE - code === 0xAEBC || // Lo HANGUL SYLLABLE GGEO - code === 0xAED8 || // Lo HANGUL SYLLABLE GGE - code === 0xAEF4 || // Lo HANGUL SYLLABLE GGYEO - code === 0xAF10 || // Lo HANGUL SYLLABLE GGYE - code === 0xAF2C || // Lo HANGUL SYLLABLE GGO - code === 0xAF48 || // Lo HANGUL SYLLABLE GGWA - code === 0xAF64 || // Lo HANGUL SYLLABLE GGWAE - code === 0xAF80 || // Lo HANGUL SYLLABLE GGOE - code === 0xAF9C || // Lo HANGUL SYLLABLE GGYO - code === 0xAFB8 || // Lo HANGUL SYLLABLE GGU - code === 0xAFD4 || // Lo HANGUL SYLLABLE GGWEO - code === 0xAFF0 || // Lo HANGUL SYLLABLE GGWE - code === 0xB00C || // Lo HANGUL SYLLABLE GGWI - code === 0xB028 || // Lo HANGUL SYLLABLE GGYU - code === 0xB044 || // Lo HANGUL SYLLABLE GGEU - code === 0xB060 || // Lo HANGUL SYLLABLE GGYI - code === 0xB07C || // Lo HANGUL SYLLABLE GGI - code === 0xB098 || // Lo HANGUL SYLLABLE NA - code === 0xB0B4 || // Lo HANGUL SYLLABLE NAE - code === 0xB0D0 || // Lo HANGUL SYLLABLE NYA - code === 0xB0EC || // Lo HANGUL SYLLABLE NYAE - code === 0xB108 || // Lo HANGUL SYLLABLE NEO - code === 0xB124 || // Lo HANGUL SYLLABLE NE - code === 0xB140 || // Lo HANGUL SYLLABLE NYEO - code === 0xB15C || // Lo HANGUL SYLLABLE NYE - code === 0xB178 || // Lo HANGUL SYLLABLE NO - code === 0xB194 || // Lo HANGUL SYLLABLE NWA - code === 0xB1B0 || // Lo HANGUL SYLLABLE NWAE - code === 0xB1CC || // Lo HANGUL SYLLABLE NOE - code === 0xB1E8 || // Lo HANGUL SYLLABLE NYO - code === 0xB204 || // Lo HANGUL SYLLABLE NU - code === 0xB220 || // Lo HANGUL SYLLABLE NWEO - code === 0xB23C || // Lo HANGUL SYLLABLE NWE - code === 0xB258 || // Lo HANGUL SYLLABLE NWI - code === 0xB274 || // Lo HANGUL SYLLABLE NYU - code === 0xB290 || // Lo HANGUL SYLLABLE NEU - code === 0xB2AC || // Lo HANGUL SYLLABLE NYI - code === 0xB2C8 || // Lo HANGUL SYLLABLE NI - code === 0xB2E4 || // Lo HANGUL SYLLABLE DA - code === 0xB300 || // Lo HANGUL SYLLABLE DAE - code === 0xB31C || // Lo HANGUL SYLLABLE DYA - code === 0xB338 || // Lo HANGUL SYLLABLE DYAE - code === 0xB354 || // Lo HANGUL SYLLABLE DEO - code === 0xB370 || // Lo HANGUL SYLLABLE DE - code === 0xB38C || // Lo HANGUL SYLLABLE DYEO - code === 0xB3A8 || // Lo HANGUL SYLLABLE DYE - code === 0xB3C4 || // Lo HANGUL SYLLABLE DO - code === 0xB3E0 || // Lo HANGUL SYLLABLE DWA - code === 0xB3FC || // Lo HANGUL SYLLABLE DWAE - code === 0xB418 || // Lo HANGUL SYLLABLE DOE - code === 0xB434 || // Lo HANGUL SYLLABLE DYO - code === 0xB450 || // Lo HANGUL SYLLABLE DU - code === 0xB46C || // Lo HANGUL SYLLABLE DWEO - code === 0xB488 || // Lo HANGUL SYLLABLE DWE - code === 0xB4A4 || // Lo HANGUL SYLLABLE DWI - code === 0xB4C0 || // Lo HANGUL SYLLABLE DYU - code === 0xB4DC || // Lo HANGUL SYLLABLE DEU - code === 0xB4F8 || // Lo HANGUL SYLLABLE DYI - code === 0xB514 || // Lo HANGUL SYLLABLE DI - code === 0xB530 || // Lo HANGUL SYLLABLE DDA - code === 0xB54C || // Lo HANGUL SYLLABLE DDAE - code === 0xB568 || // Lo HANGUL SYLLABLE DDYA - code === 0xB584 || // Lo HANGUL SYLLABLE DDYAE - code === 0xB5A0 || // Lo HANGUL SYLLABLE DDEO - code === 0xB5BC || // Lo HANGUL SYLLABLE DDE - code === 0xB5D8 || // Lo HANGUL SYLLABLE DDYEO - code === 0xB5F4 || // Lo HANGUL SYLLABLE DDYE - code === 0xB610 || // Lo HANGUL SYLLABLE DDO - code === 0xB62C || // Lo HANGUL SYLLABLE DDWA - code === 0xB648 || // Lo HANGUL SYLLABLE DDWAE - code === 0xB664 || // Lo HANGUL SYLLABLE DDOE - code === 0xB680 || // Lo HANGUL SYLLABLE DDYO - code === 0xB69C || // Lo HANGUL SYLLABLE DDU - code === 0xB6B8 || // Lo HANGUL SYLLABLE DDWEO - code === 0xB6D4 || // Lo HANGUL SYLLABLE DDWE - code === 0xB6F0 || // Lo HANGUL SYLLABLE DDWI - code === 0xB70C || // Lo HANGUL SYLLABLE DDYU - code === 0xB728 || // Lo HANGUL SYLLABLE DDEU - code === 0xB744 || // Lo HANGUL SYLLABLE DDYI - code === 0xB760 || // Lo HANGUL SYLLABLE DDI - code === 0xB77C || // Lo HANGUL SYLLABLE RA - code === 0xB798 || // Lo HANGUL SYLLABLE RAE - code === 0xB7B4 || // Lo HANGUL SYLLABLE RYA - code === 0xB7D0 || // Lo HANGUL SYLLABLE RYAE - code === 0xB7EC || // Lo HANGUL SYLLABLE REO - code === 0xB808 || // Lo HANGUL SYLLABLE RE - code === 0xB824 || // Lo HANGUL SYLLABLE RYEO - code === 0xB840 || // Lo HANGUL SYLLABLE RYE - code === 0xB85C || // Lo HANGUL SYLLABLE RO - code === 0xB878 || // Lo HANGUL SYLLABLE RWA - code === 0xB894 || // Lo HANGUL SYLLABLE RWAE - code === 0xB8B0 || // Lo HANGUL SYLLABLE ROE - code === 0xB8CC || // Lo HANGUL SYLLABLE RYO - code === 0xB8E8 || // Lo HANGUL SYLLABLE RU - code === 0xB904 || // Lo HANGUL SYLLABLE RWEO - code === 0xB920 || // Lo HANGUL SYLLABLE RWE - code === 0xB93C || // Lo HANGUL SYLLABLE RWI - code === 0xB958 || // Lo HANGUL SYLLABLE RYU - code === 0xB974 || // Lo HANGUL SYLLABLE REU - code === 0xB990 || // Lo HANGUL SYLLABLE RYI - code === 0xB9AC || // Lo HANGUL SYLLABLE RI - code === 0xB9C8 || // Lo HANGUL SYLLABLE MA - code === 0xB9E4 || // Lo HANGUL SYLLABLE MAE - code === 0xBA00 || // Lo HANGUL SYLLABLE MYA - code === 0xBA1C || // Lo HANGUL SYLLABLE MYAE - code === 0xBA38 || // Lo HANGUL SYLLABLE MEO - code === 0xBA54 || // Lo HANGUL SYLLABLE ME - code === 0xBA70 || // Lo HANGUL SYLLABLE MYEO - code === 0xBA8C || // Lo HANGUL SYLLABLE MYE - code === 0xBAA8 || // Lo HANGUL SYLLABLE MO - code === 0xBAC4 || // Lo HANGUL SYLLABLE MWA - code === 0xBAE0 || // Lo HANGUL SYLLABLE MWAE - code === 0xBAFC || // Lo HANGUL SYLLABLE MOE - code === 0xBB18 || // Lo HANGUL SYLLABLE MYO - code === 0xBB34 || // Lo HANGUL SYLLABLE MU - code === 0xBB50 || // Lo HANGUL SYLLABLE MWEO - code === 0xBB6C || // Lo HANGUL SYLLABLE MWE - code === 0xBB88 || // Lo HANGUL SYLLABLE MWI - code === 0xBBA4 || // Lo HANGUL SYLLABLE MYU - code === 0xBBC0 || // Lo HANGUL SYLLABLE MEU - code === 0xBBDC || // Lo HANGUL SYLLABLE MYI - code === 0xBBF8 || // Lo HANGUL SYLLABLE MI - code === 0xBC14 || // Lo HANGUL SYLLABLE BA - code === 0xBC30 || // Lo HANGUL SYLLABLE BAE - code === 0xBC4C || // Lo HANGUL SYLLABLE BYA - code === 0xBC68 || // Lo HANGUL SYLLABLE BYAE - code === 0xBC84 || // Lo HANGUL SYLLABLE BEO - code === 0xBCA0 || // Lo HANGUL SYLLABLE BE - code === 0xBCBC || // Lo HANGUL SYLLABLE BYEO - code === 0xBCD8 || // Lo HANGUL SYLLABLE BYE - code === 0xBCF4 || // Lo HANGUL SYLLABLE BO - code === 0xBD10 || // Lo HANGUL SYLLABLE BWA - code === 0xBD2C || // Lo HANGUL SYLLABLE BWAE - code === 0xBD48 || // Lo HANGUL SYLLABLE BOE - code === 0xBD64 || // Lo HANGUL SYLLABLE BYO - code === 0xBD80 || // Lo HANGUL SYLLABLE BU - code === 0xBD9C || // Lo HANGUL SYLLABLE BWEO - code === 0xBDB8 || // Lo HANGUL SYLLABLE BWE - code === 0xBDD4 || // Lo HANGUL SYLLABLE BWI - code === 0xBDF0 || // Lo HANGUL SYLLABLE BYU - code === 0xBE0C || // Lo HANGUL SYLLABLE BEU - code === 0xBE28 || // Lo HANGUL SYLLABLE BYI - code === 0xBE44 || // Lo HANGUL SYLLABLE BI - code === 0xBE60 || // Lo HANGUL SYLLABLE BBA - code === 0xBE7C || // Lo HANGUL SYLLABLE BBAE - code === 0xBE98 || // Lo HANGUL SYLLABLE BBYA - code === 0xBEB4 || // Lo HANGUL SYLLABLE BBYAE - code === 0xBED0 || // Lo HANGUL SYLLABLE BBEO - code === 0xBEEC || // Lo HANGUL SYLLABLE BBE - code === 0xBF08 || // Lo HANGUL SYLLABLE BBYEO - code === 0xBF24 || // Lo HANGUL SYLLABLE BBYE - code === 0xBF40 || // Lo HANGUL SYLLABLE BBO - code === 0xBF5C || // Lo HANGUL SYLLABLE BBWA - code === 0xBF78 || // Lo HANGUL SYLLABLE BBWAE - code === 0xBF94 || // Lo HANGUL SYLLABLE BBOE - code === 0xBFB0 || // Lo HANGUL SYLLABLE BBYO - code === 0xBFCC || // Lo HANGUL SYLLABLE BBU - code === 0xBFE8 || // Lo HANGUL SYLLABLE BBWEO - code === 0xC004 || // Lo HANGUL SYLLABLE BBWE - code === 0xC020 || // Lo HANGUL SYLLABLE BBWI - code === 0xC03C || // Lo HANGUL SYLLABLE BBYU - code === 0xC058 || // Lo HANGUL SYLLABLE BBEU - code === 0xC074 || // Lo HANGUL SYLLABLE BBYI - code === 0xC090 || // Lo HANGUL SYLLABLE BBI - code === 0xC0AC || // Lo HANGUL SYLLABLE SA - code === 0xC0C8 || // Lo HANGUL SYLLABLE SAE - code === 0xC0E4 || // Lo HANGUL SYLLABLE SYA - code === 0xC100 || // Lo HANGUL SYLLABLE SYAE - code === 0xC11C || // Lo HANGUL SYLLABLE SEO - code === 0xC138 || // Lo HANGUL SYLLABLE SE - code === 0xC154 || // Lo HANGUL SYLLABLE SYEO - code === 0xC170 || // Lo HANGUL SYLLABLE SYE - code === 0xC18C || // Lo HANGUL SYLLABLE SO - code === 0xC1A8 || // Lo HANGUL SYLLABLE SWA - code === 0xC1C4 || // Lo HANGUL SYLLABLE SWAE - code === 0xC1E0 || // Lo HANGUL SYLLABLE SOE - code === 0xC1FC || // Lo HANGUL SYLLABLE SYO - code === 0xC218 || // Lo HANGUL SYLLABLE SU - code === 0xC234 || // Lo HANGUL SYLLABLE SWEO - code === 0xC250 || // Lo HANGUL SYLLABLE SWE - code === 0xC26C || // Lo HANGUL SYLLABLE SWI - code === 0xC288 || // Lo HANGUL SYLLABLE SYU - code === 0xC2A4 || // Lo HANGUL SYLLABLE SEU - code === 0xC2C0 || // Lo HANGUL SYLLABLE SYI - code === 0xC2DC || // Lo HANGUL SYLLABLE SI - code === 0xC2F8 || // Lo HANGUL SYLLABLE SSA - code === 0xC314 || // Lo HANGUL SYLLABLE SSAE - code === 0xC330 || // Lo HANGUL SYLLABLE SSYA - code === 0xC34C || // Lo HANGUL SYLLABLE SSYAE - code === 0xC368 || // Lo HANGUL SYLLABLE SSEO - code === 0xC384 || // Lo HANGUL SYLLABLE SSE - code === 0xC3A0 || // Lo HANGUL SYLLABLE SSYEO - code === 0xC3BC || // Lo HANGUL SYLLABLE SSYE - code === 0xC3D8 || // Lo HANGUL SYLLABLE SSO - code === 0xC3F4 || // Lo HANGUL SYLLABLE SSWA - code === 0xC410 || // Lo HANGUL SYLLABLE SSWAE - code === 0xC42C || // Lo HANGUL SYLLABLE SSOE - code === 0xC448 || // Lo HANGUL SYLLABLE SSYO - code === 0xC464 || // Lo HANGUL SYLLABLE SSU - code === 0xC480 || // Lo HANGUL SYLLABLE SSWEO - code === 0xC49C || // Lo HANGUL SYLLABLE SSWE - code === 0xC4B8 || // Lo HANGUL SYLLABLE SSWI - code === 0xC4D4 || // Lo HANGUL SYLLABLE SSYU - code === 0xC4F0 || // Lo HANGUL SYLLABLE SSEU - code === 0xC50C || // Lo HANGUL SYLLABLE SSYI - code === 0xC528 || // Lo HANGUL SYLLABLE SSI - code === 0xC544 || // Lo HANGUL SYLLABLE A - code === 0xC560 || // Lo HANGUL SYLLABLE AE - code === 0xC57C || // Lo HANGUL SYLLABLE YA - code === 0xC598 || // Lo HANGUL SYLLABLE YAE - code === 0xC5B4 || // Lo HANGUL SYLLABLE EO - code === 0xC5D0 || // Lo HANGUL SYLLABLE E - code === 0xC5EC || // Lo HANGUL SYLLABLE YEO - code === 0xC608 || // Lo HANGUL SYLLABLE YE - code === 0xC624 || // Lo HANGUL SYLLABLE O - code === 0xC640 || // Lo HANGUL SYLLABLE WA - code === 0xC65C || // Lo HANGUL SYLLABLE WAE - code === 0xC678 || // Lo HANGUL SYLLABLE OE - code === 0xC694 || // Lo HANGUL SYLLABLE YO - code === 0xC6B0 || // Lo HANGUL SYLLABLE U - code === 0xC6CC || // Lo HANGUL SYLLABLE WEO - code === 0xC6E8 || // Lo HANGUL SYLLABLE WE - code === 0xC704 || // Lo HANGUL SYLLABLE WI - code === 0xC720 || // Lo HANGUL SYLLABLE YU - code === 0xC73C || // Lo HANGUL SYLLABLE EU - code === 0xC758 || // Lo HANGUL SYLLABLE YI - code === 0xC774 || // Lo HANGUL SYLLABLE I - code === 0xC790 || // Lo HANGUL SYLLABLE JA - code === 0xC7AC || // Lo HANGUL SYLLABLE JAE - code === 0xC7C8 || // Lo HANGUL SYLLABLE JYA - code === 0xC7E4 || // Lo HANGUL SYLLABLE JYAE - code === 0xC800 || // Lo HANGUL SYLLABLE JEO - code === 0xC81C || // Lo HANGUL SYLLABLE JE - code === 0xC838 || // Lo HANGUL SYLLABLE JYEO - code === 0xC854 || // Lo HANGUL SYLLABLE JYE - code === 0xC870 || // Lo HANGUL SYLLABLE JO - code === 0xC88C || // Lo HANGUL SYLLABLE JWA - code === 0xC8A8 || // Lo HANGUL SYLLABLE JWAE - code === 0xC8C4 || // Lo HANGUL SYLLABLE JOE - code === 0xC8E0 || // Lo HANGUL SYLLABLE JYO - code === 0xC8FC || // Lo HANGUL SYLLABLE JU - code === 0xC918 || // Lo HANGUL SYLLABLE JWEO - code === 0xC934 || // Lo HANGUL SYLLABLE JWE - code === 0xC950 || // Lo HANGUL SYLLABLE JWI - code === 0xC96C || // Lo HANGUL SYLLABLE JYU - code === 0xC988 || // Lo HANGUL SYLLABLE JEU - code === 0xC9A4 || // Lo HANGUL SYLLABLE JYI - code === 0xC9C0 || // Lo HANGUL SYLLABLE JI - code === 0xC9DC || // Lo HANGUL SYLLABLE JJA - code === 0xC9F8 || // Lo HANGUL SYLLABLE JJAE - code === 0xCA14 || // Lo HANGUL SYLLABLE JJYA - code === 0xCA30 || // Lo HANGUL SYLLABLE JJYAE - code === 0xCA4C || // Lo HANGUL SYLLABLE JJEO - code === 0xCA68 || // Lo HANGUL SYLLABLE JJE - code === 0xCA84 || // Lo HANGUL SYLLABLE JJYEO - code === 0xCAA0 || // Lo HANGUL SYLLABLE JJYE - code === 0xCABC || // Lo HANGUL SYLLABLE JJO - code === 0xCAD8 || // Lo HANGUL SYLLABLE JJWA - code === 0xCAF4 || // Lo HANGUL SYLLABLE JJWAE - code === 0xCB10 || // Lo HANGUL SYLLABLE JJOE - code === 0xCB2C || // Lo HANGUL SYLLABLE JJYO - code === 0xCB48 || // Lo HANGUL SYLLABLE JJU - code === 0xCB64 || // Lo HANGUL SYLLABLE JJWEO - code === 0xCB80 || // Lo HANGUL SYLLABLE JJWE - code === 0xCB9C || // Lo HANGUL SYLLABLE JJWI - code === 0xCBB8 || // Lo HANGUL SYLLABLE JJYU - code === 0xCBD4 || // Lo HANGUL SYLLABLE JJEU - code === 0xCBF0 || // Lo HANGUL SYLLABLE JJYI - code === 0xCC0C || // Lo HANGUL SYLLABLE JJI - code === 0xCC28 || // Lo HANGUL SYLLABLE CA - code === 0xCC44 || // Lo HANGUL SYLLABLE CAE - code === 0xCC60 || // Lo HANGUL SYLLABLE CYA - code === 0xCC7C || // Lo HANGUL SYLLABLE CYAE - code === 0xCC98 || // Lo HANGUL SYLLABLE CEO - code === 0xCCB4 || // Lo HANGUL SYLLABLE CE - code === 0xCCD0 || // Lo HANGUL SYLLABLE CYEO - code === 0xCCEC || // Lo HANGUL SYLLABLE CYE - code === 0xCD08 || // Lo HANGUL SYLLABLE CO - code === 0xCD24 || // Lo HANGUL SYLLABLE CWA - code === 0xCD40 || // Lo HANGUL SYLLABLE CWAE - code === 0xCD5C || // Lo HANGUL SYLLABLE COE - code === 0xCD78 || // Lo HANGUL SYLLABLE CYO - code === 0xCD94 || // Lo HANGUL SYLLABLE CU - code === 0xCDB0 || // Lo HANGUL SYLLABLE CWEO - code === 0xCDCC || // Lo HANGUL SYLLABLE CWE - code === 0xCDE8 || // Lo HANGUL SYLLABLE CWI - code === 0xCE04 || // Lo HANGUL SYLLABLE CYU - code === 0xCE20 || // Lo HANGUL SYLLABLE CEU - code === 0xCE3C || // Lo HANGUL SYLLABLE CYI - code === 0xCE58 || // Lo HANGUL SYLLABLE CI - code === 0xCE74 || // Lo HANGUL SYLLABLE KA - code === 0xCE90 || // Lo HANGUL SYLLABLE KAE - code === 0xCEAC || // Lo HANGUL SYLLABLE KYA - code === 0xCEC8 || // Lo HANGUL SYLLABLE KYAE - code === 0xCEE4 || // Lo HANGUL SYLLABLE KEO - code === 0xCF00 || // Lo HANGUL SYLLABLE KE - code === 0xCF1C || // Lo HANGUL SYLLABLE KYEO - code === 0xCF38 || // Lo HANGUL SYLLABLE KYE - code === 0xCF54 || // Lo HANGUL SYLLABLE KO - code === 0xCF70 || // Lo HANGUL SYLLABLE KWA - code === 0xCF8C || // Lo HANGUL SYLLABLE KWAE - code === 0xCFA8 || // Lo HANGUL SYLLABLE KOE - code === 0xCFC4 || // Lo HANGUL SYLLABLE KYO - code === 0xCFE0 || // Lo HANGUL SYLLABLE KU - code === 0xCFFC || // Lo HANGUL SYLLABLE KWEO - code === 0xD018 || // Lo HANGUL SYLLABLE KWE - code === 0xD034 || // Lo HANGUL SYLLABLE KWI - code === 0xD050 || // Lo HANGUL SYLLABLE KYU - code === 0xD06C || // Lo HANGUL SYLLABLE KEU - code === 0xD088 || // Lo HANGUL SYLLABLE KYI - code === 0xD0A4 || // Lo HANGUL SYLLABLE KI - code === 0xD0C0 || // Lo HANGUL SYLLABLE TA - code === 0xD0DC || // Lo HANGUL SYLLABLE TAE - code === 0xD0F8 || // Lo HANGUL SYLLABLE TYA - code === 0xD114 || // Lo HANGUL SYLLABLE TYAE - code === 0xD130 || // Lo HANGUL SYLLABLE TEO - code === 0xD14C || // Lo HANGUL SYLLABLE TE - code === 0xD168 || // Lo HANGUL SYLLABLE TYEO - code === 0xD184 || // Lo HANGUL SYLLABLE TYE - code === 0xD1A0 || // Lo HANGUL SYLLABLE TO - code === 0xD1BC || // Lo HANGUL SYLLABLE TWA - code === 0xD1D8 || // Lo HANGUL SYLLABLE TWAE - code === 0xD1F4 || // Lo HANGUL SYLLABLE TOE - code === 0xD210 || // Lo HANGUL SYLLABLE TYO - code === 0xD22C || // Lo HANGUL SYLLABLE TU - code === 0xD248 || // Lo HANGUL SYLLABLE TWEO - code === 0xD264 || // Lo HANGUL SYLLABLE TWE - code === 0xD280 || // Lo HANGUL SYLLABLE TWI - code === 0xD29C || // Lo HANGUL SYLLABLE TYU - code === 0xD2B8 || // Lo HANGUL SYLLABLE TEU - code === 0xD2D4 || // Lo HANGUL SYLLABLE TYI - code === 0xD2F0 || // Lo HANGUL SYLLABLE TI - code === 0xD30C || // Lo HANGUL SYLLABLE PA - code === 0xD328 || // Lo HANGUL SYLLABLE PAE - code === 0xD344 || // Lo HANGUL SYLLABLE PYA - code === 0xD360 || // Lo HANGUL SYLLABLE PYAE - code === 0xD37C || // Lo HANGUL SYLLABLE PEO - code === 0xD398 || // Lo HANGUL SYLLABLE PE - code === 0xD3B4 || // Lo HANGUL SYLLABLE PYEO - code === 0xD3D0 || // Lo HANGUL SYLLABLE PYE - code === 0xD3EC || // Lo HANGUL SYLLABLE PO - code === 0xD408 || // Lo HANGUL SYLLABLE PWA - code === 0xD424 || // Lo HANGUL SYLLABLE PWAE - code === 0xD440 || // Lo HANGUL SYLLABLE POE - code === 0xD45C || // Lo HANGUL SYLLABLE PYO - code === 0xD478 || // Lo HANGUL SYLLABLE PU - code === 0xD494 || // Lo HANGUL SYLLABLE PWEO - code === 0xD4B0 || // Lo HANGUL SYLLABLE PWE - code === 0xD4CC || // Lo HANGUL SYLLABLE PWI - code === 0xD4E8 || // Lo HANGUL SYLLABLE PYU - code === 0xD504 || // Lo HANGUL SYLLABLE PEU - code === 0xD520 || // Lo HANGUL SYLLABLE PYI - code === 0xD53C || // Lo HANGUL SYLLABLE PI - code === 0xD558 || // Lo HANGUL SYLLABLE HA - code === 0xD574 || // Lo HANGUL SYLLABLE HAE - code === 0xD590 || // Lo HANGUL SYLLABLE HYA - code === 0xD5AC || // Lo HANGUL SYLLABLE HYAE - code === 0xD5C8 || // Lo HANGUL SYLLABLE HEO - code === 0xD5E4 || // Lo HANGUL SYLLABLE HE - code === 0xD600 || // Lo HANGUL SYLLABLE HYEO - code === 0xD61C || // Lo HANGUL SYLLABLE HYE - code === 0xD638 || // Lo HANGUL SYLLABLE HO - code === 0xD654 || // Lo HANGUL SYLLABLE HWA - code === 0xD670 || // Lo HANGUL SYLLABLE HWAE - code === 0xD68C || // Lo HANGUL SYLLABLE HOE - code === 0xD6A8 || // Lo HANGUL SYLLABLE HYO - code === 0xD6C4 || // Lo HANGUL SYLLABLE HU - code === 0xD6E0 || // Lo HANGUL SYLLABLE HWEO - code === 0xD6FC || // Lo HANGUL SYLLABLE HWE - code === 0xD718 || // Lo HANGUL SYLLABLE HWI - code === 0xD734 || // Lo HANGUL SYLLABLE HYU - code === 0xD750 || // Lo HANGUL SYLLABLE HEU - code === 0xD76C || // Lo HANGUL SYLLABLE HYI - code === 0xD788 // Lo HANGUL SYLLABLE HI - ) { - return constants.LV; - } - if ( - ( 0xAC01 <= code && code <= 0xAC1B ) || // Lo [27] HANGUL SYLLABLE GAG..HANGUL SYLLABLE GAH - ( 0xAC1D <= code && code <= 0xAC37 ) || // Lo [27] HANGUL SYLLABLE GAEG..HANGUL SYLLABLE GAEH - ( 0xAC39 <= code && code <= 0xAC53 ) || // Lo [27] HANGUL SYLLABLE GYAG..HANGUL SYLLABLE GYAH - ( 0xAC55 <= code && code <= 0xAC6F ) || // Lo [27] HANGUL SYLLABLE GYAEG..HANGUL SYLLABLE GYAEH - ( 0xAC71 <= code && code <= 0xAC8B ) || // Lo [27] HANGUL SYLLABLE GEOG..HANGUL SYLLABLE GEOH - ( 0xAC8D <= code && code <= 0xACA7 ) || // Lo [27] HANGUL SYLLABLE GEG..HANGUL SYLLABLE GEH - ( 0xACA9 <= code && code <= 0xACC3 ) || // Lo [27] HANGUL SYLLABLE GYEOG..HANGUL SYLLABLE GYEOH - ( 0xACC5 <= code && code <= 0xACDF ) || // Lo [27] HANGUL SYLLABLE GYEG..HANGUL SYLLABLE GYEH - ( 0xACE1 <= code && code <= 0xACFB ) || // Lo [27] HANGUL SYLLABLE GOG..HANGUL SYLLABLE GOH - ( 0xACFD <= code && code <= 0xAD17 ) || // Lo [27] HANGUL SYLLABLE GWAG..HANGUL SYLLABLE GWAH - ( 0xAD19 <= code && code <= 0xAD33 ) || // Lo [27] HANGUL SYLLABLE GWAEG..HANGUL SYLLABLE GWAEH - ( 0xAD35 <= code && code <= 0xAD4F ) || // Lo [27] HANGUL SYLLABLE GOEG..HANGUL SYLLABLE GOEH - ( 0xAD51 <= code && code <= 0xAD6B ) || // Lo [27] HANGUL SYLLABLE GYOG..HANGUL SYLLABLE GYOH - ( 0xAD6D <= code && code <= 0xAD87 ) || // Lo [27] HANGUL SYLLABLE GUG..HANGUL SYLLABLE GUH - ( 0xAD89 <= code && code <= 0xADA3 ) || // Lo [27] HANGUL SYLLABLE GWEOG..HANGUL SYLLABLE GWEOH - ( 0xADA5 <= code && code <= 0xADBF ) || // Lo [27] HANGUL SYLLABLE GWEG..HANGUL SYLLABLE GWEH - ( 0xADC1 <= code && code <= 0xADDB ) || // Lo [27] HANGUL SYLLABLE GWIG..HANGUL SYLLABLE GWIH - ( 0xADDD <= code && code <= 0xADF7 ) || // Lo [27] HANGUL SYLLABLE GYUG..HANGUL SYLLABLE GYUH - ( 0xADF9 <= code && code <= 0xAE13 ) || // Lo [27] HANGUL SYLLABLE GEUG..HANGUL SYLLABLE GEUH - ( 0xAE15 <= code && code <= 0xAE2F ) || // Lo [27] HANGUL SYLLABLE GYIG..HANGUL SYLLABLE GYIH - ( 0xAE31 <= code && code <= 0xAE4B ) || // Lo [27] HANGUL SYLLABLE GIG..HANGUL SYLLABLE GIH - ( 0xAE4D <= code && code <= 0xAE67 ) || // Lo [27] HANGUL SYLLABLE GGAG..HANGUL SYLLABLE GGAH - ( 0xAE69 <= code && code <= 0xAE83 ) || // Lo [27] HANGUL SYLLABLE GGAEG..HANGUL SYLLABLE GGAEH - ( 0xAE85 <= code && code <= 0xAE9F ) || // Lo [27] HANGUL SYLLABLE GGYAG..HANGUL SYLLABLE GGYAH - ( 0xAEA1 <= code && code <= 0xAEBB ) || // Lo [27] HANGUL SYLLABLE GGYAEG..HANGUL SYLLABLE GGYAEH - ( 0xAEBD <= code && code <= 0xAED7 ) || // Lo [27] HANGUL SYLLABLE GGEOG..HANGUL SYLLABLE GGEOH - ( 0xAED9 <= code && code <= 0xAEF3 ) || // Lo [27] HANGUL SYLLABLE GGEG..HANGUL SYLLABLE GGEH - ( 0xAEF5 <= code && code <= 0xAF0F ) || // Lo [27] HANGUL SYLLABLE GGYEOG..HANGUL SYLLABLE GGYEOH - ( 0xAF11 <= code && code <= 0xAF2B ) || // Lo [27] HANGUL SYLLABLE GGYEG..HANGUL SYLLABLE GGYEH - ( 0xAF2D <= code && code <= 0xAF47 ) || // Lo [27] HANGUL SYLLABLE GGOG..HANGUL SYLLABLE GGOH - ( 0xAF49 <= code && code <= 0xAF63 ) || // Lo [27] HANGUL SYLLABLE GGWAG..HANGUL SYLLABLE GGWAH - ( 0xAF65 <= code && code <= 0xAF7F ) || // Lo [27] HANGUL SYLLABLE GGWAEG..HANGUL SYLLABLE GGWAEH - ( 0xAF81 <= code && code <= 0xAF9B ) || // Lo [27] HANGUL SYLLABLE GGOEG..HANGUL SYLLABLE GGOEH - ( 0xAF9D <= code && code <= 0xAFB7 ) || // Lo [27] HANGUL SYLLABLE GGYOG..HANGUL SYLLABLE GGYOH - ( 0xAFB9 <= code && code <= 0xAFD3 ) || // Lo [27] HANGUL SYLLABLE GGUG..HANGUL SYLLABLE GGUH - ( 0xAFD5 <= code && code <= 0xAFEF ) || // Lo [27] HANGUL SYLLABLE GGWEOG..HANGUL SYLLABLE GGWEOH - ( 0xAFF1 <= code && code <= 0xB00B ) || // Lo [27] HANGUL SYLLABLE GGWEG..HANGUL SYLLABLE GGWEH - ( 0xB00D <= code && code <= 0xB027 ) || // Lo [27] HANGUL SYLLABLE GGWIG..HANGUL SYLLABLE GGWIH - ( 0xB029 <= code && code <= 0xB043 ) || // Lo [27] HANGUL SYLLABLE GGYUG..HANGUL SYLLABLE GGYUH - ( 0xB045 <= code && code <= 0xB05F ) || // Lo [27] HANGUL SYLLABLE GGEUG..HANGUL SYLLABLE GGEUH - ( 0xB061 <= code && code <= 0xB07B ) || // Lo [27] HANGUL SYLLABLE GGYIG..HANGUL SYLLABLE GGYIH - ( 0xB07D <= code && code <= 0xB097 ) || // Lo [27] HANGUL SYLLABLE GGIG..HANGUL SYLLABLE GGIH - ( 0xB099 <= code && code <= 0xB0B3 ) || // Lo [27] HANGUL SYLLABLE NAG..HANGUL SYLLABLE NAH - ( 0xB0B5 <= code && code <= 0xB0CF ) || // Lo [27] HANGUL SYLLABLE NAEG..HANGUL SYLLABLE NAEH - ( 0xB0D1 <= code && code <= 0xB0EB ) || // Lo [27] HANGUL SYLLABLE NYAG..HANGUL SYLLABLE NYAH - ( 0xB0ED <= code && code <= 0xB107 ) || // Lo [27] HANGUL SYLLABLE NYAEG..HANGUL SYLLABLE NYAEH - ( 0xB109 <= code && code <= 0xB123 ) || // Lo [27] HANGUL SYLLABLE NEOG..HANGUL SYLLABLE NEOH - ( 0xB125 <= code && code <= 0xB13F ) || // Lo [27] HANGUL SYLLABLE NEG..HANGUL SYLLABLE NEH - ( 0xB141 <= code && code <= 0xB15B ) || // Lo [27] HANGUL SYLLABLE NYEOG..HANGUL SYLLABLE NYEOH - ( 0xB15D <= code && code <= 0xB177 ) || // Lo [27] HANGUL SYLLABLE NYEG..HANGUL SYLLABLE NYEH - ( 0xB179 <= code && code <= 0xB193 ) || // Lo [27] HANGUL SYLLABLE NOG..HANGUL SYLLABLE NOH - ( 0xB195 <= code && code <= 0xB1AF ) || // Lo [27] HANGUL SYLLABLE NWAG..HANGUL SYLLABLE NWAH - ( 0xB1B1 <= code && code <= 0xB1CB ) || // Lo [27] HANGUL SYLLABLE NWAEG..HANGUL SYLLABLE NWAEH - ( 0xB1CD <= code && code <= 0xB1E7 ) || // Lo [27] HANGUL SYLLABLE NOEG..HANGUL SYLLABLE NOEH - ( 0xB1E9 <= code && code <= 0xB203 ) || // Lo [27] HANGUL SYLLABLE NYOG..HANGUL SYLLABLE NYOH - ( 0xB205 <= code && code <= 0xB21F ) || // Lo [27] HANGUL SYLLABLE NUG..HANGUL SYLLABLE NUH - ( 0xB221 <= code && code <= 0xB23B ) || // Lo [27] HANGUL SYLLABLE NWEOG..HANGUL SYLLABLE NWEOH - ( 0xB23D <= code && code <= 0xB257 ) || // Lo [27] HANGUL SYLLABLE NWEG..HANGUL SYLLABLE NWEH - ( 0xB259 <= code && code <= 0xB273 ) || // Lo [27] HANGUL SYLLABLE NWIG..HANGUL SYLLABLE NWIH - ( 0xB275 <= code && code <= 0xB28F ) || // Lo [27] HANGUL SYLLABLE NYUG..HANGUL SYLLABLE NYUH - ( 0xB291 <= code && code <= 0xB2AB ) || // Lo [27] HANGUL SYLLABLE NEUG..HANGUL SYLLABLE NEUH - ( 0xB2AD <= code && code <= 0xB2C7 ) || // Lo [27] HANGUL SYLLABLE NYIG..HANGUL SYLLABLE NYIH - ( 0xB2C9 <= code && code <= 0xB2E3 ) || // Lo [27] HANGUL SYLLABLE NIG..HANGUL SYLLABLE NIH - ( 0xB2E5 <= code && code <= 0xB2FF ) || // Lo [27] HANGUL SYLLABLE DAG..HANGUL SYLLABLE DAH - ( 0xB301 <= code && code <= 0xB31B ) || // Lo [27] HANGUL SYLLABLE DAEG..HANGUL SYLLABLE DAEH - ( 0xB31D <= code && code <= 0xB337 ) || // Lo [27] HANGUL SYLLABLE DYAG..HANGUL SYLLABLE DYAH - ( 0xB339 <= code && code <= 0xB353 ) || // Lo [27] HANGUL SYLLABLE DYAEG..HANGUL SYLLABLE DYAEH - ( 0xB355 <= code && code <= 0xB36F ) || // Lo [27] HANGUL SYLLABLE DEOG..HANGUL SYLLABLE DEOH - ( 0xB371 <= code && code <= 0xB38B ) || // Lo [27] HANGUL SYLLABLE DEG..HANGUL SYLLABLE DEH - ( 0xB38D <= code && code <= 0xB3A7 ) || // Lo [27] HANGUL SYLLABLE DYEOG..HANGUL SYLLABLE DYEOH - ( 0xB3A9 <= code && code <= 0xB3C3 ) || // Lo [27] HANGUL SYLLABLE DYEG..HANGUL SYLLABLE DYEH - ( 0xB3C5 <= code && code <= 0xB3DF ) || // Lo [27] HANGUL SYLLABLE DOG..HANGUL SYLLABLE DOH - ( 0xB3E1 <= code && code <= 0xB3FB ) || // Lo [27] HANGUL SYLLABLE DWAG..HANGUL SYLLABLE DWAH - ( 0xB3FD <= code && code <= 0xB417 ) || // Lo [27] HANGUL SYLLABLE DWAEG..HANGUL SYLLABLE DWAEH - ( 0xB419 <= code && code <= 0xB433 ) || // Lo [27] HANGUL SYLLABLE DOEG..HANGUL SYLLABLE DOEH - ( 0xB435 <= code && code <= 0xB44F ) || // Lo [27] HANGUL SYLLABLE DYOG..HANGUL SYLLABLE DYOH - ( 0xB451 <= code && code <= 0xB46B ) || // Lo [27] HANGUL SYLLABLE DUG..HANGUL SYLLABLE DUH - ( 0xB46D <= code && code <= 0xB487 ) || // Lo [27] HANGUL SYLLABLE DWEOG..HANGUL SYLLABLE DWEOH - ( 0xB489 <= code && code <= 0xB4A3 ) || // Lo [27] HANGUL SYLLABLE DWEG..HANGUL SYLLABLE DWEH - ( 0xB4A5 <= code && code <= 0xB4BF ) || // Lo [27] HANGUL SYLLABLE DWIG..HANGUL SYLLABLE DWIH - ( 0xB4C1 <= code && code <= 0xB4DB ) || // Lo [27] HANGUL SYLLABLE DYUG..HANGUL SYLLABLE DYUH - ( 0xB4DD <= code && code <= 0xB4F7 ) || // Lo [27] HANGUL SYLLABLE DEUG..HANGUL SYLLABLE DEUH - ( 0xB4F9 <= code && code <= 0xB513 ) || // Lo [27] HANGUL SYLLABLE DYIG..HANGUL SYLLABLE DYIH - ( 0xB515 <= code && code <= 0xB52F ) || // Lo [27] HANGUL SYLLABLE DIG..HANGUL SYLLABLE DIH - ( 0xB531 <= code && code <= 0xB54B ) || // Lo [27] HANGUL SYLLABLE DDAG..HANGUL SYLLABLE DDAH - ( 0xB54D <= code && code <= 0xB567 ) || // Lo [27] HANGUL SYLLABLE DDAEG..HANGUL SYLLABLE DDAEH - ( 0xB569 <= code && code <= 0xB583 ) || // Lo [27] HANGUL SYLLABLE DDYAG..HANGUL SYLLABLE DDYAH - ( 0xB585 <= code && code <= 0xB59F ) || // Lo [27] HANGUL SYLLABLE DDYAEG..HANGUL SYLLABLE DDYAEH - ( 0xB5A1 <= code && code <= 0xB5BB ) || // Lo [27] HANGUL SYLLABLE DDEOG..HANGUL SYLLABLE DDEOH - ( 0xB5BD <= code && code <= 0xB5D7 ) || // Lo [27] HANGUL SYLLABLE DDEG..HANGUL SYLLABLE DDEH - ( 0xB5D9 <= code && code <= 0xB5F3 ) || // Lo [27] HANGUL SYLLABLE DDYEOG..HANGUL SYLLABLE DDYEOH - ( 0xB5F5 <= code && code <= 0xB60F ) || // Lo [27] HANGUL SYLLABLE DDYEG..HANGUL SYLLABLE DDYEH - ( 0xB611 <= code && code <= 0xB62B ) || // Lo [27] HANGUL SYLLABLE DDOG..HANGUL SYLLABLE DDOH - ( 0xB62D <= code && code <= 0xB647 ) || // Lo [27] HANGUL SYLLABLE DDWAG..HANGUL SYLLABLE DDWAH - ( 0xB649 <= code && code <= 0xB663 ) || // Lo [27] HANGUL SYLLABLE DDWAEG..HANGUL SYLLABLE DDWAEH - ( 0xB665 <= code && code <= 0xB67F ) || // Lo [27] HANGUL SYLLABLE DDOEG..HANGUL SYLLABLE DDOEH - ( 0xB681 <= code && code <= 0xB69B ) || // Lo [27] HANGUL SYLLABLE DDYOG..HANGUL SYLLABLE DDYOH - ( 0xB69D <= code && code <= 0xB6B7 ) || // Lo [27] HANGUL SYLLABLE DDUG..HANGUL SYLLABLE DDUH - ( 0xB6B9 <= code && code <= 0xB6D3 ) || // Lo [27] HANGUL SYLLABLE DDWEOG..HANGUL SYLLABLE DDWEOH - ( 0xB6D5 <= code && code <= 0xB6EF ) || // Lo [27] HANGUL SYLLABLE DDWEG..HANGUL SYLLABLE DDWEH - ( 0xB6F1 <= code && code <= 0xB70B ) || // Lo [27] HANGUL SYLLABLE DDWIG..HANGUL SYLLABLE DDWIH - ( 0xB70D <= code && code <= 0xB727 ) || // Lo [27] HANGUL SYLLABLE DDYUG..HANGUL SYLLABLE DDYUH - ( 0xB729 <= code && code <= 0xB743 ) || // Lo [27] HANGUL SYLLABLE DDEUG..HANGUL SYLLABLE DDEUH - ( 0xB745 <= code && code <= 0xB75F ) || // Lo [27] HANGUL SYLLABLE DDYIG..HANGUL SYLLABLE DDYIH - ( 0xB761 <= code && code <= 0xB77B ) || // Lo [27] HANGUL SYLLABLE DDIG..HANGUL SYLLABLE DDIH - ( 0xB77D <= code && code <= 0xB797 ) || // Lo [27] HANGUL SYLLABLE RAG..HANGUL SYLLABLE RAH - ( 0xB799 <= code && code <= 0xB7B3 ) || // Lo [27] HANGUL SYLLABLE RAEG..HANGUL SYLLABLE RAEH - ( 0xB7B5 <= code && code <= 0xB7CF ) || // Lo [27] HANGUL SYLLABLE RYAG..HANGUL SYLLABLE RYAH - ( 0xB7D1 <= code && code <= 0xB7EB ) || // Lo [27] HANGUL SYLLABLE RYAEG..HANGUL SYLLABLE RYAEH - ( 0xB7ED <= code && code <= 0xB807 ) || // Lo [27] HANGUL SYLLABLE REOG..HANGUL SYLLABLE REOH - ( 0xB809 <= code && code <= 0xB823 ) || // Lo [27] HANGUL SYLLABLE REG..HANGUL SYLLABLE REH - ( 0xB825 <= code && code <= 0xB83F ) || // Lo [27] HANGUL SYLLABLE RYEOG..HANGUL SYLLABLE RYEOH - ( 0xB841 <= code && code <= 0xB85B ) || // Lo [27] HANGUL SYLLABLE RYEG..HANGUL SYLLABLE RYEH - ( 0xB85D <= code && code <= 0xB877 ) || // Lo [27] HANGUL SYLLABLE ROG..HANGUL SYLLABLE ROH - ( 0xB879 <= code && code <= 0xB893 ) || // Lo [27] HANGUL SYLLABLE RWAG..HANGUL SYLLABLE RWAH - ( 0xB895 <= code && code <= 0xB8AF ) || // Lo [27] HANGUL SYLLABLE RWAEG..HANGUL SYLLABLE RWAEH - ( 0xB8B1 <= code && code <= 0xB8CB ) || // Lo [27] HANGUL SYLLABLE ROEG..HANGUL SYLLABLE ROEH - ( 0xB8CD <= code && code <= 0xB8E7 ) || // Lo [27] HANGUL SYLLABLE RYOG..HANGUL SYLLABLE RYOH - ( 0xB8E9 <= code && code <= 0xB903 ) || // Lo [27] HANGUL SYLLABLE RUG..HANGUL SYLLABLE RUH - ( 0xB905 <= code && code <= 0xB91F ) || // Lo [27] HANGUL SYLLABLE RWEOG..HANGUL SYLLABLE RWEOH - ( 0xB921 <= code && code <= 0xB93B ) || // Lo [27] HANGUL SYLLABLE RWEG..HANGUL SYLLABLE RWEH - ( 0xB93D <= code && code <= 0xB957 ) || // Lo [27] HANGUL SYLLABLE RWIG..HANGUL SYLLABLE RWIH - ( 0xB959 <= code && code <= 0xB973 ) || // Lo [27] HANGUL SYLLABLE RYUG..HANGUL SYLLABLE RYUH - ( 0xB975 <= code && code <= 0xB98F ) || // Lo [27] HANGUL SYLLABLE REUG..HANGUL SYLLABLE REUH - ( 0xB991 <= code && code <= 0xB9AB ) || // Lo [27] HANGUL SYLLABLE RYIG..HANGUL SYLLABLE RYIH - ( 0xB9AD <= code && code <= 0xB9C7 ) || // Lo [27] HANGUL SYLLABLE RIG..HANGUL SYLLABLE RIH - ( 0xB9C9 <= code && code <= 0xB9E3 ) || // Lo [27] HANGUL SYLLABLE MAG..HANGUL SYLLABLE MAH - ( 0xB9E5 <= code && code <= 0xB9FF ) || // Lo [27] HANGUL SYLLABLE MAEG..HANGUL SYLLABLE MAEH - ( 0xBA01 <= code && code <= 0xBA1B ) || // Lo [27] HANGUL SYLLABLE MYAG..HANGUL SYLLABLE MYAH - ( 0xBA1D <= code && code <= 0xBA37 ) || // Lo [27] HANGUL SYLLABLE MYAEG..HANGUL SYLLABLE MYAEH - ( 0xBA39 <= code && code <= 0xBA53 ) || // Lo [27] HANGUL SYLLABLE MEOG..HANGUL SYLLABLE MEOH - ( 0xBA55 <= code && code <= 0xBA6F ) || // Lo [27] HANGUL SYLLABLE MEG..HANGUL SYLLABLE MEH - ( 0xBA71 <= code && code <= 0xBA8B ) || // Lo [27] HANGUL SYLLABLE MYEOG..HANGUL SYLLABLE MYEOH - ( 0xBA8D <= code && code <= 0xBAA7 ) || // Lo [27] HANGUL SYLLABLE MYEG..HANGUL SYLLABLE MYEH - ( 0xBAA9 <= code && code <= 0xBAC3 ) || // Lo [27] HANGUL SYLLABLE MOG..HANGUL SYLLABLE MOH - ( 0xBAC5 <= code && code <= 0xBADF ) || // Lo [27] HANGUL SYLLABLE MWAG..HANGUL SYLLABLE MWAH - ( 0xBAE1 <= code && code <= 0xBAFB ) || // Lo [27] HANGUL SYLLABLE MWAEG..HANGUL SYLLABLE MWAEH - ( 0xBAFD <= code && code <= 0xBB17 ) || // Lo [27] HANGUL SYLLABLE MOEG..HANGUL SYLLABLE MOEH - ( 0xBB19 <= code && code <= 0xBB33 ) || // Lo [27] HANGUL SYLLABLE MYOG..HANGUL SYLLABLE MYOH - ( 0xBB35 <= code && code <= 0xBB4F ) || // Lo [27] HANGUL SYLLABLE MUG..HANGUL SYLLABLE MUH - ( 0xBB51 <= code && code <= 0xBB6B ) || // Lo [27] HANGUL SYLLABLE MWEOG..HANGUL SYLLABLE MWEOH - ( 0xBB6D <= code && code <= 0xBB87 ) || // Lo [27] HANGUL SYLLABLE MWEG..HANGUL SYLLABLE MWEH - ( 0xBB89 <= code && code <= 0xBBA3 ) || // Lo [27] HANGUL SYLLABLE MWIG..HANGUL SYLLABLE MWIH - ( 0xBBA5 <= code && code <= 0xBBBF ) || // Lo [27] HANGUL SYLLABLE MYUG..HANGUL SYLLABLE MYUH - ( 0xBBC1 <= code && code <= 0xBBDB ) || // Lo [27] HANGUL SYLLABLE MEUG..HANGUL SYLLABLE MEUH - ( 0xBBDD <= code && code <= 0xBBF7 ) || // Lo [27] HANGUL SYLLABLE MYIG..HANGUL SYLLABLE MYIH - ( 0xBBF9 <= code && code <= 0xBC13 ) || // Lo [27] HANGUL SYLLABLE MIG..HANGUL SYLLABLE MIH - ( 0xBC15 <= code && code <= 0xBC2F ) || // Lo [27] HANGUL SYLLABLE BAG..HANGUL SYLLABLE BAH - ( 0xBC31 <= code && code <= 0xBC4B ) || // Lo [27] HANGUL SYLLABLE BAEG..HANGUL SYLLABLE BAEH - ( 0xBC4D <= code && code <= 0xBC67 ) || // Lo [27] HANGUL SYLLABLE BYAG..HANGUL SYLLABLE BYAH - ( 0xBC69 <= code && code <= 0xBC83 ) || // Lo [27] HANGUL SYLLABLE BYAEG..HANGUL SYLLABLE BYAEH - ( 0xBC85 <= code && code <= 0xBC9F ) || // Lo [27] HANGUL SYLLABLE BEOG..HANGUL SYLLABLE BEOH - ( 0xBCA1 <= code && code <= 0xBCBB ) || // Lo [27] HANGUL SYLLABLE BEG..HANGUL SYLLABLE BEH - ( 0xBCBD <= code && code <= 0xBCD7 ) || // Lo [27] HANGUL SYLLABLE BYEOG..HANGUL SYLLABLE BYEOH - ( 0xBCD9 <= code && code <= 0xBCF3 ) || // Lo [27] HANGUL SYLLABLE BYEG..HANGUL SYLLABLE BYEH - ( 0xBCF5 <= code && code <= 0xBD0F ) || // Lo [27] HANGUL SYLLABLE BOG..HANGUL SYLLABLE BOH - ( 0xBD11 <= code && code <= 0xBD2B ) || // Lo [27] HANGUL SYLLABLE BWAG..HANGUL SYLLABLE BWAH - ( 0xBD2D <= code && code <= 0xBD47 ) || // Lo [27] HANGUL SYLLABLE BWAEG..HANGUL SYLLABLE BWAEH - ( 0xBD49 <= code && code <= 0xBD63 ) || // Lo [27] HANGUL SYLLABLE BOEG..HANGUL SYLLABLE BOEH - ( 0xBD65 <= code && code <= 0xBD7F ) || // Lo [27] HANGUL SYLLABLE BYOG..HANGUL SYLLABLE BYOH - ( 0xBD81 <= code && code <= 0xBD9B ) || // Lo [27] HANGUL SYLLABLE BUG..HANGUL SYLLABLE BUH - ( 0xBD9D <= code && code <= 0xBDB7 ) || // Lo [27] HANGUL SYLLABLE BWEOG..HANGUL SYLLABLE BWEOH - ( 0xBDB9 <= code && code <= 0xBDD3 ) || // Lo [27] HANGUL SYLLABLE BWEG..HANGUL SYLLABLE BWEH - ( 0xBDD5 <= code && code <= 0xBDEF ) || // Lo [27] HANGUL SYLLABLE BWIG..HANGUL SYLLABLE BWIH - ( 0xBDF1 <= code && code <= 0xBE0B ) || // Lo [27] HANGUL SYLLABLE BYUG..HANGUL SYLLABLE BYUH - ( 0xBE0D <= code && code <= 0xBE27 ) || // Lo [27] HANGUL SYLLABLE BEUG..HANGUL SYLLABLE BEUH - ( 0xBE29 <= code && code <= 0xBE43 ) || // Lo [27] HANGUL SYLLABLE BYIG..HANGUL SYLLABLE BYIH - ( 0xBE45 <= code && code <= 0xBE5F ) || // Lo [27] HANGUL SYLLABLE BIG..HANGUL SYLLABLE BIH - ( 0xBE61 <= code && code <= 0xBE7B ) || // Lo [27] HANGUL SYLLABLE BBAG..HANGUL SYLLABLE BBAH - ( 0xBE7D <= code && code <= 0xBE97 ) || // Lo [27] HANGUL SYLLABLE BBAEG..HANGUL SYLLABLE BBAEH - ( 0xBE99 <= code && code <= 0xBEB3 ) || // Lo [27] HANGUL SYLLABLE BBYAG..HANGUL SYLLABLE BBYAH - ( 0xBEB5 <= code && code <= 0xBECF ) || // Lo [27] HANGUL SYLLABLE BBYAEG..HANGUL SYLLABLE BBYAEH - ( 0xBED1 <= code && code <= 0xBEEB ) || // Lo [27] HANGUL SYLLABLE BBEOG..HANGUL SYLLABLE BBEOH - ( 0xBEED <= code && code <= 0xBF07 ) || // Lo [27] HANGUL SYLLABLE BBEG..HANGUL SYLLABLE BBEH - ( 0xBF09 <= code && code <= 0xBF23 ) || // Lo [27] HANGUL SYLLABLE BBYEOG..HANGUL SYLLABLE BBYEOH - ( 0xBF25 <= code && code <= 0xBF3F ) || // Lo [27] HANGUL SYLLABLE BBYEG..HANGUL SYLLABLE BBYEH - ( 0xBF41 <= code && code <= 0xBF5B ) || // Lo [27] HANGUL SYLLABLE BBOG..HANGUL SYLLABLE BBOH - ( 0xBF5D <= code && code <= 0xBF77 ) || // Lo [27] HANGUL SYLLABLE BBWAG..HANGUL SYLLABLE BBWAH - ( 0xBF79 <= code && code <= 0xBF93 ) || // Lo [27] HANGUL SYLLABLE BBWAEG..HANGUL SYLLABLE BBWAEH - ( 0xBF95 <= code && code <= 0xBFAF ) || // Lo [27] HANGUL SYLLABLE BBOEG..HANGUL SYLLABLE BBOEH - ( 0xBFB1 <= code && code <= 0xBFCB ) || // Lo [27] HANGUL SYLLABLE BBYOG..HANGUL SYLLABLE BBYOH - ( 0xBFCD <= code && code <= 0xBFE7 ) || // Lo [27] HANGUL SYLLABLE BBUG..HANGUL SYLLABLE BBUH - ( 0xBFE9 <= code && code <= 0xC003 ) || // Lo [27] HANGUL SYLLABLE BBWEOG..HANGUL SYLLABLE BBWEOH - ( 0xC005 <= code && code <= 0xC01F ) || // Lo [27] HANGUL SYLLABLE BBWEG..HANGUL SYLLABLE BBWEH - ( 0xC021 <= code && code <= 0xC03B ) || // Lo [27] HANGUL SYLLABLE BBWIG..HANGUL SYLLABLE BBWIH - ( 0xC03D <= code && code <= 0xC057 ) || // Lo [27] HANGUL SYLLABLE BBYUG..HANGUL SYLLABLE BBYUH - ( 0xC059 <= code && code <= 0xC073 ) || // Lo [27] HANGUL SYLLABLE BBEUG..HANGUL SYLLABLE BBEUH - ( 0xC075 <= code && code <= 0xC08F ) || // Lo [27] HANGUL SYLLABLE BBYIG..HANGUL SYLLABLE BBYIH - ( 0xC091 <= code && code <= 0xC0AB ) || // Lo [27] HANGUL SYLLABLE BBIG..HANGUL SYLLABLE BBIH - ( 0xC0AD <= code && code <= 0xC0C7 ) || // Lo [27] HANGUL SYLLABLE SAG..HANGUL SYLLABLE SAH - ( 0xC0C9 <= code && code <= 0xC0E3 ) || // Lo [27] HANGUL SYLLABLE SAEG..HANGUL SYLLABLE SAEH - ( 0xC0E5 <= code && code <= 0xC0FF ) || // Lo [27] HANGUL SYLLABLE SYAG..HANGUL SYLLABLE SYAH - ( 0xC101 <= code && code <= 0xC11B ) || // Lo [27] HANGUL SYLLABLE SYAEG..HANGUL SYLLABLE SYAEH - ( 0xC11D <= code && code <= 0xC137 ) || // Lo [27] HANGUL SYLLABLE SEOG..HANGUL SYLLABLE SEOH - ( 0xC139 <= code && code <= 0xC153 ) || // Lo [27] HANGUL SYLLABLE SEG..HANGUL SYLLABLE SEH - ( 0xC155 <= code && code <= 0xC16F ) || // Lo [27] HANGUL SYLLABLE SYEOG..HANGUL SYLLABLE SYEOH - ( 0xC171 <= code && code <= 0xC18B ) || // Lo [27] HANGUL SYLLABLE SYEG..HANGUL SYLLABLE SYEH - ( 0xC18D <= code && code <= 0xC1A7 ) || // Lo [27] HANGUL SYLLABLE SOG..HANGUL SYLLABLE SOH - ( 0xC1A9 <= code && code <= 0xC1C3 ) || // Lo [27] HANGUL SYLLABLE SWAG..HANGUL SYLLABLE SWAH - ( 0xC1C5 <= code && code <= 0xC1DF ) || // Lo [27] HANGUL SYLLABLE SWAEG..HANGUL SYLLABLE SWAEH - ( 0xC1E1 <= code && code <= 0xC1FB ) || // Lo [27] HANGUL SYLLABLE SOEG..HANGUL SYLLABLE SOEH - ( 0xC1FD <= code && code <= 0xC217 ) || // Lo [27] HANGUL SYLLABLE SYOG..HANGUL SYLLABLE SYOH - ( 0xC219 <= code && code <= 0xC233 ) || // Lo [27] HANGUL SYLLABLE SUG..HANGUL SYLLABLE SUH - ( 0xC235 <= code && code <= 0xC24F ) || // Lo [27] HANGUL SYLLABLE SWEOG..HANGUL SYLLABLE SWEOH - ( 0xC251 <= code && code <= 0xC26B ) || // Lo [27] HANGUL SYLLABLE SWEG..HANGUL SYLLABLE SWEH - ( 0xC26D <= code && code <= 0xC287 ) || // Lo [27] HANGUL SYLLABLE SWIG..HANGUL SYLLABLE SWIH - ( 0xC289 <= code && code <= 0xC2A3 ) || // Lo [27] HANGUL SYLLABLE SYUG..HANGUL SYLLABLE SYUH - ( 0xC2A5 <= code && code <= 0xC2BF ) || // Lo [27] HANGUL SYLLABLE SEUG..HANGUL SYLLABLE SEUH - ( 0xC2C1 <= code && code <= 0xC2DB ) || // Lo [27] HANGUL SYLLABLE SYIG..HANGUL SYLLABLE SYIH - ( 0xC2DD <= code && code <= 0xC2F7 ) || // Lo [27] HANGUL SYLLABLE SIG..HANGUL SYLLABLE SIH - ( 0xC2F9 <= code && code <= 0xC313 ) || // Lo [27] HANGUL SYLLABLE SSAG..HANGUL SYLLABLE SSAH - ( 0xC315 <= code && code <= 0xC32F ) || // Lo [27] HANGUL SYLLABLE SSAEG..HANGUL SYLLABLE SSAEH - ( 0xC331 <= code && code <= 0xC34B ) || // Lo [27] HANGUL SYLLABLE SSYAG..HANGUL SYLLABLE SSYAH - ( 0xC34D <= code && code <= 0xC367 ) || // Lo [27] HANGUL SYLLABLE SSYAEG..HANGUL SYLLABLE SSYAEH - ( 0xC369 <= code && code <= 0xC383 ) || // Lo [27] HANGUL SYLLABLE SSEOG..HANGUL SYLLABLE SSEOH - ( 0xC385 <= code && code <= 0xC39F ) || // Lo [27] HANGUL SYLLABLE SSEG..HANGUL SYLLABLE SSEH - ( 0xC3A1 <= code && code <= 0xC3BB ) || // Lo [27] HANGUL SYLLABLE SSYEOG..HANGUL SYLLABLE SSYEOH - ( 0xC3BD <= code && code <= 0xC3D7 ) || // Lo [27] HANGUL SYLLABLE SSYEG..HANGUL SYLLABLE SSYEH - ( 0xC3D9 <= code && code <= 0xC3F3 ) || // Lo [27] HANGUL SYLLABLE SSOG..HANGUL SYLLABLE SSOH - ( 0xC3F5 <= code && code <= 0xC40F ) || // Lo [27] HANGUL SYLLABLE SSWAG..HANGUL SYLLABLE SSWAH - ( 0xC411 <= code && code <= 0xC42B ) || // Lo [27] HANGUL SYLLABLE SSWAEG..HANGUL SYLLABLE SSWAEH - ( 0xC42D <= code && code <= 0xC447 ) || // Lo [27] HANGUL SYLLABLE SSOEG..HANGUL SYLLABLE SSOEH - ( 0xC449 <= code && code <= 0xC463 ) || // Lo [27] HANGUL SYLLABLE SSYOG..HANGUL SYLLABLE SSYOH - ( 0xC465 <= code && code <= 0xC47F ) || // Lo [27] HANGUL SYLLABLE SSUG..HANGUL SYLLABLE SSUH - ( 0xC481 <= code && code <= 0xC49B ) || // Lo [27] HANGUL SYLLABLE SSWEOG..HANGUL SYLLABLE SSWEOH - ( 0xC49D <= code && code <= 0xC4B7 ) || // Lo [27] HANGUL SYLLABLE SSWEG..HANGUL SYLLABLE SSWEH - ( 0xC4B9 <= code && code <= 0xC4D3 ) || // Lo [27] HANGUL SYLLABLE SSWIG..HANGUL SYLLABLE SSWIH - ( 0xC4D5 <= code && code <= 0xC4EF ) || // Lo [27] HANGUL SYLLABLE SSYUG..HANGUL SYLLABLE SSYUH - ( 0xC4F1 <= code && code <= 0xC50B ) || // Lo [27] HANGUL SYLLABLE SSEUG..HANGUL SYLLABLE SSEUH - ( 0xC50D <= code && code <= 0xC527 ) || // Lo [27] HANGUL SYLLABLE SSYIG..HANGUL SYLLABLE SSYIH - ( 0xC529 <= code && code <= 0xC543 ) || // Lo [27] HANGUL SYLLABLE SSIG..HANGUL SYLLABLE SSIH - ( 0xC545 <= code && code <= 0xC55F ) || // Lo [27] HANGUL SYLLABLE AG..HANGUL SYLLABLE AH - ( 0xC561 <= code && code <= 0xC57B ) || // Lo [27] HANGUL SYLLABLE AEG..HANGUL SYLLABLE AEH - ( 0xC57D <= code && code <= 0xC597 ) || // Lo [27] HANGUL SYLLABLE YAG..HANGUL SYLLABLE YAH - ( 0xC599 <= code && code <= 0xC5B3 ) || // Lo [27] HANGUL SYLLABLE YAEG..HANGUL SYLLABLE YAEH - ( 0xC5B5 <= code && code <= 0xC5CF ) || // Lo [27] HANGUL SYLLABLE EOG..HANGUL SYLLABLE EOH - ( 0xC5D1 <= code && code <= 0xC5EB ) || // Lo [27] HANGUL SYLLABLE EG..HANGUL SYLLABLE EH - ( 0xC5ED <= code && code <= 0xC607 ) || // Lo [27] HANGUL SYLLABLE YEOG..HANGUL SYLLABLE YEOH - ( 0xC609 <= code && code <= 0xC623 ) || // Lo [27] HANGUL SYLLABLE YEG..HANGUL SYLLABLE YEH - ( 0xC625 <= code && code <= 0xC63F ) || // Lo [27] HANGUL SYLLABLE OG..HANGUL SYLLABLE OH - ( 0xC641 <= code && code <= 0xC65B ) || // Lo [27] HANGUL SYLLABLE WAG..HANGUL SYLLABLE WAH - ( 0xC65D <= code && code <= 0xC677 ) || // Lo [27] HANGUL SYLLABLE WAEG..HANGUL SYLLABLE WAEH - ( 0xC679 <= code && code <= 0xC693 ) || // Lo [27] HANGUL SYLLABLE OEG..HANGUL SYLLABLE OEH - ( 0xC695 <= code && code <= 0xC6AF ) || // Lo [27] HANGUL SYLLABLE YOG..HANGUL SYLLABLE YOH - ( 0xC6B1 <= code && code <= 0xC6CB ) || // Lo [27] HANGUL SYLLABLE UG..HANGUL SYLLABLE UH - ( 0xC6CD <= code && code <= 0xC6E7 ) || // Lo [27] HANGUL SYLLABLE WEOG..HANGUL SYLLABLE WEOH - ( 0xC6E9 <= code && code <= 0xC703 ) || // Lo [27] HANGUL SYLLABLE WEG..HANGUL SYLLABLE WEH - ( 0xC705 <= code && code <= 0xC71F ) || // Lo [27] HANGUL SYLLABLE WIG..HANGUL SYLLABLE WIH - ( 0xC721 <= code && code <= 0xC73B ) || // Lo [27] HANGUL SYLLABLE YUG..HANGUL SYLLABLE YUH - ( 0xC73D <= code && code <= 0xC757 ) || // Lo [27] HANGUL SYLLABLE EUG..HANGUL SYLLABLE EUH - ( 0xC759 <= code && code <= 0xC773 ) || // Lo [27] HANGUL SYLLABLE YIG..HANGUL SYLLABLE YIH - ( 0xC775 <= code && code <= 0xC78F ) || // Lo [27] HANGUL SYLLABLE IG..HANGUL SYLLABLE IH - ( 0xC791 <= code && code <= 0xC7AB ) || // Lo [27] HANGUL SYLLABLE JAG..HANGUL SYLLABLE JAH - ( 0xC7AD <= code && code <= 0xC7C7 ) || // Lo [27] HANGUL SYLLABLE JAEG..HANGUL SYLLABLE JAEH - ( 0xC7C9 <= code && code <= 0xC7E3 ) || // Lo [27] HANGUL SYLLABLE JYAG..HANGUL SYLLABLE JYAH - ( 0xC7E5 <= code && code <= 0xC7FF ) || // Lo [27] HANGUL SYLLABLE JYAEG..HANGUL SYLLABLE JYAEH - ( 0xC801 <= code && code <= 0xC81B ) || // Lo [27] HANGUL SYLLABLE JEOG..HANGUL SYLLABLE JEOH - ( 0xC81D <= code && code <= 0xC837 ) || // Lo [27] HANGUL SYLLABLE JEG..HANGUL SYLLABLE JEH - ( 0xC839 <= code && code <= 0xC853 ) || // Lo [27] HANGUL SYLLABLE JYEOG..HANGUL SYLLABLE JYEOH - ( 0xC855 <= code && code <= 0xC86F ) || // Lo [27] HANGUL SYLLABLE JYEG..HANGUL SYLLABLE JYEH - ( 0xC871 <= code && code <= 0xC88B ) || // Lo [27] HANGUL SYLLABLE JOG..HANGUL SYLLABLE JOH - ( 0xC88D <= code && code <= 0xC8A7 ) || // Lo [27] HANGUL SYLLABLE JWAG..HANGUL SYLLABLE JWAH - ( 0xC8A9 <= code && code <= 0xC8C3 ) || // Lo [27] HANGUL SYLLABLE JWAEG..HANGUL SYLLABLE JWAEH - ( 0xC8C5 <= code && code <= 0xC8DF ) || // Lo [27] HANGUL SYLLABLE JOEG..HANGUL SYLLABLE JOEH - ( 0xC8E1 <= code && code <= 0xC8FB ) || // Lo [27] HANGUL SYLLABLE JYOG..HANGUL SYLLABLE JYOH - ( 0xC8FD <= code && code <= 0xC917 ) || // Lo [27] HANGUL SYLLABLE JUG..HANGUL SYLLABLE JUH - ( 0xC919 <= code && code <= 0xC933 ) || // Lo [27] HANGUL SYLLABLE JWEOG..HANGUL SYLLABLE JWEOH - ( 0xC935 <= code && code <= 0xC94F ) || // Lo [27] HANGUL SYLLABLE JWEG..HANGUL SYLLABLE JWEH - ( 0xC951 <= code && code <= 0xC96B ) || // Lo [27] HANGUL SYLLABLE JWIG..HANGUL SYLLABLE JWIH - ( 0xC96D <= code && code <= 0xC987 ) || // Lo [27] HANGUL SYLLABLE JYUG..HANGUL SYLLABLE JYUH - ( 0xC989 <= code && code <= 0xC9A3 ) || // Lo [27] HANGUL SYLLABLE JEUG..HANGUL SYLLABLE JEUH - ( 0xC9A5 <= code && code <= 0xC9BF ) || // Lo [27] HANGUL SYLLABLE JYIG..HANGUL SYLLABLE JYIH - ( 0xC9C1 <= code && code <= 0xC9DB ) || // Lo [27] HANGUL SYLLABLE JIG..HANGUL SYLLABLE JIH - ( 0xC9DD <= code && code <= 0xC9F7 ) || // Lo [27] HANGUL SYLLABLE JJAG..HANGUL SYLLABLE JJAH - ( 0xC9F9 <= code && code <= 0xCA13 ) || // Lo [27] HANGUL SYLLABLE JJAEG..HANGUL SYLLABLE JJAEH - ( 0xCA15 <= code && code <= 0xCA2F ) || // Lo [27] HANGUL SYLLABLE JJYAG..HANGUL SYLLABLE JJYAH - ( 0xCA31 <= code && code <= 0xCA4B ) || // Lo [27] HANGUL SYLLABLE JJYAEG..HANGUL SYLLABLE JJYAEH - ( 0xCA4D <= code && code <= 0xCA67 ) || // Lo [27] HANGUL SYLLABLE JJEOG..HANGUL SYLLABLE JJEOH - ( 0xCA69 <= code && code <= 0xCA83 ) || // Lo [27] HANGUL SYLLABLE JJEG..HANGUL SYLLABLE JJEH - ( 0xCA85 <= code && code <= 0xCA9F ) || // Lo [27] HANGUL SYLLABLE JJYEOG..HANGUL SYLLABLE JJYEOH - ( 0xCAA1 <= code && code <= 0xCABB ) || // Lo [27] HANGUL SYLLABLE JJYEG..HANGUL SYLLABLE JJYEH - ( 0xCABD <= code && code <= 0xCAD7 ) || // Lo [27] HANGUL SYLLABLE JJOG..HANGUL SYLLABLE JJOH - ( 0xCAD9 <= code && code <= 0xCAF3 ) || // Lo [27] HANGUL SYLLABLE JJWAG..HANGUL SYLLABLE JJWAH - ( 0xCAF5 <= code && code <= 0xCB0F ) || // Lo [27] HANGUL SYLLABLE JJWAEG..HANGUL SYLLABLE JJWAEH - ( 0xCB11 <= code && code <= 0xCB2B ) || // Lo [27] HANGUL SYLLABLE JJOEG..HANGUL SYLLABLE JJOEH - ( 0xCB2D <= code && code <= 0xCB47 ) || // Lo [27] HANGUL SYLLABLE JJYOG..HANGUL SYLLABLE JJYOH - ( 0xCB49 <= code && code <= 0xCB63 ) || // Lo [27] HANGUL SYLLABLE JJUG..HANGUL SYLLABLE JJUH - ( 0xCB65 <= code && code <= 0xCB7F ) || // Lo [27] HANGUL SYLLABLE JJWEOG..HANGUL SYLLABLE JJWEOH - ( 0xCB81 <= code && code <= 0xCB9B ) || // Lo [27] HANGUL SYLLABLE JJWEG..HANGUL SYLLABLE JJWEH - ( 0xCB9D <= code && code <= 0xCBB7 ) || // Lo [27] HANGUL SYLLABLE JJWIG..HANGUL SYLLABLE JJWIH - ( 0xCBB9 <= code && code <= 0xCBD3 ) || // Lo [27] HANGUL SYLLABLE JJYUG..HANGUL SYLLABLE JJYUH - ( 0xCBD5 <= code && code <= 0xCBEF ) || // Lo [27] HANGUL SYLLABLE JJEUG..HANGUL SYLLABLE JJEUH - ( 0xCBF1 <= code && code <= 0xCC0B ) || // Lo [27] HANGUL SYLLABLE JJYIG..HANGUL SYLLABLE JJYIH - ( 0xCC0D <= code && code <= 0xCC27 ) || // Lo [27] HANGUL SYLLABLE JJIG..HANGUL SYLLABLE JJIH - ( 0xCC29 <= code && code <= 0xCC43 ) || // Lo [27] HANGUL SYLLABLE CAG..HANGUL SYLLABLE CAH - ( 0xCC45 <= code && code <= 0xCC5F ) || // Lo [27] HANGUL SYLLABLE CAEG..HANGUL SYLLABLE CAEH - ( 0xCC61 <= code && code <= 0xCC7B ) || // Lo [27] HANGUL SYLLABLE CYAG..HANGUL SYLLABLE CYAH - ( 0xCC7D <= code && code <= 0xCC97 ) || // Lo [27] HANGUL SYLLABLE CYAEG..HANGUL SYLLABLE CYAEH - ( 0xCC99 <= code && code <= 0xCCB3 ) || // Lo [27] HANGUL SYLLABLE CEOG..HANGUL SYLLABLE CEOH - ( 0xCCB5 <= code && code <= 0xCCCF ) || // Lo [27] HANGUL SYLLABLE CEG..HANGUL SYLLABLE CEH - ( 0xCCD1 <= code && code <= 0xCCEB ) || // Lo [27] HANGUL SYLLABLE CYEOG..HANGUL SYLLABLE CYEOH - ( 0xCCED <= code && code <= 0xCD07 ) || // Lo [27] HANGUL SYLLABLE CYEG..HANGUL SYLLABLE CYEH - ( 0xCD09 <= code && code <= 0xCD23 ) || // Lo [27] HANGUL SYLLABLE COG..HANGUL SYLLABLE COH - ( 0xCD25 <= code && code <= 0xCD3F ) || // Lo [27] HANGUL SYLLABLE CWAG..HANGUL SYLLABLE CWAH - ( 0xCD41 <= code && code <= 0xCD5B ) || // Lo [27] HANGUL SYLLABLE CWAEG..HANGUL SYLLABLE CWAEH - ( 0xCD5D <= code && code <= 0xCD77 ) || // Lo [27] HANGUL SYLLABLE COEG..HANGUL SYLLABLE COEH - ( 0xCD79 <= code && code <= 0xCD93 ) || // Lo [27] HANGUL SYLLABLE CYOG..HANGUL SYLLABLE CYOH - ( 0xCD95 <= code && code <= 0xCDAF ) || // Lo [27] HANGUL SYLLABLE CUG..HANGUL SYLLABLE CUH - ( 0xCDB1 <= code && code <= 0xCDCB ) || // Lo [27] HANGUL SYLLABLE CWEOG..HANGUL SYLLABLE CWEOH - ( 0xCDCD <= code && code <= 0xCDE7 ) || // Lo [27] HANGUL SYLLABLE CWEG..HANGUL SYLLABLE CWEH - ( 0xCDE9 <= code && code <= 0xCE03 ) || // Lo [27] HANGUL SYLLABLE CWIG..HANGUL SYLLABLE CWIH - ( 0xCE05 <= code && code <= 0xCE1F ) || // Lo [27] HANGUL SYLLABLE CYUG..HANGUL SYLLABLE CYUH - ( 0xCE21 <= code && code <= 0xCE3B ) || // Lo [27] HANGUL SYLLABLE CEUG..HANGUL SYLLABLE CEUH - ( 0xCE3D <= code && code <= 0xCE57 ) || // Lo [27] HANGUL SYLLABLE CYIG..HANGUL SYLLABLE CYIH - ( 0xCE59 <= code && code <= 0xCE73 ) || // Lo [27] HANGUL SYLLABLE CIG..HANGUL SYLLABLE CIH - ( 0xCE75 <= code && code <= 0xCE8F ) || // Lo [27] HANGUL SYLLABLE KAG..HANGUL SYLLABLE KAH - ( 0xCE91 <= code && code <= 0xCEAB ) || // Lo [27] HANGUL SYLLABLE KAEG..HANGUL SYLLABLE KAEH - ( 0xCEAD <= code && code <= 0xCEC7 ) || // Lo [27] HANGUL SYLLABLE KYAG..HANGUL SYLLABLE KYAH - ( 0xCEC9 <= code && code <= 0xCEE3 ) || // Lo [27] HANGUL SYLLABLE KYAEG..HANGUL SYLLABLE KYAEH - ( 0xCEE5 <= code && code <= 0xCEFF ) || // Lo [27] HANGUL SYLLABLE KEOG..HANGUL SYLLABLE KEOH - ( 0xCF01 <= code && code <= 0xCF1B ) || // Lo [27] HANGUL SYLLABLE KEG..HANGUL SYLLABLE KEH - ( 0xCF1D <= code && code <= 0xCF37 ) || // Lo [27] HANGUL SYLLABLE KYEOG..HANGUL SYLLABLE KYEOH - ( 0xCF39 <= code && code <= 0xCF53 ) || // Lo [27] HANGUL SYLLABLE KYEG..HANGUL SYLLABLE KYEH - ( 0xCF55 <= code && code <= 0xCF6F ) || // Lo [27] HANGUL SYLLABLE KOG..HANGUL SYLLABLE KOH - ( 0xCF71 <= code && code <= 0xCF8B ) || // Lo [27] HANGUL SYLLABLE KWAG..HANGUL SYLLABLE KWAH - ( 0xCF8D <= code && code <= 0xCFA7 ) || // Lo [27] HANGUL SYLLABLE KWAEG..HANGUL SYLLABLE KWAEH - ( 0xCFA9 <= code && code <= 0xCFC3 ) || // Lo [27] HANGUL SYLLABLE KOEG..HANGUL SYLLABLE KOEH - ( 0xCFC5 <= code && code <= 0xCFDF ) || // Lo [27] HANGUL SYLLABLE KYOG..HANGUL SYLLABLE KYOH - ( 0xCFE1 <= code && code <= 0xCFFB ) || // Lo [27] HANGUL SYLLABLE KUG..HANGUL SYLLABLE KUH - ( 0xCFFD <= code && code <= 0xD017 ) || // Lo [27] HANGUL SYLLABLE KWEOG..HANGUL SYLLABLE KWEOH - ( 0xD019 <= code && code <= 0xD033 ) || // Lo [27] HANGUL SYLLABLE KWEG..HANGUL SYLLABLE KWEH - ( 0xD035 <= code && code <= 0xD04F ) || // Lo [27] HANGUL SYLLABLE KWIG..HANGUL SYLLABLE KWIH - ( 0xD051 <= code && code <= 0xD06B ) || // Lo [27] HANGUL SYLLABLE KYUG..HANGUL SYLLABLE KYUH - ( 0xD06D <= code && code <= 0xD087 ) || // Lo [27] HANGUL SYLLABLE KEUG..HANGUL SYLLABLE KEUH - ( 0xD089 <= code && code <= 0xD0A3 ) || // Lo [27] HANGUL SYLLABLE KYIG..HANGUL SYLLABLE KYIH - ( 0xD0A5 <= code && code <= 0xD0BF ) || // Lo [27] HANGUL SYLLABLE KIG..HANGUL SYLLABLE KIH - ( 0xD0C1 <= code && code <= 0xD0DB ) || // Lo [27] HANGUL SYLLABLE TAG..HANGUL SYLLABLE TAH - ( 0xD0DD <= code && code <= 0xD0F7 ) || // Lo [27] HANGUL SYLLABLE TAEG..HANGUL SYLLABLE TAEH - ( 0xD0F9 <= code && code <= 0xD113 ) || // Lo [27] HANGUL SYLLABLE TYAG..HANGUL SYLLABLE TYAH - ( 0xD115 <= code && code <= 0xD12F ) || // Lo [27] HANGUL SYLLABLE TYAEG..HANGUL SYLLABLE TYAEH - ( 0xD131 <= code && code <= 0xD14B ) || // Lo [27] HANGUL SYLLABLE TEOG..HANGUL SYLLABLE TEOH - ( 0xD14D <= code && code <= 0xD167 ) || // Lo [27] HANGUL SYLLABLE TEG..HANGUL SYLLABLE TEH - ( 0xD169 <= code && code <= 0xD183 ) || // Lo [27] HANGUL SYLLABLE TYEOG..HANGUL SYLLABLE TYEOH - ( 0xD185 <= code && code <= 0xD19F ) || // Lo [27] HANGUL SYLLABLE TYEG..HANGUL SYLLABLE TYEH - ( 0xD1A1 <= code && code <= 0xD1BB ) || // Lo [27] HANGUL SYLLABLE TOG..HANGUL SYLLABLE TOH - ( 0xD1BD <= code && code <= 0xD1D7 ) || // Lo [27] HANGUL SYLLABLE TWAG..HANGUL SYLLABLE TWAH - ( 0xD1D9 <= code && code <= 0xD1F3 ) || // Lo [27] HANGUL SYLLABLE TWAEG..HANGUL SYLLABLE TWAEH - ( 0xD1F5 <= code && code <= 0xD20F ) || // Lo [27] HANGUL SYLLABLE TOEG..HANGUL SYLLABLE TOEH - ( 0xD211 <= code && code <= 0xD22B ) || // Lo [27] HANGUL SYLLABLE TYOG..HANGUL SYLLABLE TYOH - ( 0xD22D <= code && code <= 0xD247 ) || // Lo [27] HANGUL SYLLABLE TUG..HANGUL SYLLABLE TUH - ( 0xD249 <= code && code <= 0xD263 ) || // Lo [27] HANGUL SYLLABLE TWEOG..HANGUL SYLLABLE TWEOH - ( 0xD265 <= code && code <= 0xD27F ) || // Lo [27] HANGUL SYLLABLE TWEG..HANGUL SYLLABLE TWEH - ( 0xD281 <= code && code <= 0xD29B ) || // Lo [27] HANGUL SYLLABLE TWIG..HANGUL SYLLABLE TWIH - ( 0xD29D <= code && code <= 0xD2B7 ) || // Lo [27] HANGUL SYLLABLE TYUG..HANGUL SYLLABLE TYUH - ( 0xD2B9 <= code && code <= 0xD2D3 ) || // Lo [27] HANGUL SYLLABLE TEUG..HANGUL SYLLABLE TEUH - ( 0xD2D5 <= code && code <= 0xD2EF ) || // Lo [27] HANGUL SYLLABLE TYIG..HANGUL SYLLABLE TYIH - ( 0xD2F1 <= code && code <= 0xD30B ) || // Lo [27] HANGUL SYLLABLE TIG..HANGUL SYLLABLE TIH - ( 0xD30D <= code && code <= 0xD327 ) || // Lo [27] HANGUL SYLLABLE PAG..HANGUL SYLLABLE PAH - ( 0xD329 <= code && code <= 0xD343 ) || // Lo [27] HANGUL SYLLABLE PAEG..HANGUL SYLLABLE PAEH - ( 0xD345 <= code && code <= 0xD35F ) || // Lo [27] HANGUL SYLLABLE PYAG..HANGUL SYLLABLE PYAH - ( 0xD361 <= code && code <= 0xD37B ) || // Lo [27] HANGUL SYLLABLE PYAEG..HANGUL SYLLABLE PYAEH - ( 0xD37D <= code && code <= 0xD397 ) || // Lo [27] HANGUL SYLLABLE PEOG..HANGUL SYLLABLE PEOH - ( 0xD399 <= code && code <= 0xD3B3 ) || // Lo [27] HANGUL SYLLABLE PEG..HANGUL SYLLABLE PEH - ( 0xD3B5 <= code && code <= 0xD3CF ) || // Lo [27] HANGUL SYLLABLE PYEOG..HANGUL SYLLABLE PYEOH - ( 0xD3D1 <= code && code <= 0xD3EB ) || // Lo [27] HANGUL SYLLABLE PYEG..HANGUL SYLLABLE PYEH - ( 0xD3ED <= code && code <= 0xD407 ) || // Lo [27] HANGUL SYLLABLE POG..HANGUL SYLLABLE POH - ( 0xD409 <= code && code <= 0xD423 ) || // Lo [27] HANGUL SYLLABLE PWAG..HANGUL SYLLABLE PWAH - ( 0xD425 <= code && code <= 0xD43F ) || // Lo [27] HANGUL SYLLABLE PWAEG..HANGUL SYLLABLE PWAEH - ( 0xD441 <= code && code <= 0xD45B ) || // Lo [27] HANGUL SYLLABLE POEG..HANGUL SYLLABLE POEH - ( 0xD45D <= code && code <= 0xD477 ) || // Lo [27] HANGUL SYLLABLE PYOG..HANGUL SYLLABLE PYOH - ( 0xD479 <= code && code <= 0xD493 ) || // Lo [27] HANGUL SYLLABLE PUG..HANGUL SYLLABLE PUH - ( 0xD495 <= code && code <= 0xD4AF ) || // Lo [27] HANGUL SYLLABLE PWEOG..HANGUL SYLLABLE PWEOH - ( 0xD4B1 <= code && code <= 0xD4CB ) || // Lo [27] HANGUL SYLLABLE PWEG..HANGUL SYLLABLE PWEH - ( 0xD4CD <= code && code <= 0xD4E7 ) || // Lo [27] HANGUL SYLLABLE PWIG..HANGUL SYLLABLE PWIH - ( 0xD4E9 <= code && code <= 0xD503 ) || // Lo [27] HANGUL SYLLABLE PYUG..HANGUL SYLLABLE PYUH - ( 0xD505 <= code && code <= 0xD51F ) || // Lo [27] HANGUL SYLLABLE PEUG..HANGUL SYLLABLE PEUH - ( 0xD521 <= code && code <= 0xD53B ) || // Lo [27] HANGUL SYLLABLE PYIG..HANGUL SYLLABLE PYIH - ( 0xD53D <= code && code <= 0xD557 ) || // Lo [27] HANGUL SYLLABLE PIG..HANGUL SYLLABLE PIH - ( 0xD559 <= code && code <= 0xD573 ) || // Lo [27] HANGUL SYLLABLE HAG..HANGUL SYLLABLE HAH - ( 0xD575 <= code && code <= 0xD58F ) || // Lo [27] HANGUL SYLLABLE HAEG..HANGUL SYLLABLE HAEH - ( 0xD591 <= code && code <= 0xD5AB ) || // Lo [27] HANGUL SYLLABLE HYAG..HANGUL SYLLABLE HYAH - ( 0xD5AD <= code && code <= 0xD5C7 ) || // Lo [27] HANGUL SYLLABLE HYAEG..HANGUL SYLLABLE HYAEH - ( 0xD5C9 <= code && code <= 0xD5E3 ) || // Lo [27] HANGUL SYLLABLE HEOG..HANGUL SYLLABLE HEOH - ( 0xD5E5 <= code && code <= 0xD5FF ) || // Lo [27] HANGUL SYLLABLE HEG..HANGUL SYLLABLE HEH - ( 0xD601 <= code && code <= 0xD61B ) || // Lo [27] HANGUL SYLLABLE HYEOG..HANGUL SYLLABLE HYEOH - ( 0xD61D <= code && code <= 0xD637 ) || // Lo [27] HANGUL SYLLABLE HYEG..HANGUL SYLLABLE HYEH - ( 0xD639 <= code && code <= 0xD653 ) || // Lo [27] HANGUL SYLLABLE HOG..HANGUL SYLLABLE HOH - ( 0xD655 <= code && code <= 0xD66F ) || // Lo [27] HANGUL SYLLABLE HWAG..HANGUL SYLLABLE HWAH - ( 0xD671 <= code && code <= 0xD68B ) || // Lo [27] HANGUL SYLLABLE HWAEG..HANGUL SYLLABLE HWAEH - ( 0xD68D <= code && code <= 0xD6A7 ) || // Lo [27] HANGUL SYLLABLE HOEG..HANGUL SYLLABLE HOEH - ( 0xD6A9 <= code && code <= 0xD6C3 ) || // Lo [27] HANGUL SYLLABLE HYOG..HANGUL SYLLABLE HYOH - ( 0xD6C5 <= code && code <= 0xD6DF ) || // Lo [27] HANGUL SYLLABLE HUG..HANGUL SYLLABLE HUH - ( 0xD6E1 <= code && code <= 0xD6FB ) || // Lo [27] HANGUL SYLLABLE HWEOG..HANGUL SYLLABLE HWEOH - ( 0xD6FD <= code && code <= 0xD717 ) || // Lo [27] HANGUL SYLLABLE HWEG..HANGUL SYLLABLE HWEH - ( 0xD719 <= code && code <= 0xD733 ) || // Lo [27] HANGUL SYLLABLE HWIG..HANGUL SYLLABLE HWIH - ( 0xD735 <= code && code <= 0xD74F ) || // Lo [27] HANGUL SYLLABLE HYUG..HANGUL SYLLABLE HYUH - ( 0xD751 <= code && code <= 0xD76B ) || // Lo [27] HANGUL SYLLABLE HEUG..HANGUL SYLLABLE HEUH - ( 0xD76D <= code && code <= 0xD787 ) || // Lo [27] HANGUL SYLLABLE HYIG..HANGUL SYLLABLE HYIH - ( 0xD789 <= code && code <= 0xD7A3 ) // Lo [27] HANGUL SYLLABLE HIG..HANGUL SYLLABLE HIH - ) { - return constants.LVT; - } - if ( - code === 0x200D // Cf ZERO WIDTH JOINER - ) { - return constants.ZWJ; - } - // All unlisted characters have a grapheme break property of "Other": - return constants.Other; -} - - -// EXPORTS // - -module.exports = graphemeBreakProperty; diff --git a/tools/grapheme-cluster-break/lib/break_type.js b/tools/grapheme-cluster-break/lib/break_type.js deleted file mode 100644 index 3a3441e8..00000000 --- a/tools/grapheme-cluster-break/lib/break_type.js +++ /dev/null @@ -1,261 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var constants = require( './constants.js' ); - - -// FUNCTIONS // - -/** -* Returns number of elements in array equal to a provided value. -* -* @private -* @param {Array} arr - input array -* @param {NonNegativeInteger} start - starting search index (inclusive) -* @param {NonNegativeInteger} end - ending search index (inclusive) -* @param {*} value - input value -* @returns {NonNegativeInteger} number of elements in array equal to a provided value -*/ -function count( arr, start, end, value ) { - var cnt; - var i; - - if ( end >= arr.length ) { - end = arr.length - 1; - } - cnt = 0; - for ( i = start; i <= end; i++ ) { - if ( arr[ i ] === value ) { - cnt += 1; - } - } - return cnt; -} - -/** -* Returns whether every indexed array element is equal to a provided value. -* -* @private -* @param {Array} arr - input array -* @param {NonNegativeInteger} start - starting search index (inclusive) -* @param {NonNegativeInteger} end - ending search index (inclusive) -* @param {*} value - search value -* @returns {boolean} boolean indicating whether all the values in array in the given range are equal to the provided value -*/ -function every( arr, start, end, value ) { - var i; - - if ( end >= arr.length ) { - end = arr.length - 1; - } - for ( i = start; i <= end; i++ ) { - if ( arr[ i ] !== value ) { - return false; - } - } - return true; -} - -/** -* Returns the index of the first occurrence of a value in a provided array. -* -* @private -* @param {Array} arr - input array -* @param {NonNegativeInteger} start - starting search index (inclusive) -* @param {NonNegativeInteger} end - ending search index (inclusive) -* @param {*} value - search value -* @returns {integer} index of the first occurrence -*/ -function indexOf( arr, start, end, value ) { - var i; - - if ( end >= arr.length ) { - end = arr.length - 1; - } - for ( i = start; i <= end; i++ ) { - if ( arr[ i ] === value ) { - return i; - } - } - return -1; -} - -/** -* Returns the index of the last occurrence of a value in a provided array. -* -* @private -* @param {Array} arr - input array -* @param {NonNegativeInteger} start - starting search index at which to start searching backwards (inclusive) -* @param {NonNegativeInteger} end - ending search index (inclusive) -* @param {*} value - search value -* @returns {integer} index of the last occurrence -*/ -function lastIndexOf( arr, start, end, value ) { - var i; - - if ( start >= arr.length-1 ) { - start = arr.length - 1; - } - for ( i = start; i >= end; i-- ) { - if ( arr[ i ] === value ) { - return i; - } - } - return -1; -} - - -// MAIN // - -/** -* Returns the break type between grapheme breaking classes according to _UAX #29 3.1.1 Grapheme Cluster Boundary Rules_ on extended grapheme clusters. -* -* @private -* @param {Array} breaks - list of grapheme break properties -* @param {Array} emoji - list of emoji properties -* @returns {NonNegativeInteger} break type -* -* @example -* var out = breakType( [ 11, 3, 11 ], [ 11, 11, 11 ] ); -* // returns 1 -*/ -function breakType( breaks, emoji ) { - var nextEmoji; - var next; - var prev; - var idx; - var N; - var M; - - N = breaks.length; - M = N - 1; - - prev = breaks[ M-1 ]; - next = breaks[ M ]; - nextEmoji = emoji[ M ]; - - idx = lastIndexOf( breaks, M, 0, constants.RegionalIndicator ); - if ( - idx > 0 && - prev !== constants.Prepend && - prev !== constants.RegionalIndicator && - every( breaks, 1, idx-1, constants.RegionalIndicator ) - ) { - if ( count( breaks, 0, M, constants.RegionalIndicator ) % 2 === 1 ) { - return constants.BreakLastRegional; - } - return constants.BreakPenultimateRegional; - } - // GB3: CR × LF - if ( - prev === constants.CR && - next === constants.LF - ) { - return constants.NotBreak; - } - // GB4: (Control|CR|LF) ÷ - if ( - prev === constants.Control || - prev === constants.CR || - prev === constants.LF - ) { - return constants.BreakStart; - } - // GB5: ÷ (Control|CR|LF) - if ( - next === constants.Control || - next === constants.CR || - next === constants.LF - ) { - return constants.BreakStart; - } - // GB6: L × (L|V|LV|LVT) - if ( - prev === constants.L && - ( - next === constants.L || - next === constants.V || - next === constants.LV || - next === constants.LVT - ) - ) { - return constants.NotBreak; - } - // GB7: (LV|V) × (V|T) - if ( - ( prev === constants.LV || prev === constants.V ) && - ( next === constants.V || next === constants.T ) - ) { - return constants.NotBreak; - } - // GB8: (LVT|T) × (T) - if ( - ( prev === constants.LVT || prev === constants.T ) && - next === constants.T - ) { - return constants.NotBreak; - } - // GB9: × (Extend|ZWJ) - if ( - next === constants.Extend || - next === constants.ZWJ - ) { - return constants.NotBreak; - } - // GB9a: × SpacingMark - if ( next === constants.SpacingMark ) { - return constants.NotBreak; - } - // GB9b: Prepend × - if ( prev === constants.Prepend ) { - return constants.NotBreak; - } - // GB11: \p{Extended_Pictographic} Extend* ZWJ × \p{Extended_Pictographic} - idx = lastIndexOf( emoji, M-1, 0, constants.ExtendedPictographic ); - if ( - idx >= 0 && - prev === constants.ZWJ && - nextEmoji === constants.ExtendedPictographic && - emoji[ idx ] === constants.ExtendedPictographic && - every( breaks, idx+1, M-2, constants.Extend ) - ) { - return constants.NotBreak; - } - // GB12: ^ (RI RI)* RI × RI - // GB13: [^RI] (RI RI)* RI × RI - if ( indexOf( breaks, 1, M-1, constants.RegionalIndicator ) >= 0 ) { - return constants.Break; - } - if ( - prev === constants.RegionalIndicator && - next === constants.RegionalIndicator - ) { - return constants.NotBreak; - } - // GB999: Any ? Any - return constants.BreakStart; -} - - -// EXPORTS // - -module.exports = breakType; diff --git a/tools/grapheme-cluster-break/lib/constants.js b/tools/grapheme-cluster-break/lib/constants.js deleted file mode 100644 index fc529e2a..00000000 --- a/tools/grapheme-cluster-break/lib/constants.js +++ /dev/null @@ -1,49 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MAIN // - -var consts = { - 'CR': 0, - 'LF': 1, - 'Control': 2, - 'Extend': 3, - 'RegionalIndicator': 4, - 'SpacingMark': 5, - 'L': 6, - 'V': 7, - 'T': 8, - 'LV': 9, - 'LVT': 10, - 'Other': 11, - 'Prepend': 12, - 'ZWJ': 13, - 'NotBreak': 0, - 'BreakStart': 1, - 'Break': 2, - 'BreakLastRegional': 3, - 'BreakPenultimateRegional': 4, - 'ExtendedPictographic': 101 -}; - - -// EXPORTS // - -module.exports = consts; diff --git a/tools/grapheme-cluster-break/lib/emoji_property.js b/tools/grapheme-cluster-break/lib/emoji_property.js deleted file mode 100644 index 3af11b17..00000000 --- a/tools/grapheme-cluster-break/lib/emoji_property.js +++ /dev/null @@ -1,549 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 @cspell/spellchecker, max-lines-per-function, max-lines */ - -'use strict'; - -// MODULES // - -var constants = require( './constants.js' ); - - -// MAIN // - -/** -* Returns the emoji property from the [Unicode Standard][1]. -* -* [1]: https://www.unicode.org/Public/13.0.0/ucd/emoji/emoji-data.txt -* -* @private -* @param {NonNegativeInteger} code - Unicode code point -* @returns {NonNegativeInteger} emoji property -* -* @example -* var out = emojiProperty( 0x23EC ); -* // returns 101 -* -* @example -* var out = emojiProperty( 0x1FFFE ); -* // returns 11 -*/ -function emojiProperty( code ) { - if ( - code === 0x00A9 || // E0.6 [1] (©️) copyright - code === 0x00AE || // E0.6 [1] (®️) registered - code === 0x203C || // E0.6 [1] (‼️) double exclamation mark - code === 0x2049 || // E0.6 [1] (⁉️) exclamation question mark - code === 0x2122 || // E0.6 [1] (™️) trade mark - code === 0x2139 || // E0.6 [1] (ℹ️) information - ( 0x2194 <= code && code <= 0x2199 ) || // E0.6 [6] (↔️..↙️) left-right arrow..down-left arrow - ( 0x21A9 <= code && code <= 0x21AA ) || // E0.6 [2] (↩️..↪️) right arrow curving left..left arrow curving right - ( 0x231A <= code && code <= 0x231B ) || // E0.6 [2] (⌚..⌛) watch..hourglass done - code === 0x2328 || // E1.0 [1] (⌨️) keyboard - code === 0x2388 || // E0.0 [1] (⎈) HELM SYMBOL - code === 0x23CF || // E1.0 [1] (⏏️) eject button - ( 0x23E9 <= code && code <= 0x23EC ) || // E0.6 [4] (⏩..⏬) fast-forward button..fast down button - ( 0x23ED <= code && code <= 0x23EE ) || // E0.7 [2] (⏭️..⏮️) next track button..last track button - code === 0x23EF || // E1.0 [1] (⏯️) play or pause button - code === 0x23F0 || // E0.6 [1] (⏰) alarm clock - ( 0x23F1 <= code && code <= 0x23F2 ) || // E1.0 [2] (⏱️..⏲️) stopwatch..timer clock - code === 0x23F3 || // E0.6 [1] (⏳) hourglass not done - ( 0x23F8 <= code && code <= 0x23FA ) || // E0.7 [3] (⏸️..⏺️) pause button..record button - code === 0x24C2 || // E0.6 [1] (Ⓜ️) circled M - ( 0x25AA <= code && code <= 0x25AB ) || // E0.6 [2] (▪️..▫️) black small square..white small square - code === 0x25B6 || // E0.6 [1] (▶️) play button - code === 0x25C0 || // E0.6 [1] (◀️) reverse button - ( 0x25FB <= code && code <= 0x25FE ) || // E0.6 [4] (◻️..◾) white medium square..black medium-small square - ( 0x2600 <= code && code <= 0x2601 ) || // E0.6 [2] (☀️..☁️) sun..cloud - ( 0x2602 <= code && code <= 0x2603 ) || // E0.7 [2] (☂️..☃️) umbrella..snowman - code === 0x2604 || // E1.0 [1] (☄️) comet - code === 0x2605 || // E0.0 [1] (★) BLACK STAR - ( 0x2607 <= code && code <= 0x260D ) || // E0.0 [7] (☇..☍) LIGHTNING..OPPOSITION - code === 0x260E || // E0.6 [1] (☎️) telephone - ( 0x260F <= code && code <= 0x2610 ) || // E0.0 [2] (☏..☐) WHITE TELEPHONE..BALLOT BOX - code === 0x2611 || // E0.6 [1] (☑️) check box with check - code === 0x2612 || // E0.0 [1] (☒) BALLOT BOX WITH X - ( 0x2614 <= code && code <= 0x2615 ) || // E0.6 [2] (☔..☕) umbrella with rain drops..hot beverage - ( 0x2616 <= code && code <= 0x2617 ) || // E0.0 [2] (☖..☗) WHITE SHOGI PIECE..BLACK SHOGI PIECE - code === 0x2618 || // E1.0 [1] (☘️) shamrock - ( 0x2619 <= code && code <= 0x261C ) || // E0.0 [4] (☙..☜) REVERSED ROTATED FLORAL HEART BULLET..WHITE LEFT POINTING INDEX - code === 0x261D || // E0.6 [1] (☝️) index pointing up - ( 0x261E <= code && code <= 0x261F ) || // E0.0 [2] (☞..☟) WHITE RIGHT POINTING INDEX..WHITE DOWN POINTING INDEX - code === 0x2620 || // E1.0 [1] (☠️) skull and crossbones - code === 0x2621 || // E0.0 [1] (☡) CAUTION SIGN - ( 0x2622 <= code && code <= 0x2623 ) || // E1.0 [2] (☢️..☣️) radioactive..biohazard - ( 0x2624 <= code && code <= 0x2625 ) || // E0.0 [2] (☤..☥) CADUCEUS..ANKH - code === 0x2626 || // E1.0 [1] (☦️) orthodox cross - ( 0x2627 <= code && code <= 0x2629 ) || // E0.0 [3] (☧..☩) CHI RHO..CROSS OF JERUSALEM - code === 0x262A || // E0.7 [1] (☪️) star and crescent - ( 0x262B <= code && code <= 0x262D ) || // E0.0 [3] (☫..☭) FARSI SYMBOL..HAMMER AND SICKLE - code === 0x262E || // E1.0 [1] (☮️) peace symbol - code === 0x262F || // E0.7 [1] (☯️) yin yang - ( 0x2630 <= code && code <= 0x2637 ) || // E0.0 [8] (☰..☷) TRIGRAM FOR HEAVEN..TRIGRAM FOR EARTH - ( 0x2638 <= code && code <= 0x2639 ) || // E0.7 [2] (☸️..☹️) wheel of dharma..frowning face - code === 0x263A || // E0.6 [1] (☺️) smiling face - ( 0x263B <= code && code <= 0x263F ) || // E0.0 [5] (☻..☿) BLACK SMILING FACE..MERCURY - code === 0x2640 || // E4.0 [1] (♀️) female sign - code === 0x2641 || // E0.0 [1] (♁) EARTH - code === 0x2642 || // E4.0 [1] (♂️) male sign - ( 0x2643 <= code && code <= 0x2647 ) || // E0.0 [5] (♃..♇) JUPITER..PLUTO - ( 0x2648 <= code && code <= 0x2653 ) || // E0.6 [12] (♈..♓) Aries..Pisces - ( 0x2654 <= code && code <= 0x265E ) || // E0.0 [11] (♔..♞) WHITE CHESS KING..BLACK CHESS KNIGHT - code === 0x265F || // E11.0 [1] (♟️) chess pawn - code === 0x2660 || // E0.6 [1] (♠️) spade suit - ( 0x2661 <= code && code <= 0x2662 ) || // E0.0 [2] (♡..♢) WHITE HEART SUIT..WHITE DIAMOND SUIT - code === 0x2663 || // E0.6 [1] (♣️) club suit - code === 0x2664 || // E0.0 [1] (♤) WHITE SPADE SUIT - ( 0x2665 <= code && code <= 0x2666 ) || // E0.6 [2] (♥️..♦️) heart suit..diamond suit - code === 0x2667 || // E0.0 [1] (♧) WHITE CLUB SUIT - code === 0x2668 || // E0.6 [1] (♨️) hot springs - ( 0x2669 <= code && code <= 0x267A ) || // E0.0 [18] (♩..♺) QUARTER NOTE..RECYCLING SYMBOL FOR GENERIC MATERIALS - code === 0x267B || // E0.6 [1] (♻️) recycling symbol - ( 0x267C <= code && code <= 0x267D ) || // E0.0 [2] (♼..♽) RECYCLED PAPER SYMBOL..PARTIALLY-RECYCLED PAPER SYMBOL - code === 0x267E || // E11.0 [1] (♾️) infinity - code === 0x267F || // E0.6 [1] (♿) wheelchair symbol - ( 0x2680 <= code && code <= 0x2685 ) || // E0.0 [6] (⚀..⚅) DIE FACE-1..DIE FACE-6 - ( 0x2690 <= code && code <= 0x2691 ) || // E0.0 [2] (⚐..⚑) WHITE FLAG..BLACK FLAG - code === 0x2692 || // E1.0 [1] (⚒️) hammer and pick - code === 0x2693 || // E0.6 [1] (⚓) anchor - code === 0x2694 || // E1.0 [1] (⚔️) crossed swords - code === 0x2695 || // E4.0 [1] (⚕️) medical symbol - ( 0x2696 <= code && code <= 0x2697 ) || // E1.0 [2] (⚖️..⚗️) balance scale..alembic - code === 0x2698 || // E0.0 [1] (⚘) FLOWER - code === 0x2699 || // E1.0 [1] (⚙️) gear - code === 0x269A || // E0.0 [1] (⚚) STAFF OF HERMES - ( 0x269B <= code && code <= 0x269C ) || // E1.0 [2] (⚛️..⚜️) atom symbol..fleur-de-lis - ( 0x269D <= code && code <= 0x269F ) || // E0.0 [3] (⚝..⚟) OUTLINED WHITE STAR..THREE LINES CONVERGING LEFT - ( 0x26A0 <= code && code <= 0x26A1 ) || // E0.6 [2] (⚠️..⚡) warning..high voltage - ( 0x26A2 <= code && code <= 0x26A6 ) || // E0.0 [5] (⚢..⚦) DOUBLED FEMALE SIGN..MALE WITH STROKE SIGN - code === 0x26A7 || // E13.0 [1] (⚧️) transgender symbol - ( 0x26A8 <= code && code <= 0x26A9 ) || // E0.0 [2] (⚨..⚩) VERTICAL MALE WITH STROKE SIGN..HORIZONTAL MALE WITH STROKE SIGN - ( 0x26AA <= code && code <= 0x26AB ) || // E0.6 [2] (⚪..⚫) white circle..black circle - ( 0x26AC <= code && code <= 0x26AF ) || // E0.0 [4] (⚬..⚯) MEDIUM SMALL WHITE CIRCLE..UNMARRIED PARTNERSHIP SYMBOL - ( 0x26B0 <= code && code <= 0x26B1 ) || // E1.0 [2] (⚰️..⚱️) coffin..funeral urn - ( 0x26B2 <= code && code <= 0x26BC ) || // E0.0 [11] (⚲..⚼) NEUTER..SESQUIQUADRATE - ( 0x26BD <= code && code <= 0x26BE ) || // E0.6 [2] (⚽..⚾) soccer ball..baseball - ( 0x26BF <= code && code <= 0x26C3 ) || // E0.0 [5] (⚿..⛃) SQUARED KEY..BLACK DRAUGHTS KING - ( 0x26C4 <= code && code <= 0x26C5 ) || // E0.6 [2] (⛄..⛅) snowman without snow..sun behind cloud - ( 0x26C6 <= code && code <= 0x26C7 ) || // E0.0 [2] (⛆..⛇) RAIN..BLACK SNOWMAN - code === 0x26C8 || // E0.7 [1] (⛈️) cloud with lightning and rain - ( 0x26C9 <= code && code <= 0x26CD ) || // E0.0 [5] (⛉..⛍) TURNED WHITE SHOGI PIECE..DISABLED CAR - code === 0x26CE || // E0.6 [1] (⛎) Ophiuchus - code === 0x26CF || // E0.7 [1] (⛏️) pick - code === 0x26D0 || // E0.0 [1] (⛐) CAR SLIDING - code === 0x26D1 || // E0.7 [1] (⛑️) rescue worker’s helmet - code === 0x26D2 || // E0.0 [1] (⛒) CIRCLED CROSSING LANES - code === 0x26D3 || // E0.7 [1] (⛓️) chains - code === 0x26D4 || // E0.6 [1] (⛔) no entry - ( 0x26D5 <= code && code <= 0x26E8 ) || // E0.0 [20] (⛕..⛨) ALTERNATE ONE-WAY LEFT WAY TRAFFIC..BLACK CROSS ON SHIELD - code === 0x26E9 || // E0.7 [1] (⛩️) shinto shrine - code === 0x26EA || // E0.6 [1] (⛪) church - ( 0x26EB <= code && code <= 0x26EF ) || // E0.0 [5] (⛫..⛯) CASTLE..MAP SYMBOL FOR LIGHTHOUSE - ( 0x26F0 <= code && code <= 0x26F1 ) || // E0.7 [2] (⛰️..⛱️) mountain..umbrella on ground - ( 0x26F2 <= code && code <= 0x26F3 ) || // E0.6 [2] (⛲..⛳) fountain..flag in hole - code === 0x26F4 || // E0.7 [1] (⛴️) ferry - code === 0x26F5 || // E0.6 [1] (⛵) sailboat - code === 0x26F6 || // E0.0 [1] (⛶) SQUARE FOUR CORNERS - ( 0x26F7 <= code && code <= 0x26F9 ) || // E0.7 [3] (⛷️..⛹️) skier..person bouncing ball - code === 0x26FA || // E0.6 [1] (⛺) tent - ( 0x26FB <= code && code <= 0x26FC ) || // E0.0 [2] (⛻..⛼) JAPANESE BANK SYMBOL..HEADSTONE GRAVEYARD SYMBOL - code === 0x26FD || // E0.6 [1] (⛽) fuel pump - ( 0x26FE <= code && code <= 0x2701 ) || // E0.0 [4] (⛾..✁) CUP ON BLACK SQUARE..UPPER BLADE SCISSORS - code === 0x2702 || // E0.6 [1] (✂️) scissors - ( 0x2703 <= code && code <= 0x2704 ) || // E0.0 [2] (✃..✄) LOWER BLADE SCISSORS..WHITE SCISSORS - code === 0x2705 || // E0.6 [1] (✅) check mark button - ( 0x2708 <= code && code <= 0x270C ) || // E0.6 [5] (✈️..✌️) airplane..victory hand - code === 0x270D || // E0.7 [1] (✍️) writing hand - code === 0x270E || // E0.0 [1] (✎) LOWER RIGHT PENCIL - code === 0x270F || // E0.6 [1] (✏️) pencil - ( 0x2710 <= code && code <= 0x2711 ) || // E0.0 [2] (✐..✑) UPPER RIGHT PENCIL..WHITE NIB - code === 0x2712 || // E0.6 [1] (✒️) black nib - code === 0x2714 || // E0.6 [1] (✔️) check mark - code === 0x2716 || // E0.6 [1] (✖️) multiply - code === 0x271D || // E0.7 [1] (✝️) latin cross - code === 0x2721 || // E0.7 [1] (✡️) star of David - code === 0x2728 || // E0.6 [1] (✨) sparkles - ( 0x2733 <= code && code <= 0x2734 ) || // E0.6 [2] (✳️..✴️) eight-spoked asterisk..eight-pointed star - code === 0x2744 || // E0.6 [1] (❄️) snowflake - code === 0x2747 || // E0.6 [1] (❇️) sparkle - code === 0x274C || // E0.6 [1] (❌) cross mark - code === 0x274E || // E0.6 [1] (❎) cross mark button - ( 0x2753 <= code && code <= 0x2755 ) || // E0.6 [3] (❓..❕) question mark..white exclamation mark - code === 0x2757 || // E0.6 [1] (❗) exclamation mark - code === 0x2763 || // E1.0 [1] (❣️) heart exclamation - code === 0x2764 || // E0.6 [1] (❤️) red heart - ( 0x2765 <= code && code <= 0x2767 ) || // E0.0 [3] (❥..❧) ROTATED HEAVY BLACK HEART BULLET..ROTATED FLORAL HEART BULLET - ( 0x2795 <= code && code <= 0x2797 ) || // E0.6 [3] (➕..➗) plus..divide - code === 0x27A1 || // E0.6 [1] (➡️) right arrow - code === 0x27B0 || // E0.6 [1] (➰) curly loop - code === 0x27BF || // E1.0 [1] (➿) double curly loop - ( 0x2934 <= code && code <= 0x2935 ) || // E0.6 [2] (⤴️..⤵️) right arrow curving up..right arrow curving down - ( 0x2B05 <= code && code <= 0x2B07 ) || // E0.6 [3] (⬅️..⬇️) left arrow..down arrow - ( 0x2B1B <= code && code <= 0x2B1C ) || // E0.6 [2] (⬛..⬜) black large square..white large square - code === 0x2B50 || // E0.6 [1] (⭐) star - code === 0x2B55 || // E0.6 [1] (⭕) hollow red circle - code === 0x3030 || // E0.6 [1] (〰️) wavy dash - code === 0x303D || // E0.6 [1] (〽️) part alternation mark - code === 0x3297 || // E0.6 [1] (㊗️) Japanese “congratulations” button - code === 0x3299 || // E0.6 [1] (㊙️) Japanese “secret” button - ( 0x1F000 <= code && code <= 0x1F003 ) || // E0.0 [4] (🀀..🀃) MAHJONG TILE EAST WIND..MAHJONG TILE NORTH WIND - code === 0x1F004 || // E0.6 [1] (🀄) mahjong red dragon - ( 0x1F005 <= code && code <= 0x1F0CE ) || // E0.0 [202] (🀅..🃎) MAHJONG TILE GREEN DRAGON..PLAYING CARD KING OF DIAMONDS - code === 0x1F0CF || // E0.6 [1] (🃏) joker - ( 0x1F0D0 <= code && code <= 0x1F0FF ) || // E0.0 [48] (🃐..🃿) .. - ( 0x1F10D <= code && code <= 0x1F10F ) || // E0.0 [3] (🄍..🄏) CIRCLED ZERO WITH SLASH..CIRCLED DOLLAR SIGN WITH OVERLAID BACKSLASH - code === 0x1F12F || // E0.0 [1] (🄯) COPYLEFT SYMBOL - ( 0x1F16C <= code && code <= 0x1F16F ) || // E0.0 [4] (🅬..🅯) RAISED MR SIGN..CIRCLED HUMAN FIGURE - ( 0x1F170 <= code && code <= 0x1F171 ) || // E0.6 [2] (🅰️..🅱️) A button (blood type)..B button (blood type) - ( 0x1F17E <= code && code <= 0x1F17F ) || // E0.6 [2] (🅾️..🅿️) O button (blood type)..P button - code === 0x1F18E || // E0.6 [1] (🆎) AB button (blood type) - ( 0x1F191 <= code && code <= 0x1F19A ) || // E0.6 [10] (🆑..🆚) CL button..VS button - ( 0x1F1AD <= code && code <= 0x1F1E5 ) || // E0.0 [57] (🆭..🇥) MASK WORK SYMBOL.. - ( 0x1F201 <= code && code <= 0x1F202 ) || // E0.6 [2] (🈁..🈂️) Japanese “here” button..Japanese “service charge” button - ( 0x1F203 <= code && code <= 0x1F20F ) || // E0.0 [13] (🈃..🈏) .. - code === 0x1F21A || // E0.6 [1] (🈚) Japanese “free of charge” button - code === 0x1F22F || // E0.6 [1] (🈯) Japanese “reserved” button - ( 0x1F232 <= code && code <= 0x1F23A ) || // E0.6 [9] (🈲..🈺) Japanese “prohibited” button..Japanese “open for business” button - ( 0x1F23C <= code && code <= 0x1F23F ) || // E0.0 [4] (🈼..🈿) .. - ( 0x1F249 <= code && code <= 0x1F24F ) || // E0.0 [7] (🉉..🉏) .. - ( 0x1F250 <= code && code <= 0x1F251 ) || // E0.6 [2] (🉐..🉑) Japanese “bargain” button..Japanese “acceptable” button - ( 0x1F252 <= code && code <= 0x1F2FF ) || // E0.0 [174] (🉒..🋿) .. - ( 0x1F300 <= code && code <= 0x1F30C ) || // E0.6 [13] (🌀..🌌) cyclone..milky way - ( 0x1F30D <= code && code <= 0x1F30E ) || // E0.7 [2] (🌍..🌎) globe showing Europe-Africa..globe showing Americas - code === 0x1F30F || // E0.6 [1] (🌏) globe showing Asia-Australia - code === 0x1F310 || // E1.0 [1] (🌐) globe with meridians - code === 0x1F311 || // E0.6 [1] (🌑) new moon - code === 0x1F312 || // E1.0 [1] (🌒) waxing crescent moon - ( 0x1F313 <= code && code <= 0x1F315 ) || // E0.6 [3] (🌓..🌕) first quarter moon..full moon - ( 0x1F316 <= code && code <= 0x1F318 ) || // E1.0 [3] (🌖..🌘) waning gibbous moon..waning crescent moon - code === 0x1F319 || // E0.6 [1] (🌙) crescent moon - code === 0x1F31A || // E1.0 [1] (🌚) new moon face - code === 0x1F31B || // E0.6 [1] (🌛) first quarter moon face - code === 0x1F31C || // E0.7 [1] (🌜) last quarter moon face - ( 0x1F31D <= code && code <= 0x1F31E ) || // E1.0 [2] (🌝..🌞) full moon face..sun with face - ( 0x1F31F <= code && code <= 0x1F320 ) || // E0.6 [2] (🌟..🌠) glowing star..shooting star - code === 0x1F321 || // E0.7 [1] (🌡️) thermometer - ( 0x1F322 <= code && code <= 0x1F323 ) || // E0.0 [2] (🌢..🌣) BLACK DROPLET..WHITE SUN - ( 0x1F324 <= code && code <= 0x1F32C ) || // E0.7 [9] (🌤️..🌬️) sun behind small cloud..wind face - ( 0x1F32D <= code && code <= 0x1F32F ) || // E1.0 [3] (🌭..🌯) hot dog..burrito - ( 0x1F330 <= code && code <= 0x1F331 ) || // E0.6 [2] (🌰..🌱) chestnut..seedling - ( 0x1F332 <= code && code <= 0x1F333 ) || // E1.0 [2] (🌲..🌳) evergreen tree..deciduous tree - ( 0x1F334 <= code && code <= 0x1F335 ) || // E0.6 [2] (🌴..🌵) palm tree..cactus - code === 0x1F336 || // E0.7 [1] (🌶️) hot pepper - ( 0x1F337 <= code && code <= 0x1F34A ) || // E0.6 [20] (🌷..🍊) tulip..tangerine - code === 0x1F34B || // E1.0 [1] (🍋) lemon - ( 0x1F34C <= code && code <= 0x1F34F ) || // E0.6 [4] (🍌..🍏) banana..green apple - code === 0x1F350 || // E1.0 [1] (🍐) pear - ( 0x1F351 <= code && code <= 0x1F37B ) || // E0.6 [43] (🍑..🍻) peach..clinking beer mugs - code === 0x1F37C || // E1.0 [1] (🍼) baby bottle - code === 0x1F37D || // E0.7 [1] (🍽️) fork and knife with plate - ( 0x1F37E <= code && code <= 0x1F37F ) || // E1.0 [2] (🍾..🍿) bottle with popping cork..popcorn - ( 0x1F380 <= code && code <= 0x1F393 ) || // E0.6 [20] (🎀..🎓) ribbon..graduation cap - ( 0x1F394 <= code && code <= 0x1F395 ) || // E0.0 [2] (🎔..🎕) HEART WITH TIP ON THE LEFT..BOUQUET OF FLOWERS - ( 0x1F396 <= code && code <= 0x1F397 ) || // E0.7 [2] (🎖️..🎗️) military medal..reminder ribbon - code === 0x1F398 || // E0.0 [1] (🎘) MUSICAL KEYBOARD WITH JACKS - ( 0x1F399 <= code && code <= 0x1F39B ) || // E0.7 [3] (🎙️..🎛️) studio microphone..control knobs - ( 0x1F39C <= code && code <= 0x1F39D ) || // E0.0 [2] (🎜..🎝) BEAMED ASCENDING MUSICAL NOTES..BEAMED DESCENDING MUSICAL NOTES - ( 0x1F39E <= code && code <= 0x1F39F ) || // E0.7 [2] (🎞️..🎟️) film frames..admission tickets - ( 0x1F3A0 <= code && code <= 0x1F3C4 ) || // E0.6 [37] (🎠..🏄) carousel horse..person surfing - code === 0x1F3C5 || // E1.0 [1] (🏅) sports medal - code === 0x1F3C6 || // E0.6 [1] (🏆) trophy - code === 0x1F3C7 || // E1.0 [1] (🏇) horse racing - code === 0x1F3C8 || // E0.6 [1] (🏈) american football - code === 0x1F3C9 || // E1.0 [1] (🏉) rugby football - code === 0x1F3CA || // E0.6 [1] (🏊) person swimming - ( 0x1F3CB <= code && code <= 0x1F3CE ) || // E0.7 [4] (🏋️..🏎️) person lifting weights..racing car - ( 0x1F3CF <= code && code <= 0x1F3D3 ) || // E1.0 [5] (🏏..🏓) cricket game..ping pong - ( 0x1F3D4 <= code && code <= 0x1F3DF ) || // E0.7 [12] (🏔️..🏟️) snow-capped mountain..stadium - ( 0x1F3E0 <= code && code <= 0x1F3E3 ) || // E0.6 [4] (🏠..🏣) house..Japanese post office - code === 0x1F3E4 || // E1.0 [1] (🏤) post office - ( 0x1F3E5 <= code && code <= 0x1F3F0 ) || // E0.6 [12] (🏥..🏰) hospital..castle - ( 0x1F3F1 <= code && code <= 0x1F3F2 ) || // E0.0 [2] (🏱..🏲) WHITE PENNANT..BLACK PENNANT - code === 0x1F3F3 || // E0.7 [1] (🏳️) white flag - code === 0x1F3F4 || // E1.0 [1] (🏴) black flag - code === 0x1F3F5 || // E0.7 [1] (🏵️) rosette - code === 0x1F3F6 || // E0.0 [1] (🏶) BLACK ROSETTE - code === 0x1F3F7 || // E0.7 [1] (🏷️) label - ( 0x1F3F8 <= code && code <= 0x1F3FA ) || // E1.0 [3] (🏸..🏺) badminton..amphora - ( 0x1F400 <= code && code <= 0x1F407 ) || // E1.0 [8] (🐀..🐇) rat..rabbit - code === 0x1F408 || // E0.7 [1] (🐈) cat - ( 0x1F409 <= code && code <= 0x1F40B ) || // E1.0 [3] (🐉..🐋) dragon..whale - ( 0x1F40C <= code && code <= 0x1F40E ) || // E0.6 [3] (🐌..🐎) snail..horse - ( 0x1F40F <= code && code <= 0x1F410 ) || // E1.0 [2] (🐏..🐐) ram..goat - ( 0x1F411 <= code && code <= 0x1F412 ) || // E0.6 [2] (🐑..🐒) ewe..monkey - code === 0x1F413 || // E1.0 [1] (🐓) rooster - code === 0x1F414 || // E0.6 [1] (🐔) chicken - code === 0x1F415 || // E0.7 [1] (🐕) dog - code === 0x1F416 || // E1.0 [1] (🐖) pig - ( 0x1F417 <= code && code <= 0x1F429 ) || // E0.6 [19] (🐗..🐩) boar..poodle - code === 0x1F42A || // E1.0 [1] (🐪) camel - ( 0x1F42B <= code && code <= 0x1F43E ) || // E0.6 [20] (🐫..🐾) two-hump camel..paw prints - code === 0x1F43F || // E0.7 [1] (🐿️) chipmunk - code === 0x1F440 || // E0.6 [1] (👀) eyes - code === 0x1F441 || // E0.7 [1] (👁️) eye - ( 0x1F442 <= code && code <= 0x1F464 ) || // E0.6 [35] (👂..👤) ear..bust in silhouette - code === 0x1F465 || // E1.0 [1] (👥) busts in silhouette - ( 0x1F466 <= code && code <= 0x1F46B ) || // E0.6 [6] (👦..👫) boy..woman and man holding hands - ( 0x1F46C <= code && code <= 0x1F46D ) || // E1.0 [2] (👬..👭) men holding hands..women holding hands - ( 0x1F46E <= code && code <= 0x1F4AC ) || // E0.6 [63] (👮..💬) police officer..speech balloon - code === 0x1F4AD || // E1.0 [1] (💭) thought balloon - ( 0x1F4AE <= code && code <= 0x1F4B5 ) || // E0.6 [8] (💮..💵) white flower..dollar banknote - ( 0x1F4B6 <= code && code <= 0x1F4B7 ) || // E1.0 [2] (💶..💷) euro banknote..pound banknote - ( 0x1F4B8 <= code && code <= 0x1F4EB ) || // E0.6 [52] (💸..📫) money with wings..closed mailbox with raised flag - ( 0x1F4EC <= code && code <= 0x1F4ED ) || // E0.7 [2] (📬..📭) open mailbox with raised flag..open mailbox with lowered flag - code === 0x1F4EE || // E0.6 [1] (📮) postbox - code === 0x1F4EF || // E1.0 [1] (📯) postal horn - ( 0x1F4F0 <= code && code <= 0x1F4F4 ) || // E0.6 [5] (📰..📴) newspaper..mobile phone off - code === 0x1F4F5 || // E1.0 [1] (📵) no mobile phones - ( 0x1F4F6 <= code && code <= 0x1F4F7 ) || // E0.6 [2] (📶..📷) antenna bars..camera - code === 0x1F4F8 || // E1.0 [1] (📸) camera with flash - ( 0x1F4F9 <= code && code <= 0x1F4FC ) || // E0.6 [4] (📹..📼) video camera..videocassette - code === 0x1F4FD || // E0.7 [1] (📽️) film projector - code === 0x1F4FE || // E0.0 [1] (📾) PORTABLE STEREO - ( 0x1F4FF <= code && code <= 0x1F502 ) || // E1.0 [4] (📿..🔂) prayer beads..repeat single button - code === 0x1F503 || // E0.6 [1] (🔃) clockwise vertical arrows - ( 0x1F504 <= code && code <= 0x1F507 ) || // E1.0 [4] (🔄..🔇) counterclockwise arrows button..muted speaker - code === 0x1F508 || // E0.7 [1] (🔈) speaker low volume - code === 0x1F509 || // E1.0 [1] (🔉) speaker medium volume - ( 0x1F50A <= code && code <= 0x1F514 ) || // E0.6 [11] (🔊..🔔) speaker high volume..bell - code === 0x1F515 || // E1.0 [1] (🔕) bell with slash - ( 0x1F516 <= code && code <= 0x1F52B ) || // E0.6 [22] (🔖..🔫) bookmark..pistol - ( 0x1F52C <= code && code <= 0x1F52D ) || // E1.0 [2] (🔬..🔭) microscope..telescope - ( 0x1F52E <= code && code <= 0x1F53D ) || // E0.6 [16] (🔮..🔽) crystal ball..downwards button - ( 0x1F546 <= code && code <= 0x1F548 ) || // E0.0 [3] (🕆..🕈) WHITE LATIN CROSS..CELTIC CROSS - ( 0x1F549 <= code && code <= 0x1F54A ) || // E0.7 [2] (🕉️..🕊️) om..dove - ( 0x1F54B <= code && code <= 0x1F54E ) || // E1.0 [4] (🕋..🕎) kaaba..menorah - code === 0x1F54F || // E0.0 [1] (🕏) BOWL OF HYGIEIA - ( 0x1F550 <= code && code <= 0x1F55B ) || // E0.6 [12] (🕐..🕛) one o’clock..twelve o’clock - ( 0x1F55C <= code && code <= 0x1F567 ) || // E0.7 [12] (🕜..🕧) one-thirty..twelve-thirty - ( 0x1F568 <= code && code <= 0x1F56E ) || // E0.0 [7] (🕨..🕮) RIGHT SPEAKER..BOOK - ( 0x1F56F <= code && code <= 0x1F570 ) || // E0.7 [2] (🕯️..🕰️) candle..mantelpiece clock - ( 0x1F571 <= code && code <= 0x1F572 ) || // E0.0 [2] (🕱..🕲) BLACK SKULL AND CROSSBONES..NO PIRACY - ( 0x1F573 <= code && code <= 0x1F579 ) || // E0.7 [7] (🕳️..🕹️) hole..joystick - code === 0x1F57A || // E3.0 [1] (🕺) man dancing - ( 0x1F57B <= code && code <= 0x1F586 ) || // E0.0 [12] (🕻..🖆) LEFT HAND TELEPHONE RECEIVER..PEN OVER STAMPED ENVELOPE - code === 0x1F587 || // E0.7 [1] (🖇️) linked paperclips - ( 0x1F588 <= code && code <= 0x1F589 ) || // E0.0 [2] (🖈..🖉) BLACK PUSHPIN..LOWER LEFT PENCIL - ( 0x1F58A <= code && code <= 0x1F58D ) || // E0.7 [4] (🖊️..🖍️) pen..crayon - ( 0x1F58E <= code && code <= 0x1F58F ) || // E0.0 [2] (🖎..🖏) LEFT WRITING HAND..TURNED OK HAND SIGN - code === 0x1F590 || // E0.7 [1] (🖐️) hand with fingers splayed - ( 0x1F591 <= code && code <= 0x1F594 ) || // E0.0 [4] (🖑..🖔) REVERSED RAISED HAND WITH FINGERS SPLAYED..REVERSED VICTORY HAND - ( 0x1F595 <= code && code <= 0x1F596 ) || // E1.0 [2] (🖕..🖖) middle finger..vulcan salute - ( 0x1F597 <= code && code <= 0x1F5A3 ) || // E0.0 [13] (🖗..🖣) WHITE DOWN POINTING LEFT HAND INDEX..BLACK DOWN POINTING BACKHAND INDEX - code === 0x1F5A4 || // E3.0 [1] (🖤) black heart - code === 0x1F5A5 || // E0.7 [1] (🖥️) desktop computer - ( 0x1F5A6 <= code && code <= 0x1F5A7 ) || // E0.0 [2] (🖦..🖧) KEYBOARD AND MOUSE..THREE NETWORKED COMPUTERS - code === 0x1F5A8 || // E0.7 [1] (🖨️) printer - ( 0x1F5A9 <= code && code <= 0x1F5B0 ) || // E0.0 [8] (🖩..🖰) POCKET CALCULATOR..TWO BUTTON MOUSE - ( 0x1F5B1 <= code && code <= 0x1F5B2 ) || // E0.7 [2] (🖱️..🖲️) computer mouse..trackball - ( 0x1F5B3 <= code && code <= 0x1F5BB ) || // E0.0 [9] (🖳..🖻) OLD PERSONAL COMPUTER..DOCUMENT WITH PICTURE - code === 0x1F5BC || // E0.7 [1] (🖼️) framed picture - ( 0x1F5BD <= code && code <= 0x1F5C1 ) || // E0.0 [5] (🖽..🗁) FRAME WITH TILES..OPEN FOLDER - ( 0x1F5C2 <= code && code <= 0x1F5C4 ) || // E0.7 [3] (🗂️..🗄️) card index dividers..file cabinet - ( 0x1F5C5 <= code && code <= 0x1F5D0 ) || // E0.0 [12] (🗅..🗐) EMPTY NOTE..PAGES - ( 0x1F5D1 <= code && code <= 0x1F5D3 ) || // E0.7 [3] (🗑️..🗓️) wastebasket..spiral calendar - ( 0x1F5D4 <= code && code <= 0x1F5DB ) || // E0.0 [8] (🗔..🗛) DESKTOP WINDOW..DECREASE FONT SIZE SYMBOL - ( 0x1F5DC <= code && code <= 0x1F5DE ) || // E0.7 [3] (🗜️..🗞️) clamp..rolled-up newspaper - ( 0x1F5DF <= code && code <= 0x1F5E0 ) || // E0.0 [2] (🗟..🗠) PAGE WITH CIRCLED TEXT..STOCK CHART - code === 0x1F5E1 || // E0.7 [1] (🗡️) dagger - code === 0x1F5E2 || // E0.0 [1] (🗢) LIPS - code === 0x1F5E3 || // E0.7 [1] (🗣️) speaking head - ( 0x1F5E4 <= code && code <= 0x1F5E7 ) || // E0.0 [4] (🗤..🗧) THREE RAYS ABOVE..THREE RAYS RIGHT - code === 0x1F5E8 || // E2.0 [1] (🗨️) left speech bubble - ( 0x1F5E9 <= code && code <= 0x1F5EE ) || // E0.0 [6] (🗩..🗮) RIGHT SPEECH BUBBLE..LEFT ANGER BUBBLE - code === 0x1F5EF || // E0.7 [1] (🗯️) right anger bubble - ( 0x1F5F0 <= code && code <= 0x1F5F2 ) || // E0.0 [3] (🗰..🗲) MOOD BUBBLE..LIGHTNING MOOD - code === 0x1F5F3 || // E0.7 [1] (🗳️) ballot box with ballot - ( 0x1F5F4 <= code && code <= 0x1F5F9 ) || // E0.0 [6] (🗴..🗹) BALLOT SCRIPT X..BALLOT BOX WITH BOLD CHECK - code === 0x1F5FA || // E0.7 [1] (🗺️) world map - ( 0x1F5FB <= code && code <= 0x1F5FF ) || // E0.6 [5] (🗻..🗿) mount fuji..moai - code === 0x1F600 || // E1.0 [1] (😀) grinning face - ( 0x1F601 <= code && code <= 0x1F606 ) || // E0.6 [6] (😁..😆) beaming face with smiling eyes..grinning squinting face - ( 0x1F607 <= code && code <= 0x1F608 ) || // E1.0 [2] (😇..😈) smiling face with halo..smiling face with horns - ( 0x1F609 <= code && code <= 0x1F60D ) || // E0.6 [5] (😉..😍) winking face..smiling face with heart-eyes - code === 0x1F60E || // E1.0 [1] (😎) smiling face with sunglasses - code === 0x1F60F || // E0.6 [1] (😏) smirking face - code === 0x1F610 || // E0.7 [1] (😐) neutral face - code === 0x1F611 || // E1.0 [1] (😑) expressionless face - ( 0x1F612 <= code && code <= 0x1F614 ) || // E0.6 [3] (😒..😔) unamused face..pensive face - code === 0x1F615 || // E1.0 [1] (😕) confused face - code === 0x1F616 || // E0.6 [1] (😖) confounded face - code === 0x1F617 || // E1.0 [1] (😗) kissing face - code === 0x1F618 || // E0.6 [1] (😘) face blowing a kiss - code === 0x1F619 || // E1.0 [1] (😙) kissing face with smiling eyes - code === 0x1F61A || // E0.6 [1] (😚) kissing face with closed eyes - code === 0x1F61B || // E1.0 [1] (😛) face with tongue - ( 0x1F61C <= code && code <= 0x1F61E ) || // E0.6 [3] (😜..😞) winking face with tongue..disappointed face - code === 0x1F61F || // E1.0 [1] (😟) worried face - ( 0x1F620 <= code && code <= 0x1F625 ) || // E0.6 [6] (😠..😥) angry face..sad but relieved face - ( 0x1F626 <= code && code <= 0x1F627 ) || // E1.0 [2] (😦..😧) frowning face with open mouth..anguished face - ( 0x1F628 <= code && code <= 0x1F62B ) || // E0.6 [4] (😨..😫) fearful face..tired face - code === 0x1F62C || // E1.0 [1] (😬) grimacing face - code === 0x1F62D || // E0.6 [1] (😭) loudly crying face - ( 0x1F62E <= code && code <= 0x1F62F ) || // E1.0 [2] (😮..😯) face with open mouth..hushed face - ( 0x1F630 <= code && code <= 0x1F633 ) || // E0.6 [4] (😰..😳) anxious face with sweat..flushed face - code === 0x1F634 || // E1.0 [1] (😴) sleeping face - code === 0x1F635 || // E0.6 [1] (😵) dizzy face - code === 0x1F636 || // E1.0 [1] (😶) face without mouth - ( 0x1F637 <= code && code <= 0x1F640 ) || // E0.6 [10] (😷..🙀) face with medical mask..weary cat - ( 0x1F641 <= code && code <= 0x1F644 ) || // E1.0 [4] (🙁..🙄) slightly frowning face..face with rolling eyes - ( 0x1F645 <= code && code <= 0x1F64F ) || // E0.6 [11] (🙅..🙏) person gesturing NO..folded hands - code === 0x1F680 || // E0.6 [1] (🚀) rocket - ( 0x1F681 <= code && code <= 0x1F682 ) || // E1.0 [2] (🚁..🚂) helicopter..locomotive - ( 0x1F683 <= code && code <= 0x1F685 ) || // E0.6 [3] (🚃..🚅) railway car..bullet train - code === 0x1F686 || // E1.0 [1] (🚆) train - code === 0x1F687 || // E0.6 [1] (🚇) metro - code === 0x1F688 || // E1.0 [1] (🚈) light rail - code === 0x1F689 || // E0.6 [1] (🚉) station - ( 0x1F68A <= code && code <= 0x1F68B ) || // E1.0 [2] (🚊..🚋) tram..tram car - code === 0x1F68C || // E0.6 [1] (🚌) bus - code === 0x1F68D || // E0.7 [1] (🚍) oncoming bus - code === 0x1F68E || // E1.0 [1] (🚎) trolleybus - code === 0x1F68F || // E0.6 [1] (🚏) bus stop - code === 0x1F690 || // E1.0 [1] (🚐) minibus - ( 0x1F691 <= code && code <= 0x1F693 ) || // E0.6 [3] (🚑..🚓) ambulance..police car - code === 0x1F694 || // E0.7 [1] (🚔) oncoming police car - code === 0x1F695 || // E0.6 [1] (🚕) taxi - code === 0x1F696 || // E1.0 [1] (🚖) oncoming taxi - code === 0x1F697 || // E0.6 [1] (🚗) automobile - code === 0x1F698 || // E0.7 [1] (🚘) oncoming automobile - ( 0x1F699 <= code && code <= 0x1F69A ) || // E0.6 [2] (🚙..🚚) sport utility vehicle..delivery truck - ( 0x1F69B <= code && code <= 0x1F6A1 ) || // E1.0 [7] (🚛..🚡) articulated lorry..aerial tramway - code === 0x1F6A2 || // E0.6 [1] (🚢) ship - code === 0x1F6A3 || // E1.0 [1] (🚣) person rowing boat - ( 0x1F6A4 <= code && code <= 0x1F6A5 ) || // E0.6 [2] (🚤..🚥) speedboat..horizontal traffic light - code === 0x1F6A6 || // E1.0 [1] (🚦) vertical traffic light - ( 0x1F6A7 <= code && code <= 0x1F6AD ) || // E0.6 [7] (🚧..🚭) construction..no smoking - ( 0x1F6AE <= code && code <= 0x1F6B1 ) || // E1.0 [4] (🚮..🚱) litter in bin sign..non-potable water - code === 0x1F6B2 || // E0.6 [1] (🚲) bicycle - ( 0x1F6B3 <= code && code <= 0x1F6B5 ) || // E1.0 [3] (🚳..🚵) no bicycles..person mountain biking - code === 0x1F6B6 || // E0.6 [1] (🚶) person walking - ( 0x1F6B7 <= code && code <= 0x1F6B8 ) || // E1.0 [2] (🚷..🚸) no pedestrians..children crossing - ( 0x1F6B9 <= code && code <= 0x1F6BE ) || // E0.6 [6] (🚹..🚾) men’s room..water closet - code === 0x1F6BF || // E1.0 [1] (🚿) shower - code === 0x1F6C0 || // E0.6 [1] (🛀) person taking bath - ( 0x1F6C1 <= code && code <= 0x1F6C5 ) || // E1.0 [5] (🛁..🛅) bathtub..left luggage - ( 0x1F6C6 <= code && code <= 0x1F6CA ) || // E0.0 [5] (🛆..🛊) TRIANGLE WITH ROUNDED CORNERS..GIRLS SYMBOL - code === 0x1F6CB || // E0.7 [1] (🛋️) couch and lamp - code === 0x1F6CC || // E1.0 [1] (🛌) person in bed - ( 0x1F6CD <= code && code <= 0x1F6CF ) || // E0.7 [3] (🛍️..🛏️) shopping bags..bed - code === 0x1F6D0 || // E1.0 [1] (🛐) place of worship - ( 0x1F6D1 <= code && code <= 0x1F6D2 ) || // E3.0 [2] (🛑..🛒) stop sign..shopping cart - ( 0x1F6D3 <= code && code <= 0x1F6D4 ) || // E0.0 [2] (🛓..🛔) STUPA..PAGODA - code === 0x1F6D5 || // E12.0 [1] (🛕) hindu temple - ( 0x1F6D6 <= code && code <= 0x1F6D7 ) || // E13.0 [2] (🛖..🛗) hut..elevator - ( 0x1F6D8 <= code && code <= 0x1F6DF ) || // E0.0 [8] (🛘..🛟) .. - ( 0x1F6E0 <= code && code <= 0x1F6E5 ) || // E0.7 [6] (🛠️..🛥️) hammer and wrench..motor boat - ( 0x1F6E6 <= code && code <= 0x1F6E8 ) || // E0.0 [3] (🛦..🛨) UP-POINTING MILITARY AIRPLANE..UP-POINTING SMALL AIRPLANE - code === 0x1F6E9 || // E0.7 [1] (🛩️) small airplane - code === 0x1F6EA || // E0.0 [1] (🛪) NORTHEAST-POINTING AIRPLANE - ( 0x1F6EB <= code && code <= 0x1F6EC ) || // E1.0 [2] (🛫..🛬) airplane departure..airplane arrival - ( 0x1F6ED <= code && code <= 0x1F6EF ) || // E0.0 [3] (🛭..🛯) .. - code === 0x1F6F0 || // E0.7 [1] (🛰️) satellite - ( 0x1F6F1 <= code && code <= 0x1F6F2 ) || // E0.0 [2] (🛱..🛲) ONCOMING FIRE ENGINE..DIESEL LOCOMOTIVE - code === 0x1F6F3 || // E0.7 [1] (🛳️) passenger ship - ( 0x1F6F4 <= code && code <= 0x1F6F6 ) || // E3.0 [3] (🛴..🛶) kick scooter..canoe - ( 0x1F6F7 <= code && code <= 0x1F6F8 ) || // E5.0 [2] (🛷..🛸) sled..flying saucer - code === 0x1F6F9 || // E11.0 [1] (🛹) skateboard - code === 0x1F6FA || // E12.0 [1] (🛺) auto rickshaw - ( 0x1F6FB <= code && code <= 0x1F6FC ) || // E13.0 [2] (🛻..🛼) pickup truck..roller skate - ( 0x1F6FD <= code && code <= 0x1F6FF ) || // E0.0 [3] (🛽..🛿) .. - ( 0x1F774 <= code && code <= 0x1F77F ) || // E0.0 [12] (🝴..🝿) .. - ( 0x1F7D5 <= code && code <= 0x1F7DF ) || // E0.0 [11] (🟕..🟟) CIRCLED TRIANGLE.. - ( 0x1F7E0 <= code && code <= 0x1F7EB ) || // E12.0 [12] (🟠..🟫) orange circle..brown square - ( 0x1F7EC <= code && code <= 0x1F7FF ) || // E0.0 [20] (🟬..🟿) .. - ( 0x1F80C <= code && code <= 0x1F80F ) || // E0.0 [4] (🠌..🠏) .. - ( 0x1F848 <= code && code <= 0x1F84F ) || // E0.0 [8] (🡈..🡏) .. - ( 0x1F85A <= code && code <= 0x1F85F ) || // E0.0 [6] (🡚..🡟) .. - ( 0x1F888 <= code && code <= 0x1F88F ) || // E0.0 [8] (🢈..🢏) .. - ( 0x1F8AE <= code && code <= 0x1F8FF ) || // E0.0 [82] (🢮..🣿) .. - code === 0x1F90C || // E13.0 [1] (🤌) pinched fingers - ( 0x1F90D <= code && code <= 0x1F90F ) || // E12.0 [3] (🤍..🤏) white heart..pinching hand - ( 0x1F910 <= code && code <= 0x1F918 ) || // E1.0 [9] (🤐..🤘) zipper-mouth face..sign of the horns - ( 0x1F919 <= code && code <= 0x1F91E ) || // E3.0 [6] (🤙..🤞) call me hand..crossed fingers - code === 0x1F91F || // E5.0 [1] (🤟) love-you gesture - ( 0x1F920 <= code && code <= 0x1F927 ) || // E3.0 [8] (🤠..🤧) cowboy hat face..sneezing face - ( 0x1F928 <= code && code <= 0x1F92F ) || // E5.0 [8] (🤨..🤯) face with raised eyebrow..exploding head - code === 0x1F930 || // E3.0 [1] (🤰) pregnant woman - ( 0x1F931 <= code && code <= 0x1F932 ) || // E5.0 [2] (🤱..🤲) breast-feeding..palms up together - ( 0x1F933 <= code && code <= 0x1F93A ) || // E3.0 [8] (🤳..🤺) selfie..person fencing - ( 0x1F93C <= code && code <= 0x1F93E ) || // E3.0 [3] (🤼..🤾) people wrestling..person playing handball - code === 0x1F93F || // E12.0 [1] (🤿) diving mask - ( 0x1F940 <= code && code <= 0x1F945 ) || // E3.0 [6] (🥀..🥅) wilted flower..goal net - ( 0x1F947 <= code && code <= 0x1F94B ) || // E3.0 [5] (🥇..🥋) 1st place medal..martial arts uniform - code === 0x1F94C || // E5.0 [1] (🥌) curling stone - ( 0x1F94D <= code && code <= 0x1F94F ) || // E11.0 [3] (🥍..🥏) lacrosse..flying disc - ( 0x1F950 <= code && code <= 0x1F95E ) || // E3.0 [15] (🥐..🥞) croissant..pancakes - ( 0x1F95F <= code && code <= 0x1F96B ) || // E5.0 [13] (🥟..🥫) dumpling..canned food - ( 0x1F96C <= code && code <= 0x1F970 ) || // E11.0 [5] (🥬..🥰) leafy green..smiling face with hearts - code === 0x1F971 || // E12.0 [1] (🥱) yawning face - code === 0x1F972 || // E13.0 [1] (🥲) smiling face with tear - ( 0x1F973 <= code && code <= 0x1F976 ) || // E11.0 [4] (🥳..🥶) partying face..cold face - ( 0x1F977 <= code && code <= 0x1F978 ) || // E13.0 [2] (🥷..🥸) ninja..disguised face - code === 0x1F979 || // E0.0 [1] (🥹) - code === 0x1F97A || // E11.0 [1] (🥺) pleading face - code === 0x1F97B || // E12.0 [1] (🥻) sari - ( 0x1F97C <= code && code <= 0x1F97F ) || // E11.0 [4] (🥼..🥿) lab coat..flat shoe - ( 0x1F980 <= code && code <= 0x1F984 ) || // E1.0 [5] (🦀..🦄) crab..unicorn - ( 0x1F985 <= code && code <= 0x1F991 ) || // E3.0 [13] (🦅..🦑) eagle..squid - ( 0x1F992 <= code && code <= 0x1F997 ) || // E5.0 [6] (🦒..🦗) giraffe..cricket - ( 0x1F998 <= code && code <= 0x1F9A2 ) || // E11.0 [11] (🦘..🦢) kangaroo..swan - ( 0x1F9A3 <= code && code <= 0x1F9A4 ) || // E13.0 [2] (🦣..🦤) mammoth..dodo - ( 0x1F9A5 <= code && code <= 0x1F9AA ) || // E12.0 [6] (🦥..🦪) sloth..oyster - ( 0x1F9AB <= code && code <= 0x1F9AD ) || // E13.0 [3] (🦫..🦭) beaver..seal - ( 0x1F9AE <= code && code <= 0x1F9AF ) || // E12.0 [2] (🦮..🦯) guide dog..white cane - ( 0x1F9B0 <= code && code <= 0x1F9B9 ) || // E11.0 [10] (🦰..🦹) red hair..supervillain - ( 0x1F9BA <= code && code <= 0x1F9BF ) || // E12.0 [6] (🦺..🦿) safety vest..mechanical leg - code === 0x1F9C0 || // E1.0 [1] (🧀) cheese wedge - ( 0x1F9C1 <= code && code <= 0x1F9C2 ) || // E11.0 [2] (🧁..🧂) cupcake..salt - ( 0x1F9C3 <= code && code <= 0x1F9CA ) || // E12.0 [8] (🧃..🧊) beverage box..ice - code === 0x1F9CB || // E13.0 [1] (🧋) bubble tea - code === 0x1F9CC || // E0.0 [1] (🧌) - ( 0x1F9CD <= code && code <= 0x1F9CF ) || // E12.0 [3] (🧍..🧏) person standing..deaf person - ( 0x1F9D0 <= code && code <= 0x1F9E6 ) || // E5.0 [23] (🧐..🧦) face with monocle..socks - ( 0x1F9E7 <= code && code <= 0x1F9FF ) || // E11.0 [25] (🧧..🧿) red envelope..nazar amulet - ( 0x1FA00 <= code && code <= 0x1FA6F ) || // E0.0 [112] (🨀..🩯) NEUTRAL CHESS KING.. - ( 0x1FA70 <= code && code <= 0x1FA73 ) || // E12.0 [4] (🩰..🩳) ballet shoes..shorts - code === 0x1FA74 || // E13.0 [1] (🩴) thong sandal - ( 0x1FA75 <= code && code <= 0x1FA77 ) || // E0.0 [3] (🩵..🩷) .. - ( 0x1FA78 <= code && code <= 0x1FA7A ) || // E12.0 [3] (🩸..🩺) drop of blood..stethoscope - ( 0x1FA7B <= code && code <= 0x1FA7F ) || // E0.0 [5] (🩻..🩿) .. - ( 0x1FA80 <= code && code <= 0x1FA82 ) || // E12.0 [3] (🪀..🪂) yo-yo..parachute - ( 0x1FA83 <= code && code <= 0x1FA86 ) || // E13.0 [4] (🪃..🪆) boomerang..nesting dolls - ( 0x1FA87 <= code && code <= 0x1FA8F ) || // E0.0 [9] (🪇..🪏) .. - ( 0x1FA90 <= code && code <= 0x1FA95 ) || // E12.0 [6] (🪐..🪕) ringed planet..banjo - ( 0x1FA96 <= code && code <= 0x1FAA8 ) || // E13.0 [19] (🪖..🪨) military helmet..rock - ( 0x1FAA9 <= code && code <= 0x1FAAF ) || // E0.0 [7] (🪩..🪯) .. - ( 0x1FAB0 <= code && code <= 0x1FAB6 ) || // E13.0 [7] (🪰..🪶) fly..feather - ( 0x1FAB7 <= code && code <= 0x1FABF ) || // E0.0 [9] (🪷..🪿) .. - ( 0x1FAC0 <= code && code <= 0x1FAC2 ) || // E13.0 [3] (🫀..🫂) anatomical heart..people hugging - ( 0x1FAC3 <= code && code <= 0x1FACF ) || // E0.0 [13] (🫃..🫏) .. - ( 0x1FAD0 <= code && code <= 0x1FAD6 ) || // E13.0 [7] (🫐..🫖) blueberries..teapot - ( 0x1FAD7 <= code && code <= 0x1FAFF ) || // E0.0 [41] (🫗..🫿) .. - ( 0x1FC00 <= code && code <= 0x1FFFD ) // E0.0[1022] (🰀..🿽) .. - ) { - return constants.ExtendedPictographic; - } - return constants.Other; -} - - -// EXPORTS // - -module.exports = emojiProperty; diff --git a/tools/grapheme-cluster-break/lib/index.js b/tools/grapheme-cluster-break/lib/index.js deleted file mode 100644 index 63aed77f..00000000 --- a/tools/grapheme-cluster-break/lib/index.js +++ /dev/null @@ -1,56 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Grapheme cluster break tooling. -* -* @module @stdlib/string/tools/grapheme-cluster-break -* -* @example -* var grapheme = require( '@stdlib/string/tools/grapheme-cluster-break' ); -* -* var out = grapheme.emojiProperty( 0x23EC ); -* // returns 101 -* -* out = grapheme.breakProperty( 0x008f ); -* // returns 2 -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-nonenumerable-read-only-property' ); -var constants = require( './constants.js' ); -var breakType = require( './break_type.js' ); -var emojiProperty = require( './emoji_property.js' ); -var breakProperty = require( './break_property.js' ); - - -// MAIN // - -var main = {}; -setReadOnly( main, 'constants', constants ); -setReadOnly( main, 'breakType', breakType ); -setReadOnly( main, 'emojiProperty', emojiProperty ); -setReadOnly( main, 'breakProperty', breakProperty ); - - -// EXPORTS // - -module.exports = main; diff --git a/tools/grapheme-cluster-break/package.json b/tools/grapheme-cluster-break/package.json deleted file mode 100644 index 850f2f80..00000000 --- a/tools/grapheme-cluster-break/package.json +++ /dev/null @@ -1,73 +0,0 @@ -{ - "name": "@stdlib/string/tools/grapheme-cluster-break", - "version": "0.0.0", - "description": "Grapheme cluster break tooling.", - "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" - } - ], - "bin": {}, - "main": "./lib", - "directories": { - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "code", - "point", - "pt", - "unicode", - "utf-16", - "utf16", - "surrogate", - "astral", - "grapheme", - "cluster", - "segmentation", - "tc39" - ] -} diff --git a/tools/grapheme-cluster-break/test/test.break_property.js b/tools/grapheme-cluster-break/test/test.break_property.js deleted file mode 100644 index 650795de..00000000 --- a/tools/grapheme-cluster-break/test/test.break_property.js +++ /dev/null @@ -1,79 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 constants = require( './../lib/constants.js' ); -var graphemeBreakProperty = require( './../lib/break_property.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof graphemeBreakProperty, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns a grapheme break property', function test( t ) { - var out; - - out = graphemeBreakProperty( 0x008f ); - t.strictEqual( out, constants.Control, 'returns expected value' ); - - out = graphemeBreakProperty( 0x111C2 ); - t.strictEqual( out, constants.Prepend, 'returns expected value' ); - - out = graphemeBreakProperty( 0x1F3FC ); - t.strictEqual( out, constants.Extend, 'returns expected value' ); - - out = graphemeBreakProperty( 0x1F1FF ); - t.strictEqual( out, constants.RegionalIndicator, 'returns expected value' ); - - out = graphemeBreakProperty( 0x16F52 ); - t.strictEqual( out, constants.SpacingMark, 'returns expected value' ); - - out = graphemeBreakProperty( 0x1101 ); - t.strictEqual( out, constants.L, 'returns expected value' ); - - out = graphemeBreakProperty( 0x11A7 ); - t.strictEqual( out, constants.V, 'returns expected value' ); - - out = graphemeBreakProperty( 0x11FE ); - t.strictEqual( out, constants.T, 'returns expected value' ); - - out = graphemeBreakProperty( 0xAEBC ); - t.strictEqual( out, constants.LV, 'returns expected value' ); - - out = graphemeBreakProperty( 0xAFD2 ); - t.strictEqual( out, constants.LVT, 'returns expected value' ); - - out = graphemeBreakProperty( 0x200D ); - t.strictEqual( out, constants.ZWJ, 'returns expected value' ); - - out = graphemeBreakProperty( 0x000A ); - t.strictEqual( out, constants.LF, 'returns expected value' ); - - out = graphemeBreakProperty( 0x000D ); - t.strictEqual( out, constants.CR, 'returns expected value' ); - - t.end(); -}); diff --git a/tools/grapheme-cluster-break/test/test.emoji_property.js b/tools/grapheme-cluster-break/test/test.emoji_property.js deleted file mode 100644 index 6691e974..00000000 --- a/tools/grapheme-cluster-break/test/test.emoji_property.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2020 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 constants = require( './../lib/constants.js' ); -var emojiProperty = require( './../lib/emoji_property.js' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof emojiProperty, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function returns an emoji property', function test( t ) { - var out; - - out = emojiProperty( 0x23EC ); - t.strictEqual( out, constants.ExtendedPictographic, 'returns expected value' ); - - out = emojiProperty( 0x1FFFE ); - t.strictEqual( out, constants.Other, 'returns expected value' ); - - t.end(); -}); diff --git a/tools/grapheme-cluster-break/test/test.js b/tools/grapheme-cluster-break/test/test.js deleted file mode 100644 index b0d1b642..00000000 --- a/tools/grapheme-cluster-break/test/test.js +++ /dev/null @@ -1,55 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 isFunction = require( '@stdlib/assert/is-function' ); -var isPlainObject = require( '@stdlib/assert/is-plain-object' ); -var grapheme = require( './../lib' ); - - -// TESTS // - -tape( 'main export is an object', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof grapheme, 'object', 'main export is an object' ); - t.end(); -}); - -tape( 'the exported object contains a `emojiProperty` method which is a function', function test( t ) { - t.strictEqual( isFunction( grapheme.emojiProperty ), true, 'has function' ); - t.end(); -}); - -tape( 'the exported object contains a `breakProperty` method which is a function', function test( t ) { - t.strictEqual( isFunction( grapheme.breakProperty ), true, 'has function' ); - t.end(); -}); - -tape( 'the exported object contains a `breakType` method which is a function', function test( t ) { - t.strictEqual( isFunction( grapheme.breakType ), true, 'has function' ); - t.end(); -}); - -tape( 'the exported object contains a `constants` object mapping break type names to integers', function test( t ) { - t.strictEqual( isPlainObject( grapheme.constants ), true, 'is an object' ); - t.end(); -}); diff --git a/tools/lib/index.js b/tools/lib/index.js deleted file mode 100644 index 2ddf596e..00000000 --- a/tools/lib/index.js +++ /dev/null @@ -1,51 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/* -* When adding modules to the namespace, ensure that they are added in alphabetical order according to module name. -*/ - -// MODULES // - -var setReadOnly = require( '@stdlib/utils/define-read-only-property' ); - - -// MAIN // - -/** -* Top-level namespace. -* -* @namespace ns -*/ -var ns = {}; - -/** -* @name grapheme -* @memberof ns -* @readonly -* @type {Function} -* @see {@link module:@stdlib/string/tools/grapheme-cluster-break} -*/ -setReadOnly( ns, 'grapheme', require( './../../tools/grapheme-cluster-break' ) ); - - -// EXPORTS // - -module.exports = ns; diff --git a/tools/package.json b/tools/package.json deleted file mode 100644 index 5a9eda32..00000000 --- a/tools/package.json +++ /dev/null @@ -1,62 +0,0 @@ -{ - "name": "@stdlib/string/tools", - "version": "0.0.0", - "description": "String tools.", - "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": { - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "tool", - "tools" - ] -} diff --git a/tools/test/test.js b/tools/test/test.js deleted file mode 100644 index 277e7766..00000000 --- a/tools/test/test.js +++ /dev/null @@ -1,40 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 objectKeys = require( '@stdlib/utils/keys' ); -var ns = require( './../lib' ); - - -// TESTS // - -tape( 'main export is an object', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof ns, 'object', 'main export is an object' ); - t.end(); -}); - -tape( 'the exported object contains string utility tools', function test( t ) { - var keys = objectKeys( ns ); - t.strictEqual( keys.length > 0, true, 'has keys' ); - t.end(); -}); diff --git a/trim/README.md b/trim/README.md deleted file mode 100644 index e157aaad..00000000 --- a/trim/README.md +++ /dev/null @@ -1,212 +0,0 @@ - - -# trim - -> Trim whitespace characters from the beginning and end of a string. - -
- -## Usage - -```javascript -var trim = require( '@stdlib/string/trim' ); -``` - -#### trim( str ) - -Trims whitespace characters from the beginning and end of a string. - -```javascript -var out = trim( ' \t\t\n Beep \r\n\t ' ); -// returns 'Beep' -``` - -
- - - -
- -## Notes - -- Following [Unicode 6.3.0][unicode] and later, "whitespace" is defined as the following characters: - - - `\f` - - `\n` - - `\r` - - `\t` - - `\v` - - `\u0020` - - `\u00a0` - - `\u1680` - - `\u2000-\u200a` - - `\u2028` - - `\u2029` - - `\u202f` - - `\u205f` - - `\u3000` - - `\ufeff` - -
- - - -
- -## Examples - - - -```javascript -var trim = require( '@stdlib/string/trim' ); - -var out = trim( ' Whitespace ' ); -// returns 'Whitespace' - -out = trim( '\t\t\tTabs\t\t\t' ); -// returns 'Tabs' - -out = trim( '\n\n\nNew Lines\n\n\n' ); -// returns 'New Lines' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: trim [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $' foo \n bar ' | trim --split /\r?\n/ - - # Escaped... - $ echo -n $' foo \n bar ' | trim --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ trim ' beep boop ' -beep boop -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n ' beep boop ' | trim -beep boop -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n ' foo \t bar \t baz ' | trim --split '\t' -foo -bar -baz -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/trim/benchmark/benchmark.js b/trim/benchmark/benchmark.js deleted file mode 100644 index 1042c0b9..00000000 --- a/trim/benchmark/benchmark.js +++ /dev/null @@ -1,88 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var trim = require( './../lib' ); - - -// VARIABLES // - -var opts = { - 'skip': ( typeof String.prototype.trim !== 'function' ) -}; -var whitespace = '\\f\\n\\r\\t\\v\\u0020\\u00a0\\u1680\\u2000-\\u200a\\u2028\\u2029\\u202f\\u205f\\u3000\\ufeff'; - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - whitespace + 'beep boop' + whitespace, - whitespace + 'boop beep' + whitespace - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = trim( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::built-in', pkg ), opts, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - whitespace + 'beep boop' + whitespace, - whitespace + 'boop beep' + whitespace - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = values[ i%values.length ].trim(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/trim/bin/cli b/trim/bin/cli deleted file mode 100755 index 776dd2d4..00000000 --- a/trim/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var trim = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( trim( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( trim( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/trim/docs/repl.txt b/trim/docs/repl.txt deleted file mode 100644 index 3928f708..00000000 --- a/trim/docs/repl.txt +++ /dev/null @@ -1,40 +0,0 @@ - -{{alias}}( str ) - Trims whitespace from the beginning and end of a `string`. - - "Whitespace" is defined as the following characters: - - - \f - - \n - - \r - - \t - - \v - - \u0020 - - \u00a0 - - \u1680 - - \u2000-\u200a - - \u2028 - - \u2029 - - \u202f - - \u205f - - \u3000 - - \ufeff - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Trimmed string. - - Examples - -------- - > var out = {{alias}}( ' \t\t\n Beep \r\n\t ' ) - 'Beep' - - See Also - -------- - diff --git a/trim/docs/types/index.d.ts b/trim/docs/types/index.d.ts deleted file mode 100644 index be6af1d7..00000000 --- a/trim/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Trims whitespace characters from the beginning and end of a string. -* -* @param str - input string -* @returns trimmed string -* -* @example -* var out = trim( ' Whitespace ' ); -* // returns 'Whitespace' -* -* @example -* var out = trim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs' -* -* @example -* var out = trim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines' -*/ -declare function trim( str: string ): string; - - -// EXPORTS // - -export = trim; diff --git a/trim/docs/types/test.ts b/trim/docs/types/test.ts deleted file mode 100644 index ce602bf7..00000000 --- a/trim/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import trim = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - trim( ' Whitespace ' ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - trim( true ); // $ExpectError - trim( false ); // $ExpectError - trim( null ); // $ExpectError - trim( undefined ); // $ExpectError - trim( 5 ); // $ExpectError - trim( [] ); // $ExpectError - trim( {} ); // $ExpectError - trim( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - trim(); // $ExpectError -} diff --git a/trim/docs/usage.txt b/trim/docs/usage.txt deleted file mode 100644 index b5ffb055..00000000 --- a/trim/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: trim [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/trim/etc/cli_opts.json b/trim/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/trim/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/trim/examples/index.js b/trim/examples/index.js deleted file mode 100644 index 5dd75f6c..00000000 --- a/trim/examples/index.js +++ /dev/null @@ -1,30 +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'; - -var trim = require( './../lib' ); - -console.log( trim( ' Whitespace ' ) ); -// => 'Whitespace' - -console.log( trim( '\t\t\tTabs\t\t\t' ) ); -// => 'Tabs' - -console.log( trim( '\n\n\nNew Lines\n\n\n' ) ); -// => 'New Lines' diff --git a/trim/lib/index.js b/trim/lib/index.js deleted file mode 100644 index bd4b58ee..00000000 --- a/trim/lib/index.js +++ /dev/null @@ -1,46 +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'; - -/** -* Trim whitespace characters from the beginning and end of a string. -* -* @module @stdlib/string/trim -* -* @example -* var trim = require( '@stdlib/string/trim' ); -* -* var out = trim( ' Whitespace ' ); -* // returns 'Whitespace' -* -* out = trim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs' -* -* out = trim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/trim/lib/main.js b/trim/lib/main.js deleted file mode 100644 index eaad2a86..00000000 --- a/trim/lib/main.js +++ /dev/null @@ -1,59 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/trim' ); - - -// MAIN // - -/** -* Trims whitespace characters from the beginning and end of a string. -* -* @param {string} str - input string -* @throws {TypeError} must provide a string -* @returns {string} trimmed string -* -* @example -* var out = trim( ' Whitespace ' ); -* // returns 'Whitespace' -* -* @example -* var out = trim( '\t\t\tTabs\t\t\t' ); -* // returns 'Tabs' -* -* @example -* var out = trim( '\n\n\nNew Lines\n\n\n' ); -* // returns 'New Lines' -*/ -function trim( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = trim; diff --git a/trim/package.json b/trim/package.json deleted file mode 100644 index 7fc7cb28..00000000 --- a/trim/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/trim", - "version": "0.0.0", - "description": "Trim whitespace characters from the beginning and end of a string.", - "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" - } - ], - "bin": { - "trim": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "whitespace", - "remove", - "trim", - "trimming", - "replace" - ] -} diff --git a/trim/test/fixtures/stdin_error.js.txt b/trim/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 10f4acae..00000000 --- a/trim/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/trim/test/test.cli.js b/trim/test/test.cli.js deleted file mode 100644 index 87a9326b..00000000 --- a/trim/test/test.cli.js +++ /dev/null @@ -1,263 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface trims whitespace from the beginning and end of a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \' beep boop \'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep boop\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf " beep boop \n hello world"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep boop\nhello world\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \' foo \t bar \t baz \'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'foo\nbar\nbaz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \' foo \t bar \t baz \'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'foo\nbar\nbaz\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/trim/test/test.js b/trim/test/test.js deleted file mode 100644 index 4a2c4c88..00000000 --- a/trim/test/test.js +++ /dev/null @@ -1,207 +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 trim = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof trim, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - false, - void 0, - NaN, - [], - {}, - 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() { - trim( value ); - }; - } -}); - -tape( 'the function removes all whitespace characters at the beginning and end of a string', function test( t ) { - var expected; - var actual; - - expected = 'Whitespace'; - actual = trim( ' Whitespace ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'beep'; - actual = trim( ' beep' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'boop'; - actual = trim( 'boop ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'foo foo'; - actual = trim( ' foo foo ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '# bar bar bar'; - actual = trim( '# bar bar bar ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = '# beep boop'; - actual = trim( ' # beep boop' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'foo \n\n\n\n foo'; - actual = trim( ' foo \n\n\n\n foo ' ); - t.strictEqual( actual, expected, 'removes all spaces' ); - - expected = 'Tabs'; - actual = trim( '\t\t\tTabs\t\t\t' ); - t.strictEqual( actual, expected, 'removes all tabs' ); - - expected = 'New Lines'; - actual = trim( '\n\n\nNew Lines\n\n\n' ); - t.strictEqual( actual, expected, 'removes all newline characters' ); - - expected = 'Beep'; - actual = trim( ' \r\n\tBeep \r\n\t' ); - t.strictEqual( actual, expected, 'removes all whitespace characters' ); - - expected = 'beep'; - actual = trim( '\fbeep\f' ); - t.strictEqual( actual, expected, 'removes \\f' ); - - expected = 'beep'; - actual = trim( '\nbeep\n' ); - t.strictEqual( actual, expected, 'removes \\n' ); - - expected = 'beep'; - actual = trim( '\tbeep\t' ); - t.strictEqual( actual, expected, 'removes \\t' ); - - expected = 'beep'; - actual = trim( '\vbeep\v' ); - t.strictEqual( actual, expected, 'removes \\v' ); - - expected = 'beep'; - actual = trim( '\u1680beep\u1680' ); - t.strictEqual( actual, expected, 'removes \\u1680' ); - - expected = 'beep'; - actual = trim( '\u2000beep\u2000' ); - t.strictEqual( actual, expected, 'removes \\u2000' ); - - expected = 'beep'; - actual = trim( '\u2001beep\u2001' ); - t.strictEqual( actual, expected, 'removes \\u2001' ); - - expected = 'beep'; - actual = trim( '\u2002beep\u2002' ); - t.strictEqual( actual, expected, 'removes \\u2002' ); - - expected = 'beep'; - actual = trim( '\u2003beep\u2003' ); - t.strictEqual( actual, expected, 'removes \\u2003' ); - - expected = 'beep'; - actual = trim( '\u2004beep\u2004' ); - t.strictEqual( actual, expected, 'removes \\u2004' ); - - expected = 'beep'; - actual = trim( '\u2005beep\u2005' ); - t.strictEqual( actual, expected, 'removes \\u2005' ); - - expected = 'beep'; - actual = trim( '\u2006beep\u2006' ); - t.strictEqual( actual, expected, 'removes \\u2006' ); - - expected = 'beep'; - actual = trim( '\u2007beep\u2007' ); - t.strictEqual( actual, expected, 'removes \\u2007' ); - - expected = 'beep'; - actual = trim( '\u2008beep\u2008' ); - t.strictEqual( actual, expected, 'removes \\u2008' ); - - expected = 'beep'; - actual = trim( '\u2009beep\u2009' ); - t.strictEqual( actual, expected, 'removes \\u2009' ); - - expected = 'beep'; - actual = trim( '\u200abeep\u200a' ); - t.strictEqual( actual, expected, 'removes \\u200a' ); - - expected = 'beep'; - actual = trim( '\u2028beep\u2028' ); - t.strictEqual( actual, expected, 'removes \\u2028' ); - - expected = 'beep'; - actual = trim( '\u2029beep\u2029' ); - t.strictEqual( actual, expected, 'removes \\u2029' ); - - expected = 'beep'; - actual = trim( '\u202fbeep\u202f' ); - t.strictEqual( actual, expected, 'removes \\u202f' ); - - expected = 'beep'; - actual = trim( '\u205fbeep\u205f' ); - t.strictEqual( actual, expected, 'removes \\u205f' ); - - expected = 'beep'; - actual = trim( '\u3000beep\u3000' ); - t.strictEqual( actual, expected, 'removes \\u3000' ); - - expected = 'beep'; - actual = trim( '\ufeffbeep\ufeff' ); - t.strictEqual( actual, expected, 'removes \\ufefff' ); - - t.end(); -}); - -tape( 'the function does not remove the Mongolian space separator in accordance with Unicode 6.3.0 and later', function test( t ) { - var expected; - var actual; - - expected = '\u180ebeep\u180e'; - actual = trim( '\u180ebeep\u180e' ); - t.strictEqual( actual, expected, 'does not remove \\u180e' ); - - t.end(); -}); diff --git a/truncate-middle/README.md b/truncate-middle/README.md deleted file mode 100644 index 4b53c1d9..00000000 --- a/truncate-middle/README.md +++ /dev/null @@ -1,237 +0,0 @@ - - -# truncateMiddle - -> Truncate a string in the middle to a specified length. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var truncateMiddle = require( '@stdlib/string/truncate-middle' ); -``` - -#### truncate( str, len\[, seq] ) - -Truncates a string in the middle to a specified length. - -```javascript -var out = truncateMiddle( 'beep boop', 7 ); -// returns 'be...op' -``` - -By default, the truncated string uses the replacement sequence `'...'`. To customize the replacement sequence, provide a `seq` argument: - -```javascript -var out = truncateMiddle( 'beep boop', 7, '!' ); -// returns 'bee!oop' - -out = truncateMiddle( 'beep boop', 7, '!!!' ); -// returns 'be!!!op' -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - -```javascript -var truncateMiddle = require( '@stdlib/string/truncate-middle' ); - -var str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; -var out = truncateMiddle( str, 15 ); -// returns 'Lorem ... elit.' - -str = 'To be or not to be, that is the question'; -out = truncateMiddle( str, 19, '|' ); -// returns 'To be or | question' - -str = 'The quick fox jumps over the lazy dog.'; -out = truncateMiddle( str, 28, '...' ); -// returns 'The quick fox...he lazy dog.' - -str = '🐺 Wolf Brothers 🐺'; -out = truncateMiddle( str, 7 ); -// returns '🐺 ... 🐺' - -str = '🐺 Wolf Pack 🐺'; -out = truncateMiddle( str, 7, '🐺🐺🐺' ); -// returns '🐺 🐺🐺🐺 🐺' -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: truncate-middle [options] [] --len - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --len length String length. - --seq str Custom replacement sequence. Default: '...'. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'Hello, World!\nBeep Boop Baz' | truncate-middle --len 6 --split /\r?\n/ - - # Escaped... - $ echo -n $'Hello, World!\nBeep Boop Baz' | truncate-middle --len 6 --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - - - -
- -### Examples - -```bash -$ truncate-middle 'Hello, World!' --len 8 -Hel...d! - -$ truncate-middle 'Hello, World!' --len 6 --seq '!' -Hel|d! -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'Hello, World!' | truncate-middle --len 8 -Hel...d! -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'Hello, World!\tBeep Boop' | truncate-middle --split '\t' --len 6 --seq '!' -Hel|d! -Bee|op -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/truncate-middle/benchmark/benchmark.js b/truncate-middle/benchmark/benchmark.js deleted file mode 100644 index 437ad0f1..00000000 --- a/truncate-middle/benchmark/benchmark.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var truncateMiddle = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - string length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - 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 = truncateMiddle( fromCodePoint( i%126 )+'eep boop', len ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var f; - var i; - - min = 1; - max = 10; - - for ( i = min; i <= max; i++ ) { - f = createBenchmark( i ); - bench( format( '%s:len=%d', pkg, i ), f ); - } -} - -main(); diff --git a/truncate-middle/bin/cli b/truncate-middle/bin/cli deleted file mode 100755 index 6dd44410..00000000 --- a/truncate-middle/bin/cli +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var truncateMiddle = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - var len; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - len = parseInt( flags.len, 10 ); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - if ( flags.seq ) { - console.log( truncateMiddle( args[ 0 ], len, flags.seq ) ); // eslint-disable-line no-console - } else { - console.log( truncateMiddle( args[ 0 ], len ) ); // eslint-disable-line no-console - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - if ( flags.seq ) { - for ( i = 0; i < lines.length; i++ ) { - console.log( truncateMiddle( lines[ i ], len, flags.seq ) ); // eslint-disable-line no-console - } - } else { - for ( i = 0; i < lines.length; i++ ) { - console.log( truncateMiddle( lines[ i ], len ) ); // eslint-disable-line no-console - } - } - } -} - -main(); diff --git a/truncate-middle/docs/repl.txt b/truncate-middle/docs/repl.txt deleted file mode 100644 index d8ce1900..00000000 --- a/truncate-middle/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( str, len[, seq] ) - Truncates a string in the middle to a specified length. - - Parameters - ---------- - str: string - Input string. - - len: integer - Output string length. - - seq: string (optional) - Custom replacement sequence. Default: '...'. - - Returns - ------- - out: string - Truncated string. - - Examples - -------- - > var str = 'beep boop'; - > var out = {{alias}}( str, 5 ) - 'b...p' - - > out = {{alias}}( str, 5, '|' ) - 'be|op' - - See Also - -------- diff --git a/truncate-middle/docs/types/index.d.ts b/truncate-middle/docs/types/index.d.ts deleted file mode 100644 index 0b3ce83f..00000000 --- a/truncate-middle/docs/types/index.d.ts +++ /dev/null @@ -1,66 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/// - -/** -* Truncates a string in the middle to a specified length. -* -* @param str - input string -* @param len - output string length (including sequence) -* @param seq - custom replacement sequence (default: `...`) -* @returns truncated string -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 5 ); -* // returns 'b...p' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 5, '>>>' ); -* // returns 'b>>>p' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 10 ); -* // returns 'beep boop' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 0 ); -* // returns '' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 2 ); -* // returns '..' -* -* @example -* var str = '🐺 Wolf Brothers 🐺'; -* var out = truncateMiddle( str, 7 ); -* // returns '🐺 ... 🐺' -*/ -declare function truncateMiddle( str: string, len: number, seq?: string ): string; - - -// EXPORTS // - -export = truncateMiddle; diff --git a/truncate-middle/docs/types/test.ts b/truncate-middle/docs/types/test.ts deleted file mode 100644 index 08cf129e..00000000 --- a/truncate-middle/docs/types/test.ts +++ /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. -*/ - -import truncateMiddle = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - truncateMiddle( 'abcdefghi', 3 ); // $ExpectType string - truncateMiddle( 'abcdefghi', 10, '|' ); // $ExpectType string -} - -// The compiler throws an error if the function is not provided a string as its first argument... -{ - truncateMiddle( true, 6 ); // $ExpectError - truncateMiddle( false, 6 ); // $ExpectError - truncateMiddle( 3, 6 ); // $ExpectError - truncateMiddle( [], 6 ); // $ExpectError - truncateMiddle( {}, 6 ); // $ExpectError - truncateMiddle( ( x: number ): number => x, 6 ); // $ExpectError -} - -// The compiler throws an error if the function is not provided a number as its second argument... -{ - truncateMiddle( 'abd', true ); // $ExpectError - truncateMiddle( 'abd', false ); // $ExpectError - truncateMiddle( 'abd', 'abc' ); // $ExpectError - truncateMiddle( 'abd', [], 0 ); // $ExpectError - truncateMiddle( 'abd', {}, 0 ); // $ExpectError - truncateMiddle( 'abd', ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the function is not provided a string as its third argument... -{ - truncateMiddle( 'beep boop', 4, true ); // $ExpectError - truncateMiddle( 'beep boop', 4, false ); // $ExpectError - truncateMiddle( 'beep boop', 4, 123 ); // $ExpectError - truncateMiddle( 'beep boop', 4, [], 0 ); // $ExpectError - truncateMiddle( 'beep boop', 4, {}, 0 ); // $ExpectError - truncateMiddle( 'beep boop', 4, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - truncateMiddle(); // $ExpectError - truncateMiddle( 'abc', 4, '|', true ); // $ExpectError -} diff --git a/truncate-middle/docs/usage.txt b/truncate-middle/docs/usage.txt deleted file mode 100644 index cefc9d41..00000000 --- a/truncate-middle/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: truncate-middle [options] [] --len - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --len length String length. - --seq str Custom replacement sequence. Default: '...'. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/truncate-middle/etc/cli_opts.json b/truncate-middle/etc/cli_opts.json deleted file mode 100644 index e51a71a6..00000000 --- a/truncate-middle/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "string": [ - "len", - "seq", - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/truncate-middle/examples/index.js b/truncate-middle/examples/index.js deleted file mode 100644 index c7a45a4f..00000000 --- a/truncate-middle/examples/index.js +++ /dev/null @@ -1,46 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 truncateMiddle = require( './../lib' ); - -var str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; -var out = truncateMiddle( str, 15 ); -console.log( out ); -// => 'Lorem ... elit.' - -str = 'To be or not to be, that is the question'; -out = truncateMiddle( str, 19, '|' ); -console.log( out ); -// => 'To be or | question' - -str = 'The quick fox jumps over the lazy dog.'; -out = truncateMiddle( str, 28, '...' ); -console.log( out ); -// => 'The quick fox...he lazy dog.' - -str = '🐺 Wolf Brothers 🐺'; -out = truncateMiddle( str, 7 ); -console.log( out ); -// => '🐺 ... 🐺' - -str = '🐺 Wolf Pack 🐺'; -out = truncateMiddle( str, 7, '🐺🐺🐺' ); -console.log( out ); -// => '🐺 🐺🐺🐺 🐺' diff --git a/truncate-middle/lib/index.js b/truncate-middle/lib/index.js deleted file mode 100644 index f2ff172e..00000000 --- a/truncate-middle/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Truncate a string in the middle to a specified length. -* -* @module @stdlib/string/truncate-middle -* -* @example -* var truncateMiddle = require( '@stdlib/string/truncate-middle' ); -* -* var out = truncateMiddle( 'beep boop', 7 ); -* // returns 'be...op' -* -* out = truncateMiddle( 'beep boop', 7, '|' ); -* // returns 'bee|oop' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/truncate-middle/lib/main.js b/truncate-middle/lib/main.js deleted file mode 100644 index b546e6be..00000000 --- a/truncate-middle/lib/main.js +++ /dev/null @@ -1,128 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var numGraphemeClusters = require( './../../num-grapheme-clusters' ); -var nextGraphemeClusterBreak = require( './../../next-grapheme-cluster-break' ); -var format = require( './../../format' ); -var round = require( '@stdlib/math/base/special/round' ); -var floor = require( '@stdlib/math/base/special/floor' ); - - -// MAIN // - -/** -* Truncates a string in the middle to a specified length. -* -* @param {string} str - input string -* @param {integer} len - output string length (including sequence) -* @param {string} [seq='...'] - custom replacement sequence -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {TypeError} third argument must be a string -* @returns {string} truncated string -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 5 ); -* // returns 'b...p' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 5, '>>>' ); -* // returns 'b>>>p' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 10 ); -* // returns 'beep boop' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 0 ); -* // returns '' -* -* @example -* var str = 'beep boop'; -* var out = truncateMiddle( str, 2 ); -* // returns '..' -* -* @example -* var str = '🐺 Wolf Brothers 🐺'; -* var out = truncateMiddle( str, 7 ); -* // returns '🐺 ... 🐺' -*/ -function truncateMiddle( str, len, seq ) { - var seqLength; - var fromIndex; - var strLength; - var seqStart; - var nVisual; - var seqEnd; - var idx2; - var idx1; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isNonNegativeInteger( len ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) ); - } - if ( arguments.length > 2 ) { - if ( !isString( seq ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', seq ) ); - } - } - seq = seq || '...'; - seqLength = numGraphemeClusters( seq ); - strLength = numGraphemeClusters( str ); - fromIndex = 0; - if ( len > strLength ) { - return str; - } - if ( len - seqLength < 0 ) { - return seq.slice( 0, len ); - } - seqStart = round( ( len - seqLength ) / 2 ); - seqEnd = strLength - floor( ( len - seqLength ) / 2 ); - nVisual = 0; - while ( nVisual < seqStart ) { - idx1 = nextGraphemeClusterBreak( str, fromIndex ); - fromIndex = idx1; - nVisual += 1; - } - idx2 = idx1; - while ( idx2 > 0 ) { - idx2 = nextGraphemeClusterBreak( str, fromIndex ); - if ( idx2 >= seqEnd + fromIndex - nVisual ) { - break; - } - fromIndex = idx2; - nVisual += 1; - } - return str.substring( 0, idx1 ) + seq + str.substring( idx2 ); -} - - -// EXPORTS // - -module.exports = truncateMiddle; diff --git a/truncate-middle/package.json b/truncate-middle/package.json deleted file mode 100644 index 96b3f9c7..00000000 --- a/truncate-middle/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/truncate-middle", - "version": "0.0.0", - "description": "Truncate a string in the middle to a specified length.", - "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" - } - ], - "bin": { - "truncate-middle": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "truncate", - "trunc", - "middle", - "shorten", - "short" - ] -} diff --git a/truncate-middle/test/fixtures/stdin_error.js.txt b/truncate-middle/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/truncate-middle/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/truncate-middle/test/test.cli.js b/truncate-middle/test/test.cli.js deleted file mode 100644 index 5d9a6d65..00000000 --- a/truncate-middle/test/test.cli.js +++ /dev/null @@ -1,317 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var EXEC_PATH = require( '@stdlib/process/exec-path' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface truncates a string in the middle', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep boop\'; process.argv[ 3 ] = \'--len=5\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'b...p\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface truncates a string in the middle (custom sequence)', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep boop\'; process.argv[ 3 ] = \'--len=5\'; process.argv[ 4 ] = \'--seq=!\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be!op\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nHello World!"', - '|', - EXEC_PATH, - fpath, - '--len=5' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'b...p\nH...!\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream (custom sequence)', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nHello World!"', - '|', - EXEC_PATH, - fpath, - '--len=5', - '--seq="|"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be|op\nHe|d!\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tHello World!\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'', - '--len=5' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'b...p\nH...!\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tHello World!\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/', - '--len=5' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'b...p\nH...!\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/truncate-middle/test/test.js b/truncate-middle/test/test.js deleted file mode 100644 index e7b87730..00000000 --- a/truncate-middle/test/test.js +++ /dev/null @@ -1,206 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 truncateMiddle = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof truncateMiddle, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string primitive', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - truncateMiddle( value ); - }; - } -}); - -tape( 'the function throws an error if not provided a nonnegative integer as its second argument', function test( t ) { - var values; - var i; - - values = [ - '5', - -5, - 3.14, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - truncateMiddle( 'beep boop', value ); - }; - } -}); - -tape( 'the function throws an error if provided a non-string as a third argument', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - truncateMiddle( 'beep boop', 5, value ); - }; - } -}); - -tape( 'the function truncates a string to the specified length', function test( t ) { - var expected; - var actual; - var str; - var len; - - str = 'beep boop'; - len = 5; - expected = 'b...p'; - actual = truncateMiddle( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 10; - expected = 'beep boop'; - actual = truncateMiddle( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 0; - expected = ''; - actual = truncateMiddle( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 1; - expected = '.'; - actual = truncateMiddle( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🐺 Wolf Brothers 🐺'; - len = 7; - expected = '🐺 ... 🐺'; - actual = truncateMiddle( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function truncates a string to the specified length (custom replacement sequence)', function test( t ) { - var expected; - var actual; - var str; - var len; - - str = 'beep boop'; - len = 5; - expected = 'be|op'; - actual = truncateMiddle( str, len, '|' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 10; - expected = 'beep boop'; - actual = truncateMiddle( str, len, '!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 3; - expected = 'b!p'; - actual = truncateMiddle( str, len, '!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 5; - expected = 'be😃op'; - actual = truncateMiddle( str, len, '😃' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop foo bar'; - len = 10; - expected = 'be 🙃 🙃 🙃ar'; - actual = truncateMiddle( str, len, ' 🙃 🙃 🙃' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🐺 Wolf Brothers 🐺'; - len = 8; - expected = '🐺 Wo>s 🐺'; - actual = truncateMiddle( str, len, '>' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'Hello, world, says 🤖, the robot!'; - len = 10; - expected = 'Hello🤖bot!'; - actual = truncateMiddle( str, len, '🤖' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/truncate/README.md b/truncate/README.md deleted file mode 100644 index 392a293c..00000000 --- a/truncate/README.md +++ /dev/null @@ -1,235 +0,0 @@ - - -# truncate - -> Truncate a string to a specified length. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var truncate = require( '@stdlib/string/truncate' ); -``` - -#### truncate( str, len\[, ending] ) - -Truncates a string to a specified length. - -```javascript -var out = truncate( 'beep boop', 7 ); -// returns 'beep...' -``` - -By default, the truncated string is appended with `'...'`. To customize the truncated string, provide an `ending` argument: - -```javascript -var out = truncate( 'beep boop', 7, '!' ); -// returns 'beep b!' - -out = truncate( 'beep boop', 7, '!!!' ); -// returns 'beep!!!' -``` - -
- - - - - -
- -
- - - - - -
- -## Examples - - - - - -```javascript -var truncate = require( '@stdlib/string/truncate' ); - -var str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; -var out = truncate( str, 14 ); -// returns 'Lorem ipsum...' - -str = 'To be or not to be, that is the question'; -out = truncate( str, 19, '!' ); -// returns 'To be or not to be!' - -str = 'The quick fox jumps over the lazy dog.'; -out = truncate( str, 16, '...' ); -// returns 'The quick fox...' - -str = '🐺 Wolf Brothers 🐺'; -out = truncate( str, 6 ); -// returns '🐺 W...' -``` - -
- - - - - -* * * - -
- -## CLI - - - -
- -### Usage - -```text -Usage: truncate [options] [] --len - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --len length String length. - --ending str Custom ending. Default: '...'. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'Hello, World!\nBeep Boop Baz' | truncate --len 6 --split /\r?\n/ - - # Escaped... - $ echo -n $'Hello, World!\nBeep Boop Baz' | truncate --len 6 --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - - - -
- -### Examples - -```bash -$ truncate 'Hello, World!' --len 8 -Hello... - -$ truncate 'Hello, World!' --len 6 --ending '!' -Hello! -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'Hello, World!' | truncate --len 8 -Hello... -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'Hello, World!\tBeep Boop' | truncate --split '\t' --len 8 -Hello... -Beep ... -``` - -
- - - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/truncate/benchmark/benchmark.js b/truncate/benchmark/benchmark.js deleted file mode 100644 index bc820fd7..00000000 --- a/truncate/benchmark/benchmark.js +++ /dev/null @@ -1,92 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var bench = require( '@stdlib/bench' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var fromCodePoint = require( './../../from-code-point' ); -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var truncate = require( './../lib' ); - - -// FUNCTIONS // - -/** -* Creates a benchmark function. -* -* @private -* @param {PositiveInteger} len - string length -* @returns {Function} benchmark function -*/ -function createBenchmark( len ) { - 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 = truncate( fromCodePoint( i%126 )+'eep boop', len ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); - } -} - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -*/ -function main() { - var min; - var max; - var f; - var i; - - min = 1; - max = 10; - - for ( i = min; i <= max; i++ ) { - f = createBenchmark( i ); - bench( format( '%s:len=%d', pkg, i ), f ); - } -} - -main(); diff --git a/truncate/bin/cli b/truncate/bin/cli deleted file mode 100755 index a306c0c5..00000000 --- a/truncate/bin/cli +++ /dev/null @@ -1,121 +0,0 @@ -#!/usr/bin/env node - -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var truncate = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - var len; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - len = parseInt( flags.len, 10 ); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - if ( flags.ending ) { - console.log( truncate( args[ 0 ], len, flags.ending ) ); // eslint-disable-line no-console - } else { - console.log( truncate( args[ 0 ], len ) ); // eslint-disable-line no-console - } - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - if ( flags.ending ) { - for ( i = 0; i < lines.length; i++ ) { - console.log( truncate( lines[ i ], len, flags.ending ) ); // eslint-disable-line no-console - } - } else { - for ( i = 0; i < lines.length; i++ ) { - console.log( truncate( lines[ i ], len ) ); // eslint-disable-line no-console - } - } - } -} - -main(); diff --git a/truncate/docs/repl.txt b/truncate/docs/repl.txt deleted file mode 100644 index 0ba0c4f3..00000000 --- a/truncate/docs/repl.txt +++ /dev/null @@ -1,31 +0,0 @@ - -{{alias}}( str, len[, ending] ) - Truncates a string to a specified length. - - Parameters - ---------- - str: string - Input string. - - len: integer - Output string length. - - ending: string (optional) - Custom ending. Default: '...'. - - Returns - ------- - out: string - Truncated string. - - Examples - -------- - > var str = 'beep boop'; - > var out = {{alias}}( str, 5 ) - 'be...' - - > out = {{alias}}( str, 5, '|' ) - 'beep|' - - See Also - -------- diff --git a/truncate/docs/types/index.d.ts b/truncate/docs/types/index.d.ts deleted file mode 100644 index ad332539..00000000 --- a/truncate/docs/types/index.d.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -// TypeScript Version: 4.1 - -/// - -/** -* Truncates a string to a specified length. -* -* @param str - input string -* @param len - output string length (including ending) -* @param ending - custom ending (default: `...`) -* @returns truncated string -* -* @example -* var out = truncate( 'beep boop', 7 ); -* // returns 'beep...' -* -* @example -* var out = truncate( 'beep boop', 7, '|' ); -* // returns 'beep b|' -*/ -declare function truncate( str: string, len: number, ending?: string ): string; - - -// EXPORTS // - -export = truncate; diff --git a/truncate/docs/types/test.ts b/truncate/docs/types/test.ts deleted file mode 100644 index d97d7918..00000000 --- a/truncate/docs/types/test.ts +++ /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. -*/ - -import truncate = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - truncate( 'abcdefghi', 3 ); // $ExpectType string - truncate( 'abcdefghi', 10, '|' ); // $ExpectType string -} - -// The compiler throws an error if the function is not provided a string as its first argument... -{ - truncate( true, 6 ); // $ExpectError - truncate( false, 6 ); // $ExpectError - truncate( 3, 6 ); // $ExpectError - truncate( [], 6 ); // $ExpectError - truncate( {}, 6 ); // $ExpectError - truncate( ( x: number ): number => x, 6 ); // $ExpectError -} - -// The compiler throws an error if the function is not provided a number as its second argument... -{ - truncate( 'abd', true ); // $ExpectError - truncate( 'abd', false ); // $ExpectError - truncate( 'abd', 'abc' ); // $ExpectError - truncate( 'abd', [], 0 ); // $ExpectError - truncate( 'abd', {}, 0 ); // $ExpectError - truncate( 'abd', ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the function is not provided a string as its third argument... -{ - truncate( 'beep boop', 4, true ); // $ExpectError - truncate( 'beep boop', 4, false ); // $ExpectError - truncate( 'beep boop', 4, 123 ); // $ExpectError - truncate( 'beep boop', 4, [], 0 ); // $ExpectError - truncate( 'beep boop', 4, {}, 0 ); // $ExpectError - truncate( 'beep boop', 4, ( x: number ): number => x, 0 ); // $ExpectError -} - -// The compiler throws an error if the function is provided an unsupported number of arguments... -{ - truncate(); // $ExpectError - truncate( 'abc', 4, '|', true ); // $ExpectError -} diff --git a/truncate/docs/usage.txt b/truncate/docs/usage.txt deleted file mode 100644 index 2f3734bd..00000000 --- a/truncate/docs/usage.txt +++ /dev/null @@ -1,10 +0,0 @@ - -Usage: truncate [options] [] --len - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --len length String length. - --ending str Custom ending. Default: '...'. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/truncate/etc/cli_opts.json b/truncate/etc/cli_opts.json deleted file mode 100644 index 5dd6d7cb..00000000 --- a/truncate/etc/cli_opts.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "string": [ - "len", - "ending", - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/truncate/examples/index.js b/truncate/examples/index.js deleted file mode 100644 index fc548e10..00000000 --- a/truncate/examples/index.js +++ /dev/null @@ -1,41 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR 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 truncate = require( './../lib' ); - -var str = 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.'; -var out = truncate( str, 14 ); -console.log( out ); -// => 'Lorem ipsum...' - -str = 'To be or not to be, that is the question'; -out = truncate( str, 19, '!' ); -console.log( out ); -// => 'To be or not to be!' - -str = 'The quick fox jumps over the lazy dog.'; -out = truncate( str, 16, '...' ); -console.log( out ); -// => 'The quick fox...' - -str = '🐺 Wolf Brothers 🐺'; -out = truncate( str, 6 ); -console.log( out ); -// => '🐺 W...' diff --git a/truncate/lib/index.js b/truncate/lib/index.js deleted file mode 100644 index 6fed90ec..00000000 --- a/truncate/lib/index.js +++ /dev/null @@ -1,43 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -/** -* Truncate a string to a specified length. -* -* @module @stdlib/string/truncate -* -* @example -* var truncate = require( '@stdlib/string/truncate' ); -* -* var out = truncate( 'beep boop', 7 ); -* // returns 'beep...' -* -* out = truncate( 'beep boop', 7, '|' ); -* // returns 'beep b|' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/truncate/lib/main.js b/truncate/lib/main.js deleted file mode 100644 index 070cc46a..00000000 --- a/truncate/lib/main.js +++ /dev/null @@ -1,110 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var isNonNegativeInteger = require( '@stdlib/assert/is-nonnegative-integer' ).isPrimitive; -var numGraphemeClusters = require( './../../num-grapheme-clusters' ); -var nextGraphemeClusterBreak = require( './../../next-grapheme-cluster-break' ); -var format = require( './../../format' ); - - -// MAIN // - -/** -* Truncates a string to a specified length. -* -* @param {string} str - input string -* @param {integer} len - output string length (including ending) -* @param {string} [ending='...'] - custom ending -* @throws {TypeError} first argument must be a string -* @throws {TypeError} second argument must be a nonnegative integer -* @throws {TypeError} third argument must be a string -* @returns {string} truncated string -* -* @example -* var str = 'beep boop'; -* var out = truncate( str, 7 ); -* // returns 'beep...' -* -* @example -* var str = 'beep boop'; -* var out = truncate( str, 5, '>>>' ); -* // returns 'be>>>' -* -* @example -* var str = 'beep boop'; -* var out = truncate( str, 10 ); -* // returns 'beep boop' -* -* @example -* var str = 'beep boop'; -* var out = truncate( str, 0 ); -* // returns '' -* -* @example -* var str = 'beep boop'; -* var out = truncate( str, 2 ); -* // returns '..' -* -* @example -* var str = '🐺 Wolf Brothers 🐺'; -* var out = truncate( str, 6 ); -* // returns '🐺 W...' -*/ -function truncate( str, len, ending ) { - var endingLength; - var fromIndex; - var nVisual; - var idx; - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - if ( !isNonNegativeInteger( len ) ) { - throw new TypeError( format( 'invalid argument. Second argument must be a nonnegative integer. Value: `%s`.', len ) ); - } - if ( arguments.length > 2 ) { - if ( !isString( ending ) ) { - throw new TypeError( format( 'invalid argument. Third argument must be a string. Value: `%s`.', ending ) ); - } - } - ending = ending || '...'; - endingLength = numGraphemeClusters( ending ); - fromIndex = 0; - if ( len >= numGraphemeClusters( str ) ) { - return str; - } - if ( len - endingLength <= 0 ) { - return ending.slice( 0, len ); - } - nVisual = 0; - while ( nVisual < len - endingLength ) { - idx = nextGraphemeClusterBreak( str, fromIndex ); - fromIndex = idx; - nVisual += 1; - } - return str.substring( 0, idx ) + ending; -} - - -// EXPORTS // - -module.exports = truncate; diff --git a/truncate/package.json b/truncate/package.json deleted file mode 100644 index 29d4c86b..00000000 --- a/truncate/package.json +++ /dev/null @@ -1,69 +0,0 @@ -{ - "name": "@stdlib/string/truncate", - "version": "0.0.0", - "description": "Truncate a string to a specified length.", - "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" - } - ], - "bin": { - "truncate": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "pad", - "string", - "str", - "truncate", - "trunc", - "shorten", - "short" - ] -} diff --git a/truncate/test/fixtures/stdin_error.js.txt b/truncate/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 30db78fd..00000000 --- a/truncate/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'beep' ) ); -} diff --git a/truncate/test/test.cli.js b/truncate/test/test.cli.js deleted file mode 100644 index d35a636a..00000000 --- a/truncate/test/test.cli.js +++ /dev/null @@ -1,317 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -'use strict'; - -// MODULES // - -var resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var EXEC_PATH = require( '@stdlib/process/exec-path' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface truncates a string', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep boop\'; process.argv[ 3 ] = \'--len=5\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be...\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface truncates a string (custom ending)', opts, function test( t ) { - var opts; - var cmd; - - cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'beep boop\'; process.argv[ 3 ] = \'--len=5\'; process.argv[ 4 ] = \'--ending=!\'; require( \''+fpath+'\' );"' - ]; - opts = {}; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep!\n', 'prints expected results to stdout' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nHello World!"', - '|', - EXEC_PATH, - fpath, - '--len=5' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be...\nHe...\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream (custom ending)', opts, function test( t ) { - var cmd = [ - 'printf "beep boop\nHello World!"', - '|', - EXEC_PATH, - fpath, - '--len=5', - '--ending="|"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep|\nHell|\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tHello World!\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'', - '--len=5' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be...\nHe...\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'beep boop\tHello World!\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/', - '--len=5' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'be...\nHe...\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: beep\n', 'expected value' ); - t.end(); - } -}); diff --git a/truncate/test/test.js b/truncate/test/test.js deleted file mode 100644 index 02a6531f..00000000 --- a/truncate/test/test.js +++ /dev/null @@ -1,212 +0,0 @@ -/** -* @license Apache-2.0 -* -* Copyright (c) 2021 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF 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 truncate = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof truncate, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string primitive', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - truncate( value ); - }; - } -}); - -tape( 'the function throws an error if not provided a nonnegative integer as its second argument', function test( t ) { - var values; - var i; - - values = [ - '5', - -5, - 3.14, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - truncate( 'beep boop', value ); - }; - } -}); - -tape( 'the function throws an error if provided a non-string as a third argument', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - [], - {}, - 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() { - truncate( 'beep boop', 5, value ); - }; - } -}); - -tape( 'the function truncates a string to the specified length', function test( t ) { - var expected; - var actual; - var str; - var len; - - str = 'beep boop'; - len = 5; - expected = 'be...'; - actual = truncate( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 10; - expected = 'beep boop'; - actual = truncate( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 0; - expected = ''; - actual = truncate( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 1; - expected = '.'; - actual = truncate( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 3; - expected = '...'; - actual = truncate( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 9; - expected = 'beep boop'; - actual = truncate( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🐺 Wolf Brothers 🐺'; - len = 6; - expected = '🐺 W...'; - actual = truncate( str, len ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); - -tape( 'the function truncates a string to the specified length (custom ending)', function test( t ) { - var expected; - var actual; - var str; - var len; - - str = 'beep boop'; - len = 5; - expected = 'beep|'; - actual = truncate( str, len, '|' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 10; - expected = 'beep boop'; - actual = truncate( str, len, '!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 3; - expected = 'be!'; - actual = truncate( str, len, '!' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop'; - len = 5; - expected = 'beep😃'; - actual = truncate( str, len, '😃' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = 'beep boop foo bar'; - len = 10; - expected = 'beep 🙃 🙃 🙃'; - actual = truncate( str, len, ' 🙃 🙃 🙃' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - str = '🐺 Wolf Brothers 🐺'; - len = 8; - expected = '🐺 Wolf 🐺'; - actual = truncate( str, len, '🐺' ); - t.strictEqual( actual, expected, 'returns expected value' ); - - t.end(); -}); diff --git a/uncapitalize/README.md b/uncapitalize/README.md deleted file mode 100644 index d1282ae1..00000000 --- a/uncapitalize/README.md +++ /dev/null @@ -1,186 +0,0 @@ - - -# uncapitalize - -> Uncapitalize the first character of a string. - -
- -## Usage - -```javascript -var uncapitalize = require( '@stdlib/string/uncapitalize' ); -``` - -#### uncapitalize( str ) - -Uncapitalizes the first character of a string. - -```javascript -var out = uncapitalize( 'Last man standing' ); -// returns 'last man standing' - -out = uncapitalize( 'Hidden Treasures' ); -// returns 'hidden Treasures' -``` - -
- - - -
- -## Examples - - - -```javascript -var uncapitalize = require( '@stdlib/string/uncapitalize' ); - -var out = uncapitalize( 'Last man standing' ); -// returns 'last man standing' - -out = uncapitalize( 'Presidential election' ); -// returns 'presidential election' - -out = uncapitalize( 'JavaScript' ); -// returns 'javaScript' - -out = uncapitalize( 'Hidden Treasures' ); -// returns 'hidden Treasures' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: uncapitalize [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. -``` - -
- - - - - -
- -### Notes - -- If the split separator is a [regular expression][mdn-regexp], ensure that the `split` option is either properly escaped or enclosed in quotes. - - ```bash - # Not escaped... - $ echo -n $'Beep\nBoop' | uncapitalize --split /\r?\n/ - - # Escaped... - $ echo -n $'Beep\nBoop' | uncapitalize --split /\\r?\\n/ - ``` - -- The implementation ignores trailing delimiters. - -
- - - -
- -### Examples - -```bash -$ uncapitalize Beep -beep -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'Beep' | uncapitalize -beep -``` - -By default, when used as a [standard stream][standard-streams], the implementation assumes newline-delimited data. To specify an alternative delimiter, set the `split` option. - -```bash -$ echo -n 'Beep\tBOOP' | uncapitalize --split '\t' -beep -bOOP -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/uncapitalize/benchmark/benchmark.js b/uncapitalize/benchmark/benchmark.js deleted file mode 100644 index 7f87a18b..00000000 --- a/uncapitalize/benchmark/benchmark.js +++ /dev/null @@ -1,55 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var pkg = require( './../package.json' ).name; -var uncapitalize = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = uncapitalize( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/uncapitalize/bin/cli b/uncapitalize/bin/cli deleted file mode 100755 index 11aa34bd..00000000 --- a/uncapitalize/bin/cli +++ /dev/null @@ -1,108 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var RE_EOL = require( '@stdlib/regexp/eol' ).REGEXP; -var isRegExpString = require( '@stdlib/assert/is-regexp-string' ); -var reFromString = require( '@stdlib/utils/regexp-from-string' ); -var uncapitalize = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var split; - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - if ( flags.split ) { - if ( !isRegExpString( flags.split ) ) { - flags.split = '/'+flags.split+'/'; - } - split = reFromString( flags.split ); - } else { - split = RE_EOL; - } - return stdin( onRead ); - } - console.log( uncapitalize( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - var lines; - var i; - if ( error ) { - return cli.error( error ); - } - lines = data.toString().split( split ); - - // Remove any trailing separators (e.g., trailing newline)... - if ( lines[ lines.length-1 ] === '' ) { - lines.pop(); - } - for ( i = 0; i < lines.length; i++ ) { - console.log( uncapitalize( lines[ i ] ) ); // eslint-disable-line no-console - } - } -} - -main(); diff --git a/uncapitalize/docs/repl.txt b/uncapitalize/docs/repl.txt deleted file mode 100644 index dc092c13..00000000 --- a/uncapitalize/docs/repl.txt +++ /dev/null @@ -1,24 +0,0 @@ - -{{alias}}( str ) - Lowercases the first character of a string. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Uncapitalized string. - - Examples - -------- - > var out = {{alias}}( 'Beep' ) - 'beep' - > out = {{alias}}( 'bOOp' ) - 'bOOp' - - See Also - -------- - diff --git a/uncapitalize/docs/types/index.d.ts b/uncapitalize/docs/types/index.d.ts deleted file mode 100644 index 3b7c488f..00000000 --- a/uncapitalize/docs/types/index.d.ts +++ /dev/null @@ -1,50 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -type Uncapitalize = S extends `${infer F}${infer R}` ? `${Lowercase}${R}` : S; - -/** -* Uncapitalizes the first character of a string. -* -* @param str - input string -* @returns input string with first character converted to lowercase -* -* @example -* var out = uncapitalize( 'Last man standing' ); -* // returns 'last man standing' -* -* @example -* var out = uncapitalize( 'Presidential election' ); -* // returns 'presidential election' -* -* @example -* var out = uncapitalize( 'JavaScript' ); -* // returns 'javaScript' -* -* @example -* var out = uncapitalize( 'Hidden Treasures' ); -* // returns 'hidden Treasures' -*/ -declare function uncapitalize( str: S ): Uncapitalize; - - -// EXPORTS // - -export = uncapitalize; diff --git a/uncapitalize/docs/types/test.ts b/uncapitalize/docs/types/test.ts deleted file mode 100644 index b35d326b..00000000 --- a/uncapitalize/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import uncapitalize = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - uncapitalize( 'Last man standing' ); // $ExpectType "last man standing" - uncapitalize( 'Hello World!' ); // $ExpectType "hello World!" - uncapitalize( 'BeepBoop' ); // $ExpectType "beepBoop" - uncapitalize( 'A' ); // $ExpectType "a" - uncapitalize( 'foo' as string ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - uncapitalize( true ); // $ExpectError - uncapitalize( false ); // $ExpectError - uncapitalize( null ); // $ExpectError - uncapitalize( undefined ); // $ExpectError - uncapitalize( 5 ); // $ExpectError - uncapitalize( [] ); // $ExpectError - uncapitalize( {} ); // $ExpectError - uncapitalize( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - uncapitalize(); // $ExpectError -} diff --git a/uncapitalize/docs/usage.txt b/uncapitalize/docs/usage.txt deleted file mode 100644 index 23cfaa41..00000000 --- a/uncapitalize/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: uncapitalize [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - --split sep Delimiter for stdin data. Default: '/\\r?\\n/'. diff --git a/uncapitalize/etc/cli_opts.json b/uncapitalize/etc/cli_opts.json deleted file mode 100644 index 7c40f9a1..00000000 --- a/uncapitalize/etc/cli_opts.json +++ /dev/null @@ -1,17 +0,0 @@ -{ - "string": [ - "split" - ], - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/uncapitalize/examples/index.js b/uncapitalize/examples/index.js deleted file mode 100644 index 203d1180..00000000 --- a/uncapitalize/examples/index.js +++ /dev/null @@ -1,33 +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'; - -var uncapitalize = require( './../lib' ); - -console.log( uncapitalize( 'Last man standing' ) ); -// => 'last man standing' - -console.log( uncapitalize( 'Presidential election' ) ); -// => 'presidential election' - -console.log( uncapitalize( 'JavaScript' ) ); -// => 'javaScript' - -console.log( uncapitalize( 'Hidden Treasures' ) ); -// => 'hidden Treasures' diff --git a/uncapitalize/lib/index.js b/uncapitalize/lib/index.js deleted file mode 100644 index 627a9e34..00000000 --- a/uncapitalize/lib/index.js +++ /dev/null @@ -1,43 +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'; - -/** -* Uncapitalize the first character of a string. -* -* @module @stdlib/string/uncapitalize -* -* @example -* var uncapitalize = require( '@stdlib/string/uncapitalize' ); -* -* var out = uncapitalize( 'Last man standing' ); -* // returns 'last man standing' -* -* out = uncapitalize( 'Hidden Treasures' ); -* // returns 'hidden Treasures' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/uncapitalize/lib/main.js b/uncapitalize/lib/main.js deleted file mode 100644 index ba063a97..00000000 --- a/uncapitalize/lib/main.js +++ /dev/null @@ -1,63 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var base = require( './../../base/uncapitalize' ); - - -// MAIN // - -/** -* Uncapitalizes the first character of a string. -* -* @param {string} str - input string -* @throws {TypeError} must provide a string -* @returns {string} input string with first character converted to lowercase -* -* @example -* var out = uncapitalize( 'Last man standing' ); -* // returns 'last man standing' -* -* @example -* var out = uncapitalize( 'Presidential election' ); -* // returns 'presidential election' -* -* @example -* var out = uncapitalize( 'JavaScript' ); -* // returns 'javaScript' -* -* @example -* var out = uncapitalize( 'Hidden Treasures' ); -* // returns 'hidden Treasures' -*/ -function uncapitalize( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. First argument must be a string. Value: `%s`.', str ) ); - } - return base( str ); -} - - -// EXPORTS // - -module.exports = uncapitalize; diff --git a/uncapitalize/package.json b/uncapitalize/package.json deleted file mode 100644 index 120be3e2..00000000 --- a/uncapitalize/package.json +++ /dev/null @@ -1,70 +0,0 @@ -{ - "name": "@stdlib/string/uncapitalize", - "version": "0.0.0", - "description": "Uncapitalize the first character of a string.", - "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" - } - ], - "bin": { - "uncapitalize": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "string", - "str", - "capitalize", - "decapitalize", - "uncapitalize", - "lowercase", - "lower", - "case" - ] -} diff --git a/uncapitalize/test/fixtures/stdin_error.js.txt b/uncapitalize/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 452e3afe..00000000 --- a/uncapitalize/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'BEEP' ) ); -} diff --git a/uncapitalize/test/test.cli.js b/uncapitalize/test/test.cli.js deleted file mode 100644 index 1cbed0e6..00000000 --- a/uncapitalize/test/test.cli.js +++ /dev/null @@ -1,263 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface uncapitalizes a string argument', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'BeeP\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beeP\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf "BeeP\nHELLO"', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beeP\nhELLO\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (string)', opts, function test( t ) { - var cmd = [ - 'printf \'HELLO\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split \'\t\'' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'hELLO\nisMobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports specifying a custom delimiter when used as a standard stream (regexp)', opts, function test( t ) { - var cmd = [ - 'printf \'Beep\tisMobile\'', - '|', - EXEC_PATH, - fpath, - '--split=/\\\\t/' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'beep\nisMobile\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: BEEP\n', 'expected value' ); - t.end(); - } -}); diff --git a/uncapitalize/test/test.js b/uncapitalize/test/test.js deleted file mode 100644 index b826392e..00000000 --- a/uncapitalize/test/test.js +++ /dev/null @@ -1,81 +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 uncapitalize = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof uncapitalize, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - null, - true, - false, - void 0, - NaN, - [], - {}, - 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() { - uncapitalize( value ); - }; - } -}); - -tape( 'the function returns an empty string if provided an empty string', function test( t ) { - t.strictEqual( uncapitalize( '' ), '', 'returns empty string' ); - t.end(); -}); - -tape( 'the function converts the first character of an input string to lowercase', function test( t ) { - var out; - - out = uncapitalize( 'Hello world' ); - t.strictEqual( out, 'hello world', 'uncapitalizes first character' ); - - out = uncapitalize( '!!!' ); - t.strictEqual( out, '!!!', 'does not change non-alphabetical characters' ); - - out = uncapitalize( 'hello World' ); - t.strictEqual( out, 'hello World', 'leaves lowercase letters in lowercase' ); - - t.end(); -}); diff --git a/uppercase/README.md b/uppercase/README.md deleted file mode 100644 index 4821cfef..00000000 --- a/uppercase/README.md +++ /dev/null @@ -1,159 +0,0 @@ - - -# uppercase - -> Convert a string to uppercase. - -
- -
- - - -
- -## Usage - -```javascript -var uppercase = require( '@stdlib/string/uppercase' ); -``` - -#### uppercase( str ) - -Converts a string to uppercase. - -```javascript -var str = uppercase( 'bEEp' ); -// returns 'BEEP' -``` - -
- - - -
- -## Examples - - - -```javascript -var uppercase = require( '@stdlib/string/uppercase' ); - -var str = uppercase( 'Beep' ); -// returns 'BEEP' - -str = uppercase( 'BeEp' ); -// returns 'BEEP' - -str = uppercase( 'Beep BOOP' ); -// returns 'BEEP BOOP' - -str = uppercase( '$**_beep_BoOp_**$' ); -// returns '$**_BEEP_BOOP_**$' - -str = uppercase( '' ); -// returns '' -``` - -
- - - -* * * - -
- -## CLI - -
- -### Usage - -```text -Usage: uppercase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. -``` - -
- - - -
- -### Examples - -```bash -$ uppercase bEEp -BEEP -``` - -To use as a [standard stream][standard-streams], - -```bash -$ echo -n 'bEEp' | uppercase -BEEP -``` - -
- - - -
- - - - - - - - - - - - - - diff --git a/uppercase/benchmark/benchmark.js b/uppercase/benchmark/benchmark.js deleted file mode 100644 index 51c911f0..00000000 --- a/uppercase/benchmark/benchmark.js +++ /dev/null @@ -1,82 +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' ); -var isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); -var pkg = require( './../package.json' ).name; -var uppercase = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = uppercase( values[ i%values.length ] ); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); - -bench( format( '%s::builtin', pkg ), function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'beep boop', - 'foo bar', - 'xyz abc' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = values[ i%values.length ].toUpperCase(); - if ( typeof out !== 'string' ) { - b.fail( 'should return a string' ); - } - } - b.toc(); - if ( !isString( out ) ) { - b.fail( 'should return a string' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/uppercase/bin/cli b/uppercase/bin/cli deleted file mode 100755 index 89128aa2..00000000 --- a/uppercase/bin/cli +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/env node - -/** -* @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 resolve = require( 'path' ).resolve; -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var CLI = require( '@stdlib/cli/ctor' ); -var stdin = require( '@stdlib/process/read-stdin' ); -var stdinStream = require( '@stdlib/streams/node/stdin' ); -var uppercase = require( './../lib' ); - - -// MAIN // - -/** -* Main execution sequence. -* -* @private -* @returns {void} -*/ -function main() { - var flags; - var args; - var cli; - - // Create a command-line interface: - cli = new CLI({ - 'pkg': require( './../package.json' ), - 'options': require( './../etc/cli_opts.json' ), - 'help': readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }) - }); - - // Get any provided command-line options: - flags = cli.flags(); - if ( flags.help || flags.version ) { - return; - } - - // Get any provided command-line arguments: - args = cli.args(); - - // Check if we are receiving data from `stdin`... - if ( !stdinStream.isTTY ) { - return stdin( onRead ); - } - console.log( uppercase( args[ 0 ] ) ); // eslint-disable-line no-console - - /** - * Callback invoked upon reading from `stdin`. - * - * @private - * @param {(Error|null)} error - error object - * @param {Buffer} data - data - * @returns {void} - */ - function onRead( error, data ) { - if ( error ) { - return cli.error( error ); - } - console.log( uppercase( data.toString() ) ); // eslint-disable-line no-console - } -} - -main(); diff --git a/uppercase/docs/repl.txt b/uppercase/docs/repl.txt deleted file mode 100644 index 36405910..00000000 --- a/uppercase/docs/repl.txt +++ /dev/null @@ -1,22 +0,0 @@ - -{{alias}}( str ) - Converts a string to uppercase. - - Parameters - ---------- - str: string - Input string. - - Returns - ------- - out: string - Uppercase string. - - Examples - -------- - > var out = {{alias}}( 'bEEp' ) - 'BEEP' - - See Also - -------- - diff --git a/uppercase/docs/types/index.d.ts b/uppercase/docs/types/index.d.ts deleted file mode 100644 index 6254b653..00000000 --- a/uppercase/docs/types/index.d.ts +++ /dev/null @@ -1,36 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Converts a string to uppercase. -* -* @param str - string to convert -* @returns uppercase string -* -* @example -* var str = uppercase( 'bEEp' ); -* // returns 'BEEP' -*/ -declare function uppercase( str: S ): Uppercase; - - -// EXPORTS // - -export = uppercase; diff --git a/uppercase/docs/types/test.ts b/uppercase/docs/types/test.ts deleted file mode 100644 index 2cadcfa6..00000000 --- a/uppercase/docs/types/test.ts +++ /dev/null @@ -1,48 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import uppercase = require( './index' ); - - -// TESTS // - -// The function returns a string... -{ - uppercase( 'Last man standing' ); // $ExpectType "LAST MAN STANDING" - uppercase( 'Hello World!' ); // $ExpectType "HELLO WORLD!" - uppercase( 'beep' ); // $ExpectType "BEEP" - uppercase( 'BOOP' ); // $ExpectType "BOOP" - uppercase( 'foo' as string ); // $ExpectType string -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - uppercase( true ); // $ExpectError - uppercase( false ); // $ExpectError - uppercase( null ); // $ExpectError - uppercase( undefined ); // $ExpectError - uppercase( 5 ); // $ExpectError - uppercase( [] ); // $ExpectError - uppercase( {} ); // $ExpectError - uppercase( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - uppercase(); // $ExpectError -} diff --git a/uppercase/docs/usage.txt b/uppercase/docs/usage.txt deleted file mode 100644 index 5ad77b8e..00000000 --- a/uppercase/docs/usage.txt +++ /dev/null @@ -1,8 +0,0 @@ - -Usage: uppercase [options] [] - -Options: - - -h, --help Print this message. - -V, --version Print the package version. - diff --git a/uppercase/etc/cli_opts.json b/uppercase/etc/cli_opts.json deleted file mode 100644 index f245a17e..00000000 --- a/uppercase/etc/cli_opts.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "boolean": [ - "help", - "version" - ], - "alias": { - "help": [ - "h" - ], - "version": [ - "V" - ] - } -} diff --git a/uppercase/examples/index.js b/uppercase/examples/index.js deleted file mode 100644 index af760fbe..00000000 --- a/uppercase/examples/index.js +++ /dev/null @@ -1,41 +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'; - -var uppercase = require( './../lib' ); - -var str = uppercase( 'Beep' ); -console.log( str ); -// => 'BEEP' - -str = uppercase( 'BeEp' ); -console.log( str ); -// => 'BEEP' - -str = uppercase( 'Beep BOOP' ); -console.log( str ); -// => 'BEEP BOOP' - -str = uppercase( '$**_beep_BoOp_**$' ); -console.log( str ); -// => '$**_BEEP_BOOP_**$' - -str = uppercase( '' ); -console.log( str ); -// => '' diff --git a/uppercase/lib/index.js b/uppercase/lib/index.js deleted file mode 100644 index 8f979309..00000000 --- a/uppercase/lib/index.js +++ /dev/null @@ -1,40 +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'; - -/** -* Convert a string to uppercase. -* -* @module @stdlib/string/uppercase -* -* @example -* var uppercase = require( '@stdlib/string/uppercase' ); -* -* var str = uppercase( 'bEEp' ); -* // returns 'BEEP' -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/uppercase/lib/main.js b/uppercase/lib/main.js deleted file mode 100644 index 4e564011..00000000 --- a/uppercase/lib/main.js +++ /dev/null @@ -1,50 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); - - -// MAIN // - -/** -* Converts a string to uppercase. -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {string} uppercase string -* -* @example -* var str = uppercase( 'bEEp' ); -* // returns 'BEEP' -*/ -function uppercase( str ) { - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - return str.toUpperCase(); -} - - -// EXPORTS // - -module.exports = uppercase; diff --git a/uppercase/package.json b/uppercase/package.json deleted file mode 100644 index e49b5ffd..00000000 --- a/uppercase/package.json +++ /dev/null @@ -1,68 +0,0 @@ -{ - "name": "@stdlib/string/uppercase", - "version": "0.0.0", - "description": "Convert a string to uppercase.", - "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" - } - ], - "bin": { - "uppercase": "./bin/cli" - }, - "main": "./lib", - "directories": { - "benchmark": "./benchmark", - "doc": "./docs", - "example": "./examples", - "lib": "./lib", - "test": "./test" - }, - "types": "./docs/types", - "scripts": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "utilities", - "utility", - "utils", - "util", - "upper", - "case", - "uppercase", - "convert", - "string", - "str" - ] -} diff --git a/uppercase/test/fixtures/stdin_error.js.txt b/uppercase/test/fixtures/stdin_error.js.txt deleted file mode 100644 index 452e3afe..00000000 --- a/uppercase/test/fixtures/stdin_error.js.txt +++ /dev/null @@ -1,33 +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. -*/ - -var proc = require( 'process' ); -var resolve = require( 'path' ).resolve; -var proxyquire = require( 'proxyquire' ); - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); - -proc.stdin.isTTY = false; - -proxyquire( fpath, { - '@stdlib/process/read-stdin': stdin -}); - -function stdin( clbk ) { - clbk( new Error( 'BEEP' ) ); -} diff --git a/uppercase/test/test.cli.js b/uppercase/test/test.cli.js deleted file mode 100644 index de4703a1..00000000 --- a/uppercase/test/test.cli.js +++ /dev/null @@ -1,219 +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 resolve = require( 'path' ).resolve; -var exec = require( 'child_process' ).exec; -var tape = require( 'tape' ); -var IS_BROWSER = require( '@stdlib/assert/is-browser' ); -var IS_WINDOWS = require( '@stdlib/assert/is-windows' ); -var replace = require( './../../replace' ); -var readFileSync = require( '@stdlib/fs/read-file' ).sync; -var EXEC_PATH = require( '@stdlib/process/exec-path' ); - - -// VARIABLES // - -var fpath = resolve( __dirname, '..', 'bin', 'cli' ); -var opts = { - 'skip': IS_BROWSER || IS_WINDOWS -}; - - -// FIXTURES // - -var PKG_VERSION = require( './../package.json' ).version; - - -// TESTS // - -tape( 'command-line interface', function test( t ) { - t.ok( true, __filename ); - t.end(); -}); - -tape( 'when invoked with a `--help` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '--help' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-h` flag, the command-line interface prints the help text to `stderr`', opts, function test( t ) { - var expected; - var cmd; - - expected = readFileSync( resolve( __dirname, '..', 'docs', 'usage.txt' ), { - 'encoding': 'utf8' - }); - cmd = [ - EXEC_PATH, - fpath, - '-h' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), expected+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `--version` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '--version' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'when invoked with a `-V` flag, the command-line interface prints the version to `stderr`', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - fpath, - '-V' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), PKG_VERSION+'\n', 'expected value' ); - } - t.end(); - } -}); - -tape( 'the command-line interface converts a string argument to uppercase', opts, function test( t ) { - var cmd = [ - EXEC_PATH, - '-e', - '"process.stdin.isTTY = true; process.argv[ 2 ] = \'bEEp\'; require( \''+fpath+'\' );"' - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'BEEP\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'the command-line interface supports use as a standard stream', opts, function test( t ) { - var cmd = [ - 'printf bEEp', - '|', - EXEC_PATH, - fpath - ]; - - exec( cmd.join( ' ' ), done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.fail( error.message ); - } else { - t.strictEqual( stdout.toString(), 'BEEP\n', 'expected value' ); - t.strictEqual( stderr.toString(), '', 'does not print to `stderr`' ); - } - t.end(); - } -}); - -tape( 'when used as a standard stream, if an error is encountered when reading from `stdin`, the command-line interface prints an error and sets a non-zero exit code', opts, function test( t ) { - var script; - var opts; - var cmd; - - script = readFileSync( resolve( __dirname, 'fixtures', 'stdin_error.js.txt' ), { - 'encoding': 'utf8' - }); - - // Replace single quotes with double quotes: - script = replace( script, '\'', '"' ); - - cmd = [ - EXEC_PATH, - '-e', - '\''+script+'\'' - ]; - - opts = { - 'cwd': __dirname - }; - - exec( cmd.join( ' ' ), opts, done ); - - function done( error, stdout, stderr ) { - if ( error ) { - t.pass( error.message ); - t.strictEqual( error.code, 1, 'expected exit code' ); - } - t.strictEqual( stdout.toString(), '', 'does not print to `stdout`' ); - t.strictEqual( stderr.toString(), 'Error: BEEP\n', 'expected value' ); - t.end(); - } -}); diff --git a/uppercase/test/test.js b/uppercase/test/test.js deleted file mode 100644 index 4020b6c0..00000000 --- a/uppercase/test/test.js +++ /dev/null @@ -1,91 +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 uppercase = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof uppercase, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - values = [ - 5, - NaN, - null, - void 0, - true, - false, - [], - {}, - function noop() {} - ]; - for ( i = 0; i < values.length; i++ ) { - t.throws( badValue( values[i] ), TypeError, 'throws a type error when provided '+values[i] ); - } - t.end(); - - function badValue( value ) { - return function badValue() { - uppercase( value ); - }; - } -}); - -tape( 'the function converts a string to uppercase', function test( t ) { - var expected; - var values; - var actual; - var i; - - values = [ - 'BEEP', - 'beep', - 'Beep', - 'BeEp', - 'Beep BOOP', - '$**_Beep_BoOp_**$', - 'König' - ]; - expected = [ - 'BEEP', - 'BEEP', - 'BEEP', - 'BEEP', - 'BEEP BOOP', - '$**_BEEP_BOOP_**$', - 'KÖNIG' - ]; - for ( i = 0; i < values.length; i++ ) { - actual = uppercase( values[i] ); - t.strictEqual( actual, expected[i], 'converts string to '+expected[i] ); - } - t.end(); -}); diff --git a/utf16-to-utf8-array/README.md b/utf16-to-utf8-array/README.md deleted file mode 100644 index 4a44d079..00000000 --- a/utf16-to-utf8-array/README.md +++ /dev/null @@ -1,147 +0,0 @@ - - -# UTF-16 to UTF-8 - -> Convert a [UTF-16][utf-16] encoded string to an array of integers using [UTF-8][utf-8] encoding. - - - -
- -
- - - - - -
- -## Usage - -```javascript -var utf16ToUTF8Array = require( '@stdlib/string/utf16-to-utf8-array' ); -``` - -#### utf16ToUTF8Array( str ) - -Converts a [UTF-16][utf-16] encoded string to an `array` of integers using [UTF-8][utf-8] encoding. - -```javascript -var out = utf16ToUTF8Array( '☃' ); -// returns [ 226, 152, 131 ] -``` - -
- - - - - -
- -## Notes - -- [UTF-16][utf-16] encoding uses one 16-bit unit for non-surrogates (`U+0000` to `U+D7FF` and `U+E000` to `U+FFFF`). - -- [UTF-16][utf-16] encoding uses two 16-bit units (surrogate pairs) for `U+10000` to `U+10FFFF` and encodes `U+10000-U+10FFFF` by subtracting `0x10000` from the code point, expressing the result as a 20-bit binary, and splitting the 20 bits of `0x0-0xFFFFF` as upper and lower 10-bits. The respective 10-bits are stored in two 16-bit words: a **high** and a **low** surrogate. - -- [UTF-8][utf-8] is defined to encode code points in one to four bytes, depending on the number of significant bits in the numerical value of the code point. Encoding uses the following byte sequences: - - ```text - 0x00000000 - 0x0000007F: - 0xxxxxxx - - 0x00000080 - 0x000007FF: - 110xxxxx 10xxxxxx - - 0x00000800 - 0x0000FFFF: - 1110xxxx 10xxxxxx 10xxxxxx - - 0x00010000 - 0x001FFFFF: - 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - ``` - - where an `x` represents a code point bit. Only the shortest possible multi-byte sequence which can represent a code point is used. - -
- - - - - -
- -## Examples - - - -```javascript -var utf16ToUTF8Array = require( '@stdlib/string/utf16-to-utf8-array' ); - -var values; -var out; -var i; - -values = [ - 'Ladies + Gentlemen', - 'An encoded string!', - 'Dogs, Cats & Mice', - '☃', - 'æ', - '𐐷' -]; -for ( i = 0; i < values.length; i++ ) { - out = utf16ToUTF8Array( values[ i ] ); - console.log( '%s: %s', values[ i ], out.join( ',' ) ); -} -``` - -
- - - - - -
- -
- - - - - - - - - - - - - - diff --git a/utf16-to-utf8-array/benchmark/benchmark.js b/utf16-to-utf8-array/benchmark/benchmark.js deleted file mode 100644 index e6d8e632..00000000 --- a/utf16-to-utf8-array/benchmark/benchmark.js +++ /dev/null @@ -1,57 +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' ); -var isArray = require( '@stdlib/assert/is-array' ); -var pkg = require( './../package.json' ).name; -var utf16ToUTF8Array = require( './../lib' ); - - -// MAIN // - -bench( pkg, function benchmark( b ) { - var values; - var out; - var i; - - values = [ - 'Ladies + Gentlemen', - 'An encoded string!', - 'Dogs, Cats & Mice', - '☃', - 'æ' - ]; - - b.tic(); - for ( i = 0; i < b.iterations; i++ ) { - out = utf16ToUTF8Array( values[ i%values.length ] ); - if ( typeof out !== 'object' ) { - b.fail( 'should return an object' ); - } - } - b.toc(); - if ( !isArray( out ) ) { - b.fail( 'should return an array' ); - } - b.pass( 'benchmark finished' ); - b.end(); -}); diff --git a/utf16-to-utf8-array/docs/repl.txt b/utf16-to-utf8-array/docs/repl.txt deleted file mode 100644 index 2220bb7e..00000000 --- a/utf16-to-utf8-array/docs/repl.txt +++ /dev/null @@ -1,44 +0,0 @@ - -{{alias}}( str ) - Converts a UTF-16 encoded string to an array of integers using UTF-8 - encoding. - - The following byte sequences are used to represent a character. The sequence - depends on the code point: - - 0x00000000 - 0x0000007F: - 0xxxxxxx - - 0x00000080 - 0x000007FF: - 110xxxxx 10xxxxxx - - 0x00000800 - 0x0000FFFF: - 1110xxxx 10xxxxxx 10xxxxxx - - 0x00010000 - 0x001FFFFF: - 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - - The `x` bit positions correspond to code point bits. - - Only the shortest possible multi-byte sequence which can represent a code - point is used. - - Parameters - ---------- - str: string - UTF-16 encoded string. - - Returns - ------- - out: Array - Array of integers. - - Examples - -------- - > var str = '☃'; - > var out = {{alias}}( str ) - [ 226, 152, 131 ] - - See Also - -------- - diff --git a/utf16-to-utf8-array/docs/types/index.d.ts b/utf16-to-utf8-array/docs/types/index.d.ts deleted file mode 100644 index a71705c9..00000000 --- a/utf16-to-utf8-array/docs/types/index.d.ts +++ /dev/null @@ -1,58 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT 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 - -/** -* Converts a UTF-16 encoded string to an array of integers using UTF-8 encoding. -* -* ## Notes -* -* - The following byte sequences are used to represent a character. The sequence depends on the code point: -* -* 0x00000000 - 0x0000007F: -* 0xxxxxxx -* -* 0x00000080 - 0x000007FF: -* 110xxxxx 10xxxxxx -* -* 0x00000800 - 0x0000FFFF: -* 1110xxxx 10xxxxxx 10xxxxxx -* -* 0x00010000 - 0x001FFFFF: -* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx -* -* - The `x` bit positions correspond to code point bits. -* - Only the shortest possible multi-byte sequence which can represent a code point is used. -* -* @param str - string to convert -* @returns array of integers -* @see [UTF-8]{@link https://en.wikipedia.org/wiki/UTF-8} -* @see [Stack Overflow]{@link https://stackoverflow.com/questions/6240055/manually-converting-unicode-codepoints-into-utf-8-and-utf-16} -* -* @example -* var str = '☃'; -* var out = utf16ToUTF8Array( str ); -* // returns [ 226, 152, 131 ] -*/ -declare function utf16ToUTF8Array( str: string ): Array; - - -// EXPORTS // - -export = utf16ToUTF8Array; diff --git a/utf16-to-utf8-array/docs/types/test.ts b/utf16-to-utf8-array/docs/types/test.ts deleted file mode 100644 index ad6176fb..00000000 --- a/utf16-to-utf8-array/docs/types/test.ts +++ /dev/null @@ -1,44 +0,0 @@ -/* -* @license Apache-2.0 -* -* Copyright (c) 2019 The Stdlib Authors. -* -* Licensed under the Apache License, Version 2.0 (the "License"); -* you may not use this file except in compliance with the License. -* You may obtain a copy of the License at -* -* http://www.apache.org/licenses/LICENSE-2.0 -* -* Unless required by applicable law or agreed to in writing, software -* distributed under the License is distributed on an "AS IS" BASIS, -* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -* See the License for the specific language governing permissions and -* limitations under the License. -*/ - -import utf16ToUTF8Array = require( './index' ); - - -// TESTS // - -// The function returns an array of numbers... -{ - utf16ToUTF8Array( '☃' ); // $ExpectType number[] -} - -// The compiler throws an error if the function is provided a value other than a string... -{ - utf16ToUTF8Array( true ); // $ExpectError - utf16ToUTF8Array( false ); // $ExpectError - utf16ToUTF8Array( null ); // $ExpectError - utf16ToUTF8Array( undefined ); // $ExpectError - utf16ToUTF8Array( 5 ); // $ExpectError - utf16ToUTF8Array( [] ); // $ExpectError - utf16ToUTF8Array( {} ); // $ExpectError - utf16ToUTF8Array( ( x: number ): number => x ); // $ExpectError -} - -// The compiler throws an error if the function is provided insufficient arguments... -{ - utf16ToUTF8Array(); // $ExpectError -} diff --git a/utf16-to-utf8-array/examples/index.js b/utf16-to-utf8-array/examples/index.js deleted file mode 100644 index 13c737ba..00000000 --- a/utf16-to-utf8-array/examples/index.js +++ /dev/null @@ -1,38 +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'; - -var utf16ToUTF8Array = require( './../lib' ); - -var values; -var out; -var i; - -values = [ - 'Ladies + Gentlemen', - 'An encoded string!', - 'Dogs, Cats & Mice', - '☃', - 'æ', - '𐐷' -]; -for ( i = 0; i < values.length; i++ ) { - out = utf16ToUTF8Array( values[ i ] ); - console.log( '%s: %s', values[ i ], out.join( ',' ) ); -} diff --git a/utf16-to-utf8-array/lib/index.js b/utf16-to-utf8-array/lib/index.js deleted file mode 100644 index 6b55a27f..00000000 --- a/utf16-to-utf8-array/lib/index.js +++ /dev/null @@ -1,41 +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'; - -/** -* Convert a UTF-16 encoded string to an array of integers using UTF-8 encoding. -* -* @module @stdlib/string/utf16-to-utf8-array -* -* @example -* var utf16ToUTF8Array = require( '@stdlib/string/utf16-to-utf8-array' ); -* -* var str = '☃'; -* var out = utf16ToUTF8Array( str ); -* // returns [ 226, 152, 131 ] -*/ - -// MODULES // - -var main = require( './main.js' ); - - -// EXPORTS // - -module.exports = main; diff --git a/utf16-to-utf8-array/lib/main.js b/utf16-to-utf8-array/lib/main.js deleted file mode 100644 index 3e1b6f0f..00000000 --- a/utf16-to-utf8-array/lib/main.js +++ /dev/null @@ -1,159 +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 isString = require( '@stdlib/assert/is-string' ).isPrimitive; -var format = require( './../../format' ); - - -// VARIABLES // - -// 2^6-1 = 63 => 0x3f => 00111111 -var Ox3F = 63|0; - -// 2^7 = 128 => 0x80 => 10000000 -var Ox80 = 128|0; - -// 192 => 0xc0 => 11000000 -var OxC0 = 192|0; - -// 224 => 0xe0 => 11100000 -var OxE0 = 224|0; - -// 240 => 0xf0 => 11110000 -var OxF0 = 240|0; - -// 2^10-1 = 1023 => 0x3ff => 00000011 11111111 -var Ox3FF = 1023|0; - -// 2^11 = 2048 => 0x800 => 00001000 00000000 -var Ox800 = 2048|0; - -// 55296 => 11011000 00000000 -var OxD800 = 55296|0; - -// 57344 => 11100000 00000000 -var OxE000 = 57344|0; - -// 2^16 = 65536 => 00000000 00000001 00000000 00000000 -var Ox10000 = 65536|0; - - -// MAIN // - -/** -* Converts a UTF-16 encoded string to an array of integers using UTF-8 encoding. -* -* ## Method -* -* - UTF-8 is defined to encode code points in one to four bytes, depending on the number of significant bits in the numerical value of the code point. -* -* - UTF-16 encoding uses one 16-bit unit for non-surrogates (U+0000 to U+D7FF and U+E000 to U+FFFF). -* -* - UTF-16 encoding uses two 16-bit units (surrogate pairs) for U+10000 to U+10FFFF and encodes U+10000-U+10FFFF by subtracting 0x10000 from the code point, expressing the result as a 20-bit binary, and splitting the 20 bits of 0x0-0xFFFFF as upper and lower 10-bits. The respective 10-bits are stored in two 16-bit words. -* -* - Let `N` be the number of significant bits. -* -* - If `N <= 7` (i.e., U+0000 to U+007F), a code point is encoded in a single byte. -* -* ```text -* 0xxxxxxx -* ``` -* -* where an `x` refers to a code point bit. -* -* - If `N <= 11` (i.e., U+0080 to U+07FF; ASCII characters), a code point is encoded in two bytes (5+6 bits). -* -* ```text -* 110xxxxx 10xxxxxx -* ``` -* -* - If `N <= 16` (i.e., U+0800 to U+FFFF), a code point is encoded in three bytes (4+6+6 bits). -* -* ```text -* 1110xxxx 10xxxxxx 10xxxxxx -* ``` -* -* - If `N <= 21` (i.e., U+10000 to U+10FFFF), a code point is encoded in four bytes (3+6+6+6 bits). -* -* ```text -* 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx -* ``` -* -* @param {string} str - string to convert -* @throws {TypeError} must provide a string -* @returns {Array} array of integers -* @see [UTF-8]{@link https://en.wikipedia.org/wiki/UTF-8} -* @see [Stack Overflow]{@link https://stackoverflow.com/questions/6240055/manually-converting-unicode-codepoints-into-utf-8-and-utf-16} -* -* @example -* var str = '☃'; -* var out = utf16ToUTF8Array( str ); -* // returns [ 226, 152, 131 ] -*/ -function utf16ToUTF8Array( str ) { - var code; - var out; - var len; - var i; - - if ( !isString( str ) ) { - throw new TypeError( format( 'invalid argument. Must provide a string. Value: `%s`.', str ) ); - } - len = str.length; - out = []; - for ( i = 0; i < len; i++ ) { - code = str.charCodeAt( i ); - - // ASCII... - if ( code < Ox80 ) { - out.push( code ); - } - // UTF-16 non-surrogate pair... - else if ( code < Ox800 ) { - out.push( OxC0 | (code>>6) ); - out.push( Ox80 | (code & Ox3F) ); - } - else if ( code < OxD800 || code >= OxE000 ) { - out.push( OxE0 | (code>>12) ); - out.push( Ox80 | ((code>>6) & Ox3F) ); - out.push( Ox80 | (code & Ox3F) ); - } - // UTF-16 surrogate pair... - else { - i += 1; - - // eslint-disable-next-line max-len - code = Ox10000 + (((code & Ox3FF)<<10) | (str.charCodeAt(i) & Ox3FF)); - - out.push( OxF0 | (code>>18) ); - out.push( Ox80 | ((code>>12) & Ox3F) ); - out.push( Ox80 | ((code>>6) & Ox3F) ); - out.push( Ox80 | (code & Ox3F) ); - } - } - return out; -} - - -// EXPORTS // - -module.exports = utf16ToUTF8Array; diff --git a/utf16-to-utf8-array/package.json b/utf16-to-utf8-array/package.json deleted file mode 100644 index 89ff0d0e..00000000 --- a/utf16-to-utf8-array/package.json +++ /dev/null @@ -1,67 +0,0 @@ -{ - "name": "@stdlib/string/utf16-to-utf8-array", - "version": "0.0.0", - "description": "Convert a UTF-16 encoded string to an array of integers using UTF-8 encoding.", - "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": {}, - "homepage": "https://github.com/stdlib-js/stdlib", - "repository": { - "type": "git", - "url": "git://github.com/stdlib-js/stdlib.git" - }, - "bugs": { - "url": "https://github.com/stdlib-js/stdlib/issues" - }, - "dependencies": {}, - "devDependencies": {}, - "engines": { - "node": ">=0.10.0", - "npm": ">2.7.0" - }, - "os": [ - "aix", - "darwin", - "freebsd", - "linux", - "macos", - "openbsd", - "sunos", - "win32", - "windows" - ], - "keywords": [ - "stdlib", - "stdstring", - "string", - "str", - "utilities", - "utility", - "utils", - "util", - "utf-16", - "utf16", - "utf8", - "utf-8", - "convert", - "encoding" - ] -} diff --git a/utf16-to-utf8-array/test/test.js b/utf16-to-utf8-array/test/test.js deleted file mode 100644 index 9f5ae166..00000000 --- a/utf16-to-utf8-array/test/test.js +++ /dev/null @@ -1,143 +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 utf16ToUTF8Array = require( './../lib' ); - - -// TESTS // - -tape( 'main export is a function', function test( t ) { - t.ok( true, __filename ); - t.strictEqual( typeof utf16ToUTF8Array, 'function', 'main export is a function' ); - t.end(); -}); - -tape( 'the function throws an error if not provided a string', function test( t ) { - var values; - var i; - - 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() { - utf16ToUTF8Array( value ); - }; - } -}); - -tape( 'the function converts a UTF-16 encoded string to an array of integers using UTF-8 encoding', function test( t ) { - var expected; - var values; - var out; - var i; - - values = [ - '0123456789', - 'abcdefghij', - 'klmnopqrst', - 'uvwxyz', - 'ABCDEFGHIJ', - 'KLMNOPQRST', - 'UVWXYZ', - '☃', // 3 bytes - 'æ', // 2 bytes - '𐐷' // surrogate pair - ]; - - /* - * U+10437 (𐐷) => 00000000 00000001 00000100 00110111 - * - * To convert U+10437 to a UTF-8 array, pack the bit sequence (more specifically, the last 21 bits) into 4 bytes using UTF-8 encoding. - * - * ```text - * 00000000 000 00001 00000100 00110111 - * - * 00001 00000100 00110111 - * - * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx - * - * 11110000 10010000 10010000 10110111 - * ``` - * - * To determine the surrogate pair, - * - * - Subtract 0x10000. - * - * ```text - * 0x10437 - 0x10000 = 0x00437 => 0000 0000 0100 0011 0111 - * ``` - * - * - Split into high and low 10-bits. - * - * ```text - * 0000 0000 01 - * 00 0011 0111 - * ``` - * - * - Add 0xD800 to high 10-bits to get high surrogate. - * - * ```text - * 0xD800 + 0x0001 = 0xD801 => 1101100000000001 - * ``` - * - * - Add 0xDC00 to low 10-bits to get low surrogate. - * - * ```text - * 0xDC00 + 0x0037 = 0xDC37 => 1101110000110111 - * ``` - */ - - expected = [ - [ 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 ], - [ 97, 98, 99, 100, 101, 102, 103, 104, 105, 106 ], - [ 107, 108, 109, 110, 111, 112, 113, 114, 115, 116 ], - [ 117, 118, 119, 120, 121, 122 ], - [ 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 ], - [ 226, 152, 131 ], - [ 195, 166 ], - [ 240, 144, 144, 183 ] - ]; - - for ( i = 0; i < values.length; i++ ) { - out = utf16ToUTF8Array( values[ i ] ); - t.deepEqual( out, expected[ i ], 'returns expected value for '+values[i] ); - } - t.end(); -});